We don't bite newbies here... much | |
PerlMonks |
TANGENT = %.17g formatting (Re^8:int() function)by pryrt (Abbot) |
on Oct 26, 2020 at 13:39 UTC ( [id://11123182]=note: print w/replies, xml ) | Need Help?? |
"%.17g" formatting I was surprised to see 16 digits after the decimal point in a "%.17" notation. Per perl's sprintf docs: %g a floating-point number, in %e or %f notation But that's not what actually happens in Perl:
... In this instance, "%.17g" is neither equivalent to "%.17f" (17 digits after the fixed decimal point) nor to "%.17e" (17 digits after the floating decimal point). I tried on an ancient linux machine with v5.8.5, with similar results:
The sprintf docs have used that phrasing at least as far back as v5.005 . Am I misunderstanding what I'm seeing? or has perl documentation about %g been wrong for that long?
In Section
Seekers of Perl Wisdom
|
|