adjustments to floating-point printing

This commit is contained in:
caheckman 2020-06-03 17:48:52 -04:00
parent 91ef0680da
commit a027a5cdd8
3 changed files with 46 additions and 13 deletions

View file

@ -71,6 +71,7 @@ FloatFormat::FloatFormat(int4 sz)
jbitimplied = true;
}
maxexponent = (1<<exp_size)-1;
calcPrecision();
}
/// \param sign is set to \b true if the value should be negative
@ -227,6 +228,13 @@ uintb FloatFormat::getNaNEncoding(bool sgn) const
return setSign(res,sgn);
}
void FloatFormat::calcPrecision(void)
{
float val = frac_size * 0.30103;
decimal_precision = (int4)floor(val + 0.5);
}
/// \param encoding is the encoding value
/// \param type points to the floating-point class, which is passed back
/// \return the equivalent double value
@ -613,4 +621,5 @@ void FloatFormat::restoreXml(const Element *el)
}
jbitimplied = xml_readbool(el->getAttributeValue("jbitimplied"));
maxexponent = (1<<exp_size)-1;
calcPrecision();
}