-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
Description
We already support converting a FixedDecimal to a Rational, via:
FixedPointDecimals.jl/src/FixedPointDecimals.jl
Lines 324 to 326 in e8c9f3b
function Base.convert(::Type{TR}, x::FD{T, f}) where {TR <: Rational, T, f} | |
convert(TR, x.i // coefficient(FD{T, f}))::TR | |
end |
We should also provide numerator()
and denominator()
, as part of that interface. They might be implemented like this:
function Base.numerator(x::FixedDecimal{T,f})::T where {T, f}
return value(x)
end
function Base.denominator(x::FixedDecimal{T,f})::T where {T, f}
return coefficient(x)
end
mbravenboer