Skip to content

Editorial: Replace Number-specific term "finite" with "finite Number"#3911

Open
gibson042 wants to merge 8 commits into
tc39:mainfrom
gibson042:gh-3840-finite-number
Open

Editorial: Replace Number-specific term "finite" with "finite Number"#3911
gibson042 wants to merge 8 commits into
tc39:mainfrom
gibson042:gh-3840-finite-number

Conversation

@gibson042

@gibson042 gibson042 commented Jul 13, 2026

Copy link
Copy Markdown
Member

...fixing inappropriate auto-linking for uses of "finite" as a colloquial term

Fixes #3840

This does not affect Web IDL, HTML, or WebAssembly. ECMA-402 has a corresponding PR at tc39/ecma402#1091 , which can land independently of this one.

...fixing inappropriate auto-linking for uses of "finite" as a colloquial term

Fixes tc39#3840
@github-actions

Copy link
Copy Markdown

The rendered spec preview for this PR is available as a single page at https://tc39.es/ecma262/pr/3911 and as multiple pages at https://tc39.es/ecma262/pr/3911/multipage .

@gibson042 gibson042 added the request preview ask the bot to trigger a PR preview label Jul 13, 2026
@github-actions github-actions Bot removed the request preview ask the bot to trigger a PR preview label Jul 13, 2026
Comment thread spec.html Outdated
Comment thread spec.html Outdated
Comment thread spec.html Outdated
Comment thread spec.html
Comment on lines 48407 to +48408
1. If _value_ is a Number, then
1. If _value_ is finite, return ! ToString(_value_).
1. If _value_ is a finite Number, return ! ToString(_value_).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively:

Suggested change
1. If _value_ is a Number, then
1. If _value_ is finite, return ! ToString(_value_).
1. If _value_ is a finite Number, return ! ToString(_value_).
1. If _value_ is a finite Number, return ! ToString(_value_).
1. If _value_ is a Number, return *"null"*.

But either one is fine.

@michaelficarra michaelficarra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM otherwise, but I haven't checked that all the remaining uses of the term "finite" are still appropriate yet.

Comment thread spec.html Outdated
@@ -33068,7 +33068,7 @@ <h1>Number.prototype.toFixed ( _fractionDigits_ )</h1>
1. Assert: If _fractionDigits_ is *undefined*, then _fractionCount_ is 0.
1. If _fractionCount_ is not finite, throw a *RangeError* exception.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the result of ToIntegerOrInfinity, it's be clearer to say "is not an integer". Something similar happens in Function.prototype.bind for targetLengthAsInt.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated both sites.

@michaelficarra

Copy link
Copy Markdown
Member

I see some additional uses of finite time value. I think we're going to need to bite the bullet and just dfn it.

@michaelficarra

Copy link
Copy Markdown
Member

In MakeDate, there's a missed finite -> finite Number.

@michaelficarra

Copy link
Copy Markdown
Member

All other uses of finite LGTM.

gibson042 added a commit to gibson042/ecma262 that referenced this pull request Jul 16, 2026
gibson042 added a commit to gibson042/ecma262 that referenced this pull request Jul 16, 2026
@gibson042
gibson042 force-pushed the gh-3840-finite-number branch from bc07c90 to eda5ab8 Compare July 16, 2026 18:10
gibson042 added a commit to gibson042/ecma262 that referenced this pull request Jul 16, 2026
@gibson042
gibson042 force-pushed the gh-3840-finite-number branch from eda5ab8 to 00bfbea Compare July 16, 2026 18:11
@gibson042
gibson042 force-pushed the gh-3840-finite-number branch from 00bfbea to 5dbf2af Compare July 16, 2026 18:26
@gibson042

Copy link
Copy Markdown
Member Author

I see some additional uses of finite time value. I think we're going to need to bite the bullet and just dfn it.

Agreed 😭 . Done.

In MakeDate, there's a missed finite -> finite Number.

Fixed.

Comment thread spec.html
Comment on lines +33017 to +33018
1. If _number_ is not a finite Number, return Number::toString(_number_, 10).
1. If _fractionCount_ is not an integer, throw a *RangeError* exception.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These steps are being aligned across Number.protototype.{toExponential,toFixed,toPrecision}. The integer check is optional because relational operators support extended mathematical values, but these are cases where we tend to be explicit for minimizing cognitive burden. Further refactoring could combine both checks into a single step and/or use inclusive interval in the range check, and I'm deferring both of those options to the future as out of scope for a PR whose focus is introducing the term "finite Number".

Comment thread spec.html
1. If _numerator_ is either *+0*<sub>𝔽</sub> or *-0*<sub>𝔽</sub>, return _numerator_.
1. Assert: _numerator_ and _denominator_ are finite and non-zero.
1. Assert: _numerator_ is a finite Number and is neither *+0*<sub>𝔽</sub> nor *-0*<sub>𝔽</sub>.
1. Assert: _denominator_ is a finite Number and is neither *+0*<sub>𝔽</sub> nor *-0*<sub>𝔽</sub>.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is a finite Number and is neither +0𝔽 nor -0𝔽" is a very common check in Number-related algorithms; we should consider a shorter way to express it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be okay defining nonzero finite Number.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this PR, or later?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either would be fine.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it would be non-zero finite Number; we always include the hyphen.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread spec.html
1. If _x_ is an Object and _y_ is either a String, a Number, a BigInt, or a Symbol, return ! IsLooselyEqual(? ToPrimitive(_x_), _y_).
1. If _x_ is a BigInt and _y_ is a Number, or if _x_ is a Number and _y_ is a BigInt, then
1. If _x_ is not finite or _y_ is not finite, return *false*.
1. If _x_ is a Number and _x_ is not a finite Number, return *false*.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is just NaN, +∞, and -∞, right? Would it be better to just say that?

@michaelficarra

Copy link
Copy Markdown
Member

We should give esmeta a heads up about this and see if they could add support for the new term before landing.

@gibson042

Copy link
Copy Markdown
Member Author

We should give esmeta a heads up about this and see if they could add support for the new term before landing.

Indeed: es-meta/esmeta#346

Comment thread spec.html
Comment on lines 6087 to 6092
1. If _x_ is a BigInt and _y_ is a Number, or if _x_ is a Number and _y_ is a BigInt, then
1. If _x_ is not finite or _y_ is not finite, return *false*.
1. If _x_ is a Number and _x_ is not a finite Number, return *false*.
1. If _y_ is a Number and _y_ is not a finite Number, return *false*.
1. If ℝ(_x_) = ℝ(_y_), return *true*.
1. Return *false*.
1. Return *false*.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is just NaN, +∞, and -∞, right? Would it be better to just say that?

I'd rather not enumerate three exceptions. If we don't like this phrasing, my preference would instead be

Suggested change
1. If _x_ is a BigInt and _y_ is a Number, or if _x_ is a Number and _y_ is a BigInt, then
1. If _x_ is not finite or _y_ is not finite, return *false*.
1. If _x_ is a Number and _x_ is not a finite Number, return *false*.
1. If _y_ is a Number and _y_ is not a finite Number, return *false*.
1. If ℝ(_x_) = ℝ(_y_), return *true*.
1. Return *false*.
1. Return *false*.
1. If _x_ is a BigInt and _y_ is a finite Number, or if _x_ is a finite Number and _y_ is a BigInt, then
1. If ℝ(_x_) = ℝ(_y_), return *true*.
1. Return *false*.

gibson042 added a commit to gibson042/ecma262 that referenced this pull request Jul 16, 2026
...taking advantage of type mismatch after the first step

Ref tc39#3911 (comment)
gibson042 added a commit to gibson042/ecma262 that referenced this pull request Jul 16, 2026
...taking advantage of type mismatch after the first step

Ref tc39#3911 (comment)
Comment thread spec.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editor call to be discussed in the next editor call editorial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-linked term "finite" should not be limited to Number values

3 participants