summaryrefslogtreecommitdiffhomepage
path: root/ir/tv
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2015-02-01 20:10:54 +0100
committerChristoph Mallon <mallon@cs.uni-saarland.de>2015-02-01 23:15:30 +0100
commit3ace044d2fa050bc60c02bd40220e2416cc492cd (patch)
treec54fb97ec72123acea42e75c6ba073f6e6742bed /ir/tv
parent73600cee6c51344cd73177ac8999f14ed7cfffaa (diff)
tv: When checking for lossless conversion, examine the mantissa of NaNs.
Diffstat (limited to 'ir/tv')
-rw-r--r--ir/tv/fltcalc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ir/tv/fltcalc.c b/ir/tv/fltcalc.c
index 24e3178..d947ca5 100644
--- a/ir/tv/fltcalc.c
+++ b/ir/tv/fltcalc.c
@@ -999,7 +999,6 @@ bool fc_can_lossless_conv_to(const fp_value *value,
switch ((value_class_t)value->clss) {
case FC_ZERO:
case FC_INF:
- case FC_NAN:
return true;
case FC_NORMAL:
case FC_SUBNORMAL: {
@@ -1009,6 +1008,8 @@ bool fc_can_lossless_conv_to(const fp_value *value,
int v = fc_get_exponent(value) + exp_bias;
if (0 < v && v < (1 << desc->exponent_size) - 1) {
/* exponent can be encoded, now check the mantissa */
+ /* FALLTHROUGH */
+ case FC_NAN:
v = (value->desc.mantissa_size - value->desc.explicit_one)
+ ROUNDING_BITS - sc_get_lowest_set_bit(_mant(value));
return v <= desc->mantissa_size - desc->explicit_one;