02:51 | <jschoi> | Math.sqrt says, “Return 𝔽(the square root of ℝ(n)),” but Math.cbrt says, “Return an implementation-approximated Number value representing the cube root of ℝ(n).” Does anyone know why their language is different? |
02:53 | <bakkot> | jschoi: https://github.com/tc39/ecma262/pull/3345 |
02:53 | <bakkot> | basically we know that everyone is using a correct sqrt because wasm requires it but we don't know this about cube root and it's a pain to find out |
02:56 | <jschoi> | Ah…so it’s because there’s no cbrt instruction in WASM. That seems like an unfortunate omission. |
03:01 | <jschoi> | I presume that BigInt.sqrt should also use the “implementation-approximated” language, since it’s not trying to match a f32/364 WASM instruction but rather something like Waldemar’s novel implementation over an unbounded ℕ domain. |
03:31 | <bakkot> | no, if it's straightforward for everyone to have the right answer, then we should require the right answer |
03:31 | <bakkot> | and waldemar's is exact |
03:32 | <bakkot> | we only do implementation-approximated if getting the exact right answer is difficult or expensive |
03:38 | <jschoi> | Oh, so then both BigInt.sqrt and BigInt.cbrt should say something like, “Return ℤ(the square/cube root of ℝ(n)), truncated toward 0.” |
03:45 | <bakkot> | yes although the ℤ operator takes an integer as input so it would have to be more like “Return ℤ(the square/cube root of ℝ(n) truncated toward 0)” |
03:45 | <bakkot> | though probably clearer as two steps |
03:48 | <jschoi> | Editorially, do you have an opinion about which would be preferable?
Hm, I see MakeFullYear does already use “the integer part of”. There is nowhere in the spec that uses “toward 0/+∞/-∞”. |