* src/cff/cffparse.c (cff_parse_real): Don't apply `power_ten'
division too early; otherwise the most significant digit(s) of the final result are lost as the value is truncated to an integer. This fixes Savannah bug #21794 (where the patch has been posted too).
This commit is contained in:
parent
bd7e1c3ce0
commit
d156cabcae
@ -1,3 +1,10 @@
|
||||
2007-12-14 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/cff/cffparse.c (cff_parse_real): Don't apply `power_ten'
|
||||
division too early; otherwise the most significant digit(s) of the
|
||||
final result are lost as the value is truncated to an integer. This
|
||||
fixes Savannah bug #21794 (where the patch has been posted too).
|
||||
|
||||
2007-12-06 Fix <4d876b82@gmail.com>
|
||||
|
||||
Pass options from one configure script to another as-is (not
|
||||
|
@ -248,23 +248,6 @@
|
||||
power_ten += (FT_Int)exponent;
|
||||
}
|
||||
|
||||
/* raise to power of ten if needed */
|
||||
while ( power_ten > 0 )
|
||||
{
|
||||
result = result * 10;
|
||||
num = num * 10;
|
||||
|
||||
power_ten--;
|
||||
}
|
||||
|
||||
while ( power_ten < 0 )
|
||||
{
|
||||
result = result / 10;
|
||||
divider = divider * 10;
|
||||
|
||||
power_ten++;
|
||||
}
|
||||
|
||||
/* Move the integer part into the high 16 bits. */
|
||||
result <<= 16;
|
||||
|
||||
@ -272,6 +255,24 @@
|
||||
if ( num )
|
||||
result |= FT_DivFix( num, divider );
|
||||
|
||||
/* apply power of 10 if needed */
|
||||
if ( power_ten > 0 )
|
||||
{
|
||||
divider = 10; /* actually, this will be used as multiplier here */
|
||||
while ( --power_ten > 0 )
|
||||
divider = divider * 10;
|
||||
|
||||
result = FT_MulFix( divider << 16, result );
|
||||
}
|
||||
else if ( power_ten < 0 )
|
||||
{
|
||||
divider = 10;
|
||||
while ( ++power_ten < 0 )
|
||||
divider = divider * 10;
|
||||
|
||||
result = FT_DivFix( result, divider << 16 );
|
||||
}
|
||||
|
||||
if ( sign )
|
||||
result = -result;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user