|
From: Luigi B. <lui...@gm...> - 2007-05-18 09:25:16
|
On Fri, 2007-05-18 at 10:08 +0200, DU VIGNAUD DE VILLEFORT FRANCOIS GASAPRD PHI wrote: > Is there any reason why QL_NULL_REAL is defined this way : > > #define QL_NULL_REAL ((std::numeric_limits<float>::max)()) > > whereas QL_MIN_REAL and QL_MAX_REAL are defined this way : > > #define QL_MAX_REAL ((std::numeric_limits<QL_REAL>::max)()) In theory, QL_REAL might be redefined to float or long double (in practice it is not, as some tests break.) QL_MIN_REAL and QL_MAX_REAL should be the min and max value for the actual type chosen, so numeric_limits<QL_REAL> is used. As for QL_NULL_REAL, it doesn't really matter what value is used as long as it's a determined one, so there's no need to use the actual QL_REAL type; also, we define Null<float>, Null<double> and Null<long double> to be all equal to QL_NULL_REAL, which is somewhat convenient (this way, Null<T> is the same number, no matter the actual type) and using float ensured that the resulting number could be contained in all such types without overflow. Speaking of which, funny that you came out with a question on Null. Just yesterday I was thinking of removing it and using boost::optional when a number might or might not be defined. What do you think? Later, Luigi ---------------------------------------- Lubarsky's Law of Cybernetic Entomology: There is _always_ one more bug. |