
Chad Nelson wrote:
On 04/07/2010 05:04 PM, Joachim Faulhaber wrote: [...]
I think, the values of a numeric types should be (1) closed under their fundamental operations e.g. +. [...]
I'm not sure what your first point means, but I think I agree, for the most part.
Closed in the sense that if x, y in S, then (x op y) in S as well. [...]
and provide a NaN and Infinity closure as template
template<class IntegralT, class ClosureTraits=...> closed { ... }
because the way in which NaNs, Infinities (and maybe more special values) are handled should be the same for all the different implementations of integral numeric types.
I'm not sure what you mean by "a NaN and Infinity closure". I understand templates, and I think I understand closures (at least as provided by languages like Lisp), but I can't make out what you're trying to say there. Is that a C++0x (or C++1x, now) thing?
Closure in the (general) mathematical sense, not in the programming language sense. I.e., extend your set to make previously-undefined operations defined (and somehow consistent with the existing properties of interest). - Jeff