SetFormat inconsistent behaviour
Posted: 03 May 2019, 13:26
MsgBox tells me my vars are equivalent, but behind the scenes they aren't.
Can't debug my script with MsgBox because it's telling me lies
Can't debug my script with MsgBox because it's telling me lies
Code: Select all
#SingleInstance Force
SetFormat , Float , 0.3 ;also, removing this makes both tests not equal,
;but only if I don't put it in any functions
Test1()
Test2()
return
Test1(){
;Result: equal
Var1 := ((17/255)**(1/2))**(2)
Var2 := (17/255)
If ( var1 = var2 )
MsgBox Comparing vars`n%Var1% is equal to %Var2%
Else
MsgBox Comparing vars`n%Var1% is not equal to %Var2%
}
Test2(){
;Result: not equal
Array1 := [ ((17/255)**(1/2))**(2) ]
Array2 := [ (17/255) ]
If ( Array1[1] = Array2[1] )
MsgBox % "Comparing arrays`n" . Array1[1] . " is equal to " . Array2[1]
Else
MsgBox % "Comparing arrays`n" . Array1[1] . " is not equal to " . Array2[1]
}