Jump to content

Exponent ^ wrong on large integers ?


Recommended Posts

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.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

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 by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

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

ja, that's funny. :P 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.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...