History

Long double Constant problem

ayush-varshney committed 5 years ago

Commit 405aef91 parent fbef90a1 file · +3 −3Browse files

Unified · Split

tccgen.c+3−3
@@ -3024,7 +3024,7 @@ static void gen_opif(int op) · 3023 unmodified lines
30243024 case '-': f1 -= f2; break;
30253025 case '*': f1 *= f2; break;
30263026 case '/':
3027− if (f2 == 0.0) {
3027+ if (f2 == (f1-f1) ) {
30283028 union { float f; unsigned u; } x1, x2, y;
30293029 /* If not in initializer we need to potentially generate
30303030 FP exceptions at runtime, otherwise we want to fold. */
@@ -3033,7 +3033,7 @@ static void gen_opif(int op) · 2 unmodified lines
30333033 /* the run-time result of 0.0/0.0 on x87, also of other compilers
30343034 when used to compile the f1 /= f2 below, would be -nan */
30353035 x1.f = f1, x2.f = f2;
3036− if (f1 == 0.0)
3036+ if (f1 == (f1-f1) )
30373037 y.u = 0x7fc00000; /* nan */
30383038 else
30393039 y.u = 0x7f800000; /* infinity */
@@ -8102,7 +8102,7 @@ static void init_putv(init_params *p, CType *type, unsigned long c) · 5062 unmodified lines
81028102 else if (sizeof (long double) == sizeof (double))
81038103 __asm__("fldl %1\nfstpt %0\n" : "=m" (*ptr) : "m" (vtop->c.ld));
81048104 #endif
8105− else if (vtop->c.ld == 0.0)
8105+ else if (vtop->c.ld == (f1-f1) )
81068106 ;
81078107 else
81088108 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t