Fixed bug in "ToExponentAndMantissa" when negative exponents where created.

Unary minus where applied to an unsigned type.
This commit is contained in:
Anton Danielsson 2015-10-05 14:26:31 +02:00
parent a822c71655
commit e7f6c42a79

View File

@ -66,7 +66,7 @@ void ToExponentAndMantissa(double val, double thresh, int precision,
scaled *= one_k;
if (scaled >= small_threshold) {
mantissa_stream << scaled;
*exponent = -i - 1;
*exponent = -static_cast<int64_t>(i + 1);
*mantissa = mantissa_stream.str();
return;
}