-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util/decimal: Investigate EricLagergren/decimal package #6009
Comments
Hey! Just noticed this. Feel free to ask about anything you want. :) |
Also, our current decimal library appears not to handle scientific notation, while PG does. EricLagergren/decimal also handles scientific notation, which is good. |
@ericlagergren it seems that you don't have an equivalent of https://godoc.org/gopkg.in/inf.v0#Dec.UnscaledBig, which we need for our serialization of decimals. |
@tamird That could easily be added. Unless the decimal spec (http://speleotrove.com/decimal/decarith.html) has a name for the method, I'd probably lean towards a |
I haven't read the spec, but |
Note: there are some optimizations in 72a5c19 which are baked into github.com/EricLagergren/decimal and should be removed when this is implemented. |
@nvanbenschoten, do you mind elaborating why write a new library? I am trying to find a big.Decimal lib for some financial calculation. So, I am curious. |
@tamalsaha the reddit thread and blog post Eric linked to does a pretty good job explaining our rationale. The decision had less to do with specific shortcomings in other libraries and more to do with independent requirements for our use case, like panic-free operation and configurable precision. |
This library looks really good, and could be a justifiable alternative to our current
inf/dec
library.Specially, reasons to consider switching libraries are that this new package:
int64
, speeding up operations and potentially avoiding allocationsLog
,Exp
, etc.)so we could remove our custom implementations
Context
to define how arithmetic operations react (common in a lot of other languages)FizzBuz
function!Either way, we should continue to monitor golang/go#12127.
The text was updated successfully, but these errors were encountered: