modulus redux

Michiel Helvensteijn m.helvensteijn.remove at gmail.com
Mon Jul 13 04:38:33 PDT 2009


Andrei Alexandrescu wrote:

> The  multiplicative expressions  are multiplication  (\ccbox{a  * b}),
> division  (\ccbox{a  / b}),  and  remainder  (\ccbox{a  \% b}).   They
> operate  on numeric types  only. The  result type  of either  of these
> operations   is  same  as   the  type   of  \ccbox{true   ?  a   :  b}
> (see~\S~\ref{sec:conditional-operator}).

"either of" means "one of two" or "both of two". You're talking about three
operations, so I'd leave out "either of".

Also, while the (true ? a : b) thing may be true, is this really the
clearest way to explain? Perhaps you should define a term to mean "common
type of two operands" and use that to explain both typeof(a mulop b) and
typeof(true ? a : b).

> ...
> 
> If such  a number  cannot be found,  \ccbox{a \%  b} yields the  Not A
> Number (NaN) special value.

When is this? If b == 0? If b == NaN? Perhaps it would be better to be
precise.

-- 
Michiel Helvensteijn




More information about the Digitalmars-d mailing list