
Johan Råde wrote: | I note that: | | The output from the extended_num_put facet is consistent | with the C99 | standard, except that I do not put signs on NaNs. I will not change | that, since there is no reasonable way for a C++ program to | detect that sign.
Paul A. Bristow wrote:
Surely C99 signbit tests the sign bit? (And is best used for testing the sign of infinity?)
| (And the sign has no meaning anyway, unlike infinity | where a sign sometimes, but not always, does have meaning.)
Mathematically, you are absolutely correct, but I have argued, and continue to argue strongly, that there really IS a sign bit, and that it is unnecessary, indeed wasteful, to prevent users from making some entirely private use of this potentially precious sign bit, when it costs almost nothing to simply output a '-' if the NaN has the sign bit set.
You are right, but our goals are different. You are working on a proposal to the C++ standardization committee. I writing code that should work with existing C++ compilers and std lib implementations. So I can not assume that the C99 signbit macro is present. What do you thing of Robert Ramey's idea of making it possible to configure a stream to report an error when a non-finite number is inserted or extracted? This could be done with a new stream flag and corresponding manipulators. --Johan Råde