Created
June 30, 2014 19:17
-
-
Save Fiona-J-W/b4eb6a80f84ed5d1ac56 to your computer and use it in GitHub Desktop.
rounding-error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cmath> | |
#include <iostream> | |
int main() { | |
double num1 = 1.4126572077159485e+23; | |
double num2 = 1.4126572077159483546e+23; | |
double num3 = std::nexttoward(num2, num1); | |
std::cout << (num3 > num2) << '\n'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If compiler and stdlib work correctly, this should print “1”