Re: [csswg-drafts] [css-values] Allow division of same types in calc()

> the allowed range doesn't seem to be defined

It wasn't previously defined either, that's up to individual properties and/or user-agent choice.  Again, you could *always* define an arbitrarily large value in calc(); infinity is just slightly larger than that. ^_^

> since some calc()s are resolved at computed value time, I think some clamping needs to happen then, or else you need to figure out how to represent infinite computed values

Ah, I didn't mean to restrict it to used-values only. Fixed.

> do the IEEE-754 semantics depend on the order of operations in places where the order of operations isn't defined by CSS? (I'm not sure.)

I dunno either.

> within what scope does an implementation need to track distinctions like +0 and -0?

I rewrote it to be more specific, specifying exactly which operations produce infinities or NaNs, and how infinities or NaNs affect operations they show up in. I defined "top-level calculations" to be any of the expression arguments to min()/max()/clamp(), or a non-nested calc(); these censor NaN by turning it into positive infinity, while non-top-level calculations are still allowed to produce NaN.  (So in particular, `calc(-1 * calc(0/0))` will produce positive infinity, not negative infinity, because the inner calc() resolves to a NaN, so the outer calc() resolves to a NaN, and gets censored into positive infinity.)

I went ahead and dropped negative-zero tracking, tho I'm not sure if I should. There are only two ways to produce a negative zero in 754 semantics: explicitly negate a zero (or an expression resulting in zero), or divide a finite number by negative infinity.  calc() can't negate things, only subtract them, and subtraction will never result in -0 unless one of the arguments is -0 already.  So we're left with dividing by negative infinity. Unless there's some difficulty with implementations having semantics differenting from 754, I'd rather just pretend that particular case doesn't exist. But if it does become a problem, I'm fine with explicitly specifying how it works, too.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/545#issuecomment-394045467 using your GitHub account

Received on Saturday, 2 June 2018 01:13:13 UTC