
15 May
2006
15 May
'06
7:10 p.m.
Peter Dimov wrote:
It depends. Where do you draw the line? Is inf a number? Is -0.0 a number? You have to have NaN if you want to be able to represent x/y as a float.
That's the problem. x/y is not a valid operation if y is equal to 0. So it can't be represented as a number. The fact that C++ permits such an operation makes C++ different than arithmetic. The fact that C++ uses operators like "/" and defines them similar to - but not identical to - the way they are defined by standard arithmetic is the source of all these problems. I say that C++ should be changed to so that the floats and operators which apply to them should implement what people expect from arithmetic operators. Robert Ramey