Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2019-06-17 01:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (76 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!