@@ -369,7 +369,7 @@ const char *show_instruction(struct instruction *insn)
buf += sprintf(buf, "%lld", expr->value);
break;
case EXPR_FVALUE:
- buf += sprintf(buf, "%Lf", expr->fvalue);
+ buf += sprintf(buf, "%Le", expr->fvalue);
break;
case EXPR_STRING:
buf += sprintf(buf, "%.40s", show_string(expr->string));
@@ -387,7 +387,7 @@ const char *show_instruction(struct instruction *insn)
}
case OP_SETFVAL:
buf += sprintf(buf, "%s <- ", show_pseudo(insn->target));
- buf += sprintf(buf, "%Lf", insn->fvalue);
+ buf += sprintf(buf, "%Le", insn->fvalue);
break;
case OP_SWITCH: {
@@ -987,7 +987,7 @@ static int show_fvalue(struct expression *expr)
int new = new_pseudo();
long double value = expr->fvalue;
- printf("\tmovf.%d\t\tv%d,$%Lf\n", expr->ctype->bit_size, new, value);
+ printf("\tmovf.%d\t\tv%d,$%Le\n", expr->ctype->bit_size, new, value);
return new;
}
@@ -48,7 +48,7 @@ fneg:
ftst:
.L10:
<entry-point>
- setfval.64 %r21 <- 0.000000
+ setfval.64 %r21 <- 0.000000e+00
fcmpoeq.1 %r23 <- %arg1, %r21
ret.1 %r23
@@ -13,21 +13,21 @@ double f3(void) { return -1.0; }
f1:
.L0:
<entry-point>
- setfval.64 %r1 <- -1.000000
+ setfval.64 %r1 <- -1.000000e+00
ret.64 %r1
f2:
.L2:
<entry-point>
- setfval.64 %r3 <- -1.000000
+ setfval.64 %r3 <- -1.000000e+00
ret.64 %r3
f3:
.L4:
<entry-point>
- setfval.64 %r5 <- -1.000000
+ setfval.64 %r5 <- -1.000000e+00
ret.64 %r5
@@ -286,70 +286,70 @@ vptr_2_iptr:
int_2_float:
.L76:
<entry-point>
- setfval.32 %r39 <- 123.000000
+ setfval.32 %r39 <- 1.230000e+02
ret.32 %r39
uint_2_float:
.L78:
<entry-point>
- setfval.32 %r41 <- 123.000000
+ setfval.32 %r41 <- 1.230000e+02
ret.32 %r41
long_2_float:
.L80:
<entry-point>
- setfval.32 %r43 <- 123.000000
+ setfval.32 %r43 <- 1.230000e+02
ret.32 %r43
ulong_2_float:
.L82:
<entry-point>
- setfval.32 %r45 <- 123.000000
+ setfval.32 %r45 <- 1.230000e+02
ret.32 %r45
double_2_float:
.L84:
<entry-point>
- setfval.32 %r47 <- 1.123000
+ setfval.32 %r47 <- 1.123000e+00
ret.32 %r47
int_2_double:
.L86:
<entry-point>
- setfval.64 %r49 <- 123.000000
+ setfval.64 %r49 <- 1.230000e+02
ret.64 %r49
uint_2_double:
.L88:
<entry-point>
- setfval.64 %r51 <- 123.000000
+ setfval.64 %r51 <- 1.230000e+02
ret.64 %r51
long_2_double:
.L90:
<entry-point>
- setfval.64 %r53 <- 123.000000
+ setfval.64 %r53 <- 1.230000e+02
ret.64 %r53
ulong_2_double:
.L92:
<entry-point>
- setfval.64 %r55 <- 123.000000
+ setfval.64 %r55 <- 1.230000e+02
ret.64 %r55
float_2_double:
.L94:
<entry-point>
- setfval.64 %r57 <- 1.123000
+ setfval.64 %r57 <- 1.123000e+00
ret.64 %r57
@@ -14,7 +14,7 @@ int ifnot(float a) { return !a; }
bfimp:
.L0:
<entry-point>
- setfval.32 %r2 <- 0.000000
+ setfval.32 %r2 <- 0.000000e+00
fcmpune.1 %r3 <- %arg1, %r2
ret.1 %r3
@@ -22,7 +22,7 @@ bfimp:
bfexp:
.L2:
<entry-point>
- setfval.32 %r6 <- 0.000000
+ setfval.32 %r6 <- 0.000000e+00
fcmpune.1 %r7 <- %arg1, %r6
ret.1 %r7
@@ -30,7 +30,7 @@ bfexp:
bfnot:
.L4:
<entry-point>
- setfval.32 %r10 <- 0.000000
+ setfval.32 %r10 <- 0.000000e+00
fcmpoeq.1 %r12 <- %arg1, %r10
ret.1 %r12
@@ -38,7 +38,7 @@ bfnot:
ifnot:
.L6:
<entry-point>
- setfval.32 %r15 <- 0.000000
+ setfval.32 %r15 <- 0.000000e+00
fcmpoeq.32 %r16 <- %arg1, %r15
ret.32 %r16
Floating-point values are displayed using the printf format "%Lf" but this is the format without exponent (and with default precision of 6 digit). However, by its nature, this format is very imprecise. For example, *all* values smaller than 0.5e-6 are displayed as "0.000000". Improve this by using the "%Le" format which always use an exponent and thus maximize the precision. Note: ultimately, we should display them exactly, for example by using "%La", but this will requires C99. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- linearize.c | 4 ++-- show-parse.c | 2 +- validation/fp-ops.c | 2 +- validation/linear/cast-constant-to-float.c | 6 +++--- validation/linear/cast-constants.c | 20 ++++++++++---------- validation/optim/bool-context-fp.c | 8 ++++---- 6 files changed, 21 insertions(+), 21 deletions(-)