----- Original Message ----- From: "David Budd" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, July 26, 2005 11:34 PM Subject: Floating point
> It strikes me that a Closer_than($e,$x,$y) function that does the suggested > abs(1-$x/$y) <= $e > would be a fine addition to almost any programming language. The compiler/interpreter writer could surely make it more efficient built-in than leaving us to do the construction ourselves. > The MPFR C library ( http://www.mpfr.org/ ) accessible from perl via Math::MPFR (plug) has such a function. It's not implemented exactly in those terms: $bool = Rmpfr_eq($op1, $op2, $ui); Return non-zero if the first $ui bits of $op1 and $op2 are equal, zero otherwise. For multiple precision floating point arithmetic, you really can't do better than MPFR ...... though of course, in most instances, you don't really need to do any better than what's offered by core perl. Cheers, Rob _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
