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

Re^7: All Calculations Done with One Variable Give Integer Answers

by syphilis (Chancellor)
on Sep 24, 2013 at 00:08 UTC ( #1055417=note: print w/replies, xml ) Need Help??


in reply to Re^6: All Calculations Done with One Variable Give Integer Answers
in thread All Calculations Done with One Variable Give Integer Answers

I am highly intrigued by this

Most likely it's standard Math::BigInt behaviour and standard Perl behaviour:
use strict; use warnings; use Math::BigInt; my $x = Math::BigInt->new(17); my $y = 70 / $x; print $y, "\n"; $x = "$x.00"; #or: #$x = "$x"; $y = 70 / $x; print $y, "\n"; __END__ Outputs: 4 4.11764705882353
Cheers,
Rob
  • Comment on Re^7: All Calculations Done with One Variable Give Integer Answers
  • Download Code

Replies are listed 'Best First'.
Re^8: All Calculations Done with One Variable Give Integer Answers
by HalNineThousand (Beadle) on Sep 24, 2013 at 04:27 UTC
    You're right. BigInt was used in the module - and then anything done with the variable returned from the module forces integer answers. And my problem is I'd like to find a way to override that reliably.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1055417]
help
Chatterbox?
[Corion]: Well, no computer will start up without the blood sacrifice being made!
[Corion]: I used to cut me on PC cases, but they've gotten better or I don't let blood that easy anymore ;)
[Corion]: You say the girls may strip with your permission, You draw the line dividing art from sin :-D

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2017-01-16 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (151 votes). Check out past polls.