Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Bitcast double <-> int64? #18

Closed
littledan opened this issue Feb 20, 2017 · 3 comments
Closed

Bitcast double <-> int64? #18

littledan opened this issue Feb 20, 2017 · 3 comments

Comments

@littledan
Copy link
Member

Should we have functions on BigInt to cast to and from Numbers, bitwise? Or, is the better primitive to have functions based on Numbers which construct a Number from an exponent and mantissa, and to deconstruct it that way? Or, would it be better not to expose this at all, as it would add an additional place where NaN payloads are exposed beyond TypedArrays?

@littledan
Copy link
Member Author

cc @sebmarkbage

@sebmarkbage
Copy link

My worry is that, performance wise, deconstructing would be difficult to optimize or would be easy to slip off the fast path. Strong preference for a cast function in both directions.

@littledan
Copy link
Member Author

littledan commented Jun 30, 2017

The current plan is to leave this feature for a "v2", and that this cast sits outside of the minimal viable product for BigInt. I presented this plan to TC39 in May and they were supportive. However, I'm OK to revisit this any time. One negative point about this function was some hand-wringing about exposing NaN bits in more places, but in my opinion that's rather unjustified, as TypedArrays already expose them, and this is exactly equivalent. Closing for now, as the hope is to go to for Stage 3 without this function.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants