Instead of these, <limits> of the standard library should be used. std::numeric_limits<double>::quiet_NaN() gives a NaN and std::numeric_limits<double>::infinity() gives an inf. See http://www.dinkumware.com/manuals/?manu ... mits2.html for a full list of available options.
Code: Select all
// Constants const Simple SimplePositiveInfinity = Simple(1.0f) / Simple(0.0f); const Simple SimpleNegativeInfinity = Simple(-1.0f) / Simple(0.0f); // TODO: non-signaling version const Simple SimpleNaN = SimplePositiveInfinity + SimpleNegativeInfinity; const Double DoublePositiveInfinity = Double(1.0f) / Double(0.0f); const Double DoubleNegativeInfinity = Double(-1.0f) / Double(0.0f); // TODO: non-signaling version const Double DoubleNaN = DoublePositiveInfinity + DoubleNegativeInfinity;
Also, using special typedefs for Double etc. seems strange, as the standard library already provides double that should be good for all purposes where Double would be used. Obviously, using the numeric_limits as instructed above may also be done where needed instead of a special header (granted, though, that they are a bit ugly).