Raymond Toy pushed to branch issue-428-add-constants-for-irrat at cmucl / cmucl

Commits:

3 changed files:

Changes:

  • src/code/irrat.lisp
    ... ... @@ -32,7 +32,10 @@
    32 32
       (log 2w0)
    
    33 33
       "Natural log of 2w0")
    
    34 34
     
    
    35
    -  
    
    35
    +(defconstant +log2-e+
    
    36
    +  (log (exp 1d0) 2d0)
    
    37
    +  "Base 2 logarithm of e")
    
    38
    +
    
    36 39
     ;;; Make these INLINE, since the call to C is at least as compact as a Lisp
    
    37 40
     ;;; call, and saves number consing to boot.
    
    38 41
     ;;;
    
    ... ... @@ -836,7 +839,7 @@
    836 839
     	 (if (minusp number)
    
    837 840
     	     (complex (coerce (log (- number)) 'single-float)
    
    838 841
     		      (coerce pi 'single-float))
    
    839
    -	     (coerce (/ (log2 number) #.(log (exp 1d0) 2d0)) 'single-float)))
    
    842
    +	     (coerce (/ (log2 number) +log2-e+) 'single-float)))
    
    840 843
     	((ratio)
    
    841 844
     	 (if (minusp number)
    
    842 845
     	     (complex (coerce (log (- number)) 'single-float)
    
    ... ... @@ -861,7 +864,7 @@
    861 864
     		   (coerce (%log1p (coerce (- number 1) 'double-float))
    
    862 865
     			   'single-float)
    
    863 866
     		   (coerce (/ (- (log2 top) (log2 bot))
    
    864
    -			      #.(log (exp 1d0) 2d0))
    
    867
    +			      +log2-e+)
    
    865 868
     			   'single-float)))))
    
    866 869
     	(((foreach single-float double-float))
    
    867 870
     	 ;; Is (log -0) -infinity (libm.a) or -infinity + i*pi (Kahan)?
    

  • src/general-info/release-22a.md
    ... ... @@ -28,6 +28,7 @@ public domain.
    28 28
         * #373: Add macros to handle temp files and directories
    
    29 29
         * #387: Update CLX from upstream to version from 2024-09-11
    
    30 30
         * #408: Add C functions to get user name and home dir
    
    31
    +    * #428: Add some constants for common values in irrat.lisp
    
    31 32
         * #437: Use `realpath` to find the lisp executable
    
    32 33
         * #444: `unix-stat` and friends return wrong timestamp
    
    33 34
         * #449: Touch 64-bit timestamp.txt with desired time for testing
    

  • src/i18n/locale/cmucl.pot
    ... ... @@ -5012,6 +5012,10 @@ msgstr ""
    5012 5012
     msgid "Natural log of 2w0"
    
    5013 5013
     msgstr ""
    
    5014 5014
     
    
    5015
    +#: src/code/irrat.lisp
    
    5016
    +msgid "Base 2 logarithm of e"
    
    5017
    +msgstr ""
    
    5018
    +
    
    5015 5019
     #: src/code/irrat.lisp
    
    5016 5020
     msgid "Return e raised to the power NUMBER."
    
    5017 5021
     msgstr ""