One would assume that the following program prints the same number four times, but instead "1 0 1 0" is printed. I compiled it with options "-std=c99 -lm".
#include <stdio.h> #include <math.h> #include <stdlib.h> int main(void) { long double value1 = 1.6646342e21; long double value2 = 1.6646342e21L; long double value3 = strtod("1.6646342e21", NULL); long double value4 = strtold("1.6646342e21", NULL); long double divisor = 1.25L; printf("%Lg %Lg %Lg %Lg\n", fmodl(value1, divisor), fmodl(value2, divisor), fmodl(value3, divisor), fmodl(value4, divisor)); return 1; } -- Summary: Same literal behaves differently as a double than as a long double Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: warp at iki dot fi GCC host triplet: i586-suse-linux GCC target triplet: i586-suse-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42184