True, it's not a Perl issue (I've been able to duplicate the problem in C, and Scheme), but I'm looking for a Perl solution. Math::BigFloat seems to work well enough.
Thanks, Peter |---------+----------------------------> | | "Levon Barker" | | | <[EMAIL PROTECTED]> | | | | | | 08/21/2003 03:09 | | | PM | | | | |---------+----------------------------> >--------------------------------------------------------------------------------------------------------------| | | | To: [EMAIL PROTECTED], [EMAIL PROTECTED] | | cc: | | Subject: RE: trouble with math... driving me nuts. | >--------------------------------------------------------------------------------------------------------------| Hi Peter, This is a floating point issue. It is a general computing problem and not just subject to Perl. In decimal form the result is -0.0000000000000017763568. Generally thats usually acurate enough. Otherwise you could truncate it or round it to the nearest quadrabillionth. Cheers, Levon Barker > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 21, 2003 3:06 PM > To: [EMAIL PROTECTED] > Subject: trouble with math... driving me nuts. > > > Luckily I was easily able to recreate the problem. See code below: > > print 37.75 - 33.67 - 4.08 ; > <STDIN>; > > I find these things all the time. Is there a particular module I can use > to fix these things? > > Output is > > -1.77635683940025e-015 > > Should be 0 > > Running on Win2000 / Intel P3 > > -Peter > > > ****** CONFIDENTIALITY NOTICE ****** > NOTICE: This e-mail message and all attachments transmitted with it may > contain legally privileged and confidential information intended > solely for > the use of the addressee. If the reader of this message is not the > intended recipient, you are hereby notified that any reading, > dissemination, distribution, copying, or other use of this message or its > attachments is strictly prohibited. If you have received this message in > error, please notify the sender immediately and delete this message from > your system. Thank you. > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ****** CONFIDENTIALITY NOTICE ****** NOTICE: This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete this message from your system. Thank you.. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]