!WgJwmjBNZEXhJnXHXw:matrix.org

TC39 Delegates

213 Members
Feb meeting: https://github.com/tc39/Reflector/issues/516 Public logs at https://matrixlogs.bakkot.com/7 Servers

Load older messages


SenderMessageTime
29 Feb 2024
@shuyuguo:matrix.orgshuokay, so the precedent is that several functions already decided that NaN should have lower precedence than Infinity because Infinity is thought of as just another "non-NaN"?22:15:52
@shuyuguo:matrix.orgshu that doesn't give me insight on why they made this decision when the precedence in user + is the opposite 22:16:18
@tabatkins:matrix.orgTabAtkins No, the (mixed!) precedent is that, in several functions, if the NaN argument doesn't affect the result (aka you could replace it with any non-NaN value, and every possible substitution would have no effect on the return value), then the function just returns that consistent value. 22:18:16
@tabatkins:matrix.orgTabAtkinsIt's not a "lower precedence" thing, it's a "the return value doesn't depend on this argument, so we won't pay any attention to it" thing.22:18:49
@tabatkins:matrix.orgTabAtkins Infinity is just another number; NaN is the weird one that (among other reasons) is returned when multiple possible values are possible. 22:19:36
@tabatkins:matrix.orgTabAtkins + is consistent with this behavior: in Infinity + X, if X=-Infinity you get NaN, while any other value yields Infinity, so the X's value is important to the result, so Infinity + NaN has to be NaN too. 22:23:16
@shuyuguo:matrix.orgshuInfinity + NaN is NaN, right22:30:45
@shuyuguo:matrix.orgshubut hypot(Infinity, NaN) is Infinity?22:30:53
@shuyuguo:matrix.orgshuthat's the inconsistency, no?22:31:04
@tabatkins:matrix.orgTabAtkins No, substitute any non-NaN value for the second argument there. You'll always get Infinity, still. 22:34:50
@tabatkins:matrix.orgTabAtkinsSo the NaN argument is powerless, and can be safely ignored.22:35:06
@tabatkins:matrix.orgTabAtkins (hypot(Infinity, Infinity), hypot(Infinity, 0), hypot(Infinity, -Infinity) all give Infinity; once one argument is infinite the entire function is guaranteed to return Infinity regardless of the other values.) 22:36:21
@shuyuguo:matrix.orgshui think we're talking past each other somehow22:36:41
@tabatkins:matrix.orgTabAtkinsWe must be, since you still seem to be talking about this in terms of "precedence", like the existence of an Infinity vs a NaN does something and we have to define which one "wins" when they both appear.22:37:19
@tabatkins:matrix.orgTabAtkinsWhat I'm explaining is that the behavior isn't about that at all.22:37:34
@shuyuguo:matrix.orgshu looking at just +, Infinity + NaN, one cannot know whether the rule that applies is "Infinity is infectious" or "NaN is infectious", and people just internalize it as "NaN is infectious" applies over "Infinity is infectious" 22:38:00
@shuyuguo:matrix.orgshuin that Infinity + NaN is a degenerate form that has no intuition in extended real arithmetic22:38:18
@tabatkins:matrix.orgTabAtkins Sure. But "Infinity + NaN yields NaN" is also consistent with the reasoning I gave, which appears to be the reasoning used by hypot(). 22:38:51
@tabatkins:matrix.orgTabAtkins (But not the reasoning used by min()/max(); they both use "NaN is infectious" logic.) 22:39:08
@shuyuguo:matrix.orgshu look at hypot(Infinity, NaN), one also cannot know whether the rule that applies is "Infinity is infectious" or "NaN is infectious", and people just internalize one, except it's confusing now because they need to internalize the other one 22:39:11
@tabatkins:matrix.orgTabAtkinsyeah, the logic isn't about infection in hypot()22:39:34
@tabatkins:matrix.orgTabAtkinsis what i keep saying22:39:38
@shuyuguo:matrix.orgshuokay, think i finally see where you're coming from22:39:50
@shuyuguo:matrix.orgshubut doesn't that kick the can one level up? there's still inconsistent in which logic is used for which operations/functions, and it's confusing22:40:12
@tabatkins:matrix.orgTabAtkins Yes, it's inconsistent no matter what reasoning you use 22:40:24
@tabatkins:matrix.orgTabAtkinsour functions are just straight up inconsistent in their NaN handling22:40:33
@shuyuguo:matrix.orgshuokay, bear with me, but now we're back at my still not having any insight on how we arrived at this inconsistency in logic22:41:09
@shuyuguo:matrix.orgshui guess just accident of how things were argued at the time22:41:14
@tabatkins:matrix.orgTabAtkinsyup22:48:00
1 Mar 2024
@usharma:igalia.comryzokuken (back monday) changed their display name from ryzokuken to ryzokuken (back monday).12:28:19

There are no newer messages yet.


Back to Room ListRoom Version: 6