Main Page
Namespaces
Classes
Files
File List
File Members
include
Mathematics
GteExpEstimate.h
Go to the documentation of this file.
1
// David Eberly, Geometric Tools, Redmond WA 98052
2
// Copyright (c) 1998-2017
3
// Distributed under the Boost Software License, Version 1.0.
4
// http://www.boost.org/LICENSE_1_0.txt
5
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6
// File Version: 3.0.0 (2016/06/19)
7
8
#pragma once
9
10
#include <
Mathematics/GteExp2Estimate.h
>
11
12
// Minimax polynomial approximations to 2^x. The polynomial p(x) of
13
// degree D minimizes the quantity maximum{|2^x - p(x)| : x in [0,1]}
14
// over all polynomials of degree D. The natural exponential is
15
// computed using exp(x) = 2^{x log(2)}, where log(2) is the natural
16
// logarithm of 2.
17
18
namespace
gte
19
{
20
21
template
<
typename
Real>
22
class
ExpEstimate
23
{
24
public
:
25
// The input constraint is x in [0,1]. For example,
26
// float x; // in [0,1]
27
// float result = ExpEstimate<float>::Degree<3>(x);
28
template
<
int
D>
29
inline
static
Real
Degree
(Real
x
);
30
31
// The input x can be any real number. Range reduction is used to
32
// generate a value y in [0,1], call Degree(y), and combine the output
33
// with the proper exponent to obtain the approximation. For example,
34
// float x; // x >= 0
35
// float result = ExpEstimate<float>::DegreeRR<3>(x);
36
template
<
int
D>
37
inline
static
Real
DegreeRR
(Real x);
38
};
39
40
41
template
<
typename
Real>
42
template
<
int
D>
43
inline
Real
ExpEstimate<Real>::Degree
(Real
x
)
44
{
45
return
Exp2Estimate<Real>::Degree
<D>((Real)
GTE_C_LN_2
* x);
46
}
47
48
template
<
typename
Real>
49
template
<
int
D>
50
inline
Real
ExpEstimate<Real>::DegreeRR
(Real
x
)
51
{
52
return
Exp2Estimate<Real>::DegreeRR
<D>((Real)
GTE_C_LN_2
* x);
53
}
54
55
56
}
GteExp2Estimate.h
x
GLint GLenum GLint x
Definition:
glcorearb.h:404
gte::ExpEstimate
Definition:
GteExpEstimate.h:22
GTE_C_LN_2
#define GTE_C_LN_2
Definition:
GteConstants.h:32
gte
Definition:
GLX/GteWICFileIO.h:16
gte::Exp2Estimate
Definition:
GteExp2Estimate.h:21
gte::ExpEstimate::DegreeRR
static Real DegreeRR(Real x)
Definition:
GteExpEstimate.h:50
gte::ExpEstimate::Degree
static Real Degree(Real x)
Definition:
GteExpEstimate.h:43
geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:59