[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: FW: Transcendental function tables: comments welcome!
"Fred J. Tydeman" <tydeman@xxxxxxxxx> wrote:
If one takes what is in the IEEE 754 and the drafts as a guide, in the
first instance, NaN's are the return value appropriate for a domain
error, ...
Agreed. Whether they mean "absolutely any value, including infinity",
"the result of an erroneous calculation" (e.g. sqrt(-1)) or a true
"not a number" (e.g. float("purple")) is less clear. But that isn't
critical, as those categories have similar propagation characteristics.
... The only exception to this principle that I can see
are the min/maxNum and min/maxNumMag functions, which treat NaN as an
uninitialised value to be ignored. I had the impression this caused
much angst and argument in the committee a few years ago.
I wasn't involved at the time, but am completely baffled why 40 years
of prior art was completely ignored. I tried raising this in C99,
and merely got flamed. In particular, "missing value" indicators go
back to the 1960s, and were first used (as far as I know) in Rothamsted
software. SPSS was the first package to make them available to the
masses. They have the following properties:
1) They propagate as error indicators (i.e. max(miss,1.0) = miss)
in normal calculations.
2) They propagate as missing values (i.e. max(miss,1.0) = 1.0) ONLY
in reduction operations.
3) They are superseded by error indicators in ANY operation, if
the arithmetic supports both.
For example, if X = (1.0,miss,2.0), Y = (miss,2.0,3.0) and
Z = (NaN,2.0,3.0), then X+Y = (miss,miss,5.0), Y+Z = (NaN.4.0,6.0),
sum(X) = 3.0 and sum(Z) = NaN.
It is claimed by some people that it is a great efficiency advantage
in statistics if max(NaN,1.0) = 1.0. This is nonsense, as I can
witness (and statistical packages were my 'area' for some years).
The primary reduction operations which need missing value handling
are IN THIS ORDER:
Counting (i.e. the number of non-missing values)
Summation
Variance (i.e. sum(x^2)-sum(x)^2/count(x))
Maximum/minimum
Product
Counting is not in IEEE 754, and it is unclear whether reduction or
normal operations are more important, anyway.
The idea the NaN represents any number is not really supported by the
standard. What happens if you attempt to ascii to binary conversion of
"purple". It belongs more to an interval arithmetic approach, which
still needs NaN to deal with examples such as sqrt(-1).
Agreed.
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email: nmm1@xxxxxxxxx
Tel.: +44 1223 334761 Fax: +44 1223 334679