Wayne Simmons wrote: [snip] > why does .0006 * 10000 = 6 but "round" to 5? Is this a precision issue I'm > not aware of? If it is it seems awfully shallow to lose information. > > Comments appreciated! > > -Wayne
Hi Wayne, By default, Perl is only as precise as C. This is common to a great many programming languages, as the IEEE-754 standard for floating point arithmetic is what many people who work with numbers frequently expect to follow. The solution to your dilemma may be Math::BigFloat, which is distributed with Perl and ActivePerl. It is documented here: http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/lib/Math/BigFloat.html BigFloat allows you to specify the precision to which your floating point calculations should be accurate. This is a fair amount slower than native arithmetic, but does avoid the loss of precision inherent in native floating point math. Cheers, kjw _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs