[PB4 Beta 4] test values.d failed
Posted: Sat Feb 25, 2006 11:50 pm
I was trying to do a program who tests Intel's processor (Bugs found by Tim Coe (and co
)).
I've done it with float like that and it works.After, I tried to replace, in test 1 and 3, floats by double. To have the good value, I made first the right calcul, and I copy the new result in the code, and I've done it And with this code (and double), tests 1 and 3 doesn't work.
So I've tried a small code :It always returns 0, however, the calculates value is as the "constant".

I've done it with float like that and it works.
Code: Select all
OpenConsole()
res.f = 4195835/3145727
PrintN(StrF(res))
If res.f <> 1.3338204491362411
PrintN("First test failed.")
EndIf
Repeat
Delay(1)
Until Inkey()
B.f = 4.1 - 1.1
A.f = 699306 * B
Q.f = A/B
PrintN(StrF(Q))
If Q <> 699306
PrintN("Second test failed.")
EndIf
Repeat
Delay(1)
Until Inkey()
res.f = 4.999999/14.999999
PrintN(StrF(res))
If res.f <> 0.33333328888888591
PrintN("Third test failed.")
EndIf
PrintN("End")
Repeat
Delay(1)
Until Inkey()
CloseConsole()
End
Code: Select all
OpenConsole()
res.d = 4195835/3145727
PrintN(StrD(res))
If res.d <> 1.3338204491362411
PrintN("First test failed.")
EndIf
Repeat
Delay(1)
Until Inkey()
B.f = 4.1 - 1.1
A.f = 699306 * B
Q.f = A/B
PrintN(StrF(Q))
If Q <> 699306
PrintN("Second test failed.")
EndIf
Repeat
Delay(1)
Until Inkey()
res.d = 4.999999/14.999999
PrintN(StrD(res))
If res.d <> 0.33333328888888591
PrintN("Third test failed.")
EndIf
PrintN("End")
Repeat
Delay(1)
Until Inkey()
CloseConsole()
End
So I've tried a small code :
Code: Select all
res.d = 4195835/3145727
Debug res.d
If res.d = 1.3338204491362411
Debug 1
Else
Debug 0
EndIf
;----------------------------
res.d = 4195835/3145727
good.d = 1.3338204491362411
Debug res.d
If res.d = good.d
Debug 1
Else
Debug 0
EndIf