Skip to content

Commit

Permalink
exp: adjust boundaries for single-precision floating point
Browse files Browse the repository at this point in the history
Fixes #273
  • Loading branch information
amyspark committed Aug 12, 2021
1 parent 93ac07e commit 408cbd5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Vc/common/exponential.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ Direct inquiries to 30 Frost Street, Cambridge, MA 02140
#ifdef Vc_COMMON_MATH_H_INTERNAL

constexpr float log2_e = 1.44269504088896341f;
constexpr float MAXLOGF = 88.72283905206835f;
constexpr float MINLOGF = -103.278929903431851103f; /* log(2^-149) */

// These constants are adjusted to account for single-precision floating point.
// The original are for double precision:
//
// constexpr float MAXLOGF = 88.72283905206835f;
// constexpr float MINLOGF = -103.278929903431851103f; /* log(2^-149) */

constexpr float MAXLOGF = 88.722831726074219f; /* log(2^127.99998474121094f) */
constexpr float MINLOGF = -88.029685974121094f; /* log(2^-126.99999237060547f) */
constexpr float MAXNUMF = 3.4028234663852885981170418348451692544e38f;

template <typename Abi, typename = enable_if<std::is_same<Abi, VectorAbi::Sse>::value ||
Expand Down

0 comments on commit 408cbd5

Please sign in to comment.