http://www.perlmonks.org?node_id=11157081


in reply to Re^5: [OT: JavaScript] JS remainder operation ('%')
in thread [OT: JavaScript] JS remainder operation ('%')

Wouldn't it be better to s/perl/print/g here?

That would be better. (Some might even argue that "perl's interpolation" would be the more strictly accurate replacement - since all print() does is to output what perl has interpolated ... but that sort of thinking is way too moot for me to understand ;-)

IMHO your statement is misleading as it is, because it's limited to output by print and doesn't effect internal representation.

I don't quite follow that. The only problem is the print function (or perl's interpolation of NV's or whatever we should call it).
There's no issue with perl's internal representation of doubles, since 5.30.0.

Cheers,
Rob
  • Comment on Re^6: [OT: JavaScript] JS remainder operation ('%')

Replies are listed 'Best First'.
Re^7: [OT: JavaScript] JS remainder operation ('%')
by LanX (Saint) on Jan 18, 2024 at 15:04 UTC
    > Some might even argue that "perl's interpolation

    That's a very good point!

    But it's not the interpolation, but more generally the stringification .

    use v5.12; use warnings; $a= 1-1e-16; printf "%.16f\n",$a; printf "%.16f\n",("".$a);

    0.9999999999999999 1.0000000000000000

    Consequently this should be documented for stringification, and print should reference it.

    Update

    Apart from mentions in perlglossary and overload there is not much on stringification to be found in perldocs :/

    https://perldoc.perl.org/perlglossary#stringification

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery