/*
* truncate float literal fv to 32-bit or 64-bit precision
- * according to type.
+ * according to type; return truncated value.
*/
-void
-truncfltlit(Mpflt *fv, Type *t)
+Mpflt*
+truncfltlit(Mpflt *oldv, Type *t)
{
double d;
float f;
+ Mpflt *fv;
if(t == T)
- return;
+ return oldv;
+
+ fv = mal(sizeof *fv);
+ *fv = *oldv;
// convert large precision literal floating
// into limited precision (float64 or float32)
mpmovecflt(fv, d);
break;
}
+ return fv;
}
/*
else if(ct != CTFLT)
goto bad;
overflow(n->val, t);
- truncfltlit(n->val.u.fval, t);
+ n->val.u.fval = truncfltlit(n->val.u.fval, t);
} else if(et == TSTRING && ct == CTINT && explicit)
n->val = tostr(n->val);
else
// truncate precision for non-ideal float.
if(v.ctype == CTFLT && n->type->etype != TIDEAL)
- truncfltlit(v.u.fval, n->type);
+ n->val.u.fval = truncfltlit(v.u.fval, n->type);
return;
settrue:
BUG: errchk: bugs/bug153.go:9: error message does not match 'nil'
bugs/bug153.go:9: fatal error: dowidth: unknown type: E-34
-=========== bugs/bug154.go
-r0 = 3.141592
-r1 = 3.141592025756836
-r0 and r1 should be the same
-panic PC=xxx
-BUG: should not panic
-
=========== fixedbugs/bug016.go
fixedbugs/bug016.go:7: constant -3 overflows uint