P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'd probably recommend %a
Good advice - and the value I'd be looking at is $num itself. Perl is notorious for assigning values incorrectly - and I have a number of -Duselongdouble builds of perl (Windows and Linux) which assign the value 1e-33 incorrectly as 0xa.6274bbdd0fadd61p-113, instead of (correctly) 0xa.6274bbdd0fadd62p-113. This doesn't cause any test failures for me. It underestimates the value of '1e-33' by a measly 1 ULP, and I think we're looking for an overestimate for the test to fail. (I also don't discount the possibility that the error is in the calculation.) If the problem *is* in the value that perl assigns for '1e-33' then your solution is to make sure that a correct value is being assigned - for which you can use Math::MPFR or (I believe) Data::Float. There are perhaps other modules, too. Data::Float is pure perl and therefore makes for a more straightforward installation. I use Math::MPFR, which requires the MPFR C library. Afterthought: IIRC, some systems that implement the 'long double' type don't actually implement the full range of math functions for the long double. It's therefore worth determining whether the underlying libc for those 2 FAIL reports provides floorl() and logl(), or whether libc just uses the double precision floor() and log() functions. Cheers, Rob In reply to Re^2: Portability of floor(log(N))
by syphilis
|
|