Commit 6de1dfa0 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

tv: Print the sign of NaN and zero, too.

parent 314a1662
...@@ -925,12 +925,13 @@ bool fc_is_subnormal(const fp_value *a) ...@@ -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) int fc_print(const fp_value *val, char *buf, size_t buflen, fc_base_t base)
{ {
switch ((value_class_t)val->clss) { switch ((value_class_t)val->clss) {
case FC_INF: char const *v;
return snprintf(buf, buflen, "%cINF", val->sign ? '-' : '+'); case FC_INF: v = "INF"; goto special;
case FC_NAN: case FC_NAN: v = "NaN"; goto special;
return snprintf(buf, buflen, "NaN"); case FC_ZERO: v = "0.0"; goto special;
case FC_ZERO: special:
return snprintf(buf, buflen, "0.0"); return snprintf(buf, buflen, "%c%s", val->sign ? '-' : '+', v);
case FC_SUBNORMAL: case FC_SUBNORMAL:
case FC_NORMAL: { case FC_NORMAL: {
long double flt_val = fc_val_to_ieee754(val); long double flt_val = fc_val_to_ieee754(val);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment