Skip Menu |

This queue is for tickets about the Math-Round CPAN distribution.

Report information
The Basics
Id: 4614
Status: new
Priority: 0/
Queue: Math-Round

People
Owner: Nobody in particular
Requestors: nbest [...] speakeasy.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.05
Fixed in: (no value)



Subject: results do not compare numerically as expected
Math-Round-0.05 perl -v = 5.8.1 uname -a = Linux intercept 2.6.0-test5-mm4 #2 Thu Sep 25 17:05:33 PDT 2003 i686 GNU/Linux It seems that values returned by nearest() contain a floating point epsilon that prevents proper numeric comparison. nbest@intercept:~/verifier$ perl -e ' use Math::Round; print nearest(0.1,0.3)-0.3, "\n"; print "same\n" if nearest(0.1,0.3) == 0.3; Show quoted text
> '
5.55111512312578e-17 nbest@intercept:~/verifier$ Perhaps you are aware of this, but I thought to bring it to your attention. My work-around is . . . sprintf "%0.1f", nearest(0.1, $input->mean()); Let me know if I can provide more detail. Thanks for a useful module. Neil
Subject: Re: [cpan #4614] results do not compare numerically as expected
To: bug-Math-Round [...] rt.cpan.org
From: grommel [...] sears.com
Date: Tue, 9 Dec 2003 14:13:54 -0600
RT-Send-Cc:
Thanks for your note. IMHO, this is not a bug, but an unavoidable consequence of working with floating-point numbers. In general, you cannot be sure that (x/y) * y will = x. s17a105 [/home/grommel/Math-Round-0.05] $ perl printf "%.18f\n", 0.1 * 3; printf "%.18f\n", 0.3; 0.300000000000000044 0.299999999999999989 "Guest via RT" <bug-Math-Round@r To: "AdminCc of cpan Ticket #4614": ; t.cpan.org> cc: Subject: [cpan #4614] results do not compare numerically 12/09/2003 10:24 as expected AM Please respond to bug-Math-Round This message about Math-Round was sent to you by guest <> via rt.cpan.org Full context and any attached attachments can be found at: <URL: https://rt.cpan.org/Ticket/Display.html?id=4614 > Math-Round-0.05 perl -v = 5.8.1 uname -a = Linux intercept 2.6.0-test5-mm4 #2 Thu Sep 25 17:05:33 PDT 2003 i686 GNU/Linux It seems that values returned by nearest() contain a floating point epsilon that prevents proper numeric comparison. nbest@intercept:~/verifier$ perl -e ' use Math::Round; print nearest(0.1,0.3)-0.3, "\n"; print "same\n" if nearest(0.1,0.3) == 0.3; Show quoted text
> '
5.55111512312578e-17 nbest@intercept:~/verifier$ Perhaps you are aware of this, but I thought to bring it to your attention. My work-around is . . . sprintf "%0.1f", nearest(0.1, $input->mean()); Let me know if I can provide more detail. Thanks for a useful module. Neil