spire
spire copied to clipboard
Cannot find the sqrt of a BigDecimal with unlimited precision
import spire.algebra._, spire.implicits._
Field[BigDecimal].fromDouble(0).sqrt
throws:
java.lang.ArithmeticException: Cannot find the sqrt of a BigDecimal with unlimited precision.
at spire.std.BigDecimalIsNRoot.sqrt(bigDecimal.scala:43)
at spire.std.BigDecimalIsNRoot.sqrt$(bigDecimal.scala:41)
at spire.std.BigDecimalAlgebra.sqrt(bigDecimal.scala:177)
... 36 elided
Affects 0.13.0 and (org.typelevel
) 0.14.1
BigDecimalIsField.fromDouble
returns a BigDecimal
with UNLIMITED
precision; I don't have context to know if that is unconditionally a bug or not.
NB: changing UNLIMITED
to DECIMAL64
in BigDecimalIsField.fromDouble
results in FpFilterTest
Orientation test for degenerate case
failing, though it seems like that test may not really be verifying anything useful.
@non, is it related to the stuff that you fixed yesterday?
Not super familiar with how precision is supposed to work, but this doesn't seem like it's an issue yet. (And arguably, it seems like the behavior makes sense). Might make sense to close.