Skip to content

Commit 57e7c3a

Browse files
committed
Simplify expression and remove the possibility of div by 0
Maybe should use exp2() but not sure about how supported it is.
1 parent 3bde483 commit 57e7c3a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/exif/exif.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,7 +2683,7 @@ PHP_FUNCTION(exif_tagname)
26832683
RETURN_FALSE;
26842684
}
26852685

2686-
RETURN_STRING(szTemp)
2686+
RETURN_STRING(szTemp);
26872687
}
26882688
/* }}} */
26892689

@@ -3369,7 +3369,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
33693369
have appropriate aperture information yet. */
33703370
if (ImageInfo->ApertureFNumber == 0) {
33713371
ImageInfo->ApertureFNumber
3372-
= (float)exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*log(2)*0.5);
3372+
= expf(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*logf(2.0)*0.5);
33733373
}
33743374
break;
33753375

@@ -3380,7 +3380,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
33803380
*/
33813381
if (ImageInfo->ExposureTime == 0) {
33823382
ImageInfo->ExposureTime
3383-
= (float)(1/exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*log(2)));
3383+
= expf(-exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*logf(2.0));
33843384
}
33853385
break;
33863386
case TAG_EXPOSURETIME:

0 commit comments

Comments
 (0)