Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

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

by no_slogan (Deacon)
on Oct 24, 2014 at 22:19 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2023-06-01 11:47 GMT
Find Nodes?
    Voting Booth?

    No recent polls found