Wrong double -> int conversion when double is < 0 #include <stdio.h>
int main() { // Ok if d >0 { double d = 413.55; long l = (long)d; int i = (int)d; printf("d=%f, i=%d (OK), l=%ld (OK)\n", d, i, l); } // BUG if d <0 { double d = -413.55; long l = (long)d; int i = (int)d; printf("d=%f, i=%d (BUG), l=%ld (BUG)\n", d, i, l); } } jullien~/openlisp/src $ tcc foo.c && ./a.out d=413.550000, i=414 (OK), l=414 (OK) d=-413.550000, i=0 (BUG), l=0 (BUG) _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel