[devel] Guard "modf()" with PNG_FLOATING_ARITHMETIC_SUPPORTED.

This commit is contained in:
Glenn Randers-Pehrson 2010-07-29 21:21:03 -05:00
parent 6679d7c0b1
commit b9109e8254

8
png.c
View File

@ -1155,10 +1155,16 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
* that the final digit is rounded. * that the final digit is rounded.
*/ */
if (cdigits+czero-clead+1 < (int)precision) if (cdigits+czero-clead+1 < (int)precision)
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
fp = modf(fp, &d); fp = modf(fp, &d);
#else
{
d = (double)((int)(fp));
fp -= d;
}
#endif
else else
{ {
/* End of loop - round the whole number. */
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
d = floor(fp + .5); d = floor(fp + .5);
#else #else