1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix math functions

This commit is contained in:
bolero-MURAKAMI 2013-05-05 00:06:30 +09:00
parent ffb876c930
commit fccb16687b
20 changed files with 209 additions and 68 deletions

View file

@ -0,0 +1,32 @@
#ifndef SPROUT_MATH_DETAIL_COSP_HPP
#define SPROUT_MATH_DETAIL_COSP_HPP
#include <sprout/config.hpp>
namespace sprout {
namespace math {
namespace detail {
template<typename T>
inline SPROUT_CONSTEXPR T
cosp_impl(T x2) {
return (((((((
-1.13585365213876817300e-11) * x2
+ 2.08757008419747316778e-9) * x2
- 2.75573141792967388112e-7) * x2
+ 2.48015872888517045348e-5) * x2
- 1.38888888888730564116e-3) * x2
+ 4.16666666666665929218e-2) * x2
- 0.5) * x2
+ 1.0
;
}
template<typename T>
inline SPROUT_CONSTEXPR T
cosp(T x) {
return sprout::math::detail::cosp_impl(x * x);
}
} // namespace detail
} // namespace math
} // namespace sprout
#endif // #ifndef SPROUT_MATH_DETAIL_COSP_HPP

View file

@ -0,0 +1,30 @@
#ifndef SPROUT_MATH_DETAIL_SINP_HPP
#define SPROUT_MATH_DETAIL_SINP_HPP
#include <sprout/config.hpp>
namespace sprout {
namespace math {
namespace detail {
template<typename T>
inline SPROUT_CONSTEXPR T
sinp_impl(T x, T x2) {
return x + x * (((((((
1.58962301576546568060e-10) * x2
- 2.50507477628578072866e-8) * x2
+ 2.75573136213857245213e-6) * x2
- 1.98412698295895385996e-4) * x2
+ 8.33333333332211858878e-3) * x2
- 1.66666666666666307295e-1) * x2
);
}
template<typename T>
inline SPROUT_CONSTEXPR T
sinp(T x) {
return sprout::math::detail::sinp_impl(x, x * x);
}
} // namespace detail
} // namespace math
} // namespace sprout
#endif // #ifndef SPROUT_MATH_DETAIL_SINP_HPP