Changeset 35121 in project


Ignore:
Timestamp:
02/15/18 20:47:27 (4 months ago)
Author:
kon
Message:

rename C statics - this should not be necessary nor sure a "fix" for https://stackoverflow.com/questions/48805740/installing-eggs-in-chicken-scheme

Location:
release/4/mathh/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/mathh/trunk/mathh.scm

    r35009 r35121  
    5454#endif
    5555
    56 #if defined(_WIN32)
     56#if defined(__sun__) || defined(__sun)
     57
     58# include <sunmath.h> /* log2 */
     59
     60#elif defined(_WIN32)
    5761
    5862static double
    59 log2( double x )
     63mm_log2( double x )
    6064{
    6165# ifndef M_LN2
    62 #   define M_LN2 0.693147180559945309417232121458176568
     66# define M_LN2 0.693147180559945309417232121458176568
    6367# endif
    6468  return log( x ) / M_LN2;
    6569}
    6670
    67 #elif defined(__sun__) || defined(__sun)
    68 
    69 # include <sunmath.h> /* log2 */
    70 
    71 #endif
    72 
    73 #if defined(_WIN32)
    74 
    7571static double
    76 log1p( double x )
     72mm_log1p( double x )
    7773{
    7874  /* very imprecise */
     
    8278/* from a Python implementation by John D. Cook */
    8379static double
    84 erf( double x )
     80mm_erf( double x )
    8581{
    8682# define A1 0.254829592
     
    9793  double y = 1.0 - (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * exp( -abs_x * abs_x );
    9894
    99   return _copysign( y, x ); /* handle singage */
     95  return _copysign( y, x ); /* handle signage */
    10096
    10197# undef P
     
    109105
    110106static double
    111 erfc( double x )
     107mm_erfc( double x )
    112108{
    113109  /* very imprecise */
    114   return 1.0 - erf( x );
     110  return 1.0 - mm_erf( x );
    115111}
    116112
    117113static double
    118 scalbn( double x, int n )
     114mm_scalbn( double x, int n )
    119115{
    120116  /* not efficient */
     
    179175;; Error functions
    180176
    181 (define erf (foreign-lambda double "erf" double))
    182 (define erfc (foreign-lambda double "erfc" double))
     177(define erf
     178  (cond-expand
     179    (windows  (foreign-lambda double "mm_erf" double) )
     180    (else     (foreign-lambda double "erf" double) ) ) )
     181
     182(define erfc
     183  (cond-expand
     184    (windows  (foreign-lambda double "mm_erfc" double) )
     185    (else     (foreign-lambda double "erfc" double) ) ) )
    183186
    184187;; Hyperbolic functions
     
    209212(define hypot
    210213  (cond-expand
    211     (windows  (foreign-lambda double "_hypot" double double) )
     214    (windows  (foreign-lambda double "mm_hypot" double double) )
    212215    (else     (foreign-lambda double "hypot" double double) ) ) )
    213216
     
    236239;; Base-2 logarithm
    237240
    238 (define log2 (foreign-lambda double "log2" double))
     241(define log2
     242  (cond-expand
     243    (windows  (foreign-lambda double "mm_log2" double) )
     244    (else     (foreign-lambda double "log2" double) ) ) )
    239245
    240246;; Natural logarithm of 1+x accurate for very small x
    241247
    242 (define log1p (foreign-lambda double "log1p" double))
     248(define log1p
     249  (cond-expand
     250    (windows  (foreign-lambda double "mm_log1p" double) )
     251    (else     (foreign-lambda double "log1p" double) ) ) )
    243252
    244253;; Compute x * 2**n
     
    248257;; Efficiently compute x * 2**n
    249258
    250 (define scalbn (foreign-lambda double "scalbn" double integer))
     259(define scalbn
     260  (cond-expand
     261    (windows  (foreign-lambda double "mm_scalbn" double integer) )
     262    (else     (foreign-lambda double "scalbn" double integer) ) ) )
    251263
    252264;; Log function for base n
  • release/4/mathh/trunk/mathh.setup

    r34955 r35121  
    1212
    1313;* (The compiler option '-inline-global' causes problems; so no -O3+.)
    14 (setup-shared+static-extension-module (extension-name) (extension-version "3.3.0")
     14(setup-shared+static-extension-module (extension-name) (extension-version "3.3.1")
    1515  ;cannot be inline #1340
    1616  ;#:inline? #t
     
    1919  #:files '("mathh-constants.scm"))
    2020
    21 (setup-shared+static-extension-module 'mathh-consts (extension-version "3.3.0")
     21(setup-shared+static-extension-module 'mathh-consts (extension-version "3.3.1")
    2222  #:inline? #t
    2323  #:types? #t
     
    2727    -no-bound-checks -no-argc-checks -no-procedure-checks))
    2828
    29 (setup-shared+static-extension-module 'fp-utils (extension-version "3.3.0")
     29(setup-shared+static-extension-module 'fp-utils (extension-version "3.3.1")
    3030  #:inline? #t
    3131  #:types? #t
     
    3535    -no-procedure-checks))
    3636
    37 (setup-shared+static-extension-module 'fx-utils (extension-version "3.3.0")
     37(setup-shared+static-extension-module 'fx-utils (extension-version "3.3.1")
    3838  #:inline? #t
    3939  #:types? #t
Note: See TracChangeset for help on using the changeset viewer.