All content and materials on this
site are provided "as is". TI and its respective suppliers and providers of content make no representations about
the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these
materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a
particular purpose, title and non-infringement of any third party intellectual property right. No license, either
express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a
license from a third party, or a license from TI.
The following code prints '-0x1.d6f3457f35ba8p+26' for the value of high.
Using the gcc or TI arm compiler, the value is '-0x1.d6f3457f35ba7p+26'.
It appears to be a floating point rounding error caused by the addition (+) or subtraction (-) arithmetic operators.
#include <cmath>
#include <stdio.h>
#define BOUND 0.00000001
double _x9 = -123456789.987654321;
double _y9 = 9.0;
double ans9 = -123456789.987654321;
int main()
{
double val = std::nextafter(_x9, _y9);
double low = ans9 - BOUND;
double high = ans9 + BOUND;
printf("%a %a (%zu)\n", _x9, _y9, sizeof(double));
printf("%a < %a < %a ?\n", low, val, high);
if (val >= low && val <= high) printf("Yes!\n");
else printf("No!\n");
}