You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Randal L. Schwartz" <me...@stonehenge.com> on 2002/02/19 19:55:24 UTC

Re: [OT] Really need Comments! very strange bug that happens only on Linux.

>>>>> "Vlad" == Vlad Safronov <vl...@yandex-team.ru> writes:

Vlad> "3238200"? The answer is NO! Try this example on your Linux box

Vlad> ResultSum = 10000;
Vlad> Sum = 323.82;

Vlad> the Buffer value is very strange! I have no ideas how Buffer can be 3238199!
Vlad> FreeBSD (old 3.x) works well and Buffer=3238200 as it should be, but on
Vlad> Linux 6.2, 7.0 it is 3238199..

Vlad> Any ideas?

Yes.  Learn that 1/10 doesn't have a precise representation in binary,
so *all* floating point numbers are "approximate".

Perhaps you've just not gotten bitten before.  Welcome to adulthood. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Re: [OT] Really need Comments! very strange bug that happens only on Linux.

Posted by Ged Haywood <ge...@www2.jubileegroup.co.uk>.
Hi all,

On 19 Feb 2002, Randal L. Schwartz wrote:

> Yes.  Learn that 1/10 doesn't have a precise representation in binary,
> so *all* floating point numbers are "approximate".

Well, maybe not 0.5, 0.25,... :)

73,
Ged.