Boost logo

Boost :

Subject: [boost] [math] pull request for boost::math::round bug in corner cases
From: Robin Eckert (const_at_[hidden])
Date: 2014-08-24 06:04:20


Hello,

I found two corner cases in which boost::math::round doesn't round
correctly. For double types, these are the numbers directly beneath 0.5:

+/- 0.499999999999999944488848768742172978818416595458984375
    (which get rounded to 1.0 although their aboslute value is smaller
     than 0.59)

and odd integral numbers on the edge of the mantissa length:

+/- 4503599627370497.0
+/- 4503599627370499.0
+/- 4503599627370501.0
           ...
+/- 9007199254740989.0
+/- 9007199254740991.0
+/- 9007199254740993.0

These get rounded to the next bigger/smaller integral value.

For a detailed explanation and a fix, see the description of the pull
request on

https://github.com/boostorg/math/pull/8

Regards,
Robin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk