tc39 / proposal-bigint-math

Draft specification for supporting BigInts in JavaScript’s Math methods.

Home Page:https://tc39.es/proposal-bigint-math/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BigInt hypot and the nullary case

js-choi opened this issue · comments

Unlike with Math.max and min (see #3), the arguments of Math.hypot cannot mix regular numbers and BigInts.

This means that we have three choices:

  • We extend Math.hypot to accept BigInt arguments. Math.hypot() with no arguments remains +0 the regular number. We are okay with Math.hypot(...arrOfBigInts) returning +0 whenever arrOfBigInts is empty. (Otherwise, non-integer results truncate, like with BigInt division.)
  • We add a new Math.bigHypot that handles the nullary-arguments case (throwing a TypeError). (Otherwise, non-integer results truncate, like with BigInt division.)
  • We don’t support any BigInt hypot.

After hearing feedback from TC39 at the prior presentation, my inclination is with the first choice.

Closing. hypot has now been completely removed due to lack of use cases.

See #13 (comment) and #14 (comment).