From 3bc504b68576091163d0d23ff374d1a89da5071a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 12 Jul 2016 06:58:21 -0600 Subject: [PATCH] Per comment from David Alession: M_E128 will never be used since it is greater than FLT_MAX. --- libc/math/lib_libexpif.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libc/math/lib_libexpif.c b/libc/math/lib_libexpif.c index 88dd9dd61e..1ab9b90f43 100644 --- a/libc/math/lib_libexpif.c +++ b/libc/math/lib_libexpif.c @@ -49,13 +49,16 @@ #define M_E16 (M_E8 * M_E8) #define M_E32 (M_E16 * M_E16) #define M_E64 (M_E32 * M_E32) -#define M_E128 (M_E64 * M_E64) /**************************************************************************** * Private Data ****************************************************************************/ -static const float g_expif_square_tbl[8] = +/* Values above M_E64 will never be used since it’s larger than FLT_MAX + *(3.402823e+38). + */ + +static const float g_expif_square_tbl[7] = { (float)M_E, /* e^1 */ (float)M_E2, /* e^2 */ @@ -64,7 +67,6 @@ static const float g_expif_square_tbl[8] = (float)M_E16, /* e^16 */ (float)M_E32, /* e^32 */ (float)M_E64, /* e^64 */ - (float)M_E128, /* e^128 */ }; /**************************************************************************** @@ -76,7 +78,7 @@ float lib_expif(size_t n) size_t i; float val; - if (n > 128) + if (n >= 128) { return INFINITY_F; }