From: Stanislav Malyshev Date: Sun, 7 Jul 2019 23:16:05 +0000 (-0700) Subject: Simplify expression and remove the possibility of div by 0 X-Git-Tag: php-7.4.0alpha3~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=57e7c3aac100f7ceb992a9a554b76235713f9a83;p=php Simplify expression and remove the possibility of div by 0 Maybe should use exp2() but not sure about how supported it is. --- diff --git a/ext/exif/exif.c b/ext/exif/exif.c index e8b52bc83f..de44689902 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -2683,7 +2683,7 @@ PHP_FUNCTION(exif_tagname) RETURN_FALSE; } - RETURN_STRING(szTemp) + RETURN_STRING(szTemp); } /* }}} */ @@ -3369,7 +3369,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha have appropriate aperture information yet. */ if (ImageInfo->ApertureFNumber == 0) { ImageInfo->ApertureFNumber - = (float)exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*log(2)*0.5); + = expf(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*logf(2.0)*0.5); } break; @@ -3380,7 +3380,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha */ if (ImageInfo->ExposureTime == 0) { ImageInfo->ExposureTime - = (float)(1/exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*log(2))); + = expf(-exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*logf(2.0)); } break; case TAG_EXPOSURETIME: