Re: [csswg-drafts] [css-values] Add round()/floor()/ceil() functions (#2513)

@AmeliaBR:

Putting the keyword first does read better, yeah.

And as Oriol said, I don't think an offset is necessary here; it complicates the grammar with a *third* unlabeled calculation, which isn't great design, and it's pretty easy to handle yourself in the rare cases it's needed. ("Rare" based on my own usage of rounding across my CS career; I've only needed to do that a handful of times.)

@Crissov:

In this case I think there's good reason to avoid pure JS compat. As stated before, there's no way to do rounding with unitted values without specifying a precision, which already breaks compat somewhat. (I don't think it's reasonable to only allow rounding on numbers; we're currently only applying that restriction on the two functions where it's *necessary* to do so due to the power changing; everything else is adapted to unitted values appropriately.)

Also, ceil is just a terrible, terrible name. It's difficult for me to remember whether it's ei or ie, and I know I'm not alone. Using the Rhythm keywords reads much better, I think.

fround() doesn't seem necessary; I'm not even really sure what it's purpose is in JS, let alone what one could possible want it for in CSS.

Similarly, trunc() is just "round towards zero"; if we include it we should use the same naming scheme as the others.

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

Received on Monday, 6 January 2020 21:52:30 UTC