Strange behavior of Abs()! @PureBasicTeam
Posted: Tue Jan 02, 2024 10:24 pm
we found out a strange behavior of the Abs() function.
It is a Float function, but can we use it for big Quads too? More than 53Bits!
Is it internal overladed with a AbsQ() function which is not documented?
The problem you can see at Q= -100000000000000005
Abs(-100000000000000005) -> 100000000000000000.0
But if we use with a quad variable the result is 100000000000000005
what is correct for a quad!
It is a Float function, but can we use it for big Quads too? More than 53Bits!
Is it internal overladed with a AbsQ() function which is not documented?
The problem you can see at Q= -100000000000000005
Abs(-100000000000000005) -> 100000000000000000.0
But if we use with a quad variable the result is 100000000000000005
what is correct for a quad!
Code: Select all
EnableExplicit
Macro mac_AbsInt(val)
If val < 0 : val = -val : EndIf
EndMacro
Define.q Q, r, s
Q= -100000000000000005
r = Abs(Q)
s = Q
mac_AbsInt(s)
Debug r
Debug s
Debug Abs(Q)