summaryrefslogtreecommitdiff
path: root/fpoptimizer/consts.hh
blob: b6e8f88b6b725b1db4d2e41f44202fc86d9e869a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "fparser.hh"
#include "extrasrc/fpaux.hh"

#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif

/*
#define CONSTANT_L10B  0.3010299956639811952137 // log10(2)
#define CONSTANT_L10BI 3.3219280948873623478703 // 1/log10(2)
#define CONSTANT_LB10  CONSTANT_L10BI          // log2(10)
#define CONSTANT_LB10I CONSTANT_L10B           // 1/log2(10)
*/

#define CONSTANT_POS_INF     HUGE_VAL  // positive infinity, from math.h
#define CONSTANT_NEG_INF   (-HUGE_VAL) // negative infinity

namespace FUNCTIONPARSERTYPES
{
    template<typename Value_t>
    inline Value_t fp_const_pihalf() // CONSTANT_PIHALF
    {
        return fp_const_pi<Value_t>() * Value_t(0.5);
    }
    template<typename Value_t>
    inline Value_t fp_const_twopi() // CONSTANT_TWOPI
    {
        Value_t result( fp_const_pi<Value_t>() );
        result += result;
        return result;
    }
    template<typename Value_t>
    inline Value_t fp_const_twoe() // CONSTANT_2E
    {
        Value_t result( fp_const_e<Value_t>() );
        result += result;
        return result;
    }
    template<typename Value_t>
    inline Value_t fp_const_twoeinv() // CONSTANT_2EI
    {
        Value_t result( fp_const_einv<Value_t>() );
        result += result;
        return result;
    }

    template<typename Value_t>
    inline Value_t fp_const_negativezero()
    {
        return -Epsilon<Value_t>::value;
    }
}