x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
precision.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\math\tools\precision.hpp
旋转
特效
属性
历史版本
// Copyright John Maddock 2005-2006. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_TOOLS_PRECISION_INCLUDED #define BOOST_MATH_TOOLS_PRECISION_INCLUDED #include
#include
#include
#include
#include
#include
#include
#include
#include
// These two are for LDBL_MAN_DIG: #include
#include
namespace boost{ namespace math { namespace tools { // If T is not specialized, the functions digits, max_value and min_value, // all get synthesised automatically from std::numeric_limits. // However, if numeric_limits is not specialised for type RealType, // for example with NTL::RR type, then you will get a compiler error // when code tries to use these functions, unless you explicitly specialise them. // For example if the precision of RealType varies at runtime, // then numeric_limits support may not be appropriate, // see boost/math/tools/ntl.hpp for examples like // template <> NTL::RR max_value
... // See Conceptual Requirements for Real Number Types. template
inline int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT( ::std::numeric_limits
::is_specialized); #else BOOST_ASSERT(::std::numeric_limits
::is_specialized); #endif return std::numeric_limits
::digits; } template
inline T max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT( ::std::numeric_limits
::is_specialized); #else BOOST_ASSERT(::std::numeric_limits
::is_specialized); #endif return (std::numeric_limits
::max)(); } // Also used as a finite 'infinite' value for - and +infinity, for example: // -max_value
= -1.79769e+308, max_value
= 1.79769e+308. template
inline T min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT( ::std::numeric_limits
::is_specialized); #else BOOST_ASSERT(::std::numeric_limits
::is_specialized); #endif return (std::numeric_limits
::min)(); } namespace detail{ // // Logarithmic limits come next, note that although // we can compute these from the log of the max value // that is not in general thread safe (if we cache the value) // so it's better to specialise these: // // For type float first: // template
inline T log_max_value(const mpl::int_<128>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { return 88.0f; } template
inline T log_min_value(const mpl::int_<128>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { return -87.0f; } // // Now double: // template
inline T log_max_value(const mpl::int_<1024>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { return 709.0; } template
inline T log_min_value(const mpl::int_<1024>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { return -708.0; } // // 80 and 128-bit long doubles: // template
inline T log_max_value(const mpl::int_<16384>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { return 11356.0L; } template
inline T log_min_value(const mpl::int_<16384>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { return -11355.0L; } template
inline T log_max_value(const mpl::int_<0>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT( ::std::numeric_limits
::is_specialized); #else BOOST_ASSERT(::std::numeric_limits
::is_specialized); #endif BOOST_MATH_STD_USING static const T val = log((std::numeric_limits
::max)()); return val; } template
inline T log_min_value(const mpl::int_<0>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT( ::std::numeric_limits
::is_specialized); #else BOOST_ASSERT(::std::numeric_limits
::is_specialized); #endif BOOST_MATH_STD_USING static const T val = log((std::numeric_limits
::max)()); return val; } template
inline T epsilon(const mpl::true_& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { return std::numeric_limits
::epsilon(); } #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106)) template <> inline long double epsilon
(const mpl::true_& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(long double)) { // numeric_limits on Darwin tells lies here. // This static assert fails for some unknown reason, so // disabled for now... // BOOST_STATIC_ASSERT(std::numeric_limits
::digits == 106); return 2.4651903288156618919116517665087e-32L; } #endif template
inline T epsilon(const mpl::false_& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) { BOOST_MATH_STD_USING // for ADL of std names static const T eps = ldexp(static_cast
(1), 1-policies::digits
>()); return eps; } } // namespace detail template
inline T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS typedef typename mpl::if_c< std::numeric_limits
::max_exponent == 128 || std::numeric_limits
::max_exponent == 1024 || std::numeric_limits
::max_exponent == 16384, mpl::int_
::max_exponent>, mpl::int_<0> >::type tag_type; BOOST_STATIC_ASSERT( ::std::numeric_limits
::is_specialized); return detail::log_max_value
(tag_type()); #else BOOST_ASSERT(::std::numeric_limits
::is_specialized); BOOST_MATH_STD_USING static const T val = log((std::numeric_limits
::max)()); return val; #endif } template
inline T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS typedef typename mpl::if_c< std::numeric_limits
::max_exponent == 128 || std::numeric_limits
::max_exponent == 1024 || std::numeric_limits
::max_exponent == 16384, mpl::int_
::max_exponent>, mpl::int_<0> >::type tag_type; BOOST_STATIC_ASSERT( ::std::numeric_limits
::is_specialized); return detail::log_min_value
(tag_type()); #else BOOST_ASSERT(::std::numeric_limits
::is_specialized); BOOST_MATH_STD_USING static const T val = log((std::numeric_limits
::min)()); return val; #endif } template
inline T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS return detail::epsilon
(mpl::bool_< ::std::numeric_limits
::is_specialized>()); #else return ::std::numeric_limits
::is_specialized ? detail::epsilon
(mpl::true_()) : detail::epsilon
(mpl::false_()); #endif } } // namespace tools } // namespace math } // namespace boost #endif // BOOST_MATH_TOOLS_PRECISION_INCLUDED
precision.hpp
网页地址
文件地址
上一页
5/19
下一页
下载
( 7 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.