Skip to content

BigInt hypot and the nullary case #6

Closed
@js-choi

Description

@js-choi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions