[poincare] Integer: fix approximate, round instead of truncate integers

to closest float
This commit is contained in:
Émilie Feral
2018-02-14 16:00:44 +01:00
committed by EmilieNumworks
parent 97df52d0c5
commit d9150d4faa
3 changed files with 42 additions and 13 deletions

View File

@@ -531,11 +531,6 @@ T Integer::approximate() const {
}
digitIndex++;
}
// TODO: Here, we just cast the Integer in float(double). We should round it
// to the closest float(double). To do so, we should keep a additional bit
// at the end of the mantissa and add it to the mantissa; do not forget to
// shift the mantissa if the rounding increase the length in bits of the
// mantissa.
T result = IEEE754<T>::buildFloat(sign, exponent, mantissa);