Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

/ray/src/lib/numerics/fpconst.cc

Go to the documentation of this file.
00001 /*
00002  * lib/numerics/fpconst.cc
00003  * 
00004  * Provide various floating point constants if using them in the header 
00005  * file was disabled. 
00006  * 
00007  * Copyright (c) 2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 
00008  * 
00009  * This file may be distributed and/or modified under the terms of the 
00010  * GNU General Public License version 2 as published by the Free Software 
00011  * Foundation. (See COPYING.GPL for details.)
00012  * 
00013  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00014  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00015  * 
00016  */
00017 
00018 #include "num_math.h"
00019 #include <float.h>   /* FIXME: Add HAVE_FLOAT_H */
00020 
00021 
00022 namespace NUM
00023 {
00024 
00025 template<> const dbl FPConst<dbl>::huge_val = HUGE_VAL;
00026 template<> const flt FPConst<flt>::huge_val = HUGE_VALF;
00027 
00028 template<> const dbl FPConst<dbl>::max_val = DBL_MAX;
00029 template<> const flt FPConst<flt>::max_val = FLT_MAX;
00030 
00031 template<> const dbl FPConst<dbl>::min_val = DBL_MIN;
00032 template<> const flt FPConst<flt>::min_val = FLT_MIN;
00033 
00034 
00035 #if !USE_STATIC_CONST_FP_MEMB
00036 
00037 #define FP_CONST_DEF(name,value) \
00038     template<> const dbl FPConst<dbl>::name = value; \
00039     template<> const flt FPConst<flt>::name = value;
00040 
00041 FP_CONST_DEF(pi, 3.1415926535897932384626433832795029)
00042 FP_CONST_DEF(div_pi_2, 1.5707963267948966192313216916397514)
00043 FP_CONST_DEF(div_pi_3, 1.047197551196597746154214461093168)
00044 FP_CONST_DEF(div_pi_4, 0.7853981633974483096156608458198757)
00045 FP_CONST_DEF(mul_pi_2, 6.283185307179586476925286766559006)
00046 FP_CONST_DEF(mul_pi_3, 9.424777960769379715387930149838509)
00047 FP_CONST_DEF(mul_pi_4, 12.56637061435917295385057353311801)
00048 FP_CONST_DEF(mul_pi_2_3, 2.094395102393195492308428922186335)
00049 FP_CONST_DEF(div_1_pi, 0.3183098861837906715377675267450287)
00050 FP_CONST_DEF(div_2_pi, 0.6366197723675813430755350534900574)
00051 FP_CONST_DEF(div_2_sqrt_pi, 1.1283791670955125738961589031215452)
00052 
00053 FP_CONST_DEF(sqrt_2 , 1.4142135623730950488016887242096981)
00054 FP_CONST_DEF(div_1_sqrt_2, 0.7071067811865475244008443621048490)
00055 
00056 FP_CONST_DEF(e      , 2.7182818284590452353602874713526625)
00057 FP_CONST_DEF(log2_e , 1.4426950408889634073599246810018921)
00058 FP_CONST_DEF(log10_e, 0.4342944819032518276511289189166051)
00059 FP_CONST_DEF(ln_2   , 0.6931471805599453094172321214581766)
00060 FP_CONST_DEF(ln_10  , 2.3025850929940456840179914546843642)
00061 
00062 FP_CONST_DEF(div_1_pow_2_31  , 1.0/2147483648.0)
00063 FP_CONST_DEF(div_1_pow_2_31m1, 1.0/2147483647.0)
00064 FP_CONST_DEF(div_1_pow_2_32  , 1.0/4294967296.0)
00065 FP_CONST_DEF(div_1_pow_2_32m1, 1.0/4294967295.0)
00066 FP_CONST_DEF(div_1_pow_2_53  , 1.0/9007199254740992.0)
00067 FP_CONST_DEF(div_1_pow_2_53m1, 1.0/9007199254740991.0)
00068 
00069 #endif
00070 
00071 }  // end of namespace NUM

Generated on Sat Feb 19 22:33:45 2005 for Ray by doxygen 1.3.5