I also ran into issues with quadmath builds.

Thanks for the excellent info.
In specifying NV_DIG as the second arg handed to quadmath_snprintf() I had made a mistake. It's quite possible that more than 33 characters need to be written to enc->cur.
I'll switch to enc->end - enc->cur.

It seems to me that there's no reason to assume that the user wants 33 digits of precision just because perl's nvtype is __float128, but "33" is probably as good an assumption as anything else.
Anyone wanting just "double" precision values could alter the "%.33Qg" to "%.15Qg" and rebuild and reinstall the module. (For the same outputs as a "long double" build of perl, you'd specify "%.18Qg".)
I think those various options work fine - though I haven't rigorously tested them.

Your rewrite of the test looks fine to me, too.
The failure of the test is just a quirk of the way perl displays that edge case value:
>perl -le "print 1.01e30;" 1010000000000000000000000000000 <c> Similar things happen with long double values: <c> >perl -le "print 1.01e17;" 101000000000000000
and with doubles, too:
perl -le "print 1.01e14" 101000000000000
Cheers,
Rob

In reply to Re^2: JSON-XS on quadmath builds of perl by syphilis
in thread JSON-XS on quadmath builds of perl by syphilis

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.