Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^6: Perl can't make some easy arithmetics :(

by no_slogan (Deacon)
on Oct 24, 2014 at 22:19 UTC ( [id://1104925]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Perl can't make some easy arithmetics :(
in thread Perl can't make some easy arithmetics :(

To explain further: use bigint only causes numeric literals to become bigints. It does not change the meaning of operators (like -), no matter what the perldoc might lead you to believe. 0 is a literal, and becomes a bigint. $a and $b are strings, and do not become bigints unless you add 0 to them. Just saying "$a-$b" does not trigger bigint conversion.

Edit: Here's a quick demonstration:

> perl -le 'use bigint; print 22/7; print "22"/"7"' 3 3.14285714285714

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-03-28 10:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found