src/util/miscmath.c File Reference

#include <ncbiconf.h>
#include <util/miscmath.h>
#include <math.h>

Include dependency graph for miscmath.c:

Go to the source code of this file.

Defines

#define NEED_EXP
#define __HI(x)   *(1+(int*)&x)
#define __LO(x)   *(int*)&x
#define __HIp(x)   *(1+(int*)x)
#define __LOp(x)   *(int*)x

Functions

static double s_IEEE754_Exp (double x)
double NCBI_Erf (double x)
 The error function of x: the integral from 0 to x of e(-t*t) dt, scaled by 2/sqrt(pi) to fall within the range (-1,1).
double NCBI_ErfC (double x)
 The complementary error function of x: 1 - erf(x), but calculated more accurately for large x (where erf(x) approaches unity).

Variables

static const double one = 1.0
static const double halF [2] = {0.5,-0.5,}
static const double huge = 1.0e+300
static const double twom1000 = 9.33263618503218878990e-302
static const double o_threshold = 7.09782712893383973096e+02
static const double u_threshold = -7.45133219101941108420e+02
static const double ln2HI [2]
static const double ln2LO [2]
static const double invln2 = 1.44269504088896338700e+00
static const double P1 = 1.66666666666666019037e-01
static const double P2 = -2.77777777770155933842e-03
static const double P3 = 6.61375632143793436117e-05
static const double P4 = -1.65339022054652515390e-06
static const double P5 = 4.13813679705723846039e-08
static const double tiny = 1e-300
static const double half = 5.00000000000000000000e-01
static const double two = 2.00000000000000000000e+00
static const double erx = 8.45062911510467529297e-01
static const double efx = 1.28379167095512586316e-01
static const double efx8 = 1.02703333676410069053e+00
static const double pp0 = 1.28379167095512558561e-01
static const double pp1 = -3.25042107247001499370e-01
static const double pp2 = -2.84817495755985104766e-02
static const double pp3 = -5.77027029648944159157e-03
static const double pp4 = -2.37630166566501626084e-05
static const double qq1 = 3.97917223959155352819e-01
static const double qq2 = 6.50222499887672944485e-02
static const double qq3 = 5.08130628187576562776e-03
static const double qq4 = 1.32494738004321644526e-04
static const double qq5 = -3.96022827877536812320e-06
static const double pa0 = -2.36211856075265944077e-03
static const double pa1 = 4.14856118683748331666e-01
static const double pa2 = -3.72207876035701323847e-01
static const double pa3 = 3.18346619901161753674e-01
static const double pa4 = -1.10894694282396677476e-01
static const double pa5 = 3.54783043256182359371e-02
static const double pa6 = -2.16637559486879084300e-03
static const double qa1 = 1.06420880400844228286e-01
static const double qa2 = 5.40397917702171048937e-01
static const double qa3 = 7.18286544141962662868e-02
static const double qa4 = 1.26171219808761642112e-01
static const double qa5 = 1.36370839120290507362e-02
static const double qa6 = 1.19844998467991074170e-02
static const double ra0 = -9.86494403484714822705e-03
static const double ra1 = -6.93858572707181764372e-01
static const double ra2 = -1.05586262253232909814e+01
static const double ra3 = -6.23753324503260060396e+01
static const double ra4 = -1.62396669462573470355e+02
static const double ra5 = -1.84605092906711035994e+02
static const double ra6 = -8.12874355063065934246e+01
static const double ra7 = -9.81432934416914548592e+00
static const double sa1 = 1.96512716674392571292e+01
static const double sa2 = 1.37657754143519042600e+02
static const double sa3 = 4.34565877475229228821e+02
static const double sa4 = 6.45387271733267880336e+02
static const double sa5 = 4.29008140027567833386e+02
static const double sa6 = 1.08635005541779435134e+02
static const double sa7 = 6.57024977031928170135e+00
static const double sa8 = -6.04244152148580987438e-02
static const double rb0 = -9.86494292470009928597e-03
static const double rb1 = -7.99283237680523006574e-01
static const double rb2 = -1.77579549177547519889e+01
static const double rb3 = -1.60636384855821916062e+02
static const double rb4 = -6.37566443368389627722e+02
static const double rb5 = -1.02509513161107724954e+03
static const double rb6 = -4.83519191608651397019e+02
static const double sb1 = 3.03380607434824582924e+01
static const double sb2 = 3.25792512996573918826e+02
static const double sb3 = 1.53672958608443695994e+03
static const double sb4 = 3.19985821950859553908e+03
static const double sb5 = 2.55305040643316442583e+03
static const double sb6 = 4.74528541206955367215e+02
static const double sb7 = -2.24409524465858183362e+01


Define Documentation

#define __HI  )     *(1+(int*)&x)
 

Definition at line 40 of file miscmath.c.

Referenced by NCBI_Erf(), NCBI_ErfC(), and s_IEEE754_Exp().

#define __HIp  )     *(1+(int*)x)
 

Definition at line 42 of file miscmath.c.

#define __LO  )     *(int*)&x
 

Definition at line 41 of file miscmath.c.

Referenced by NCBI_Erf(), NCBI_ErfC(), and s_IEEE754_Exp().

#define __LOp  )     *(int*)x
 

Definition at line 43 of file miscmath.c.

#define NEED_EXP
 

Definition at line 31 of file miscmath.c.


Function Documentation

static double s_IEEE754_Exp double  x  )  [static]
 

Definition at line 128 of file miscmath.c.

References __HI, __LO, halF, invln2, ln2HI, ln2LO, o_threshold, one, P1, P2, P3, P4, P5, twom1000, and u_threshold.

Referenced by NCBI_Erf(), and NCBI_ErfC().


Variable Documentation

const double efx = 1.28379167095512586316e-01 [static]
 

Definition at line 287 of file miscmath.c.

Referenced by NCBI_Erf().

const double efx8 = 1.02703333676410069053e+00 [static]
 

Definition at line 288 of file miscmath.c.

Referenced by NCBI_Erf().

const double erx = 8.45062911510467529297e-01 [static]
 

Definition at line 283 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double half = 5.00000000000000000000e-01 [static]
 

Definition at line 279 of file miscmath.c.

Referenced by CRenderingContext::DrawStrandIndicators(), CRgbaGradColorTable::FillGradient(), NCBI_ErfC(), WriteDB_Ncbi4naToBinary(), CAlnVecRow::x_RenderIcons(), CAlnVecRow::x_RenderIconStrand(), and CMouseZoomHandler::x_RenderScale().

const double halF[2] = {0.5,-0.5,} [static]
 

Definition at line 112 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double huge = 1.0e+300 [static]
 

Definition at line 113 of file miscmath.c.

const double invln2 = 1.44269504088896338700e+00 [static]
 

Definition at line 121 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double ln2HI[2] [static]
 

Initial value:

{ 6.93147180369123816490e-01,  
         -6.93147180369123816490e-01,}

Definition at line 117 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double ln2LO[2] [static]
 

Initial value:

{ 1.90821492927058770002e-10,  
         -1.90821492927058770002e-10,}

Definition at line 119 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double o_threshold = 7.09782712893383973096e+02 [static]
 

Definition at line 115 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double one = 1.0 [static]
 

Definition at line 111 of file miscmath.c.

Referenced by tree< T, tree_node_allocator >::equal(), tree< T, tree_node_allocator >::equal_subtree(), CDFamily::isDup(), NCBI_Erf(), NCBI_ErfC(), s_IEEE754_Exp(), s_VersionNumberLess(), and SeqDB_CombinePath().

const double P1 = 1.66666666666666019037e-01 [static]
 

Definition at line 122 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double P2 = -2.77777777770155933842e-03 [static]
 

Definition at line 123 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double P3 = 6.61375632143793436117e-05 [static]
 

Definition at line 124 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double P4 = -1.65339022054652515390e-06 [static]
 

Definition at line 125 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double P5 = 4.13813679705723846039e-08 [static]
 

Definition at line 126 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double pa0 = -2.36211856075265944077e-03 [static]
 

Definition at line 302 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double pa1 = 4.14856118683748331666e-01 [static]
 

Definition at line 303 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double pa2 = -3.72207876035701323847e-01 [static]
 

Definition at line 304 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double pa3 = 3.18346619901161753674e-01 [static]
 

Definition at line 305 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double pa4 = -1.10894694282396677476e-01 [static]
 

Definition at line 306 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double pa5 = 3.54783043256182359371e-02 [static]
 

Definition at line 307 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double pa6 = -2.16637559486879084300e-03 [static]
 

Definition at line 308 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double pp0 = 1.28379167095512558561e-01 [static]
 

Definition at line 289 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double pp1 = -3.25042107247001499370e-01 [static]
 

Definition at line 290 of file miscmath.c.

Referenced by ddAreEquivalent(), NCBI_Erf(), and NCBI_ErfC().

const double pp2 = -2.84817495755985104766e-02 [static]
 

Definition at line 291 of file miscmath.c.

Referenced by ddAreEquivalent(), NCBI_Erf(), and NCBI_ErfC().

const double pp3 = -5.77027029648944159157e-03 [static]
 

Definition at line 292 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double pp4 = -2.37630166566501626084e-05 [static]
 

Definition at line 293 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qa1 = 1.06420880400844228286e-01 [static]
 

Definition at line 309 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qa2 = 5.40397917702171048937e-01 [static]
 

Definition at line 310 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qa3 = 7.18286544141962662868e-02 [static]
 

Definition at line 311 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qa4 = 1.26171219808761642112e-01 [static]
 

Definition at line 312 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qa5 = 1.36370839120290507362e-02 [static]
 

Definition at line 313 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qa6 = 1.19844998467991074170e-02 [static]
 

Definition at line 314 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qq1 = 3.97917223959155352819e-01 [static]
 

Definition at line 294 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qq2 = 6.50222499887672944485e-02 [static]
 

Definition at line 295 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qq3 = 5.08130628187576562776e-03 [static]
 

Definition at line 296 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qq4 = 1.32494738004321644526e-04 [static]
 

Definition at line 297 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double qq5 = -3.96022827877536812320e-06 [static]
 

Definition at line 298 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double ra0 = -9.86494403484714822705e-03 [static]
 

Definition at line 318 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double ra1 = -6.93858572707181764372e-01 [static]
 

Definition at line 319 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double ra2 = -1.05586262253232909814e+01 [static]
 

Definition at line 320 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double ra3 = -6.23753324503260060396e+01 [static]
 

Definition at line 321 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double ra4 = -1.62396669462573470355e+02 [static]
 

Definition at line 322 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double ra5 = -1.84605092906711035994e+02 [static]
 

Definition at line 323 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double ra6 = -8.12874355063065934246e+01 [static]
 

Definition at line 324 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double ra7 = -9.81432934416914548592e+00 [static]
 

Definition at line 325 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double rb0 = -9.86494292470009928597e-03 [static]
 

Definition at line 337 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double rb1 = -7.99283237680523006574e-01 [static]
 

Definition at line 338 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double rb2 = -1.77579549177547519889e+01 [static]
 

Definition at line 339 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double rb3 = -1.60636384855821916062e+02 [static]
 

Definition at line 340 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double rb4 = -6.37566443368389627722e+02 [static]
 

Definition at line 341 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double rb5 = -1.02509513161107724954e+03 [static]
 

Definition at line 342 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double rb6 = -4.83519191608651397019e+02 [static]
 

Definition at line 343 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sa1 = 1.96512716674392571292e+01 [static]
 

Definition at line 326 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sa2 = 1.37657754143519042600e+02 [static]
 

Definition at line 327 of file miscmath.c.

Referenced by NCBI_Erf(), NCBI_ErfC(), and CGFF3_Formatter::x_FormatAlignment().

const double sa3 = 4.34565877475229228821e+02 [static]
 

Definition at line 328 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sa4 = 6.45387271733267880336e+02 [static]
 

Definition at line 329 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sa5 = 4.29008140027567833386e+02 [static]
 

Definition at line 330 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sa6 = 1.08635005541779435134e+02 [static]
 

Definition at line 331 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sa7 = 6.57024977031928170135e+00 [static]
 

Definition at line 332 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sa8 = -6.04244152148580987438e-02 [static]
 

Definition at line 333 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sb1 = 3.03380607434824582924e+01 [static]
 

Definition at line 344 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sb2 = 3.25792512996573918826e+02 [static]
 

Definition at line 345 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sb3 = 1.53672958608443695994e+03 [static]
 

Definition at line 346 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sb4 = 3.19985821950859553908e+03 [static]
 

Definition at line 347 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sb5 = 2.55305040643316442583e+03 [static]
 

Definition at line 348 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sb6 = 4.74528541206955367215e+02 [static]
 

Definition at line 349 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double sb7 = -2.24409524465858183362e+01 [static]
 

Definition at line 350 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double tiny = 1e-300 [static]
 

Definition at line 278 of file miscmath.c.

Referenced by NCBI_Erf(), and NCBI_ErfC().

const double two = 2.00000000000000000000e+00 [static]
 

Definition at line 281 of file miscmath.c.

Referenced by tree< T, tree_node_allocator >::equal_subtree(), NCBI_ErfC(), s_VersionNumberLess(), and SeqDB_CombinePath().

const double twom1000 = 9.33263618503218878990e-302 [static]
 

Definition at line 114 of file miscmath.c.

Referenced by s_IEEE754_Exp().

const double u_threshold = -7.45133219101941108420e+02 [static]
 

Definition at line 116 of file miscmath.c.

Referenced by s_IEEE754_Exp().


Generated on Mon Dec 7 09:45:46 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:22:10 2009 by modify_doxy.py rev. 173732