JuliaMath / JuliaMath/FixedPointDecimals.jl

Add support for `numerator(::FD)` and `denominator(::FD)`

Open
#56 0 comments 1 reaction 0 assignees View on GitHub
help wanted
Dominant language
Julia
Stars
37
Forks
23
PR merge metrics
No merged PRs in 30d

Description

We already support converting a FixedDecimal to a Rational, via:
https://github.com/JuliaMath/FixedPointDecimals.jl/blob/e8c9f3b4b68c85fa0bb8813b35c27ee267114175/src/FixedPointDecimals.jl#L324-L326

We should also provide `numerator()` and `denominator()`, as part of that interface. They might be implemented like this:
```julia
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
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.