DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
/* Boost interval/arith.hpp template implementation file * * Copyright 2000 Jens Maurer * Copyright 2002-2003 Herv� Br�nnimann, 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_ARITH_HPP #define BOOST_NUMERIC_INTERVAL_ARITH_HPP #include
#include
#include
#include
#include
#include
namespace boost { namespace numeric { /* * Basic arithmetic operators */ template
inline const interval
& operator+(const interval
& x) { return x; } template
inline interval
operator-(const interval
& x) { if (interval_lib::detail::test_input(x)) return interval
::empty(); return interval
(-x.upper(), -x.lower(), true); } template
inline interval
& interval
::operator+=(const interval
& r) { if (interval_lib::detail::test_input(*this, r)) set_empty(); else { typename Policies::rounding rnd; set(rnd.add_down(low, r.low), rnd.add_up(up, r.up)); } return *this; } template
inline interval
& interval
::operator+=(const T& r) { if (interval_lib::detail::test_input(*this, r)) set_empty(); else { typename Policies::rounding rnd; set(rnd.add_down(low, r), rnd.add_up(up, r)); } return *this; } template
inline interval
& interval
::operator-=(const interval
& r) { if (interval_lib::detail::test_input(*this, r)) set_empty(); else { typename Policies::rounding rnd; set(rnd.sub_down(low, r.up), rnd.sub_up(up, r.low)); } return *this; } template
inline interval
& interval
::operator-=(const T& r) { if (interval_lib::detail::test_input(*this, r)) set_empty(); else { typename Policies::rounding rnd; set(rnd.sub_down(low, r), rnd.sub_up(up, r)); } return *this; } template
inline interval
& interval
::operator*=(const interval
& r) { return *this = *this * r; } template
inline interval
& interval
::operator*=(const T& r) { return *this = r * *this; } template
inline interval
& interval
::operator/=(const interval
& r) { return *this = *this / r; } template
inline interval
& interval
::operator/=(const T& r) { return *this = *this / r; } template
inline interval
operator+(const interval
& x, const interval
& y) { if (interval_lib::detail::test_input(x, y)) return interval
::empty(); typename Policies::rounding rnd; return interval
(rnd.add_down(x.lower(), y.lower()), rnd.add_up (x.upper(), y.upper()), true); } template
inline interval
operator+(const T& x, const interval
& y) { if (interval_lib::detail::test_input(x, y)) return interval
::empty(); typename Policies::rounding rnd; return interval
(rnd.add_down(x, y.lower()), rnd.add_up (x, y.upper()), true); } template
inline interval
operator+(const interval
& x, const T& y) { return y + x; } template
inline interval
operator-(const interval
& x, const interval
& y) { if (interval_lib::detail::test_input(x, y)) return interval
::empty(); typename Policies::rounding rnd; return interval
(rnd.sub_down(x.lower(), y.upper()), rnd.sub_up (x.upper(), y.lower()), true); } template
inline interval
operator-(const T& x, const interval
& y) { if (interval_lib::detail::test_input(x, y)) return interval
::empty(); typename Policies::rounding rnd; return interval
(rnd.sub_down(x, y.upper()), rnd.sub_up (x, y.lower()), true); } template
inline interval
operator-(const interval
& x, const T& y) { if (interval_lib::detail::test_input(x, y)) return interval
::empty(); typename Policies::rounding rnd; return interval
(rnd.sub_down(x.lower(), y), rnd.sub_up (x.upper(), y), true); } template
inline interval
operator*(const interval
& x, const interval
& y) { BOOST_USING_STD_MIN(); BOOST_USING_STD_MAX(); typedef interval
I; if (interval_lib::detail::test_input(x, y)) return I::empty(); typename Policies::rounding rnd; const T& xl = x.lower(); const T& xu = x.upper(); const T& yl = y.lower(); const T& yu = y.upper(); if (interval_lib::user::is_neg(xl)) if (interval_lib::user::is_pos(xu)) if (interval_lib::user::is_neg(yl)) if (interval_lib::user::is_pos(yu)) // M * M return I(min BOOST_PREVENT_MACRO_SUBSTITUTION(rnd.mul_down(xl, yu), rnd.mul_down(xu, yl)), max BOOST_PREVENT_MACRO_SUBSTITUTION(rnd.mul_up (xl, yl), rnd.mul_up (xu, yu)), true); else // M * N return I(rnd.mul_down(xu, yl), rnd.mul_up(xl, yl), true); else if (interval_lib::user::is_pos(yu)) // M * P return I(rnd.mul_down(xl, yu), rnd.mul_up(xu, yu), true); else // M * Z return I(static_cast
(0), static_cast
(0), true); else if (interval_lib::user::is_neg(yl)) if (interval_lib::user::is_pos(yu)) // N * M return I(rnd.mul_down(xl, yu), rnd.mul_up(xl, yl), true); else // N * N return I(rnd.mul_down(xu, yu), rnd.mul_up(xl, yl), true); else if (interval_lib::user::is_pos(yu)) // N * P return I(rnd.mul_down(xl, yu), rnd.mul_up(xu, yl), true); else // N * Z return I(static_cast
(0), static_cast
(0), true); else if (interval_lib::user::is_pos(xu)) if (interval_lib::user::is_neg(yl)) if (interval_lib::user::is_pos(yu)) // P * M return I(rnd.mul_down(xu, yl), rnd.mul_up(xu, yu), true); else // P * N return I(rnd.mul_down(xu, yl), rnd.mul_up(xl, yu), true); else if (interval_lib::user::is_pos(yu)) // P * P return I(rnd.mul_down(xl, yl), rnd.mul_up(xu, yu), true); else // P * Z return I(static_cast
(0), static_cast
(0), true); else // Z * ? return I(static_cast
(0), static_cast
(0), true); } template
inline interval
operator*(const T& x, const interval
& y) { typedef interval
I; if (interval_lib::detail::test_input(x, y)) return I::empty(); typename Policies::rounding rnd; const T& yl = y.lower(); const T& yu = y.upper(); // x is supposed not to be infinite if (interval_lib::user::is_neg(x)) return I(rnd.mul_down(x, yu), rnd.mul_up(x, yl), true); else if (interval_lib::user::is_zero(x)) return I(static_cast
(0), static_cast
(0), true); else return I(rnd.mul_down(x, yl), rnd.mul_up(x, yu), true); } template
inline interval
operator*(const interval
& x, const T& y) { return y * x; } template
inline interval
operator/(const interval
& x, const interval
& y) { if (interval_lib::detail::test_input(x, y)) return interval
::empty(); if (zero_in(y)) if (!interval_lib::user::is_zero(y.lower())) if (!interval_lib::user::is_zero(y.upper())) return interval_lib::detail::div_zero(x); else return interval_lib::detail::div_negative(x, y.lower()); else if (!interval_lib::user::is_zero(y.upper())) return interval_lib::detail::div_positive(x, y.upper()); else return interval
::empty(); else return interval_lib::detail::div_non_zero(x, y); } template
inline interval
operator/(const T& x, const interval
& y) { if (interval_lib::detail::test_input(x, y)) return interval
::empty(); if (zero_in(y)) if (!interval_lib::user::is_zero(y.lower())) if (!interval_lib::user::is_zero(y.upper())) return interval_lib::detail::div_zero
(x); else return interval_lib::detail::div_negative
(x, y.lower()); else if (!interval_lib::user::is_zero(y.upper())) return interval_lib::detail::div_positive
(x, y.upper()); else return interval
::empty(); else return interval_lib::detail::div_non_zero(x, y); } template
inline interval
operator/(const interval
& x, const T& y) { if (interval_lib::detail::test_input(x, y) || interval_lib::user::is_zero(y)) return interval
::empty(); typename Policies::rounding rnd; const T& xl = x.lower(); const T& xu = x.upper(); if (interval_lib::user::is_neg(y)) return interval
(rnd.div_down(xu, y), rnd.div_up(xl, y), true); else return interval
(rnd.div_down(xl, y), rnd.div_up(xu, y), true); } } // namespace numeric } // namespace boost #endif // BOOST_NUMERIC_INTERVAL_ARITH_HPP
arith.hpp
Page URL
File URL
Prev 1/16
Next
Download
( 10 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.