[Git][cmucl/cmucl][issue-435-add-core-math-lisp-support] Make expf overflow
Raymond Toy pushed to branch issue-435-add-core-math-lisp-support at cmucl / cmucl Commits: a03443c7 by Raymond Toy at 2026-03-04T06:59:11-08:00 Make expf overflow It seems the compiler on Darwin has constant-folded the product of huge*huge to be infinity. Change this so that the compiler doesn't constant-fold it by creating a volatile float to compute the product that will overflow a float. - - - - - 1 changed file: - src/lisp/openlibm/e_expf.c Changes: ===================================== src/lisp/openlibm/e_expf.c ===================================== @@ -58,7 +58,10 @@ __ieee754_expf(float x) return x+x; /* NaN */ if(hx==0x7f800000) return (xsb==0)? x:0.0; /* exp(+-inf)={inf,0} */ - if(x > o_threshold) return huge*huge; /* overflow */ + if(x > o_threshold) { + volatile float fhuge = huge; + return fhuge*fhuge; /* overflow */ + } if(x < u_threshold) return twom100*twom100; /* underflow */ } View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/a03443c70abd7a41c91be305... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/a03443c70abd7a41c91be305... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)