Open
Description
julia> one = FixedDecimal{Int,2}(1)
FixedDecimal{Int64,2}(1.00)
julia> one/3
FixedDecimal{Int64,2}(0.33)
julia> one/3.0
0.3333333333333333
Intuitively, I would expect one/3 === one/3.0
since
julia> 1/3 === 1/3.0
true
Strictly speaking, one/3
should probably also be a Float64
, BUT...
I think users of this package might reasonably expect both
julia> one/3
FixedDecimal{Int64,2}(0.33)
and
julia> one/3.0
FixedDecimal{Int64,2}(0.33)
Otherwise, there would need to be a lot of conversion in the code that would kind of defeat its purpose. For example, if you wanted the result of one/3.0
to remain a FixedDecimal
, you'd need to do something like
> onethird = FixedDecimal{Int,2}(one/3.0)
I think we should either:
- Make
one/3
also aFloat64
soone/3 === one/3.0
or - Make
one/3.0
also aFixedDecimal
soone/3 === one/3.0
I kind of prefer the latter, but in any case it currently seems inconsistent.
What do you think?
Metadata
Metadata
Assignees
Labels
No labels