Hi,
Internally (in XS,xs), JSON-XS uses Gconvert():
Gconvert (SvNVX (sv), NV_DIG, 0, enc->cur);
But Gconvert() doesn't DWIM when nvtype is __float128, so I've altered that code to:
#ifdef USE_QUADMATH
quadmath_snprintf(enc->cur, NV_DIG, "%.33Qg", SvNVX (sv)); /* NV_DIG i
+s 33 for quadmath builds */
#else
Gconvert (SvNVX (sv), NV_DIG, 0, enc->cur);
#endif
I've chosen "33" (== the value of NV_DIG on quadmath builds) because Gconvert uses NV_DIG for both "double" builds of perl (where NV_DIG is 15) and "long double" builds of perl (where NV_DIG is 18).
It seems to work pretty well - but there's one JSON-XS-4.03 test that fails:
t/11_pc_expo.t .......... 1/8
# Failed test 'digit 1.01e+30'
# at t/11_pc_expo.t line 35.
# '[1010000000000000000000000000000]'
# doesn't match '(?^:\[1.01[Ee]\+0?30\])'
# Looks like you failed 1 test of 8.
Before I investigate that test failure, I just want to check that NV_DIG (33) is the correct value to be specifying in the "%Qg" formatting ??
If I alter that value of 33 to 30 (or less), then all tests pass ... but I know very little about json, or what it expects, or what is expected of it.
Any assistance would be much appreciated.
Cheers,
Rob
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.