Skip to content
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

Announcing proposal-numerics-with-precision #926

Closed
jessealama opened this issue Sep 24, 2024 · 5 comments
Closed

Announcing proposal-numerics-with-precision #926

jessealama opened this issue Sep 24, 2024 · 5 comments
Labels
c: numbers Component: numbers, currency, units s: comment Status: more info is needed to move forward

Comments

@jessealama
Copy link

We're happy to announce numeric-with-precision, a stage 0 proposal that is intended to provide a wrapper around a "numeric" (think: Number, Decimal, maybe Bigint, maybe more) plus a precision, which we can intuitively think of as the number of fractional digits for the "numeric".

The idea of considering a numeric-with-precision as a separate idea came out of discussions in the TG3 call, where proposal-decimal was discussed at length. In particular, we discussed the idea of trailing zeroes (or, more generally, just keeping all digits of a number in the data model for decimals and preserving them as arithmetic is done on decimals). This led to a further discussion in the proposal-decimal repo.

We'd love to hear the Intl folks' thoughts on this during the next monthly call on September 23rd. It's still early days here, and we're happy to iterate a bit on the idea. Initially, no decision needs to be made; we just want to announce our effort to the Intl community.

@TehShrike
Copy link

Cool, I'm happy to see it! Do you plan to enable Github Issues for discussion at some point?

@sffc sffc added s: discuss Status: TG2 must discuss to move forward c: numbers Component: numbers, currency, units labels Sep 25, 2024
@jessealama
Copy link
Author

Cool, I'm happy to see it! Do you plan to enable Github Issues for discussion at some point?

As soon as the proposal moves to Stage 1 in the TC39 process, we can set up a proper TC39-hosted repo thas has issues, etc. Currently, there's a lot in flux. But stay tuned!

@sffc
Copy link
Contributor

sffc commented Oct 3, 2024

@TehShrike
Copy link

A few thoughts after reading the discussion:

  1. I'm not sure how relevant it is, but I saw a few members assuming that financial use cases could "use BigInts to represent cents", which isn't actually possible in real-world systems. If you multiply 1.22 pounds by 3.50 dollars, you're dealing with hundredths of a cent, and then if you multiply by a 0.11 tax rate, you're dealing with ten-thousandths of a cent, and then maybe you add all of those line item totals together and after that you round the subtotal back down to cents. So if you are using bigints to do the arithmetic, they're still having to represent different fractions of a cent at different points.

  2. I hope this proposal doesn't get co-opted to include unit. Unit seems like a very different, more complicated problem.

@ben-allen ben-allen added s: comment Status: more info is needed to move forward and removed s: discuss Status: TG2 must discuss to move forward labels Oct 31, 2024
@ben-allen
Copy link
Contributor

ben-allen commented Oct 31, 2024

Closed as discussed (and no longer planned?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: numbers Component: numbers, currency, units s: comment Status: more info is needed to move forward
Projects
Status: Previously Discussed
Development

No branches or pull requests

4 participants