1
///////////////////////////////////////////////////////////////////////////////////
2
/// OpenGL Mathematics (glm.g-truc.net)
4
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
5
/// Permission is hereby granted, free of charge, to any person obtaining a copy
6
/// of this software and associated documentation files (the "Software"), to deal
7
/// in the Software without restriction, including without limitation the rights
8
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
/// copies of the Software, and to permit persons to whom the Software is
10
/// furnished to do so, subject to the following conditions:
12
/// The above copyright notice and this permission notice shall be included in
13
/// all copies or substantial portions of the Software.
15
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
/// @file glm/core/func_exponential.inl
25
/// @date 2008-08-03 / 2011-06-15
26
/// @author Christophe Riccio
27
///////////////////////////////////////////////////////////////////////////////////
29
#include "_vectorize.hpp"
34
template <typename genType>
35
GLM_FUNC_QUALIFIER genType pow
41
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'pow' only accept floating-point input");
43
return ::std::pow(x, y);
46
VECTORIZE_VEC_VEC(pow)
49
template <typename genType>
50
GLM_FUNC_QUALIFIER genType exp
55
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp' only accept floating-point input");
63
template <typename genType>
64
GLM_FUNC_QUALIFIER genType log
69
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'log' only accept floating-point input");
76
//exp2, ln2 = 0.69314718055994530941723212145818f
77
template <typename genType>
78
GLM_FUNC_QUALIFIER genType exp2
83
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp2' only accept floating-point input");
85
return ::std::exp(genType(0.69314718055994530941723212145818) * x);
92
template <int _PATH = detail::float_or_int_value::GLM_ERROR>
96
T operator() (T const & Value) const;
99
GLM_STATIC_ASSERT(0, "'log2' parameter has an invalid template parameter type. GLM core features only supports floating-point types, include <glm/gtx/integer.hpp> for integer types support. Others types are not supported.");
106
struct _compute_log2<detail::float_or_int_value::GLM_FLOAT>
108
template <typename T>
109
T operator() (T const & Value) const
111
return T(::std::log(Value)) / T(0.69314718055994530941723212145818);
117
// log2, ln2 = 0.69314718055994530941723212145818f
118
template <typename genType>
119
GLM_FUNC_QUALIFIER genType log2
124
assert(x > genType(0)); // log2 is only defined on the range (0, inf]
125
return _detail::_compute_log2<detail::float_or_int_trait<genType>::ID>()(x);
131
template <typename genType>
132
GLM_FUNC_QUALIFIER genType sqrt
137
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sqrt' only accept floating-point input");
139
return genType(::std::sqrt(x));
144
template <typename genType>
145
GLM_FUNC_QUALIFIER genType inversesqrt
150
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'inversesqrt' only accept floating-point input");
152
return genType(1) / ::std::sqrt(x);
155
VECTORIZE_VEC(inversesqrt)