url icon indicating copy to clipboard operation
url copied to clipboard

Radix operations are not defined

Open GPHemsley opened this issue 8 years ago • 2 comments

The "IPv4 number parser" and the "port state" of the "basic URL parser" mention radix-R (or radix-10) operations. (I presume "radix" is used to avoid confusion with the other definition of "base" used in the same document.)

However, it does not provide instructions on how to perform radix-based operations.

If input contains a code point that is not a radix-R digit, then return failure.

Return the mathematical integer value that is represented by input in radix-R notation, using ASCII hex digits for digits with values 0 through 15.

Let port be the mathematical integer value that is represented by buffer in radix-10 using ASCII digits for digits with values 0 through 9.

It would be good for there to be explicit instructions on how to perform these radix operations (particularly that first one, where R can be 10, 16, or 8, in context), either here or in Infra. Otherwise, it is up to the implementation to determine how to map 10 => 0-9, 16 => 0-F, and 8 => 0-7, a seemingly non-trivial task.

GPHemsley avatar Jun 03 '17 06:06 GPHemsley

This is inspired by https://tc39.github.io/ecma262/. If this needs fixing here it probably needs fixing there too.

annevk avatar Jun 29 '17 02:06 annevk

In particular, parseInt and Number.prototype.toString.


But you're right, it's not specified there either.

GPHemsley avatar Jun 29 '17 04:06 GPHemsley