jennico Posted October 5, 2008 Share Posted October 5, 2008 why does this happen ? : For $i=65 To 0 Step -1 MsgBox(0,"",Int(2^$i)) NextoÝ÷ Ú·¬º[lw(®·¶ö¥¹ëh¶«mÚ'ßÛfy©íêÞ²ém±¦è½íºÞ;¬¶[oÝ÷ ÛbëazÇ«zË¥¶Æ«yÊ+ç-Â+a¶ÅÇ©¶*'¡ýºÝ«¢+ØÀÌØí¨ôÄ)½ÈÀÌØí¤ôÄQ¼ØÔ($ÀÌØí¨¬ôÀÌØí¨(%5Í ½à À°ÀÌØí¤°ÀÌØí¨¤)9áÐ why does it happen ? regards j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
jennico Posted October 5, 2008 Author Share Posted October 5, 2008 i mean, the results from 2^49 to 2^62 are one higher than they should be. a rounding problem ? j Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
Andreik Posted October 5, 2008 Share Posted October 5, 2008 You don't need to use Int(). Here is the error. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
jennico Posted October 5, 2008 Author Share Posted October 5, 2008 no it's not. i use int to prevent float. the same happens with round. j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
Andreik Posted October 5, 2008 Share Posted October 5, 2008 no it's not. i use int to prevent float. the same happens with round.j.If you use without Int() will return the good result. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
jennico Posted October 5, 2008 Author Share Posted October 5, 2008 (edited) well sorry, but 2^62 returns 4.61168601842739e+018. this is not the same precision. j. i tried some other algorithms and i can definitely exclude Int() from being the cause of the error. the problem must be within ^. it must be a systematical error, because it constantly results exactly one higher and not two or one lower. therefore this cannot be an Int or Round problem. anyone can help ? Edited October 5, 2008 by jennico Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
trancexx Posted October 5, 2008 Share Posted October 5, 2008 (edited) Try: ConsoleWrite(2^62 - 4611686018427387904 & @CRLF) If you get 0 then everything is ok. Edited October 5, 2008 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Skrip Posted October 5, 2008 Share Posted October 5, 2008 Problem solved. For $i=65 To 0 Step -1 If $i > 48 Then MsgBox(0,"",Int(2^$i) - 1) Else MsgBox(0,"",Int(2^$i)) EndIf Next [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
jennico Posted October 5, 2008 Author Share Posted October 5, 2008 ja, that's funny. the jockey survived but the horse had to be shot. but seriously, that does only fix the result, but does not heal the ^ function. j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
Malkey Posted October 5, 2008 Share Posted October 5, 2008 Problem solved. For $i=65 To 0 Step -1 If $i > 48 Then MsgBox(0,"",Int(2^$i) - 1) Else MsgBox(0,"",Int(2^$i)) EndIf NextFirestorm's work around rewritten. Local $res For $i = 0 To 65 $res &= "2 ^ " & $i & " = " & Int(2 ^ $i) - ($i > 48) & @CRLF Next MsgBox(0, "2 to power of 0 to 65", $res) Link to comment Share on other sites More sharing options...
trancexx Posted October 6, 2008 Share Posted October 6, 2008 ja, that's funny. the jockey survived but the horse had to be shot.but seriously, that does only fix the result, but does not heal the ^ function.j.How come you don't see that operator "^" is not the cause of this? Operator operates just fine. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now