wojtekmach

wojtekmach

Hex Core Team

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:

Happy hacking!

Showing Posts 1 to 10

OvermindDL1

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.

wojtekmach

wojtekmach OP

Hex Core Team

We haven’t discussed this. That might be too big of a leap if that makes sense, for example we’d no longer have protocols. But your results are definitely interesting, can you share library and benchmark code?

michallepicki

michallepicki

We will need protocols for Records for Elixir 2.0 :slight_smile:

josevalim

josevalim

Creator of Elixir

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. :slight_smile:

Sanjibukai

Sanjibukai

Hi,
Sorry if I’m introducing off-topic but what’s the purpose of this library? I saw the post on the forum homepage and was curious.
Is it just for decimal number formatting purpose?
Or is it even related to computation precision? If so why? Does elixir is lacking type for precision calculation (e.g. like using Float in Ruby for currency operations)?

NobbZ

NobbZ

Elixir does not have a native fixed point precision type, decimal fills this gap.

As far as I remember, this is as frowned in the ruby community as it is here…

Sanjibukai

Sanjibukai

Yes.. And so, I just noticed that I completely missed the fact that Elixir guides doesn’t even mention working with decimals for precision computation..

In the meantime I just discovered (while searching on the forum about how people are dealing with currencies) ex_money which seems to depend indeed on the decimal library.. So I bet that ex_money doesn’t simply consider values as integer in cents..

Anyway I’m interested to learn more on the subject.. If you have any resource (like blogposts etc.) I’ll be happy to read them..

tmbb

tmbb

That might be why @OvermindDL1 sees such dramatic improvements

kip

kip

ex_cldr Core Team

Definitely ex_money uses Decimal for representing money amounts both in Elixir and the the database (I’m the author)

José has always been clear in his intent to keep Elixir as a language small and to consider libraries as first class citizens in the ecosystem. Decimal is definitely the ‘goto’ package for this purpose.

josevalim

josevalim

Creator of Elixir

My point is that records are not 5 times faster than structs even when you are only performing records and structs operations, so when you increase the baseline by adding decimal operations as well, it is even more unlikely to get such a number.

Where Next? Top

Trending in Discussions Top

cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
jtormey
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews