简体   繁体   中英

Boost multiprecision rounding mode

Is there a way to change the rounding mode used in Boost.Multiprecision?

I want to use this library but need to know if I can specify the rounding mode for arithmetic operations on the fly, such that I can guarantee certain properties of operations (eg that they are overapproximating).

Is there a cheap way of knowing whether rounding has happened?

After more research I found out that Boost::Interval with a custom type can preserve the inclusion property. However this requires implementing all the arithmetic with downwards and upwarts rounded results. With this in mind I can equip the Boost::Interval with any floating point implementation I like, eg mpfr_t. For further details see:

http://www.boost.org/doc/libs/1_35_0/libs/numeric/interval/doc/guide.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM