| diff -up ghostscript-9.07/trio/trio.c~ ghostscript-9.07/trio/trio.c |
| |
| |
| @@ -3172,6 +3172,9 @@ TRIO_ARGS6((self, number, flags, width, |
| if (integerNumber > epsilon) |
| { |
| integerDigits += (int)TrioLogarithm(integerNumber, base); |
| + /* Deal with the dangers of casting long double to int */ |
| + if (integerNumber - TrioPower (base, integerDigits) >= 0) |
| + integerDigits++; |
| } |
| |
| fractionDigits = precision; |
| @@ -3255,6 +3258,11 @@ TRIO_ARGS6((self, number, flags, width, |
| integerDigits = (integerNumber > epsilon) |
| ? 1 + (int)TrioLogarithm(integerNumber, base) |
| : 1; |
| + |
| + /* Deal with the dangers of casting long double to int */ |
| + if (integerNumber - TrioPower (base, integerDigits) >= 0) |
| + integerDigits++; |
| + |
| if (flags & FLAGS_FLOAT_G) |
| { |
| if (flags & FLAGS_ALTERNATIVE) |