Changeset 14004 in project for release/4/mathh/trunk/mathh.scm
 Timestamp:
 03/31/09 04:01:40 (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

release/4/mathh/trunk/mathh.scm
r13652 r14004 52 52 log10 log2 makelog/base log1p 53 53 fpmod modf ldexp scalbn frexp 54 signbit copysign nextafter 55 cbrt 54 56 fpclassify 55 57 fpclass) … … 127 129 #define #define M_LN2 0.693147180559945309417232121458176568 128 130 #endif 129 C_return( log( x ) / M_LN2 ); 130 ") 131 return( log( x ) / M_LN2 );") 131 132 #; 132 133 (foreignlambda* double ((double x)) " … … 137 138 # define M_E 2.71828182845904523536028747135266250 138 139 #endif 139 C_return( (log( 2.0 * M_PI * x) / 2.0) + (x * log( x / M_E )) ); 140 ") ) ) ) 140 return( (log( 2.0 * M_PI * x) / 2.0) + (x * log( x / M_E )) );") ) ) ) 141 141 142 142 ;; Natural logarithm of 1+x accurate for very small x … … 145 145 (condexpand 146 146 (windows ; potentially inaccurate but ... 147 (foreignlambda* double ((double x)) " C_return( log( 1.0 + x ) );") )147 (foreignlambda* double ((double x)) "return( log( 1.0 + x ) );") ) 148 148 (else 149 149 (foreignlambda double "log1p" double) ) ) ) … … 158 158 (condexpand 159 159 (windows ; not efficient but ... 160 (foreignlambda* double ((double x) (integer n)) " C_return( ldexp( x, n ) );"))160 (foreignlambda* double ((double x) (integer n)) "return( ldexp( x, n ) );")) 161 161 (else 162 162 (foreignlambda double "scalbn" double integer))) ) … … 172 172 (let ((lnb (log b))) 173 173 (lambda (n) 174 ((foreignlambda* double ((double x) (double lnb)) " C_return( log( x ) / lnb );") n lnb)) ) ) ) )174 ((foreignlambda* double ((double x) (double lnb)) "return( log( x ) / lnb );") n lnb)) ) ) ) ) 175 175 176 176 ;; Flonum remainder … … 200 200 ") ) 201 201 202 ;; Returns arg1 with same sign as arg2 203 204 (define copysign 205 (condexpand 206 (windows (foreignlambda double "_copysign" double double)) 207 (else (foreignlambda double "copysign" double double)) ) ) 208 209 ;; Increments/decrements arg1 in the direction of arg2 210 211 (define nextafter 212 (condexpand 213 (windows (foreignlambda double "_nextafter" double double)) 214 (else (foreignlambda double "nextafter" double double)) ) ) 215 216 ;; #t when negative, #f otherwise 217 218 (define signbit 219 (condexpand 220 (windows (foreignlambda* bool ((double n)) "return( _copysign( 1.0, n ) < 0 );")) 221 (else (foreignlambda bool "signbit" double)) ) ) 222 223 ;; Cube Root 224 225 (define cbrt 226 (condexpand 227 (windows (lambdaunimplemented 'cbrt)) 228 (else (foreignlambda double "cbrt" double)) ) ) 229 202 230 ;; Returns a symbol denoting the kind of floatingpoint number. 203 231 … … 242 270 break; 243 271 } 244 C_return( name ); 245 ") ) 272 return( name );") ) 246 273 (else 247 274 (foreignlambda* symbol ((double x)) " … … 262 289 break; 263 290 case FP_ZERO: 264 name = x == 0.0? \"negativezero\" : \"positivezero\";291 name = signbit( x ) ? \"negativezero\" : \"positivezero\"; 265 292 break; 266 293 default: … … 268 295 break; 269 296 } 270 C_return( name ); 271 ") ) ) ) 297 return( name );") ) ) ) 272 298 273 299 ;; Returns a symbol denoting the kind of floatingpoint number. … … 303 329 break; 304 330 } 305 C_return( name ); 306 ") ) 331 return( name );") ) 307 332 (else 308 333 (foreignlambda* symbol ((double x)) " … … 328 353 break; 329 354 } 330 C_return( name ); 331 ") ) ) ) 355 return( name );") ) ) ) 332 356 333 357 ) ;module mathh
Note: See TracChangeset
for help on using the changeset viewer.