Changeset 36001 in project


Ignore:
Timestamp:
07/22/18 20:52:39 (14 months ago)
Author:
Kon Lovett
Message:

4 C5 but linux bld rqrs

Location:
release/5/mathh/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • release/5/mathh/trunk/mathh-constants.scm

    r35992 r36001  
    1 ;;;; mathh-constants.scm
     1;;;; mathh-constants.scm  -*- Scheme -*-
     2;;;; Kon Lovett, Jul '18
     3
    24;;;; Common flonum constants in <math.h> + more
    3 
    4 ;;; Flonum Constants
    55
    66;; The precision is greater than those found in <math.h>
    77;; but in practice not perfectly representable
     8
     9(import (chicken base))
    810
    911(define-constant E                                      2.7182818284590452353602874713526624977572)   ; e
  • release/5/mathh/trunk/mathh-consts.scm

    r35992 r36001  
    1 ;;;; mathh-consts.scm
     1;;;; mathh-consts.scm  -*- Scheme -*-
     2;;;; Kon Lovett, Jul '18
     3
    24;;;; Common flonum constants in <math.h> + more
    3 
    4 ;;; Flonum Constants
    55
    66(module mathh-consts *
    77
    8 (import scheme chicken)
     8(import scheme
     9  (chicken base))
    910
    1011(include "mathh-constants")
  • release/5/mathh/trunk/mathh.egg

    r35992 r36001  
    1 ;;;; "mathh.meta  -*- Hen -*-
     1;;;; "mathh.egg  -*- Scheme -*-
     2;;;; Kon Lovett, Jul '18
    23
    3 ((egg "mathh.egg")
     4((synopsis "ISO C math functions and constants")
     5 (version "4.0.0")
    46 (category math)
    57 (author "[[kon lovett]] and [[john cowan]]")
    68 (license "Public Domain")
    7  (doc-from-wiki)
    8  (synopsis "ISO C math functions and constants")
    9  (depends (setup-helper "2.1.0"))
    10  (test-depends test)
    11 
    12 (define mathh-compile-options `(
    13   -local -no-procedure-checks
    14   ,@(cond-expand
    15       (linux    '(-C -D_ISOC99_SOURCE) ) ;_GNU_SOURCE instead?
    16       (else     '() ) ) ) )
    17 
    18 ;* (The compiler option '-inline-global' causes problems; so no -O3+.)
    19 (setup-shared+static-extension-module (extension-name) (extension-version "3.4.2")
    20   ;cannot be inline #1340
    21   ;#:inline? #t
    22   #:types? #t
    23   #:compile-options mathh-compile-options
    24   #:files '("mathh-constants.scm"))
    25 
    26 (setup-shared+static-extension-module 'mathh-consts (extension-version "3.4.2")
    27   #:inline? #t
    28   #:types? #t
    29   #:compile-options `(
    30     -scrutinize
    31     -optimize-level 3 -debug-level 1
    32     -no-bound-checks -no-argc-checks -no-procedure-checks))
     9 (test-dependencies test)
     10 ;linux ;_GNU_SOURCE instead?
     11 ;CSC_OPTIONS='-C -D_ISOC99_SOURCE' chicken-install -test mathh
     12 (components
     13  (extension mathh-consts
     14    #;(inline-file)
     15    (types-file)
     16    (scheme-include mathh-constants)
     17    (csc-options "-O3" "-d1" "-local" "-no-bound-checks" "-no-argc-checks" "-no-procedure-checks") )
     18  (extension mathh
     19    #;(inline-file)
     20    (types-file)
     21    (csc-options "-O3" "-d1" "-local" "-no-procedure-checks") ) ) )
  • release/5/mathh/trunk/mathh.scm

    r35992 r36001  
    1 ;;;; mathh.scm
     1;;;; mathh.scm  -*- Scheme -*-
     2;;;; Kon Lovett, Jul '18
     3;;;; Peter Bex, Aug '15 (argvector work!)
     4;;;; Kon Lovett, Mar '09 - '10, '15, Sep '17
    25;;;; Kon Lovett & John Cowen, '07 - '08
    3 ;;;; Kon Lovett, Mar '09 - '10, '15, Sep '17
    4 ;;;; Peter Bex, Aug '15 (argvector work!)
    56
    67;;; Provides access to ISO C math functions in <math.h>
     
    2526;; preprocessor macro by default, but it will if you provide the -mwin32 options
    2627
    27 ;;; Mathh
    28 
    29 (module mathh
    30 
    31 (;export
    32   fpclassify fpclass
    33   signbit
    34   copysign nextafter
    35   fpmod
    36   cbrt
    37   hypot
    38   log10 log2 log-with-base log1p
    39   modf frexp
    40   ldexp scalbn
    41   cosh sinh tanh
    42   acosh asinh atanh
    43   gamma tgamma lgamma
    44   bessel-j0 bessel-j1 bessel-jn
    45   bessel-y0 bessel-y1 bessel-yn
    46   erf erfc
    47   ;DEPRECATED
    48   make-log/base)
    49 
    50 (import scheme chicken foreign)
    51 
    5228#>
    5329#include <math.h>
     
    11894#endif
    11995<#
     96
     97(module mathh
     98
     99(;export
     100  fpclassify fpclass
     101  signbit
     102  copysign nextafter
     103  fpmod
     104  cbrt
     105  hypot
     106  log10 log2 log1p
     107  log-with-base make-log/base
     108  modf frexp
     109  ldexp scalbn
     110  cosh sinh tanh
     111  acosh asinh atanh
     112  gamma tgamma lgamma
     113  bessel-j0 bessel-j1 bessel-jn
     114  bessel-y0 bessel-y1 bessel-yn
     115  erf erfc)
     116
     117(import scheme
     118  (chicken base)
     119  (chicken flonum)
     120  (chicken syntax)
     121  (chicken foreign))
    120122
    121123;;; Unimplemented Support
  • release/5/mathh/trunk/tests/mathh-test.scm

    r35992 r36001  
    1 ;;;; mathh-test
     1;;;; mathh-test.scm  -*- Scheme -*-
     2;;;; Kon Lovett, Jul '18
    23;;;; Kon Lovett, May '17
    34
    4 ;;;; Issues
    5 ;;;;
     5(import test)
    66
    7 (require-extension test)
     7(test-begin "Mathh")
    88
    99;;;
    1010
    11 (require-extension mathh)
    12 
    13 (test-begin "mathh")
     11(import (chicken flonum) mathh)
    1412
    1513;;
     
    116114;;;
    117115
    118 (require-extension fp-utils)
    119 
    120 (define-constant 5eps (fp/ 9.0 1e06))
    121 (define-constant 4eps (fp/ 9.0 1e05))
    122 
    123 (test-group "FP Utils"
    124 
    125   (test-assert (fpzero? 0.0))
    126   (test-assert (not (fpzero? 1.0)))
    127   (test-assert (not (fpzero? maximum-flonum)))
    128   (test-assert (not (fpzero? minimum-flonum)))
    129 
    130   (test-assert (not (fppositive? 0.0)))
    131   (test-assert (not (fppositive? (fpneg minimum-flonum))))
    132   (test-assert (fppositive? maximum-flonum))
    133 
    134   (test-assert (fpcardinal? 0.0))
    135   (test-assert (not (fpcardinal? (fpneg minimum-flonum))))
    136   (test-assert (fpcardinal? maximum-flonum))
    137 
    138   (test-assert (not (fpnegative? 0.0)))
    139   (test-assert (fpnegative? (fpneg minimum-flonum)))
    140   (test-assert (not (fpnegative? maximum-flonum)))
    141 
    142         (test-assert (not (fpeven? 7.0)))
    143         (test-assert (fpeven? 6.0))
    144         (test-assert (not (fpodd? 6.0)))
    145         (test-assert (fpodd? 7.0))
    146 
    147         (test-assert (flonum? (fprandom)))
    148         (test-assert (flonum? (fprandom 2456)))
    149 
    150         (test 4.0 (fpadd1 3.0))
    151         (test 2.0 (fpsub1 3.0))
    152 
    153         (test 27.0 (fpcub 3.0))
    154 
    155         (test 1.0 (fpmodulo 5.0 2.0))
    156         (test 0.0 (fpmodulo 0.0 1.0))
    157 
    158         (test 2.0 (fpquotient 5.0 2.0))
    159         (test 1.0 (fpremainder 5.0 2.0))
    160 
    161         (test-assert (fp~= 0.123456 0.123457 5eps))
    162         (test-assert (fp~<= 0.123456 0.123457 5eps))
    163         (test-assert (fp~>= 0.123456 0.123457 5eps))
    164         (test-assert (fp~<= 0.123456 0.12346 5eps))
    165         (test-assert (fp~>= 0.123456 0.12344 5eps))
    166 
    167   (parameterize ((current-test-epsilon 4eps))
    168           (test 5.6568 (fpdistance 1.0 1.0 5.0 5.0)) )
    169 
    170         (receive (mx mn) (fpmax-and-min 1.0 -1.0 -16.0 13.0 2.0 16.0 7.0 -8.0)
    171           (test "fpmax-and-min max" 16.0 mx)
    172           (test "fpmax-and-min min" -16.0 mn) )
    173 )
    174 
    175 ;;;
    176 
    177 (require-extension fx-utils)
    178 
    179 (test-group "FX Utils"
    180 
    181   (test-assert (fxzero? 0))
    182   (test-assert (not (fxzero? 1)))
    183   (test-assert (not (fxzero? most-positive-fixnum)))
    184   (test-assert (not (fxzero? most-negative-fixnum)))
    185 
    186   (test-assert (not (fxpositive? 0)))
    187   (test-assert (not (fxpositive? most-negative-fixnum)))
    188   (test-assert (fxpositive? most-positive-fixnum))
    189 
    190   (test-assert (fxcardinal? 0))
    191   (test-assert (not (fxcardinal? most-negative-fixnum)))
    192   (test-assert (fxcardinal? most-positive-fixnum))
    193 
    194   (test-assert (not (fxnegative? 0)))
    195   (test-assert (fxnegative? most-negative-fixnum))
    196   (test-assert (not (fxnegative? most-positive-fixnum)))
    197 
    198         (test-assert (fixnum? (fxrandom)))
    199         (test-assert (fixnum? (fxrandom 2456)))
    200 
    201         (test 4 (fxadd1 3))
    202         (test 2 (fxsub1 3))
    203 
    204         (test 27 (fxcub 3))
    205 
    206         (test -1 (fxlog2 0))
    207         (test 0 (fxlog2 1))
    208         (test 1 (fxlog2 2))
    209         (test 1 (fxlog2 3))
    210         (test 2 (fxlog2 4))
    211 
    212         (test -1 (fxpow2log2 0))
    213         (test 4 (fxpow2log2 3))
    214         (test 8 (fxpow2log2 7))
    215         (test 16 (fxpow2log2 15))
    216         (test 16 (fxpow2log2 16))
    217         (test 32 (fxpow2log2 17))
    218 
    219         (test 16 (fxdistance 1 1 5 5))
    220 
    221         (receive (mx mn) (fxmax-and-min 1 -1 -16 13 2 16 7 -8)
    222           (test "fxmax-and-min max" 16 mx)
    223           (test "fxmax-and-min min" -16 mn) )
    224 )
    225 
    226 ;;;
    227 
    228 (test-end "mathh")
    229 
    230 ;;;
     116(test-end "Mathh")
    231117
    232118(test-exit)
  • release/5/mathh/trunk/tests/run.scm

    r35992 r36001  
    44;chicken-install invokes as "<csi> -s run.scm <eggnam> <eggdir>"
    55
    6 (use files)
     6(import
     7  (only (chicken pathname) make-pathname)
     8  (only (chicken process) system)
     9  (only (chicken process-context) argv)
     10  (only (chicken format) format))
     11
     12(define *args* (argv))
    713
    814;no -disable-interrupts
    9 (define *csc-options* "-inline-global -scrutinize -optimize-leaf-routines -local -inline -specialize -unsafe -no-trace -no-lambda-info -clustering -lfa2")
    10 
    11 (define *args* (argv))
     15(define *csc-options* "-inline-global \
     16  -specialize -optimize-leaf-routines -clustering -lfa2 \
     17  -local -inline \
     18  -no-trace -no-lambda-info \
     19  -unsafe")
    1220
    1321(define (test-name #!optional (eggnam EGG-NAME))
     
    2937(define (run-test #!optional (eggnam EGG-NAME) (cscopts *csc-options*))
    3038  (let ((tstnam (test-name eggnam)))
    31     (print "*** csi ***")
     39    (format #t "*** csi ***~%")
    3240    (system (string-append "csi -s " (make-pathname #f tstnam "scm")))
    3341    (newline)
    34     (print "*** csc (" cscopts ") ***")
     42    (format #t "*** csc ~s ***~%" cscopts)
    3543    (system (string-append "csc" " " cscopts " " (make-pathname #f tstnam "scm")))
    3644    (system (make-pathname (cond-expand (unix "./") (else #f)) tstnam)) ) )
Note: See TracChangeset for help on using the changeset viewer.