|Subject:||Mixing accuracy and precision creates NaN|
Mixing operand where one has accuracy set and the other has precision set, returns NaN: use strict; use warnings; use Math::BigFloat; my $x = Math::BigFloat -> new(6); $x -> accuracy(5); my $y = Math::BigFloat -> new(4); $y -> precision(-3); my $zadd = $x + $y; # = NaN my $zmul = $x * $y; # = NaN my $zsub = $x - $y; # = NaN my $zdiv = $x / $y; # = NaN my $zpow = $x ** $y; # = NaN The actual code that creates the NaN is in Math::BigInt::round(), where a comment says "set A and set P is an fatal error". It should be possible to get a meaningful result, even when both accuracy and precision is set. I consider the current behaviour to be a bug. If I remember correctly, IEEE 754-2008 states that the rounding parameters are determined by the first operand.