Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Perl returns NaN after addition

by tinita (Parson)
on Oct 17, 2013 at 01:42 UTC ( [id://1058578]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl returns NaN after addition
in thread Perl returns NaN after addition

or, if the OP happens to use Math::BigFloat:
$ perl -MMath::BigFloat -wE 'say Math::BigFloat->new(5) + "foo"' NaN

Replies are listed 'Best First'.
Re^3: Perl returns NaN after addition
by syphilis (Archbishop) on Oct 17, 2013 at 03:37 UTC
    or, if the OP happens to use Math::BigFloat

    It's interesting that Math::BigFloat decides it has to numify a non-numeric string to NaN ... when everything else numifies such a string to zero.

    Actually, I'm tempted to s/interesting/stupid/, but maybe there's a precedent somewhere that gives some credence to the Math::BigFloat behaviour.

    Cheers,
    Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1058578]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2025-06-20 10:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.