next up previous
Next: About this document Up: Expression evaluation with mixed Previous: Precisions

Treatment of domains

What should sqrt(-1) be? distinguishing between sqrt(x:real) from sqrt(z : complex) means that sqrt(-1) is an error, but sqrt( -1+0i) is i.

IEEE 754 is not prescriptive with respect to all issues of numerical interest(most esp. wrt complex numbers, but also transcendental functions, etc.). Even within its scope it does not prevent programmers or language designers from setting policies. (e.g. if you don't like NaNs, trap on invalid; use the rounding modes as desired...)

Example of a questionable default: Common Lisp makes sqrt(-1) into a complex result, thereby invalidating compiler optimizations that deduce the type of sqrt(x) from the type of x.



Richard J. Fateman
Thu Aug 13 13:55:33 PDT 1998