/* result of the new version inroduced in 4ad186c5ef61: t2a = 44100312 */ #include<stdio.h> int main() { int t1 = 176401255; float f = 0.25f; int t2a = (int)(t1 * f); // must be 44100313 int t2b = (int)(t1 * (float)0.25f); printf("t2a=%d t2b=%d \n",t2a,t2b); return 0; }
Showing the changes to lib (1 of 3 files). Show all
Unified · Split
| @@ -480,6 +480,20 @@ long long __ashldi3(long long a, int b) · 479 unmodified lines | |||
| 480 | #endif | 480 | #endif |
| 481 | } | 481 | } |
| 482 | 482 | ||
| 483 | #ifndef COMMIT_4ad186c5ef61_IS_FIXED | ||
| 484 | long long __tcc_cvt_ftol(long double x) | ||
| 485 | { | ||
| 486 | unsigned c0, c1; | ||
| 487 | long long ret; | ||
| 488 | __asm__ __volatile__ ("fnstcw %0" : "=m" (c0)); | ||
| 489 | c1 = c0 | 0x0C00; | ||
| 490 | __asm__ __volatile__ ("fldcw %0" : : "m" (c1)); | ||
| 491 | __asm__ __volatile__ ("fistpll %0" : "=m" (ret)); | ||
| 492 | __asm__ __volatile__ ("fldcw %0" : : "m" (c0)); | ||
| 493 | return ret; | ||
| 494 | } | ||
| 495 | #endif | ||
| 496 | |||
| 483 | #endif /* !__x86_64__ */ | 497 | #endif /* !__x86_64__ */ |
| 484 | 498 | ||
| 485 | /* XXX: fix tcc's code generator to do this instead */ | 499 | /* XXX: fix tcc's code generator to do this instead */ |