summaryrefslogtreecommitdiffhomepage
path: root/ir/tv
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2015-02-01 12:59:47 +0100
committerChristoph Mallon <mallon@cs.uni-saarland.de>2015-02-01 12:59:47 +0100
commit6de1dfa09f3d91c4f794992ba1e6510b5f3457d8 (patch)
tree1b3f6b696e50e966e34481873d5130f0db090e9c /ir/tv
parent314a16625e0b531ef2a37c9c02334cfa7ea855a1 (diff)
tv: Print the sign of NaN and zero, too.
Diffstat (limited to 'ir/tv')
-rw-r--r--ir/tv/fltcalc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ir/tv/fltcalc.c b/ir/tv/fltcalc.c
index dd034ca..c226581 100644
--- a/ir/tv/fltcalc.c
+++ b/ir/tv/fltcalc.c
@@ -925,12 +925,13 @@ bool fc_is_subnormal(const fp_value *a)
int fc_print(const fp_value *val, char *buf, size_t buflen, fc_base_t base)
{
switch ((value_class_t)val->clss) {
- case FC_INF:
- return snprintf(buf, buflen, "%cINF", val->sign ? '-' : '+');
- case FC_NAN:
- return snprintf(buf, buflen, "NaN");
- case FC_ZERO:
- return snprintf(buf, buflen, "0.0");
+ char const *v;
+ case FC_INF: v = "INF"; goto special;
+ case FC_NAN: v = "NaN"; goto special;
+ case FC_ZERO: v = "0.0"; goto special;
+special:
+ return snprintf(buf, buflen, "%c%s", val->sign ? '-' : '+', v);
+
case FC_SUBNORMAL:
case FC_NORMAL: {
long double flt_val = fc_val_to_ieee754(val);