PDL::Core (which stringifies ndarrays) uses these variables:
$PDL::floatformat = "%7g"; # Default print format for long numbers
$PDL::doubleformat = "%10.8g";
And when it is stringifying, as you asked it to do, it uses the values of those. The above is the current (2.080) values, but those have been the same since 2.002 back in 1999. However,
printf's
g format treats the precision (the number after the ".", here 8) like so:
The precision specifies the number of significant digits.
50137.686 has 8 significant digits. To change this behaviour, just assign a different value to e.g.
$PDL::doubleformat.
The way I checked the above was my usual technique: use git log -p -w and text-search for a relevant string, here "floatformat".
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.