x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
division.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\numeric\interval\detail\division.hpp
旋转
特效
属性
历史版本
/* Boost interval/detail/division.hpp file * * Copyright 2003 Guillaume Melquiond, Sylvain Pion * * Distributed under 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_NUMERIC_INTERVAL_DETAIL_DIVISION_HPP #define BOOST_NUMERIC_INTERVAL_DETAIL_DIVISION_HPP #include
#include
#include
#include
#include
namespace boost { namespace numeric { namespace interval_lib { namespace detail { template
inline interval
div_non_zero(const interval
& x, const interval
& y) { // assert(!in_zero(y)); typename Policies::rounding rnd; typedef interval
I; const T& xl = x.lower(); const T& xu = x.upper(); const T& yl = y.lower(); const T& yu = y.upper(); if (::boost::numeric::interval_lib::user::is_neg(xu)) if (::boost::numeric::interval_lib::user::is_neg(yu)) return I(rnd.div_down(xu, yl), rnd.div_up(xl, yu), true); else return I(rnd.div_down(xl, yl), rnd.div_up(xu, yu), true); else if (::boost::numeric::interval_lib::user::is_neg(xl)) if (::boost::numeric::interval_lib::user::is_neg(yu)) return I(rnd.div_down(xu, yu), rnd.div_up(xl, yu), true); else return I(rnd.div_down(xl, yl), rnd.div_up(xu, yl), true); else if (::boost::numeric::interval_lib::user::is_neg(yu)) return I(rnd.div_down(xu, yu), rnd.div_up(xl, yl), true); else return I(rnd.div_down(xl, yu), rnd.div_up(xu, yl), true); } template
inline interval
div_non_zero(const T& x, const interval
& y) { // assert(!in_zero(y)); typename Policies::rounding rnd; typedef interval
I; const T& yl = y.lower(); const T& yu = y.upper(); if (::boost::numeric::interval_lib::user::is_neg(x)) return I(rnd.div_down(x, yl), rnd.div_up(x, yu), true); else return I(rnd.div_down(x, yu), rnd.div_up(x, yl), true); } template
inline interval
div_positive(const interval
& x, const T& yu) { // assert(::boost::numeric::interval_lib::user::is_pos(yu)); if (::boost::numeric::interval_lib::user::is_zero(x.lower()) && ::boost::numeric::interval_lib::user::is_zero(x.upper())) return x; typename Policies::rounding rnd; typedef interval
I; const T& xl = x.lower(); const T& xu = x.upper(); typedef typename Policies::checking checking; if (::boost::numeric::interval_lib::user::is_neg(xu)) return I(checking::neg_inf(), rnd.div_up(xu, yu), true); else if (::boost::numeric::interval_lib::user::is_neg(xl)) return I(checking::neg_inf(), checking::pos_inf(), true); else return I(rnd.div_down(xl, yu), checking::pos_inf(), true); } template
inline interval
div_positive(const T& x, const T& yu) { // assert(::boost::numeric::interval_lib::user::is_pos(yu)); typedef interval
I; if (::boost::numeric::interval_lib::user::is_zero(x)) return I(static_cast
(0), static_cast
(0), true); typename Policies::rounding rnd; typedef typename Policies::checking checking; if (::boost::numeric::interval_lib::user::is_neg(x)) return I(checking::neg_inf(), rnd.div_up(x, yu), true); else return I(rnd.div_down(x, yu), checking::pos_inf(), true); } template
inline interval
div_negative(const interval
& x, const T& yl) { // assert(::boost::numeric::interval_lib::user::is_neg(yl)); if (::boost::numeric::interval_lib::user::is_zero(x.lower()) && ::boost::numeric::interval_lib::user::is_zero(x.upper())) return x; typename Policies::rounding rnd; typedef interval
I; const T& xl = x.lower(); const T& xu = x.upper(); typedef typename Policies::checking checking; if (::boost::numeric::interval_lib::user::is_neg(xu)) return I(rnd.div_down(xu, yl), checking::pos_inf(), true); else if (::boost::numeric::interval_lib::user::is_neg(xl)) return I(checking::neg_inf(), checking::pos_inf(), true); else return I(checking::neg_inf(), rnd.div_up(xl, yl), true); } template
inline interval
div_negative(const T& x, const T& yl) { // assert(::boost::numeric::interval_lib::user::is_neg(yl)); typedef interval
I; if (::boost::numeric::interval_lib::user::is_zero(x)) return I(static_cast
(0), static_cast
(0), true); typename Policies::rounding rnd; typedef typename Policies::checking checking; if (::boost::numeric::interval_lib::user::is_neg(x)) return I(rnd.div_down(x, yl), checking::pos_inf(), true); else return I(checking::neg_inf(), rnd.div_up(x, yl), true); } template
inline interval
div_zero(const interval
& x) { if (::boost::numeric::interval_lib::user::is_zero(x.lower()) && ::boost::numeric::interval_lib::user::is_zero(x.upper())) return x; else return interval
::whole(); } template
inline interval
div_zero(const T& x) { if (::boost::numeric::interval_lib::user::is_zero(x)) return interval
(static_cast
(0), static_cast
(0), true); else return interval
::whole(); } template
inline interval
div_zero_part1(const interval
& x, const interval
& y, bool& b) { // assert(::boost::numeric::interval_lib::user::is_neg(y.lower()) && ::boost::numeric::interval_lib::user::is_pos(y.upper())); if (::boost::numeric::interval_lib::user::is_zero(x.lower()) && ::boost::numeric::interval_lib::user::is_zero(x.upper())) { b = false; return x; } typename Policies::rounding rnd; typedef interval
I; const T& xl = x.lower(); const T& xu = x.upper(); const T& yl = y.lower(); const T& yu = y.upper(); typedef typename Policies::checking checking; if (::boost::numeric::interval_lib::user::is_neg(xu)) { b = true; return I(checking::neg_inf(), rnd.div_up(xu, yu), true); } else if (::boost::numeric::interval_lib::user::is_neg(xl)) { b = false; return I(checking::neg_inf(), checking::pos_inf(), true); } else { b = true; return I(checking::neg_inf(), rnd.div_up(xl, yl), true); } } template
inline interval
div_zero_part2(const interval
& x, const interval
& y) { // assert(::boost::numeric::interval_lib::user::is_neg(y.lower()) && ::boost::numeric::interval_lib::user::is_pos(y.upper()) && (div_zero_part1(x, y, b), b)); typename Policies::rounding rnd; typedef interval
I; typedef typename Policies::checking checking; if (::boost::numeric::interval_lib::user::is_neg(x.upper())) return I(rnd.div_down(x.upper(), y.lower()), checking::pos_inf(), true); else return I(rnd.div_down(x.lower(), y.upper()), checking::pos_inf(), true); } } // namespace detail } // namespace interval_lib } // namespace numeric } // namespace boost #endif // BOOST_NUMERIC_INTERVAL_DETAIL_DIVISION_HPP
division.hpp
网页地址
文件地址
上一页
6/14
下一页
下载
( 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.