Jump to content

Recommended Posts

Posted

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

 

Posted

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

 

Posted

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

 

Posted (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 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

 

Posted

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]

Posted

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

 

Posted

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
Firestorm'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)
Posted

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.

How come you don't see that operator "^" is not the cause of this?

Operator operates just fine.

♡♡♡

.

eMyvnE

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
×
×
  • Create New...