>
> from https://github.com/ericmj/decimal
>
> iex> alias Decimal, as: D
> nil
> iex> D.add(D.new(6), D.new(7))
> #Decimal<13>
> iex> D.div(D.new(1), D.new(3))
> #Decimal<0.333333333>
>
>
I definitely agree it is non-ideal. One option would to at least add a
sigil so we can create decimals without going through Decimal.new.

6.75d + 7.293d
>
> 6.75d / 3.2d
>

The issue with this is that we would make the + operator slower for regular
operations AND it would still not be allowed in guards, as Norbert
mentioned. This has been, as a matter of fact, the biggest blocker for
adding Decimals to Elixir itself.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2ByufavV2SKWpBPx0kiqbtS4CD%2BDn0adD8BHi%2BpZc6jxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to