For an Inline::C solution, the following works ok for me with gcc on Windows:
use strict; use warnings; use Inline C => Config => BUILD_NOISY => 1, ; use Inline C => <<'EOC'; double nxtafter(double in, double dir) { return nextafter(in, dir); } EOC my $pos_inf = (99 ** 99) ** 99; my $neg_inf = -$pos_inf; my $next_down = nxtafter(1.9041105342991877e+258, $neg_inf); printf "%.16e\n", $next_down; my $next_up = nxtafter(-8.2727285363069939e-293, $pos_inf); printf "%.16e\n", $next_up; __END__ Outputs: 1.9041105342991875e+258 -8.2727285363069927e-293
With the latest MS compiler that I have (14.00.40310.41) I need to replace "nextafter" with "_nextafter" in order to get the script to compile.
But it then produces incorrect results anyway:
1.9041105342991884e+258 -7.9999999999999937e-293
Perhaps a more recent MS compiler fares better.

Cheers,
Rob

In reply to Re: Determining the minimum representable increment/decrement possible? by syphilis
in thread Determining the minimum representable increment/decrement possible? by BrowserUk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.