This is a type class for types with n-roots. The value returned by nroot
and sqrt
are only guaranteed to be
approximate answers (except in the case of Real
).
Also, generally nroot
s where n
is even are not defined for negative numbers. The behaviour is undefined if this
is attempted. It would be nice to ensure an exception is raised, but some types may defer computation and testing if
a value is negative may not be ideal. So, do not count on ArithmeticException
s to save you from bad arithmetic!
- Companion:
- object
class Any
trait Fractional[A]
trait RealIsFractional
class RealAlgebra
trait Numeric[A]
trait BigDecimalIsNRoot
class BigDecimalAlgebra
trait BigIntIsNRoot
class BigIntAlgebra
trait BigIntegerIsNRoot
class BigIntegerAlgebra
trait ByteIsNRoot
trait DoubleIsNRoot
class DoubleAlgebra
trait FloatIsNRoot
class FloatAlgebra
trait IntIsNRoot
class IntAlgebra
trait LongIsNRoot
class LongAlgebra
trait ShortIsNRoot