1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

add math::phi

This commit is contained in:
bolero-MURAKAMI 2014-03-17 17:06:41 +09:00
parent 57d2a8bc21
commit 6e09fc2ee5
3 changed files with 130 additions and 117 deletions

View file

@ -11,5 +11,6 @@
#include <sprout/config.hpp>
#include <sprout/math/functions.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/math/constant_variables.hpp>
#endif // #ifndef SPROUT_MATH_HPP

View file

@ -14,8 +14,8 @@
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
namespace sprout {
#if SPROUT_USE_VARIABLE_TEMPLATES
namespace math {
#if SPROUT_USE_VARIABLE_TEMPLATES
//
// pi
//
@ -110,8 +110,13 @@ namespace sprout {
SPROUT_STATIC_CONSTEXPR T ln_ten_v = sprout::math::ln_ten<T>();
template<typename T>
SPROUT_STATIC_CONSTEXPR T ln_two_v = sprout::math::ln_two<T>();
} // namespace math
//
// phi
//
template<typename T>
SPROUT_STATIC_CONSTEXPR T phi_v = sprout::math::phi<T>();
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
} // namespace math
} // namespace sprout
#endif // #ifndef SPROUT_MATH_CONSTANT_VARIABLES_HPP

View file

@ -154,6 +154,13 @@ namespace sprout {
inline SPROUT_CONSTEXPR T ln_two() {
return static_cast<T>(0.693147180559945309417232121458176568075500134360255254120680009493393621969694715605863326996418687542001481021L);
}
//
// phi
//
template<typename T>
inline SPROUT_CONSTEXPR T phi() {
return static_cast<T>(1.61803398874989484820458683436563811772030917980576286213544862270526046281890244970720720418939113748475408807L);
}
} // namespace math
} // namespace sprout