wojtekmach
Decimal 1.9 and 2.0
I’m happy to announce the plans for the next major version of Decimal: v2.0.0.
The primary reason for the next major release is a need for a breaking change. Elixir v1.10 ships with Improvements to sort-based APIs in Enum using a compare/2 returning :lt | :eq | :gt that a module can implement. However, there already exists a Decimal.compare/2 function with different return values, and so the function will be adjusted in Decimal v2.0.0.
Creating a new major release is also an opportunity to further clean up the API. For example, Decimal.parse/1 will be changed to behave like the Integer.parse/1 and Float.parse/1 counterparts. Other functions have been slightly changed and/or renamed to have a more idiomatic Elixir interface. Finally, the next major release will drop deprecated functionality and will require more recent Elixir versions.
Before shipping v2.0.0, we plan to have v1.9.0, which will be a backwards-compatible release that works on Elixir v1.0 and has deprecation warnings that should ease the transition.
Today we’re also shipping release candidates: v1.9.0-rc.0 and v2.0.0-rc.0. See the changelongs for more information:
- CHANGELOG for v1.9
- CHANGELOG for v2.0 (master)
Happy hacking!
Most Liked
wojtekmach
We’ve just released stable versions of Decimal v1.9.0 and v2.0.0, happy arbitrary precision computations ![]()
OvermindDL1
Sounds nice!
Have you thought about going to a Record based backend instead of a Struct? I’ve written a Decimal clone (for the functions I needed for a very limited purpose) and it benchmarked over 5 times (~5.68 average times faster for my use-case) faster than Decimal. It was identical code to Decimal (copy/pasted) other than using records instead of Structs.
josevalim
Before Elixir v1.0, we had protocols for Records and there were many issues. For example, is {:name, "hello"} a record or not? Checking all tuples for potentially being a record was too expensive and it had too many false positives, meaning we would call the implementation code for something that would not be a record and then it would fail. That’s one of the reasons why we introduced structs in the first place.
I am honestly skeptical this would be case. Records are not 5x faster than structs even on regular operationss, so once it gets diluted with the operations done by Decimal, I really don’t expect a 5 times improvement. ![]()
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









