-
Notifications
You must be signed in to change notification settings - Fork 18
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
Normalization in other implementations #89
Comments
I didn't go this deep but it would be interesting to see how the prior art handles the "middle ground" proposal suggested in the slide deck, namely whether |
So in conclusion, Java, C# and Python's behavior is closest to the "middle ground" proposal. The primary comparison operators care only about the mathematical value and ignore trailing zeroes. The string conversion exposes trailing zeroes. On the other hand, Ruby adopts the always-normalize strategy. On top of that, Python offers a |
In Temporal we had similar questions about what fields to consider in |
Just to update this discussion with the status quo:
|
It looks like Python has a
|
The answer for Postgresql is "NO", not "YES". Postgres does not store the precision together with the number, and instead it's part of the type of the column (so, there is no difference between trying to store 12.0 or 12.00 in any given column). |
This week's slides discuss precedent for decimals from other programming languages. I did some quick research on the listed programming languages to see if they support trailing zeros.
Java: YES
https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html
C#: YES
https://learn.microsoft.com/en-us/dotnet/api/system.decimal?view=net-8.0
Python: YES
https://docs.python.org/3/library/decimal.html
Ruby: Wasn't able to determine for sure in the short amount of time I took to research, but I think it does not support them. Ruby defines decimals as: "arbitrary-precision floating point decimal arithmetic". When I play with them in
irb
I can't seem to get a trailing zero to roundtrip.Postgresql: YES
https://www.postgresql.org/docs/8.1/datatype.html
https://stackoverflow.com/questions/26920157/postgresql-adds-trailing-zeros-to-numeric
@jessealama
The text was updated successfully, but these errors were encountered: