FixedPointDecimals.jl icon indicating copy to clipboard operation
FixedPointDecimals.jl copied to clipboard

Julia fixed-point decimals built from integers

Results 30 FixedPointDecimals.jl issues
Sort by recently updated
recently updated
newest added

FixedPointDecimals.jl should probably implement `Base.big(::FixedDecimal)` and `Base.big(::Type{

Operations like `*` or `\` can be lossy because they can cause the number of fractional digits to exceed the precision of the FD type, e.g.: ```julia julia> FixedDecimal{Int,2}(1.11) *...

Consider: ```julia julia> @which FD{BigInt,2}(2) + 2 +(x::Number, y::Number) @ Base promotion.jl:410 julia> @code_typed FD{BigInt,2}(2) + 2 CodeInfo( 1 ─ %1 = invoke Base.GMP.MPZ.set_si(10::Int64)::BigInt │ %2 = invoke Base.GMP.bigint_pow(%1::BigInt, 2::Int64)::BigInt...

performance

It seems you always need to specify how many decimals, e.g. with FixedDecimal{Int8, 2} and that type which is far from optional. Most likely it's not useful enough for money,...

Code to test, using Julia 1.6.6 and FixedPointDecimals 0.4.0: ``` julia> using FixedPointDecimals julia> tryparse(FixedDecimal{Int64,2},"1.5") ERROR: MethodError: no method matching tryparse(::Type{FixedDecimal{Int64, 2}}, ::String) Closest candidates are: tryparse(::Type{Complex{S}}, ::AbstractString) where S

This allows to get updates for GitHub actions automatically. I have used this for my own packages, the [Trixi.jl framework](https://github.com/trixi-framework), and the [SciML organization](https://github.com/SciML). After merging this, you could also...

I'm not sure how easy this would be, but if it's at all possible, I'd be very interested in an extension of this that allows for arbitrary bases--this would have...

The default implementation of `signbit` is quite slow for `BigInt` and `Int128`. MWE: ```julia using FixedPointDecimals using BenchmarkTools signbit2(x) = signbit(x.i); x = FixedDecimal{BigInt, 10}(1); @btime signbit($x); @btime signbit2($x); x...

Had once forgotten to add the second type parameter but I was met with a stack overflow: ``` julia> FixedDecimal{Int8}(5) ERROR: StackOverflowError: Stacktrace: [1] convert(#unused#::Type{FixedDecimal{Int8}}, x::Int64) @ Base ./number.jl:7 [2]...