Hello mje,

I did a bit of a research as McA did but on a different area. I came up with the following:

Ok let's start with the basics, I tried to load both Math::FixedPrecision and bignum. As a result, I got the same error with you.

Then I went I start reading for bignum and I found this:

*All operators (including basic math operations) are overloaded. Integer and floating-point constants are created as proper BigInts or BigFloats, respectively.*

*If you do *`use bignum;`

*at the top of your script, Math::BigFloat and Math::BigInt will be loaded and any constant number will be converted to an object (Math::BigFloat for floats like 3.1415 and Math::BigInt for integers like 1234).*

So at this point I can imagine there is a conflict between the packages Math::FixedPrecision and bignum.

So as a second step I decided to go through the documentation of Math::BigFloat and Math::BigInt where are used by bignum in order to create my solution to your problem.

If I understand correctly, your problem is that you want to have accuracy to the nth digit of your float, but at the same time you want to use the bignum module.

**Update:** I just thought that maybe you are interested in just getting the 2 digits after the dot of a float, without rounding. In that case the solution could be much more simpler by using substr. If this is what you are looking for you can simply do that:

**Update 2:** wrong output, correcting output. I was experimenting and accidentally I posted before the experimentation.

`my $pi = "3.1415";
my $substr = substr $pi, 0, 4;
print "\substring: ".$substr."\n"; # $substr: 1.14
`

Alternatively if my assumption is correct, sample of working code with the output:

`#!/usr/bin/perl
use bignum;
use strict;
use warnings;
use Math::BigFloat;
sub math {
my $pi = "3.1415";
my $substr = substr $pi, 0, 4;
print "\$substr: ".$substr."\n";
my $N = Math::BigFloat->new($pi);
print "\$N: ".$N."\n";
my $round = $N->copy()->ffround(-3);
print "\$round:" .$round. "\n";
}
math();
sub alternative {
my $x = 2 + 4.5; # BigFloat 6.5
print "My \$x: ".$x."\n";
print 2 ** 512 * 0.1,"\n"; # really is what you think it is
print inf * inf,"\n"; # prints inf
print NaN * 3,"\n"; # prints NaN
{
no bignum;
print 2 ** 256 * 0.1,"\n"; # a normal Perl scalar now
}
}
alternative();
__END__
$substr: 3.14
$N: 3.1415
$round:3.142
My $x: 6.5
1340780792994259709957402499820584612747936582059239337772356144372176
+403007354697680187429816690342769003185818648605085375388281194656994
+643364900608409.6
inf
NaN
1.15792089237316e+76
`

Seeking for Perl wisdom...on the process of learning...not there...yet!

Comment onRe: Math::FixedPrecision and bignum clashSelectorDownloadCode