You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need a clean way to express the following ideas for spire types, via typeclasses:
Some types are "fractional" - they can approximate all their answers "closely" (for some value of "close") in a fractional way:
Float
Double
Rational
BigDecimal
Algebraic
Real
for all native and spire types that are fractional, one can compute a "good" approximation (again, for some value of "good") for fpow and nroot
I think a clean way to do this would be to simply define actual typeclass instances of Fractional for all these types. That gives library users a clean way to say either using NRoot or using Fractional in their signatures.
Currently spire provides literally no usable typeclass instance of NRoot[Rational], even though it provides instances for several integral types like NRoot[Int], which doesn't seem numerically safe at all!
There are also currently no typeclass instances that allow one to "filter" on numeric types that actually are fractional. I should be able to say things like using Fractional[V] and have this be satisfiable for Float, Double, Rational, BigDecimal, etc. Currently that doesn't seem possible.
The text was updated successfully, but these errors were encountered:
I need a clean way to express the following ideas for spire types, via typeclasses:
fpow
andnroot
I think a clean way to do this would be to simply define actual typeclass instances of
Fractional
for all these types. That gives library users a clean way to say eitherusing NRoot
orusing Fractional
in their signatures.Currently spire provides literally no usable typeclass instance of
NRoot[Rational]
, even though it provides instances for several integral types likeNRoot[Int]
, which doesn't seem numerically safe at all!There are also currently no typeclass instances that allow one to "filter" on numeric types that actually are fractional. I should be able to say things like
using Fractional[V]
and have this be satisfiable for Float, Double, Rational, BigDecimal, etc. Currently that doesn't seem possible.The text was updated successfully, but these errors were encountered: