Raymond Toy pushed to branch issue-428-add-constants-for-irrat at cmucl / cmucl Commits: 46e88b6a by Raymond Toy at 2026-01-18T07:51:21-08:00 Add constant for log base 2 of e - - - - - 688490f6 by Raymond Toy at 2026-01-18T07:57:48-08:00 Update release notes and cmucl.pot for docstrings - - - - - 3 changed files: - src/code/irrat.lisp - src/general-info/release-22a.md - src/i18n/locale/cmucl.pot Changes: ===================================== src/code/irrat.lisp ===================================== @@ -32,7 +32,10 @@ (log 2w0) "Natural log of 2w0") - +(defconstant +log2-e+ + (log (exp 1d0) 2d0) + "Base 2 logarithm of e") + ;;; Make these INLINE, since the call to C is at least as compact as a Lisp ;;; call, and saves number consing to boot. ;;; @@ -836,7 +839,7 @@ (if (minusp number) (complex (coerce (log (- number)) 'single-float) (coerce pi 'single-float)) - (coerce (/ (log2 number) #.(log (exp 1d0) 2d0)) 'single-float))) + (coerce (/ (log2 number) +log2-e+) 'single-float))) ((ratio) (if (minusp number) (complex (coerce (log (- number)) 'single-float) @@ -861,7 +864,7 @@ (coerce (%log1p (coerce (- number 1) 'double-float)) 'single-float) (coerce (/ (- (log2 top) (log2 bot)) - #.(log (exp 1d0) 2d0)) + +log2-e+) 'single-float))))) (((foreach single-float double-float)) ;; Is (log -0) -infinity (libm.a) or -infinity + i*pi (Kahan)? ===================================== src/general-info/release-22a.md ===================================== @@ -28,6 +28,7 @@ public domain. * #373: Add macros to handle temp files and directories * #387: Update CLX from upstream to version from 2024-09-11 * #408: Add C functions to get user name and home dir + * #428: Add some constants for common values in irrat.lisp * #437: Use `realpath` to find the lisp executable * #444: `unix-stat` and friends return wrong timestamp * #449: Touch 64-bit timestamp.txt with desired time for testing ===================================== src/i18n/locale/cmucl.pot ===================================== @@ -5012,6 +5012,10 @@ msgstr "" msgid "Natural log of 2w0" msgstr "" +#: src/code/irrat.lisp +msgid "Base 2 logarithm of e" +msgstr "" + #: src/code/irrat.lisp msgid "Return e raised to the power NUMBER." msgstr "" View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/3451a113880c01328881c90... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/3451a113880c01328881c90... You're receiving this email because of your account on gitlab.common-lisp.net.