Le 28/04/2012 01:24, Jussi Lahtinen a écrit :
> At least the problem is unrelated to sin and cos...
>
> ? format(0.47942553860420300027 ^ 2 -
> 0.22984884706593014129,"#.######################")
> - .0000000000000012212453
>
> ? format(0.47942553860420300027 ^ 2.0 - 0.22984884706593014129
> ,"#.######################")
> - .0000000000000011379786
>
>
> Jussi
>
>
Hi,
OK, I found the bug.
The gambas floating point parser incorrectly took into account the
leading zero decimal digits.
In other words 2.0 was computed as 20 * 10 ^ -1, 2.00 as 200 * 10 ^ -2.
Now it is just 2.
Consequently, now 2.0 - 2 = 0, and cos(0.5) ^ 2.0 - cos(0.5) ^ 2 = 0.
But cos(0.5) ^ 2 + sin(0.5) ^ 2 keeps being not exactly 1.0. Because the
gambas algorithm is not the same as the libc algorithm. In gambas 0.5 is
computed as 5 * 10 ^ -1, which does not give the exact binary
representation of 2 ^ -1.
I will investigate...
--
Benoît Minisini
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user