Actually Robert Futrell is technically correct in his original explanation, but
his statements do not clarify the real issue.
(e-mail address removed) says...
eh? A square has two roots, one positive and one negative.
There can be up to two roots of a square depending on your number system basis.
But the number 0 only has one root which is neither positive or negative. This
is different from the classically described "square root function".
Well, yes it does.
garbage.
Actually that technically *is* definition of a function. A function can only
have a single range value for any given domain value. And that's the point.
As soon as you call it "the square root *FUNCTION*" then you are talking about
the classic square root function which takes non-negative real numbers and maps
them to other non-negative real numbers.
Robert Futrell original post made true statements, but lacked sufficient
explanation:
- Saying that the square root function takes postiive numbers to other positive
numbers is true, however he *IS* leaving out 0 for some reason.
- The square root function is also always incident with at least one of the
square roots of the numbers its defined in its domain. (He left this out.)
- The square root function is continuous.
The +/- notation is used when, for whatever reason, you need to describe both
roots when a number has two square roots. (Though it works redundantly for 0.)
Why this is all in comp.lang.c is beyond me, however I would like to point out
the following:
if (a < 0) a = -a;
does *NOT* necessarily force the integer variable a to be non-negative (see if
you can figure out how/why). So following it up with:
b = sqrt(a);
will lead to undefined behavior. See:
http://www.azillionmonkeys.com/qed/2scomp.html