On 11/09/2017 05:53 PM, Vincent Lefevre wrote:> For instance:
#include <stdio.h> #include <math.h> int main (void) { double x = 1.7; printf ("%.30g\n", x); printf ("%.30g\n", 100 * x); printf ("%.30g\n", floor (100 * x)); return 0; } outputs: 1.69999999999999995559107901499 170 170
Indeed! I would really like to have a look at the floor implementation, but it has proven difficult. It calls __builtin_floor, that is no where to be found. It seems to be implemented in gcc/builtins.c but it's too obfuscated for me to understand.
Thanks, Nil
despite the fact that 1.7 is approximated by a value less than 1.7.