Hi Bob, I'm doing data-processing (EDI). I need to format and present values in text, round here and there. Have lots of various attempts that have failed for one math related reason or another. Currently I convert to a string and split and round, etc. (Even modulo '%' has failed me at times). So this 0 comes across as -1.78. Tried printf("%.02f", $value) and got -0.00 back (negative 0?), so I'm not trusting that route much.
The documentation you refered me to (which didn't work on 2000, but luckily I keep my Linux laptop near me at all times) refers to Math::BigFloat. If you can think of a better package I'd go that route though. Thanks, Peter P.S. Things are a little crazy here, so I'm getting chatty. Sorry if there's too many words above. |---------+-------------------------------> | | "Bob Showalter" | | | <[EMAIL PROTECTED]| | | rwhite.com> | | | | | | 08/21/2003 03:18 PM | | | | |---------+-------------------------------> >--------------------------------------------------------------------------------------------------------------| | | | To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] | | cc: | | Subject: RE: trouble with math... driving me nuts. | >--------------------------------------------------------------------------------------------------------------| [EMAIL PROTECTED] wrote: > 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 That is zero, within the limits of the precision of floating point numbers. Read the faq article: perldoc -q 'long decimals' There are a number of modules on CPAN that go beyond the FAQ to address this issue. What are you trying to do? -- 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]