Decimals.jl
Decimals.jl copied to clipboard
Pure Julia decimal arithmetic library.
Off by 1 in the branch for the exponent.
This library has a number of pretty severe bugs and given it's use of `DIGITS` is incorrect for any large or small numbers (with an exponent of >10 or
Seemed like this package needed a bit of an overhaul as it appears to be basically the default arbitrary precision decimal arithmetic package. It still needs a ton of work,...
Would the following macros be useful? ```julia julia> macro decimal(ex) trans!(e::Real) = :(Decimal($e)) trans!(e::Expr) = begin for (i,a) in enumerate(e.args) a isa Integer && continue a isa Real && (e.args[i]...
I propose these changes to support `Base.tryparse`. This can be useful also for integration with other packages, like [`CSVFiles.jl`](https://github.com/queryverse/CSVFiles.jl) or [`Parsers.jl`](https://github.com/JuliaData/Parsers.jl).
I had expected this to work: ``` julia> Decimal(10)^30 / Decimal(2)^100 Decimal(0, 0, 0) ``` With python: ``` In [9]: 10**30 / 2**100 Out[9]: 0.7888609052210118 ```
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...
Decimals.scinote(str) errors when the number of decimals in the scientific number is higher than the exponent. ``` julia> x = 1.2345678e6 1.2345678e6 julia> Decimal(x) ERROR: ArgumentError: can't repeat a string...
Perhaps the hash could be defined in terms of the has of the underlying fields `s`, `c` and `q` of the `Decimal` struct. For reference, here is a stacktrace: ```...
Thanks for this package! Calling `hash` on a Decimal fails in julia 1.5.3: ```julia> using Decimals julia> p =parse(Decimal, "0.1") Decimal(0, 1, -1) julia> hash(p) ERROR: MethodError: no method matching...