Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Knom's scratchpad

by Knom (Beadle)
on Apr 24, 2006 at 16:37 UTC ( #545320=scratchpad: print w/replies, xml ) Need Help??

use strict; use warnings; # use Math::BigRat lib => 'GMP'; # ':constant' use Math::BigInt lib => 'GMP'; # ':constant' use Math::BigFloat lib => 'GMP'; # ':constant' my $DIVIDEND=Math::BigInt->new("0"); my $DIVISOR=Math::BigInt->new("0"); my $Quotient=Math::BigInt->new("0"); my $Remainder=Math::BigInt->new("0"); my $Remain=Math::BigFloat->new("0"); my $OUTPUT_TOGGLE=1; $SIG{'INT'} = sub { $OUTPUT_TOGGLE=1-$OUTPUT_TOGGLE; }; while(1) { $DIVIDEND=Math::BigInt->new("3067099418661755443795217965573854919 +944041723686207056505605015671432692895979004767739227139964638612225 +6471513118588673376164804790573372343299501858924404525517855"); $DIVISOR=Math::BigInt->new("43381880039784420238969398533696829060 +5469456301558930293445695571862781832679867424802"); print "\n\nDIVIDEND = ".$DIVIDEND.".\n" if $OUTPUT_TOGGLE; print "DIVISOR = ".$DIVISOR.".\n" if $OUTPUT_TOGGLE; ($Quotient,$Remainder)=$DIVIDEND->bdiv($DIVISOR); print "Quotient = ".$Quotient.".\n" if $OUTPUT_TOGGLE; print "Remainder = ".$Remainder.".\n" if $OUTPUT_TOGGLE; $Remain=Math::BigFloat->new("$Remainder"); $Remain=$Remain->Math::BigFloat::bdiv("$DIVISOR"); print "Remain = [".$Remain."]\n" if $OUTPUT_TOGGLE; } # DIVIDEND = 306709941866175544379521796557385491994404172368620705650 +560501567143269289597900476773922713996463861222564715131185886733761 +64804790573372343299501858924404525517855. # DIVISOR = 4338188003978442023896939853369682906054694563015589302934 +45695571862781832679867424802. # Quotient = 707000115220685796581721007456457735832654131831980004469 +43604785174615744121367. # Remainder = 11445129015742267234148865806689963100022565564826516216 +4785349155817398901652091573521. # Remain = [1144512901574226723414886580668996310002256556482651621647 +85349155817398901652091573521]
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2018-10-18 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (101 votes). Check out past polls.

    Notices?