Changeset 35121 in project
 Timestamp:
 02/15/18 20:47:27 (5 weeks ago)
 Location:
 release/4/mathh/trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

release/4/mathh/trunk/mathh.scm
r35009 r35121 54 54 #endif 55 55 56 #if defined(_WIN32) 56 #if defined(__sun__)  defined(__sun) 57 58 # include <sunmath.h> /* log2 */ 59 60 #elif defined(_WIN32) 57 61 58 62 static double 59 log2( double x )63 mm_log2( double x ) 60 64 { 61 65 # ifndef M_LN2 62 # 66 # define M_LN2 0.693147180559945309417232121458176568 63 67 # endif 64 68 return log( x ) / M_LN2; 65 69 } 66 70 67 #elif defined(__sun__)  defined(__sun)68 69 # include <sunmath.h> /* log2 */70 71 #endif72 73 #if defined(_WIN32)74 75 71 static double 76 log1p( double x )72 mm_log1p( double x ) 77 73 { 78 74 /* very imprecise */ … … 82 78 /* from a Python implementation by John D. Cook */ 83 79 static double 84 erf( double x )80 mm_erf( double x ) 85 81 { 86 82 # define A1 0.254829592 … … 97 93 double y = 1.0  (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * exp( abs_x * abs_x ); 98 94 99 return _copysign( y, x ); /* handle si ngage */95 return _copysign( y, x ); /* handle signage */ 100 96 101 97 # undef P … … 109 105 110 106 static double 111 erfc( double x )107 mm_erfc( double x ) 112 108 { 113 109 /* very imprecise */ 114 return 1.0  erf( x );110 return 1.0  mm_erf( x ); 115 111 } 116 112 117 113 static double 118 scalbn( double x, int n )114 mm_scalbn( double x, int n ) 119 115 { 120 116 /* not efficient */ … … 179 175 ;; Error functions 180 176 181 (define erf (foreignlambda double "erf" double)) 182 (define erfc (foreignlambda double "erfc" double)) 177 (define erf 178 (condexpand 179 (windows (foreignlambda double "mm_erf" double) ) 180 (else (foreignlambda double "erf" double) ) ) ) 181 182 (define erfc 183 (condexpand 184 (windows (foreignlambda double "mm_erfc" double) ) 185 (else (foreignlambda double "erfc" double) ) ) ) 183 186 184 187 ;; Hyperbolic functions … … 209 212 (define hypot 210 213 (condexpand 211 (windows (foreignlambda double " _hypot" double double) )214 (windows (foreignlambda double "mm_hypot" double double) ) 212 215 (else (foreignlambda double "hypot" double double) ) ) ) 213 216 … … 236 239 ;; Base2 logarithm 237 240 238 (define log2 (foreignlambda double "log2" double)) 241 (define log2 242 (condexpand 243 (windows (foreignlambda double "mm_log2" double) ) 244 (else (foreignlambda double "log2" double) ) ) ) 239 245 240 246 ;; Natural logarithm of 1+x accurate for very small x 241 247 242 (define log1p (foreignlambda double "log1p" double)) 248 (define log1p 249 (condexpand 250 (windows (foreignlambda double "mm_log1p" double) ) 251 (else (foreignlambda double "log1p" double) ) ) ) 243 252 244 253 ;; Compute x * 2**n … … 248 257 ;; Efficiently compute x * 2**n 249 258 250 (define scalbn (foreignlambda double "scalbn" double integer)) 259 (define scalbn 260 (condexpand 261 (windows (foreignlambda double "mm_scalbn" double integer) ) 262 (else (foreignlambda double "scalbn" double integer) ) ) ) 251 263 252 264 ;; Log function for base n 
release/4/mathh/trunk/mathh.setup
r34955 r35121 12 12 13 13 ;* (The compiler option 'inlineglobal' causes problems; so no O3+.) 14 (setupshared+staticextensionmodule (extensionname) (extensionversion "3.3. 0")14 (setupshared+staticextensionmodule (extensionname) (extensionversion "3.3.1") 15 15 ;cannot be inline #1340 16 16 ;#:inline? #t … … 19 19 #:files '("mathhconstants.scm")) 20 20 21 (setupshared+staticextensionmodule 'mathhconsts (extensionversion "3.3. 0")21 (setupshared+staticextensionmodule 'mathhconsts (extensionversion "3.3.1") 22 22 #:inline? #t 23 23 #:types? #t … … 27 27 noboundchecks noargcchecks noprocedurechecks)) 28 28 29 (setupshared+staticextensionmodule 'fputils (extensionversion "3.3. 0")29 (setupshared+staticextensionmodule 'fputils (extensionversion "3.3.1") 30 30 #:inline? #t 31 31 #:types? #t … … 35 35 noprocedurechecks)) 36 36 37 (setupshared+staticextensionmodule 'fxutils (extensionversion "3.3. 0")37 (setupshared+staticextensionmodule 'fxutils (extensionversion "3.3.1") 38 38 #:inline? #t 39 39 #:types? #t
Note: See TracChangeset
for help on using the changeset viewer.