tc39 / proposal-decimal

Built-in exact decimal numbers for JavaScript

Home Page:http://tc39.es/proposal-decimal/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSBI-style polyfill: Volunteers wanted!

littledan opened this issue · comments

JSBI provides a function-based polyfill of BigInt. This doesn't provide BigInt syntax, but it lets people use the functionality without having BigInt built-in to their JS engine. I believe a similar polyfill would be useful in BigDecimal, once we have the API worked out, to get feedback through prototyping. Would anyone be interested in drafting one?

@littledan I'm in.

Have you tried contacting them to see if they might be interested in supporting BigDecimal as well?

Would be nice for one library to do both.

@fabiosantoscode Them = who? I was planning on filing an issue in the decimal ecosystem libraries' repositories to get their feedback once we move along a little more. For JSBI, this was written by the V8 team in conjunction with their BigInt effort; I wasn't planning on bothering them about this.

Instead, I saw this as a good opportunity to bring in new people who want to contribute to a TC39 proposal.

I suppose that having decimals in their library is something they might want!

Well, maybe you could ask in their issue tracker if they would welcome this sort of contribution? (My impulse is still to separate them; no need for a one-stop shop here.)

JSBI author here. Not interested. BigDecimal libraries should be separate from BigInt libraries.

@littledan

A draft polyfill is available here.

https://github.com/Yaffle/BigDecimal - I have tried to implement over the native BigInts, but this implementation can be buggy, I was testing it using the polyfill by @MikeMcl .

https://github.com/yukinotech/JSBD an implement which is refered to https://github.com/tc39/proposal-decimal/blob/master/bigdecimal-reference.md . it is not finished yet,some method has not been impleted.

Hi @yukinotech! Thanks so much for implementing this polyfill. With the changeover in champions and various events, I don't think we're quite at the point of a stable API where we should be encouraging much use outside of experimental runs. We can then stay in touch as the API evolves and keep things in sync.

Also, what would you think about adding some notes that the API is unstable and linking to the survey (https://forms.gle/z6m2A9GkRheLKWdj8) for folks who do choose to try it out?