Created
June 22, 2024 18:55
-
-
Save bingos/755b19a9a88cc4512946fa64f17e09a9 to your computer and use it in GitHub Desktop.
You shall go to the dagobah system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpan@dagobah:~$ /home/cpan/pit/bare-qm/perl-5.36.3/bin/perl -MConfig -MMath::BigFloat -wle'my $data = Math::BigFloat->new(12391239123); my $divisor = Math::BigFloat->new(0.00000001); my ($quotient, $remainder) = $data->bdiv($divisor); print $quotient; print $remainder; print $quotient->is_inf; print Math::BigFloat->VERSION; print $Config{ivsize}; print $Config{nvsize}' | |
1239123912300000000 | |
0 | |
0 | |
1.999830 | |
4 | |
16 | |
cpan@dagobah:~$ |
Can you try this one too please?
perl -MConfig -MCpanel::JSON::XS -MData::Dumper -wle'
my ($data, $divisor) = @{ Cpanel::JSON::XS->new->allow_bignum->allow_nonref->decode(shift)};
print Dumper([$data, $divisor]);
my $dividend = ref($data) =~ /^Math::Big(?:Int|Float)$/ ? $data->copy : Math::BigFloat->new($data);
my ($quotient, $remainder) = $dividend->copy->bdiv($divisor); print "($quotient, $remainder)";
print Dumper($quotient);
print "overflow? ", $quotient->is_inf;
print Math::BigFloat->VERSION; print "$Config{ivsize}, $Config{nvsize}";
$remainder = $dividend->bmod($divisor);
print Dumper($remainder);
print "remainder: $remainder";
perl -MConfig -MCpanel::JSON::XS -MData::Dumper -wle'
my ($data, $divisor) = @{ Cpanel::JSON::XS->new->allow_bignum->allow_nonref->decode(shift)};
print Dumper([$data, $divisor]);
my $dividend = ref($data) =~ /^Math::Big(?:Int|Float)$/ ? $data->copy : Math::BigFloat->new($data);
my ($quotient, $remainder) = $dividend->copy->bdiv($divisor); print "($quotient, $remainder)";
print Dumper($quotient);
print "overflow? ", $quotient->is_inf;
print Math::BigFloat->VERSION; print "$Config{ivsize}, $Config{nvsize}";
$remainder = $dividend->bmod($divisor);
print Dumper($remainder);
print "remainder: $remainder";
my $inverse = 1/$divisor; print "inverse: $inverse";
my $product = $dividend * $inverse; print "product: $product";
print Dumper($product);
print "product infinite? ", $product->is_inf;
print "product integer? ", $product->is_int;
' "[12391239123,0.00000001]"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ cat /etc/debian_version
12.5
$ uname -a
Linux dagobah 6.1.0-21-686 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) i686 GNU/Linux
$