W3C home > Mailing lists > Public > www-style@w3.org > October 2011

[css3-values] Definition of mod in calc()

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 10 Oct 2011 18:21:50 -0700
Message-ID: <CAAWBYDDCqgeAd_sZ_q5FjXgVe2effkueP9=CAg=tK=UwrHfwSQ@mail.gmail.com>
To: www-style list <www-style@w3.org>
There are two widely-used definitions of the modulus operator: one
that keeps negative numbers negative, and one that makes them
positive.  As an example, the expression "-8 mod 5" evaluates to
either -3 or 2, depending on which definition you use.  To be safe,
some uses of modulus in pseudocode in our modules writes the math as
"((a mod b) + b) mod b)", which produces the latter answer regardless
of the definition you use.

Which interpretation should the spec use?

Received on Tuesday, 11 October 2011 01:22:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:05 UTC