Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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
in thread Portability of floor(log(N)) by toolic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 11:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found