Sign in to follow this  
Followers 0
ChiDragon

Division followed by BinaryString conversion returns incorrect values

4 posts in this topic

#1 ·  Posted (edited)

I'm getting the wrong result when I convert equations involving division to BinaryStrings (also with multiplication by numbers less than 1, which I guess AutoIt handles the same way). :lmao: Multiplication by numbers greater than (or equal to) 1, as well as any addition or subtraction, don't cause this. I'm using version 3.2.0.1.

$Num1 = 500
$Num2 = 1000 / 2
;~ $Num2 = 1000 * 0.5

$Num1_Bin = String (BinaryString ($Num1))
$Num2_Bin = String (BinaryString ($Num2))

MsgBox (0, "Test", "Num1: " & $Num1 & @CRLF & "Num2: " & $Num2 & @CRLF & "Num1_Bin: " & $Num1_Bin & @CRLF & "Num2_Bin: " & $Num2_Bin)oÝ÷ Ø-6é¶z«¶*'rïz»"¢{+zÛ«Ø^±©­ë.Ü!Èb²}ý¶Ø^±©jËa{Mú6éµrïz»"¢sn^tÐÛ¦Û46éµ)ôÄ^4×M4ÐۦاÓ4ÓM4ÓM4ãNÅã@&"h¬²)ಶ§¨táÌ(®K±¬(®F«¢éÝjÙ^jËZºÚ"µÍÌÍÓ[LH[X
Ý[È
    ÌÍÓ[LJ
Edited by ChiDragon

Share this post


Link to post
Share on other sites



What about $Num2 = Int(1000 / 2) what does that do?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

That gives the right value but padded with 8 extra zeroes at the end. Int(500) doesn't include the padding.

Share this post


Link to post
Share on other sites

Should I repost this in Bug Reports?

Share this post


Link to post
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
Sign in to follow this  
Followers 0