;;; Copyright (C) William D Clinger (2017).
;;;
;;; Permission is hereby granted, free of charge, to any person
;;; obtaining a copy of this software and associated documentation
;;; files (the "Software"), to deal in the Software without
;;; restriction, including without limitation the rights to use,
;;; copy, modify, merge, publish, distribute, sublicense, and/or
;;; sell copies of the Software, and to permit persons to whom the
;;; Software is furnished to do so, subject to the following
;;; conditions:
;;;
;;; The above copyright notice and this permission notice shall be
;;; included in all copies or substantial portions of the Software.
;;;
;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
;;; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
;;; OTHER DEALINGS IN THE SOFTWARE.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Tests these (srfi 144) constants and procedures:
;;;
;;;     fl-e
;;;     fl-1/e
;;;     fl-e-2
;;;     fl-e-pi/4
;;;     fl-log2-e
;;;     fl-log10-e
;;;     fl-log-2
;;;     fl-1/log-2
;;;     fl-log-3
;;;     fl-log-pi
;;;     fl-log-10
;;;     fl-1/log-10
;;;     fl-pi
;;;     fl-1/pi
;;;     fl-2pi
;;;     fl-pi/2
;;;     fl-pi/4
;;;     fl-2/sqrt-pi
;;;     fl-pi-squared
;;;     fl-degree
;;;     fl-2/pi
;;;     fl-sqrt-2
;;;     fl-sqrt-3
;;;     fl-sqrt-5
;;;     fl-sqrt-10
;;;     fl-1/sqrt-2
;;;     fl-cbrt-2
;;;     fl-cbrt-3
;;;     fl-4thrt-2
;;;     fl-phi
;;;     fl-log-phi
;;;     fl-1/log-phi
;;;     fl-euler
;;;     fl-e-euler
;;;     fl-sin-1
;;;     fl-cos-1
;;;     fl-gamma-1/2
;;;     fl-gamma-1/3
;;;     fl-gamma-2/3
;;;
;;;     fl-greatest
;;;     fl-least
;;;     fl-epsilon
;;;     fl-fast-fl+*
;;;     fl-integer-exponent-zero
;;;     fl-integer-exponent-nan
;;;
;;;     flonum
;;;     fladjacent
;;;     flcopysign
;;;     make-flonum
;;;
;;;     flinteger-fraction
;;;     flexponent
;;;     flinteger-exponent
;;;     flnormalized-fraction-exponent
;;;     flsign-bit
;;;
;;;     flonum?
;;;     fl=?
;;;     fl<?
;;;     fl>?
;;;     fl<=?
;;;     fl>=?
;;;     flunordered?
;;;     flmax
;;;     flmin
;;;     flinteger?
;;;     flzero?
;;;     flpositive?
;;;     flnegative?
;;;     flodd?
;;;     fleven?
;;;     flfinite?
;;;     flinfinite?
;;;     flnan?
;;;     flnormalized?
;;;     fldenormalized?
;;;
;;;     fl+
;;;     fl*
;;;     fl+*
;;;     fl-
;;;     fl/
;;;     flabs
;;;     flabsdiff
;;;     flposdiff
;;;     flsgn
;;;     flnumerator
;;;     fldenominator
;;;     flfloor
;;;     flceiling
;;;     flround
;;;     fltruncate
;;;
;;;     flexp
;;;     flexp2
;;;     flexp-1
;;;     flsquare
;;;     flsqrt
;;;     flcbrt
;;;     flhypot
;;;     flexpt
;;;     fllog
;;;     fllog1+
;;;     fllog2
;;;     fllog10
;;;     make-fllog-base
;;;
;;;     flsin
;;;     flcos
;;;     fltan
;;;     flasin
;;;     flacos
;;;     flatan
;;;     flsinh
;;;     flcosh
;;;     fltanh
;;;     flasinh
;;;     flacosh
;;;     flatanh
;;;
;;;     flquotient
;;;     flremainder
;;;     flremquo
;;;
;;;     flgamma
;;;     flloggamma
;;;     flfirst-bessel
;;;     flsecond-bessel
;;;     flerf
;;;     flerfc


;; (define-library (tests scheme flonum)
;;   (export run-flonum-tests)
;;   (import (scheme base)
;;           (srfi 144)
;;           (tests scheme test)
;;           (scheme inexact))

;;   (cond-expand
;;    ((library (scheme list))
;;     (import (only (scheme list) filter iota)))
;;    ((library (srfi 1))
;;     (import (only (srfi 1) filter iota)))
;;    (else
;;     (begin
;;      (define (filter p? x)
;;        (cond ((null? x)    x)
;;              ((p? (car x)) (cons (car x) (filter p? (cdr x))))
;;              (else         (filter p? (cdr x)))))
;;      (define (iota n)
;;        (do ((n (- n 1) (- n 1))
;;             (x '() (cons n x)))
;;            ((< n 0) x))))))

(define epsilon 10e-6)

(define (good-enough? x y)
     ;; relative error should be with 0.1%, but greater
     ;; relative error is allowed when the expected value
     ;; is near zero.
     (cond ((not (number? x)) #f)
           ((not (number? y)) #f)
           ((or (not (real? x))
                (not (real? y)))
            (and (good-enough? (real-part x) (real-part y))
                 (good-enough? (imag-part x) (imag-part y))))
           ((infinite? x)
            (= x (* 2.0 y)))
           ((infinite? y)
            (= (* 2.0 x) y))
           ((nan? y)
            (nan? x))
           ((> (magnitude y) 1e-6)
            (< (/ (magnitude (- x y))
                  (magnitude y))
               1e-3))
           (else
            (< (magnitude (- x y)) 1e-6))))


   (define-syntax test/approx
     (syntax-rules ()
       ((test/approx name expr1 expr2)
        (test name #t (good-enough? expr1 expr2)))))

   (define-syntax test-assert
     (syntax-rules ()
       ((test-assert name expr)
        (test name #t expr))))

   (define-syntax test-deny
     (syntax-rules ()
       ((test-assert name expr)
        (test name #f expr))))

   (define-syntax test-error
     (syntax-rules ()
       ((test-error expr)
        (test/error name expr))))

   (define-syntax test/=
     (syntax-rules ()
      ((test/= name expr1 expr2)
       (test name expr1 expr2))))

   ;; convenient values for test cases

   (define posints (map flonum '(1 2 3 4 5 10 65536 1e23)))
   (define nats (cons (flonum 0) posints))
   (define ints (append (map flonum '(-20 -8 -2 -1)) nats))
   (define posfracs (map flonum '(1/1000 1/10 1/3 1/2)))
   (define extremes
     (list (fl- fl-greatest) (fl- fl-least) fl-least fl-greatest))
   (define infinities (map flonum (list -inf.0 +inf.0)))
   (define weird (append infinities (list (flonum +nan.0))))

   (define somereals (append (map flonum
                                  (list (fl- fl-greatest)
                                        -10
                                        (fl- fl-least)
                                        0))
                             posfracs
                             posints))
   (define somereals+weird
     (append somereals weird))

   (define negzero (flonum -0.0))
   (define zero (flonum 0))
   (define one (flonum 1))
   (define two (flonum 2))

   (define neginf (flonum -inf.0))
   (define posinf (flonum +inf.0))
   (define nan (flonum +nan.0))


;   (define (run-flonum-tests)

     ;; Mathematical constants

     (test/= "srfi-144.0" 2.718281828459045235360287                    fl-e)
     (test/= "srfi-144.1" .3678794411714423215955238                    fl-1/e)
     (test/= "srfi-144.2" 7.389056098930650227230427                    fl-e-2)
     (test/= "srfi-144.3" 2.1932800507380154566                         fl-e-pi/4)
     (test/= "srfi-144.4" 1.4426950408889634073599246810018921374266    fl-log2-e)
     (test/= "srfi-144.5" .4342944819032518276511289                    fl-log10-e)
     (test/= "srfi-144.6" .6931471805599453094172321                    fl-log-2)
     (test/= "srfi-144.7" 1.4426950408889634073599246810018921374266    fl-1/log-2)
     (test/= "srfi-144.8" 1.0986122886681096913952452                   fl-log-3)
     (test/= "srfi-144.9" 1.144729885849400174143427                    fl-log-pi)
     (test/= "srfi-144.10" 2.3025850929940456840179915                   fl-log-10)
     (test/= "srfi-144.11" 0.4342944819032518276511289189166050822944    fl-1/log-10)

     (test/= "srfi-144.12" 3.1415926535897932384626433832795028841972    fl-pi)
     (test/= "srfi-144.13" 0.3183098861837906715377675267450287240689    fl-1/pi)
     (test/= "srfi-144.14" 6.283185307179586476925287                    fl-2pi)
     (test/= "srfi-144.15" 1.570796326794896619231322                    fl-pi/2)
     (test/= "srfi-144.16" .7853981633974483096156608                    fl-pi/4)
     (test/= "srfi-144.17" .5641895835477562869480795                    (/ fl-2/sqrt-pi 2))
     (test/= "srfi-144.18" 9.869604401089358618834491                    fl-pi-squared)
     (test/= "srfi-144.19" 0.0174532925199432957692369076848861271344    fl-degree)
     (test/= "srfi-144.20" .3183098861837906715377675                    (/ fl-2/pi 2))

     (test/= "srfi-144.21" 1.4142135623730950488016887242096980785697    fl-sqrt-2)
     (test/= "srfi-144.22" 1.7320508075688772935274463415058723669428    fl-sqrt-3)
     (test/= "srfi-144.23" 2.2360679774997896964091736687311762354406    fl-sqrt-5)
     (test/= "srfi-144.24" 3.1622776601683793319988935444327185337196    fl-sqrt-10)
     (test/= "srfi-144.25" 1.4142135623730950488016887242096980785697    (* 2 fl-1/sqrt-2))
     (test/= "srfi-144.26" 1.2599210498948731647672106072782283505703    fl-cbrt-2)
     (test/= "srfi-144.27" 1.4422495703074083823216383107801095883919    fl-cbrt-3)
     (test/= "srfi-144.28" 1.1892071150027210667174999705604759152930    fl-4thrt-2)

     (test/= "srfi-144.29" 1.6180339887498948482045868343656381177203    fl-phi)
     (test/= "srfi-144.30" 0.4812118250596034474977589134243684231352    fl-log-phi)
     (test/= "srfi-144.31" 2.0780869212350275376013226061177957677422    fl-1/log-phi)
     (test/= "srfi-144.32" 0.5772156649015328606065120900824024310422    fl-euler)
     (test/= "srfi-144.33" 1.7810724179901979852365041031071795491696    fl-e-euler)

     (test/= "srfi-144.34" 0.8414709848078965066525023216302989996226    fl-sin-1)
     (test/= "srfi-144.35" 0.5403023058681397174009366074420766037323    fl-cos-1)

     (test/= "srfi-144.36" 1.7724538509055160272981674833411451827975    fl-gamma-1/2)
     (test/= "srfi-144.37" 2.6789385347077476336556929409746776441287    fl-gamma-1/3)
     (test/= "srfi-144.38" 1.3541179394264004169452880281545137855193    fl-gamma-2/3)

     ;; Implementation Constants

     (test-assert "srfi-144.39 " (inexact? fl-greatest))
     (test-assert "srfi-144.40 " (inexact? fl-least))
     (test-assert "srfi-144.41 " (inexact? fl-epsilon))

     (test-assert "srfi-144.42 " (real? fl-greatest))
     (test-assert "srfi-144.43 " (real? fl-least))
     (test-assert "srfi-144.44 " (real? fl-epsilon))

     (test-assert "srfi-144.45 " (flonum? fl-greatest))
     (test-assert "srfi-144.46 " (flonum? fl-least))
     (test-assert "srfi-144.47 " (flonum? fl-epsilon))

     (test-assert "srfi-144.48 " (< 0.0
                     fl-least
                     fl-epsilon
                     1.0
                     (+ 1.0 fl-epsilon)
                     fl-greatest
                     posinf))
     (test-assert "srfi-144.49 " (= (* 2 fl-greatest) posinf))
     (test-assert "srfi-144.50 " (= 1 (/ (+ 1 (+ 1.0 fl-epsilon)) 2)))
     (test-assert "srfi-144.51 " (= 0.0 (/ fl-least 2)))

     (test-assert "srfi-144.52 " (boolean? fl-fast-fl+*))
     (test-assert "srfi-144.53 " (exact-integer? fl-integer-exponent-zero))
     (test-assert "srfi-144.54 " (exact-integer? fl-integer-exponent-nan))

     ;; Constructors

     (test "srfi-144.55 " (flonum 3) (flonum 3.0))
     (test "srfi-144.56 " (map flonum somereals) somereals)
     (test "srfi-144.57 " (map flonum weird) weird)

     (test "srfi-144.58 " (map fladjacent somereals somereals) somereals)
     (test "srfi-144.59 " (map fladjacent weird weird) weird)

     (test "srfi-144.60 " (fladjacent zero posinf) fl-least)
     (test "srfi-144.61 " (fladjacent zero neginf) (fl- fl-least))
     (test "srfi-144.62 " (fladjacent fl-least posinf) (fl+ fl-least fl-least))
     (test "srfi-144.63 " (fladjacent fl-least neginf) zero)
     (test "srfi-144.64 " (fladjacent (fl- fl-least) posinf) negzero)
     (test "srfi-144.65 " (fladjacent (fl- fl-least) neginf) (fl* -2.0 fl-least))

     (test "srfi-144.66 " (fladjacent zero one) fl-least)
     (test "srfi-144.67 " (fladjacent zero (fl- one)) (fl- fl-least))
     (test "srfi-144.68 " (fladjacent fl-least one) (fl+ fl-least fl-least))
     (test "srfi-144.69 " (fladjacent fl-least (fl- one)) zero)
     (test "srfi-144.70 " (fladjacent (fl- fl-least) one) negzero)
     (test "srfi-144.71 " (fladjacent (fl- fl-least) (fl- one)) (fl* -2.0 fl-least))

     (test "srfi-144.72 " (fl- (fladjacent one fl-greatest) one) fl-epsilon)
     (test "srfi-144.73 " (fl- one (fladjacent one zero)) (fl/ fl-epsilon 2.0))

     (test "srfi-144.74 " (fladjacent posinf zero) fl-greatest)
     (test "srfi-144.75 " (fladjacent neginf zero) (fl- fl-greatest))

     (test "srfi-144.76 " (flcopysign zero posinf) zero)
     (test "srfi-144.77 " (flcopysign zero neginf) negzero)
     (test "srfi-144.78 " (flcopysign zero one) zero)
     (test "srfi-144.79 " (flcopysign zero (fl- one)) negzero)
     (test "srfi-144.80 " (flcopysign one fl-least) one)
     (test "srfi-144.81 " (flcopysign one (fl- fl-greatest)) (fl- one))
     (test "srfi-144.82 " (flcopysign (fl- one) zero) one)
     (test "srfi-144.83 " (map flcopysign somereals somereals) somereals)
     (test "srfi-144.84 " (map flcopysign somereals (map fl- somereals))
           (map fl- somereals))
     (test "srfi-144.85 " (map flcopysign infinities infinities) infinities)
     (test "srfi-144.86 " (map flcopysign infinities (reverse infinities))
           (reverse infinities))

     (test "srfi-144.87 " (make-flonum zero 12) zero)
     (test "srfi-144.88 " (make-flonum zero -24) zero)
     (test "srfi-144.89 " (make-flonum zero 0) zero)
     (test "srfi-144.90 " (map make-flonum somereals (map (lambda (x) 0) somereals))
           somereals)
     (test "srfi-144.91 " (map make-flonum somereals (map (lambda (x) 2) somereals))
           (map (lambda (x) (fl* (flonum 4) x)) somereals))
     (test "srfi-144.92 " (map make-flonum somereals (map (lambda (x) -4) somereals))
           (map (lambda (x) (fl/ x (flonum 16))) somereals))
     (test "srfi-144.93 " (make-flonum fl-greatest 1) posinf)
     (test "srfi-144.94 " (make-flonum (fl- fl-greatest) 1) neginf)
     (test "srfi-144.95 " (make-flonum fl-greatest -1) (fl/ fl-greatest two))
     (test "srfi-144.96 " (make-flonum (fl- fl-greatest) -1) (fl- (fl/ fl-greatest two)))
     (test "srfi-144.97 " (make-flonum fl-least 1) (fl* two fl-least))
     (test "srfi-144.98 " (make-flonum (fl- fl-least) 1) (fl- (fl* two fl-least)))
     (test "srfi-144.99 " (make-flonum fl-least -1) zero)
     (test "srfi-144.100 " (make-flonum (fl- fl-least) -1) negzero)

     ;; Accessors

     (call-with-values
      (lambda () (flinteger-fraction 3.75))
      (lambda (q r)
        (test "srfi-144.101 " q (flonum 3))
        (test "srfi-144.102 " r (flonum .75))))

     (call-with-values
      (lambda () (flinteger-fraction -3.75))
      (lambda (q r)
        (test "srfi-144.103 " q (flonum -3))
        (test "srfi-144.104 " r (flonum -.75))))

     (test/= "srfi-144.105" (flonum 12.0)
             (flexponent (flexpt two (flonum 12))))
     (test/approx "srfi-144.106 " (flexponent (flexpt two (flonum 12.5)))
                  (flonum 12))
     (test/= "srfi-144.107" (flonum -5.0)
             (flexponent (flexpt two (flonum -5))))
     (test/approx "srfi-144.108 " (flexponent (flexpt two (flonum +4.5)))
                  (flonum +4))
     (test/approx "srfi-144.109 " (flexponent (flexpt two (flonum -4.5)))
                  (flonum -5))

     (test "srfi-144.110 " (flinteger-exponent (flexpt two (flonum 12)))   12)
     (test "srfi-144.111 " (flinteger-exponent (flexpt two (flonum 12.5))) 12)
     (test "srfi-144.112 " (flinteger-exponent (flexpt two (flonum -5)))   -5)
     (test "srfi-144.113 " (flinteger-exponent (flexpt two (flonum -4.5))) -5)

     (let* ((correct?
             (lambda (x y n)
               (or (fl=? x (* y (expt 2 n)))
                   (fl=? x (* 4.00 y (expt two (- n 2))))
                   (fl=? x (* 0.25 y (expt two (+ n 2)))))))
            (test-flnormalized-fraction-exponent
             (lambda (x)
               (call-with-values
                (lambda () (flnormalized-fraction-exponent x))
                (lambda (y n)
                  (list (flonum? y)
                        (exact-integer? n)
                        (fl<=? (flonum 0.5) (flabs y))
                        (fl<? (flabs y) one)
                        (correct? x y n)))))))
       (test "srfi-144.114 n1" (test-flnormalized-fraction-exponent zero)
             '(#t #t #f #t #t))
       (test "srfi-144.115 n2" (test-flnormalized-fraction-exponent negzero)
             '(#t #t #f #t #t))
       (test "srfi-144.116 n3" (test-flnormalized-fraction-exponent one)
             '(#t #t #t #t #t))
       (test "srfi-144.117 n4" (test-flnormalized-fraction-exponent two)
             '(#t #t #t #t #t))

       ;; FIXME: THE FOLLOWING FAILS
       ;; because (* 0.5 (expt 2 -1073)) is zero, and it should be fl-least
       ;; ( 4.94065645841247e-324 ).
       (test "srfi-144.118 n5" (test-flnormalized-fraction-exponent fl-least)
             '(#t #t #t #t #t))
       (test "srfi-144.119 n6" (test-flnormalized-fraction-exponent fl-greatest)
             '(#t #t #t #t #t))

       ;; FIXME: THE FOLLOWING FAILS
       ;; because (* 0.5 (expt 2 -1073)) is zero, and it should be fl-least
       ;; ( 4.94065645841247e-324 ).
       (test "srfi-144.120 n7" (test-flnormalized-fraction-exponent (fl- fl-least))
             '(#t #t #t #t #t))
       (test "srfi-144.121 n8" (test-flnormalized-fraction-exponent (fl- fl-greatest))
             '(#t #t #t #t #t))
       (test "srfi-144.122 n9" (test-flnormalized-fraction-exponent posinf)
             '(#t #t #t #t #t))
       (test "srfi-144.123 n10" (test-flnormalized-fraction-exponent neginf)
             '(#t #t #t #t #t))
       (test "srfi-144.124 n11" (test-flnormalized-fraction-exponent nan)
             '(#t #t #f #f #f))

        )

     (test "srfi-144.125 " (flsign-bit one) 0)
     (test "srfi-144.126 " (flsign-bit zero) 0)
     (test "srfi-144.127 " (flsign-bit negzero) 1)
     (test "srfi-144.128 " (flsign-bit (flonum -2)) 1)
     (test "srfi-144.129 " (flsign-bit posinf) 0)
     (test "srfi-144.130 " (flsign-bit neginf) 1)

     ;; Predicates

     (let ((alltrue  (map (lambda (x) #t) somereals))
           (allfalse (map (lambda (x) #f) somereals)))

       (test "srfi-144.131 " (map flonum? somereals) alltrue)
       (test "srfi-144.132 " (map flonum? weird) '(#t #t #t))

       (test-deny "srfi-144.133 "   (fl=? zero fl-least))
       (test-assert "srfi-144.134 " (fl=? fl-least fl-least))
       (test-deny "srfi-144.135 "   (fl=? one fl-least))
       (test-assert "srfi-144.136 " (fl=? neginf neginf))
       (test-deny "srfi-144.137 "   (fl=? neginf posinf))
       (test-deny "srfi-144.138 "   (fl=? posinf neginf))
       (test-assert "srfi-144.139 " (fl=? posinf posinf))
       (test-deny "srfi-144.140 "   (fl=? zero nan))
       (test-deny "srfi-144.141 "   (fl=? nan one))
       (test "srfi-144.142 " (map fl=? somereals somereals) alltrue)
       (test "srfi-144.143 " (map fl=? somereals (cdr somereals)) (cdr allfalse))
       (test "srfi-144.144 " (map fl=? (cdr somereals) somereals) (cdr allfalse))

       (test-assert "srfi-144.145 " (fl<? zero fl-least))
       (test-deny "srfi-144.146 "   (fl<? fl-least fl-least))
       (test-deny "srfi-144.147 "   (fl<? one fl-least))
       (test-deny "srfi-144.148 "   (fl<? neginf neginf))
       (test-assert "srfi-144.149 " (fl<? neginf posinf))
       (test-deny "srfi-144.150 "   (fl<? posinf neginf))
       (test-deny "srfi-144.151 "   (fl<? posinf posinf))
       (test-deny "srfi-144.152 "   (fl<? zero nan))
       (test-deny "srfi-144.153 "   (fl<? nan one))
       (test "srfi-144.154 " (map fl<? somereals somereals) allfalse)
       (test "srfi-144.155 " (map fl<? somereals (cdr somereals)) (cdr alltrue))
       (test "srfi-144.156 " (map fl<? (cdr somereals) somereals) (cdr allfalse))

       (test-deny "srfi-144.157 "   (fl>? zero fl-least))
       (test-deny "srfi-144.158 "   (fl>? fl-least fl-least))
       (test-assert "srfi-144.159 " (fl>? one fl-least))
       (test-deny "srfi-144.160 "   (fl>? neginf neginf))
       (test-deny "srfi-144.161 "   (fl>? neginf posinf))
       (test-assert "srfi-144.162 " (fl>? posinf neginf))
       (test-deny "srfi-144.163 "   (fl>? posinf posinf))
       (test-deny "srfi-144.164 "   (fl>? zero nan))
       (test-deny "srfi-144.165 "   (fl>? nan one))
       (test "srfi-144.166 " (map fl>? somereals somereals) allfalse)
       (test "srfi-144.167 " (map fl>? somereals (cdr somereals)) (cdr allfalse))
       (test "srfi-144.168 " (map fl>? (cdr somereals) somereals) (cdr alltrue))

       (test-assert "srfi-144.169 " (fl<=? zero fl-least))
       (test-assert "srfi-144.170 " (fl<=? fl-least fl-least))
       (test-deny "srfi-144.171 "   (fl<=? one fl-least))
       (test-assert "srfi-144.172 " (fl<=? neginf neginf))
       (test-assert "srfi-144.173 " (fl<=? neginf posinf))
       (test-deny "srfi-144.174 "   (fl<=? posinf neginf))
       (test-assert "srfi-144.175 " (fl<=? posinf posinf))
       (test-deny "srfi-144.176 "   (fl<=? zero nan))
       (test-deny "srfi-144.177 "   (fl<=? nan one))
       (test "srfi-144.178 " (map fl<=? somereals somereals) alltrue)
       (test "srfi-144.179 " (map fl<=? somereals (cdr somereals)) (cdr alltrue))
       (test "srfi-144.180 " (map fl<=? (cdr somereals) somereals) (cdr allfalse))

       (test-deny "srfi-144.181 "   (fl>=? zero fl-least))
       (test-assert "srfi-144.182 " (fl>=? fl-least fl-least))
       (test-assert "srfi-144.183 " (fl>=? one fl-least))
       (test-assert "srfi-144.184 " (fl>=? neginf neginf))
       (test-deny "srfi-144.185 "   (fl>=? neginf posinf))
       (test-assert "srfi-144.186 " (fl>=? posinf neginf))
       (test-assert "srfi-144.187 " (fl>=? posinf posinf))
       (test-deny "srfi-144.188 "   (fl>=? zero nan))
       (test-deny "srfi-144.189 "   (fl>=? nan one))
       (test "srfi-144.190 " (map fl>=? somereals somereals) alltrue)
       (test "srfi-144.191 " (map fl>=? somereals (cdr somereals)) (cdr allfalse))
       (test "srfi-144.192 " (map fl>=? (cdr somereals) somereals) (cdr alltrue))

       (test-deny "srfi-144.193 "   (flunordered? zero fl-least))
       (test-deny "srfi-144.194 "   (flunordered? fl-least fl-least))
       (test-deny "srfi-144.195 "   (flunordered? one fl-least))
       (test-deny "srfi-144.196 "   (flunordered? neginf neginf))
       (test-deny "srfi-144.197 "   (flunordered? neginf posinf))
       (test-deny "srfi-144.198 "   (flunordered? posinf neginf))
       (test-deny "srfi-144.199 "   (flunordered? posinf posinf))
       (test-assert "srfi-144.200 " (flunordered? zero nan))
       (test-assert "srfi-144.201 " (flunordered? nan one))
       (test "srfi-144.202 " (map flunordered? somereals somereals) allfalse)
       (test "srfi-144.203 " (map flunordered? somereals (cdr somereals)) (cdr allfalse))
       (test "srfi-144.204 " (map flunordered? (cdr somereals) somereals) (cdr allfalse))

        )

     (test "srfi-144.205 " (flmax) neginf)
     (test "srfi-144.206 " (flmax zero) zero)
     (test "srfi-144.207 " (flmax zero one) one)
     (test "srfi-144.208 " (flmax one zero) one)
     (test "srfi-144.209 " (apply flmax somereals) (car (reverse somereals)))

     (test "srfi-144.210 " (flmin) posinf)
     (test "srfi-144.211 " (flmin one) one)
     (test "srfi-144.212 " (flmin zero one) zero)
     (test "srfi-144.213 " (flmin one zero) zero)
     (test "srfi-144.214 " (apply flmin somereals) (car somereals))

     (test "srfi-144.215 "
           (map flinteger? somereals)
           (map fl=?
                somereals
                (map flround somereals)))

     (test-deny "srfi-144.216 "   (flzero? neginf))
     (test-deny "srfi-144.217 "   (flzero? (fl- fl-least)))
     (test-assert "srfi-144.218 " (flzero? negzero))
     (test-assert "srfi-144.219 " (flzero? zero))
     (test-deny "srfi-144.220 "   (flzero? fl-least))
     (test-deny "srfi-144.221 "   (flzero? posinf))

     (test-deny "srfi-144.222 "   (flpositive? neginf))
     (test-deny "srfi-144.223 "   (flpositive? (fl- fl-least)))
     (test-deny "srfi-144.224 "   (flpositive? negzero))
     (test-deny "srfi-144.225 "   (flpositive? zero))
     (test-assert "srfi-144.226 " (flpositive? fl-least))
     (test-assert "srfi-144.227 " (flpositive? posinf))

     (test-assert "srfi-144.228 " (flnegative? neginf))
     (test-assert "srfi-144.229 " (flnegative? (fl- fl-least)))
     (test-deny "srfi-144.230 "   (flnegative? negzero))    ; explicit in SRFI 144
     (test-deny "srfi-144.231 "   (flnegative? zero))
     (test-deny "srfi-144.232 "   (flnegative? fl-least))
     (test-deny "srfi-144.233 "   (flnegative? posinf))

     (test-deny "srfi-144.234 "   (flodd? zero))
     (test-assert "srfi-144.235 " (flodd? one))

     (test-assert "srfi-144.236 " (fleven? zero))
     (test-deny "srfi-144.237 "   (fleven? one))

     (test "srfi-144.238 " (map flfinite? somereals)
           (map (lambda (x) #t) somereals))
     (test "srfi-144.239 " (map flfinite? weird)
           (map (lambda (x) #f) weird))

     (test-assert "srfi-144.240 " (flinfinite? neginf))
     (test-assert "srfi-144.241 " (flinfinite? posinf))
     (test-deny "srfi-144.242 "   (flinfinite? nan))
     (test "srfi-144.243 " (map flinfinite? somereals)
           (map (lambda (x) #f) somereals))

     (test-deny "srfi-144.244 "   (flnan? neginf))
     (test-deny "srfi-144.245 "   (flnan? posinf))
     (test-assert "srfi-144.246 " (flnan? nan))
     (test "srfi-144.247 " (map flnan? somereals)
           (map (lambda (x) #f) somereals))

     (test-assert "srfi-144.248 " (flnormalized? fl-greatest))
     (test-deny "srfi-144.249 "   (flnormalized? fl-least))
     (test-deny "srfi-144.250 "   (fldenormalized? fl-greatest))
     (test-assert "srfi-144.251 " (fldenormalized? fl-least))

;;      ;; Arithmetic

     (test "srfi-144.252 " (fl+) zero)
     (test "srfi-144.253 " (fl+ zero) zero)
     (test "srfi-144.254 " (flzero? (fl+ negzero)) #t)
     (test "srfi-144.255 " (fl+ one) one)
     (test "srfi-144.256 " (fl+ one one) two)
     (test "srfi-144.257 " (fl+ nan one) nan)
     (test "srfi-144.258 " (fl+ one nan) nan)
     (test "srfi-144.259 " (map fl+ somereals somereals somereals)
           (map (lambda (x) (fl* (flonum 3) x))
                somereals))
     (test "srfi-144.260 " (map fl+ infinities infinities) infinities)
     (test "srfi-144.261 " (map flnan?
                (map fl+ infinities (reverse infinities)))
           (map (lambda (x) #t) infinities))

     (test "srfi-144.262 " (fl*) one)
     (test "srfi-144.263 " (fl* zero) zero)
     (test "srfi-144.264 " (flzero? (fl* negzero)) #t)
     (test "srfi-144.265 " (fl* one) one)
     (test "srfi-144.266 " (fl* one one) one)
     (test "srfi-144.267 " (fl* nan one) nan)
     (test "srfi-144.268 " (fl* one nan) nan)
     (test "srfi-144.269 " (map fl* somereals somereals somereals)
           (map (lambda (x) (flonum (expt x 3)))
                somereals))
     (test "srfi-144.270 " (map fl* infinities infinities)
           (map (lambda (x) posinf) infinities))
     (test "srfi-144.271 " (map fl* infinities (reverse infinities))
           (map (lambda (x) neginf) infinities))

     (let ((three (flonum 3))
           (four  (flonum 4))
           (five  (flonum 5))
           (x23   (flonum 23))
           (ten11 (flonum (expt 10 11)))
           (ten12 (flonum (expt 10 12))))
       (test "srfi-144.272 " (fl+* four five three) x23)
       (test "srfi-144.273 " (fl+* ten11 ten12 one)
             (flonum (+ (* (exact ten11) (exact ten12)) (exact one))))
       (test "srfi-144.274 " (fl+* ten11 ten12 (fl- one))
             (flonum (+ (* (exact ten11) (exact ten12)) (exact (fl- one)))))

       ;; FIXME: the following test assumes IEEE double precision,
       ;; in which (expt 10 23) lies exactly halfway between the
       ;; two nearest flonums.

       ;(test-deny "srfi-144.275 " (fl=? (fl+* ten11 ten12 one)
       ;                 (fl+* ten11 ten12 (fl- one))))
       )

     (test-assert "srfi-144.276 " (flnan? (fl+* zero posinf one)))
     (test-assert "srfi-144.277 " (flnan? (fl+* zero neginf one)))
     (test-assert "srfi-144.278 " (flnan? (fl+* posinf zero one)))
     (test-assert "srfi-144.279 " (flnan? (fl+* neginf zero one)))
     (test-assert "srfi-144.280 " (flnan? (fl+* zero posinf nan)))
     (test-assert "srfi-144.281 " (flnan? (fl+* zero neginf nan)))
     (test-assert "srfi-144.282 " (flnan? (fl+* posinf zero nan)))
     (test-assert "srfi-144.283 " (flnan? (fl+* neginf zero nan)))
     (test "srfi-144.284 " (fl+* fl-greatest fl-greatest neginf) neginf)
     (test "srfi-144.285 " (fl+* fl-greatest (fl- fl-greatest) posinf) posinf)
     (test-assert "srfi-144.286 " (flnan? (fl+* nan one one)))
     (test-assert "srfi-144.287 " (flnan? (fl+* one nan one)))
     (test-assert "srfi-144.288 " (flnan? (fl+* one one nan)))

     (test "srfi-144.289 " (fl- zero) negzero)
     (test "srfi-144.290 " (fl- negzero) zero)
     (test "srfi-144.291 " (fl- one) (flonum -1))
     (test "srfi-144.292 " (fl- one one) zero)
     (test "srfi-144.293 " (fl- nan one) nan)
     (test "srfi-144.294 " (fl- one nan) nan)
     (test "srfi-144.295 " (map fl- somereals somereals somereals)
           (map (lambda (x) (if (eqv? x zero) zero (fl- x)))
                somereals))
     (test "srfi-144.296 " (map flnan? (map fl- infinities infinities))
           '(#t #t))
     (test "srfi-144.297 " (map fl- infinities (reverse infinities))
           infinities)

     (test "srfi-144.298 " (fl/ zero) posinf)
     (test "srfi-144.299 " (fl/ negzero) neginf)
     (test "srfi-144.300 " (fl/ one) one)
     (test "srfi-144.301 " (fl/ one one) one)
     (test "srfi-144.302 " (fl/ nan one) nan)
     (test "srfi-144.303 " (fl/ one nan) nan)
     (test "srfi-144.304 " (map fl/ somereals somereals somereals)
           (map (lambda (x) (if (flzero? x) (fl/ zero zero) (fl/ x)))
                somereals))
     (test "srfi-144.305 " (map flnan? (map fl/ infinities infinities))
           '(#t #t))
     (test "srfi-144.306 " (map flnan? (map fl/ infinities (reverse infinities)))
           '(#t #t))

     (test "srfi-144.307 " (flabs zero) zero)
     (test "srfi-144.308 " (flabs negzero) zero)
     (test "srfi-144.309 " (flabs one) one)
     (test "srfi-144.310 " (flabs (flonum -5.25)) (flonum 5.25))

     (test "srfi-144.311 " (flabsdiff zero one) one)
     (test "srfi-144.312 " (flabsdiff one zero) one)
     (test "srfi-144.313 " (flabsdiff one one) zero)
     (test "srfi-144.314 " (flabsdiff posinf neginf) posinf)
     (test "srfi-144.315 " (flabsdiff neginf posinf) posinf)
;; #|
;;      (test "srfi-144.316 " (flposdiff zero one) zero)
;;      (test "srfi-144.317 " (flposdiff one zero) one)
;;      (test "srfi-144.318 " (flposdiff one one) zero)
;;      (test "srfi-144.319 " (flposdiff posinf neginf) posinf)
;;      (test "srfi-144.320 " (flposdiff neginf posinf) posinf)
;; |#
     (test "srfi-144.321 " (flsgn posinf) one)
     (test "srfi-144.322 " (flsgn neginf) (fl- one))
     (test "srfi-144.323 " (flsgn zero) one)
     (test "srfi-144.324 " (flsgn negzero) (fl- one))
     (test "srfi-144.325 " (flsgn two) one)
     (test "srfi-144.326 " (flsgn (fl- two)) (fl- one))

     (test "srfi-144.327 " (flnumerator (flonum 2.25)) (flonum 9))
     (test "srfi-144.328 " (fldenominator (flonum 2.25)) (flonum 4))
     (test "srfi-144.329 " (flnumerator (flonum -2.25)) (flonum -9))
     (test "srfi-144.330 " (fldenominator (flonum -2.25)) (flonum 4))
     (test "srfi-144.331 " (map flnumerator ints) ints)
     (test "srfi-144.332 " (map fldenominator ints)
           (map (lambda (x) one) ints))
     (test "srfi-144.333 " (map flnumerator weird) weird)
     (test "srfi-144.334 " (map fldenominator infinities) (list one one))
     (test-assert "srfi-144.335 " (flnan? (flnumerator nan)))
     (test-assert "srfi-144.336 " (flnan? (fldenominator nan)))

     (test "srfi-144.337 " (flfloor    (flonum -3.125)) (flonum -4))
     (test "srfi-144.338 " (flceiling  (flonum -3.125)) (flonum -3))
     (test "srfi-144.339 " (flround    (flonum -3.125)) (flonum -3))
     (test "srfi-144.340 " (fltruncate (flonum -3.125)) (flonum -3))

     (test "srfi-144.341 " (flfloor    (flonum -3.75)) (flonum -4))
     (test "srfi-144.342 " (flceiling  (flonum -3.75)) (flonum -3))
     (test "srfi-144.343 " (flround    (flonum -3.75)) (flonum -4))
     (test "srfi-144.344 " (fltruncate (flonum -3.75)) (flonum -3))

     (test "srfi-144.345 " (flfloor    (flonum -3.5)) (flonum -4))
     (test "srfi-144.346 " (flceiling  (flonum -3.5)) (flonum -3))
     (test "srfi-144.347 " (flround    (flonum -3.5)) (flonum -4))
     (test "srfi-144.348 " (fltruncate (flonum -3.5)) (flonum -3))

     (test "srfi-144.349 " (map flfloor    ints) ints)
     (test "srfi-144.350 " (map flceiling  ints) ints)
     (test "srfi-144.351 " (map flround    ints) ints)
     (test "srfi-144.352 " (map fltruncate ints) ints)

     (test "srfi-144.353 " (map flfloor    posfracs) (map (lambda (x) zero) posfracs))
     (test "srfi-144.354 " (map flceiling  posfracs) (map (lambda (x) one) posfracs))
     (test "srfi-144.355 " (map flround    posfracs) (map (lambda (x) zero) posfracs))
     (test "srfi-144.356 " (map fltruncate posfracs) (map (lambda (x) zero) posfracs))

     (test "srfi-144.357 " (map flfloor    weird) weird)
     (test "srfi-144.358 " (map flceiling  weird) weird)
     (test "srfi-144.359 " (map flround    weird) weird)
     (test "srfi-144.360 " (map fltruncate weird) weird)

;;      ;; Exponents and logarithms

     (test "srfi-144.361 " (flexp negzero) one)
     (test "srfi-144.362 " (flexp zero) one)
     (test "srfi-144.363 " (flexp one) fl-e)
     (test/approx "srfi-144.364 " (flexp (fl- one)) fl-1/e)
     (test/approx "srfi-144.365 " (flexp two) fl-e-2)
     (test/approx "srfi-144.366 " (flexp fl-pi/4) fl-e-pi/4)
     (test "srfi-144.367 " (flexp posinf) posinf)
     (test "srfi-144.368 " (flexp fl-greatest) posinf)
     (test/approx "srfi-144.369 " (flexp fl-least) one)
     (test/approx "srfi-144.370 " (flexp (fl- fl-greatest)) zero)
     (test/approx "srfi-144.371 " (flexp neginf) zero)

     (test "srfi-144.372 " (fl+ one (flexp-1 negzero)) one)
     (test "srfi-144.373 " (fl+ one (flexp-1 zero)) one)
     ;; [EG]: Changed the following "test" in "test-approx"
     (test/approx "srfi-144.374 " (fl+ one (flexp-1 one)) fl-e)
     (test/approx "srfi-144.375 " (fl+ one (flexp-1 (fl- one))) fl-1/e)
     (test/approx "srfi-144.376 " (fl+ one (flexp-1 two)) fl-e-2)
     (test/approx "srfi-144.377 " (fl+ one (flexp-1 fl-pi/4)) fl-e-pi/4)
     (test "srfi-144.378 " (fl+ one (flexp-1 posinf)) posinf)
     (test "srfi-144.379 " (fl+ one (flexp-1 fl-greatest)) posinf)
     (test/approx "srfi-144.380 " (fl+ one (flexp-1 fl-least)) one)
     (test/approx "srfi-144.381 " (fl+ one (flexp-1 (fl- fl-greatest))) zero)
     (test/approx "srfi-144.382 " (fl+ one (flexp-1 neginf)) zero)

     (test "srfi-144.383 " (flexp2 negzero) one)
     (test "srfi-144.384 " (flexp2 zero) one)
     (test "srfi-144.385 " (flexp2 one) two)
     (test "srfi-144.386 " (flexp2 (fl- one)) (fl/ two))
     (test "srfi-144.387 " (flexp2 two) (fl* two two))
     (test/approx "srfi-144.388 " (flexp2 fl-log2-e) fl-e)
     (test/approx "srfi-144.389 " (flexp2 fl-log2-e) fl-e)
     (test "srfi-144.390 " (flexp2 posinf) posinf)
     (test "srfi-144.391 " (flexp2 fl-greatest) posinf)
     (test/approx "srfi-144.392 " (flexp2 fl-least) one)
     (test/approx "srfi-144.393 " (flexp2 (fl- fl-greatest)) zero)
     (test/approx "srfi-144.394 " (flexp2 neginf) zero)

     (test "srfi-144.395 " (flsquare zero) zero)
     (test "srfi-144.396 " (flsquare one) one)
     (test "srfi-144.397 " (flsquare two) (fl+ two two))
     (test/approx "srfi-144.398 " (flsquare fl-sqrt-2) two)
     (test/approx "srfi-144.399 " (flsquare fl-sqrt-3) (flonum 3))
     (test/approx "srfi-144.400 " (flsquare fl-sqrt-5) (flonum 5))
     (test/approx "srfi-144.401 " (flsquare fl-sqrt-10) (flonum 10))
     (test "srfi-144.402 " (flsquare (flonum -5)) (flonum 25))
     (test "srfi-144.403 " (flsquare neginf) posinf)
     (test "srfi-144.404 " (flsquare posinf) posinf)

     (test "srfi-144.405 " (flsqrt zero) zero)
     (test "srfi-144.406 " (flsqrt one) one)
     (test/approx "srfi-144.407 " (flsqrt two) fl-sqrt-2)
     (test/approx "srfi-144.408 " (flsqrt (flonum 3)) fl-sqrt-3)
     (test/approx "srfi-144.409 " (flsqrt (flonum 5)) fl-sqrt-5)
     (test/approx "srfi-144.410 " (flsqrt (flonum 10)) fl-sqrt-10)
     (test/approx "srfi-144.411 " (flsqrt (flonum 698)) (flonum 26.419689627245813))
     (test "srfi-144.412 " (flsqrt posinf) posinf)

     (test "srfi-144.413 " (flcbrt zero) zero)
     (test "srfi-144.414 " (flcbrt one) one)
     (test/approx "srfi-144.415 " (flcbrt two) fl-cbrt-2)
     (test/approx "srfi-144.416 " (flcbrt (flonum 3)) fl-cbrt-3)
     (test/approx "srfi-144.417 " (flcbrt (flonum 698)) (flonum 8.8705757224791313))
     (test/approx "srfi-144.418 " (flcbrt (flonum 11.390625)) (flonum 2.25))
     (test/approx "srfi-144.419 " (flcbrt (flonum -11.390625)) (flonum -2.25))
     (test "srfi-144.420 " (flcbrt posinf) posinf)
     (test "srfi-144.421 " (flcbrt neginf) neginf)

     (test "srfi-144.422 " (flhypot zero zero) zero)
     (test "srfi-144.423 " (flhypot zero one) one)
     (test/approx "srfi-144.424 " (flhypot two one) fl-sqrt-5)
     (test/approx "srfi-144.425 " (flhypot (fl- two) one) fl-sqrt-5)
     (test/approx "srfi-144.426 " (flhypot two (fl- one)) fl-sqrt-5)
     (test/approx "srfi-144.427 " (flhypot (fl- two) (fl- one)) fl-sqrt-5)
     (test/approx "srfi-144.428 " (flhypot (fl/ fl-greatest two) (fl/ fl-greatest two))
                  (fl/ fl-greatest fl-sqrt-2))
     (test "srfi-144.429 " (flhypot zero posinf) posinf)
     (test "srfi-144.430 " (flhypot neginf zero) posinf)

     (test "srfi-144.431 " (flexpt two zero) one)
     (test "srfi-144.432 " (flexpt two one) two)
     (test "srfi-144.433 " (flexpt two two) (flonum 4))
     (test/approx "srfi-144.434 " (flexpt two (fl/ two)) fl-sqrt-2)
     (test/approx "srfi-144.435 " (flexpt (flonum 441) (flonum 10))
                  (flonum 2.7821842944695155e26))
     (test/approx "srfi-144.436 " (flexpt (flonum 441) (fl/ (flonum 5)))
                  (flonum 3.37977444523542851))
     (for-each (lambda (x)
                 (for-each (lambda (frac)
                             (test/approx "srfi-144.437 " (flexpt (flexpt x frac) (fl/ frac))
                                          x))
                           posfracs))
               (filter flpositive? somereals))

     (test "srfi-144.438 " (fllog zero) neginf)
     (test "srfi-144.439 " (fllog one) zero)
     (test/approx "srfi-144.440 " (fllog two) fl-log-2)
     (test/approx "srfi-144.441 " (fllog (flonum 3)) fl-log-3)
     (test/approx "srfi-144.442 " (fllog fl-pi) fl-log-pi)
     (test/approx "srfi-144.443 " (fllog (flonum 10)) fl-log-10)
     (test "srfi-144.444 " (fllog posinf) posinf)
     (for-each (lambda (x)
                 (test/approx "srfi-144.445 " (flexp (fllog x)) x))
               (filter flpositive? somereals))

     (test "srfi-144.446 " (fllog2 zero) neginf)
     (test "srfi-144.447 " (fllog2 one) zero)
     (test "srfi-144.448 " (fllog2 two) one)
     (test/approx "srfi-144.449 " (fllog2 fl-e) fl-log2-e)
     (test "srfi-144.450 " (fllog2 posinf) posinf)
     (for-each (lambda (x)
                 (test/approx "srfi-144.451 " (flexpt two (fllog2 x)) x))
               (filter flpositive? somereals))

     (test "srfi-144.452 " (fllog10 zero) neginf)
     (test "srfi-144.453 " (fllog10 one) zero)
     (test/approx "srfi-144.454 " (fllog10 fl-e) fl-log10-e)
     (test "srfi-144.455 " (fllog10 (flonum 10)) one)
     (test "srfi-144.456 " (fllog10 posinf) posinf)
     (for-each (lambda (x)
                 (test/approx "srfi-144.457 " (flexpt (flonum 10) (fllog10 x)) x))
               (filter flpositive? somereals))

     (test-assert "srfi-144.458 " (flpositive? (fllog1+ fl-least)))
     (test "srfi-144.459 " (fllog1+ (fl- zero one)) neginf)
     (test "srfi-144.460 " (fllog1+ (fl- one one)) zero)
     (test/approx "srfi-144.461 " (fllog1+ (fl- two one)) fl-log-2)
     (test/approx "srfi-144.462 " (fllog1+ (fl- (flonum 3) one)) fl-log-3)
     (test/approx "srfi-144.463 " (fllog1+ (fl- fl-pi one)) fl-log-pi)
     (test/approx "srfi-144.464 " (fllog1+ (fl- (flonum 10) one)) fl-log-10)
     (test "srfi-144.465 " (fllog1+ (fl- posinf one)) posinf)
     (for-each (lambda (x)
                 (test/approx "srfi-144.466 " (flexp (fllog1+ (fl- x one))) x))
               (filter flpositive? somereals))

     (test/approx "srfi-144.467 " ((make-fllog-base two) fl-e) fl-log2-e)
     (test/approx "srfi-144.468 " ((make-fllog-base (flonum 10)) fl-e) fl-log10-e)
     (test/approx "srfi-144.469 " ((make-fllog-base fl-e) two) fl-log-2)
     (for-each (lambda (base)
                 (let ((f (make-fllog-base base)))
                   (for-each (lambda (x)
                               (test/approx "srfi-144.470 " (flexpt (flonum base) (f x)) x))
                             (filter flpositive? somereals))))
               (map flonum '(3 7 19)))

     ;; Trigonometric functions

     (test/approx "srfi-144.471 " (flsin zero)           zero)
     (test/approx "srfi-144.472 " (flcos zero)           one)
     (test/approx "srfi-144.473 " (fltan zero)           zero)
     (test/approx "srfi-144.474 " (flsin (flonum 0.2))   0.19866933079506121545941)
     (test/approx "srfi-144.475 " (flcos (flonum 0.2))   0.98006657784124163112420)
     (test/approx "srfi-144.476 " (flsin (flonum 0.5))   0.47942553860420300027329)
     (test/approx "srfi-144.477 " (flcos (flonum 0.5))   0.87758256189037271611628)
     (test/approx "srfi-144.478 " (flsin (flonum 0.7))   0.64421768723769105367261)
     (test/approx "srfi-144.479 " (flcos (flonum 0.7))   0.76484218728448842625586)
     (test/approx "srfi-144.480 " (flsin fl-pi/4)        fl-1/sqrt-2)
     (test/approx "srfi-144.481 " (flcos fl-pi/4)        fl-1/sqrt-2)
     (test/approx "srfi-144.482 " (flsin one)            0.84147098480789651665250)
     (test/approx "srfi-144.483 " (flcos one)            0.54030230586813971740094)
     (test/approx "srfi-144.484 " (flsin fl-pi/2)        one)
     (test/approx "srfi-144.485 " (flcos fl-pi/2)        zero)
     (test/approx "srfi-144.486 " (flsin two)            0.90929742682568169539602)
     (test/approx "srfi-144.487 " (flcos two)            -0.41614683654714238699757)
     (test/approx "srfi-144.488 " (flsin (flonum 3))     0.14112000805986722210074)
     (test/approx "srfi-144.489 " (flcos (flonum 3))     -0.98999249660044545727157)
     (test/approx "srfi-144.490 " (flsin fl-pi)          zero)
     (test/approx "srfi-144.491 " (flcos fl-pi)          (fl- one))
     (test/approx "srfi-144.492 " (flsin fl-2pi)         zero)
     (test/approx "srfi-144.493 " (flcos fl-2pi)         one)
     (test/approx "srfi-144.494 " (flsin (flonum 35))    -0.42818266949615100440675)
     (test/approx "srfi-144.495 " (flcos (flonum 35))    -0.90369220509150675984730)

     (for-each (lambda (x)
                 (test/approx "srfi-144.496 " (flsin x) (fl- (flsin (fl- x))))
                 (test/approx "srfi-144.497 " (flcos x) (flcos (fl- fl-2pi x)))
                 (test/approx "srfi-144.498 " (fltan x) (fl/ (flsin x) (flcos x)))
                 (test/approx "srfi-144.499 " (flhypot (flsin x) (flcos x)) one))
               (filter (lambda (x)
                         (and (flnormalized? x)
                              (fl<? (flabs x) (flonum 10000))))
                       (append somereals posfracs)))

     (for-each (lambda (x)
                 (test/approx "srfi-144.500 " (flsin (flasin x))     x)
                 (test/approx "srfi-144.501 " (flcos (flacos x))     x))
               (filter (lambda (x) (fl<=? (fl- one) x one))
                       (append somereals posfracs)))


     (let ((xs (filter (lambda (x)
                         (and (flnormalized? x)
                              (fl<? (flabs x) (flonum 10000))))
                       (append somereals posfracs))))
       (for-each (lambda (x)
                   (let ((theta (flatan x)))
                     (test/approx "srfi-144.502 " (fl/ (flsin theta) (flcos theta)) x))
                   (for-each (lambda (y)
                               (let ((theta (flatan x)))
                                 (test/approx "srfi-144.503 " (flatan (flsin theta)
                                                      (flcos theta))
                                              theta)))
                             xs))
                 xs))

     (test/approx "srfi-144.504 " (flsinh zero)           zero)
     (test/approx "srfi-144.505 " (flcosh zero)           one)
     (test/approx "srfi-144.506 " (flsinh (flonum 0.2))   0.201336002541094)
     (test/approx "srfi-144.507 " (flcosh (flonum 0.2))   1.020066755619076)
     (test/approx "srfi-144.508 " (flsinh (flonum 0.5))   0.521095305493747)
     (test/approx "srfi-144.509 " (flcosh (flonum 0.5))   1.127625965206381)
     (test/approx "srfi-144.510 " (flsinh (flonum 0.7))   0.758583701839534)
     (test/approx "srfi-144.511 " (flcosh (flonum 0.7))   1.255169005630943)
     (test/approx "srfi-144.512 " (flsinh one)            1.175201193643801)
     (test/approx "srfi-144.513 " (flcosh one)            1.543080634815244)
     (test/approx "srfi-144.514 " (flsinh two)            3.626860407847019)
     (test/approx "srfi-144.515 " (flcosh two)            3.762195691083631)
     (test/approx "srfi-144.516 " (flsinh (flonum 3))     10.01787492740990)
     (test/approx "srfi-144.517 " (flcosh (flonum 3))     10.06766199577777)
     (test/approx "srfi-144.518 " (flsinh (flonum 10))    11013.23287470339)
     (test/approx "srfi-144.519 " (flcosh (flonum 10))    11013.23292010332)

     (for-each (lambda (x)
                 (test/approx "srfi-144.520 " (flasinh (flsinh x)) x)
                 (test/approx "srfi-144.521 " (flacosh (flcosh x)) (flabs x))
                 (test/approx "srfi-144.522 " (flatanh (fltanh x)) x))
               (filter (lambda (x)
                         (fl<? (flabs x) (flonum 100)))
                       (append somereals posfracs (map fl- posfracs))))

     ;; Integer division

     (test "srfi-144.523 " (flquotient  (flonum 9.75) (flonum 0.5))     (flonum 19))
     (test "srfi-144.524 " (flremainder (flonum 9.75) (flonum 0.5))     (flonum 0.25))
     (test "srfi-144.525 " (flquotient  (flonum -9.75) (flonum 0.5))    (flonum -19))
     (test "srfi-144.526 " (flremainder (flonum -9.75) (flonum 0.5))    (flonum -0.25))
     (test "srfi-144.527 " (flquotient  (flonum 9.75) (flonum -0.5))    (flonum -19))
     (test "srfi-144.528 " (flremainder (flonum 9.75) (flonum -0.5))    (flonum 0.25))
     (test "srfi-144.529 " (flquotient  (flonum -9.75) (flonum -0.5))   (flonum 19))
     (test "srfi-144.530 " (flremainder (flonum -9.75) (flonum -0.5))   (flonum -0.25))

     (let ((f (lambda (x y)
                (call-with-values
                 (lambda () (flremquo x y))
                 (lambda (r q)
                   (list r (modulo q 8)))))))

       (test "srfi-144.531 " (f (flonum 15.875) (flonum 0.5))
             (list (flonum -0.125) 0))
       (test "srfi-144.532 " (f (flonum 16.000) (flonum 0.5))
             (list (flonum +0.000) 0))
       (test "srfi-144.533 " (f (flonum 16.125) (flonum 0.5))
             (list (flonum +0.125) 0))
       (test "srfi-144.534 " (f (flonum 16.250) (flonum 0.5))
             (list (flonum +0.250) 0))

       (test "srfi-144.535 " (f (flonum 16.875) (flonum 0.5))
             (list (flonum -0.125) 2))
       (test "srfi-144.536 " (f (flonum 17.000) (flonum 0.5))
             (list (flonum +0.000) 2))
       (test "srfi-144.537 " (f (flonum 17.125) (flonum 0.5))
             (list (flonum +0.125) 2))
       (test "srfi-144.538 " (f (flonum 17.250) (flonum 0.5))
             (list (flonum +0.250) 2))

       (test "srfi-144.539 " (f (flonum 17.875) (flonum 0.5))
             (list (flonum -0.125) 4))
       (test "srfi-144.540 " (f (flonum 18.000) (flonum 0.5))
             (list (flonum +0.000) 4))
       (test "srfi-144.541 " (f (flonum 18.125) (flonum 0.5))
             (list (flonum +0.125) 4))
       (test "srfi-144.542 " (f (flonum 18.250) (flonum 0.5))
             (list (flonum +0.250) 4))

       (test "srfi-144.543 " (f (flonum 18.875) (flonum 0.5))
             (list (flonum -0.125) 6))
       (test "srfi-144.544 " (f (flonum 19.000) (flonum 0.5))
             (list (flonum +0.000) 6))
       (test "srfi-144.545 " (f (flonum 19.125) (flonum 0.5))
             (list (flonum +0.125) 6))
       (test "srfi-144.546 " (f (flonum 19.250) (flonum 0.5))
             (list (flonum +0.250) 6))

       (test "srfi-144.547 " (f (flonum 15.375) (flonum 0.5))
             (list (flonum -0.125) 7))
       (test "srfi-144.548 " (f (flonum 16.500) (flonum 0.5))
             (list (flonum +0.000) 1))
       (test "srfi-144.549 " (f (flonum 16.625) (flonum 0.5))
             (list (flonum +0.125) 1))
       (test "srfi-144.550 " (f (flonum 16.750) (flonum 0.5))
             (list (flonum -0.250) 2))

       (test "srfi-144.551 " (f (flonum 16.375) (flonum 0.5))
             (list (flonum -0.125) 1))
       (test "srfi-144.552 " (f (flonum 17.500) (flonum 0.5))
             (list (flonum +0.000) 3))
       (test "srfi-144.553 " (f (flonum 17.625) (flonum 0.5))
             (list (flonum +0.125) 3))
       (test "srfi-144.554 " (f (flonum 17.750) (flonum 0.5))
             (list (flonum -0.250) 4))

       (test "srfi-144.555 " (f (flonum 17.375) (flonum 0.5))
             (list (flonum -0.125) 3))
       (test "srfi-144.556 " (f (flonum 18.500) (flonum 0.5))
             (list (flonum +0.000) 5))
       (test "srfi-144.557 " (f (flonum 18.625) (flonum 0.5))
             (list (flonum +0.125) 5))
       (test "srfi-144.558 " (f (flonum 38.750) (flonum 0.5))
             (list (flonum -0.250) 6))

       (test "srfi-144.559 " (f (flonum 18.375) (flonum 0.5))
             (list (flonum -0.125) 5))
       (test "srfi-144.560 " (f (flonum 19.500) (flonum 0.5))
             (list (flonum +0.000) 7))
       (test "srfi-144.561 " (f (flonum 19.625) (flonum 0.5))
             (list (flonum +0.125) 7))
       (test "srfi-144.562 " (f (flonum 19.750) (flonum 0.5))
             (list (flonum -0.250) 0))

        )

      ;; Special functions

     (test/approx "srfi-144.563 " (flgamma (flonum 0.5)) fl-gamma-1/2)
     (test/approx "srfi-144.564 " (flgamma (flonum #i1/3)) fl-gamma-1/3)
     (test/approx "srfi-144.565 " (flgamma (flonum #i2/3)) fl-gamma-2/3)
     (test/approx "srfi-144.566 " (flgamma (flonum 0.75)) (flonum 1.225416702465178))
     (test "srfi-144.567 " (flgamma one) one)
     (test/approx "srfi-144.568 " (flgamma (flonum 1.25)) (flonum 0.906402477055477))
     (test/approx "srfi-144.569 " (flgamma (flonum 1.38)) (flonum 0.888537149431357))
     (test/approx "srfi-144.570 " (flgamma (flonum 1.50)) (fl/ (flsqrt fl-pi) two))
     (test "srfi-144.571 " (flgamma two) one)
     (test/approx "srfi-144.572 " (flgamma (flonum 11)) (flonum 3628800))
     (test/approx "srfi-144.573 " (flgamma (flonum 11.5))
                  (* 10.5 9.5 8.5 7.5 6.5 5.5 4.5 3.5 2.5 1.5 0.5
                     fl-gamma-1/2))
     (test/approx "srfi-144.574 " (flgamma (flonum 1.3))
                  (* 0.3 -0.7 -1.7 -2.7 -3.7 -4.7 -5.7 -6.7
                     (flgamma (flonum -6.7))))
     (test/approx "srfi-144.575 " (flgamma (flonum 1.3))
                  (* 0.3 -0.7 -1.7 -2.7 -3.7 -4.7 -5.7 -6.7 -7.7
                     (flgamma (flonum -7.7))))
     (test/approx "srfi-144.576 " (flgamma (flonum 76.5))
                  (flonum 2.159256448318447e110))
     (test/approx "srfi-144.577 " (flgamma (flonum 100))
                  (flonum 9.332621544439442e155))

     (let* ((f (lambda (x)
                 (call-with-values
                  (lambda () (flloggamma x))
                  list)))
            (g (lambda (x) (car (f x))))
            (s (lambda (x) (cadr (f x)))))
       (test/approx "srfi-144.578 " (g (flonum 0.5)) (log fl-gamma-1/2))
       (test/approx "srfi-144.579 " (g (flonum #i1/3)) (log fl-gamma-1/3))
       (test/approx "srfi-144.580 " (g (flonum #i2/3)) (log fl-gamma-2/3))
       (test/approx "srfi-144.581 " (g (flonum 0.75)) (log (flonum 1.225416702465178)))
       (test/approx "srfi-144.582 " (g one) (log one))
       (test/approx "srfi-144.583 " (g (flonum 1.25)) (log (flonum 0.906402477055477)))
       (test/approx "srfi-144.584 " (g (flonum 1.38)) (log (flonum 0.888537149431357)))
       (test/approx "srfi-144.585 " (g (flonum 1.50)) (log (fl/ (flsqrt fl-pi) two)))
       (test/approx "srfi-144.586 " (g two) (log one))
       (test/approx "srfi-144.587 " (g (flonum 11)) (log (flonum 3628800)))
       (test/approx "srfi-144.588 " (g (flonum 1000))
                     (apply + (map log (cdr (iota 1000)))))
       (test/approx "srfi-144.589 " (g (flonum -0.5))
                    (log (flabs (flgamma (flonum -0.5)))))
       (test/approx "srfi-144.590 " (g (flonum -49.2))
                    (log (flabs (flgamma (flonum -49.2)))))
       (test/approx "srfi-144.591 " (g (flonum -50.3))
                    (log (flabs (flgamma (flonum -50.3)))))
       (test/approx "srfi-144.592 " (g (flonum -100.5))
                    (log (flabs (flgamma (flonum -100.5)))))
       (test/approx "srfi-144.593 " (g posinf) posinf)
       (test "srfi-144.594 " +inf.0 (g neginf))
       (test "srfi-144.595 " +inf.0 (g zero))
       (test "srfi-144.596 " +nan.0 (g nan))

       (test "srfi-144.597 " (s (flonum 0.5))   one)
       (test "srfi-144.598 " (s (flonum #i1/3)) one)
       (test "srfi-144.599 " (s (flonum #i2/3)) one)
       (test "srfi-144.600 " (s (flonum 0.75))  one)
       (test "srfi-144.601 " (s one)            one)
       (test "srfi-144.602 " (s (flonum 1.25))  one)
       (test "srfi-144.603 " (s (flonum 1.38))  one)
       (test "srfi-144.604 " (s (flonum 1.50))  one)
       (test "srfi-144.605 " (s two)            one)
       (test "srfi-144.606 " (s (flonum 11))    one)
       (test "srfi-144.607 " (s (flonum 1000))  one)
       (test "srfi-144.608 " (s (flonum -0.5))  (fl- one))
       (test "srfi-144.609 " (s (flonum -49.2)) one)
       (test "srfi-144.610 " (s (flonum -50.3)) (fl- one))
       (test "srfi-144.611 " (s (flonum -999.5)) one)
       (test "srfi-144.612 " (s (flonum -1000.5)) (fl- one))
        )

     (test "srfi-144.613 " (flfirst-bessel 0 zero) one)
     (test "srfi-144.614 " (flfirst-bessel 1 zero) zero)
     (test "srfi-144.615 " (flfirst-bessel 2 zero) zero)
     (test "srfi-144.616 " (flfirst-bessel 3 zero) zero)
     (test "srfi-144.617 " (flfirst-bessel 4 zero) zero)
     (test "srfi-144.618 " (flfirst-bessel 5 zero) zero)
     (test "srfi-144.619 " (flfirst-bessel 6 zero) zero)
     (test "srfi-144.620 " (flfirst-bessel 7 zero) zero)
     (test "srfi-144.621 " (flfirst-bessel 8 zero) zero)
     (test "srfi-144.622 " (flfirst-bessel 9 zero) zero)

     (test/approx "srfi-144.623 " (flfirst-bessel 0 (flonum 0.4))
                  (flonum 0.960398226659563))
     (test/approx "srfi-144.624 " (flfirst-bessel 1 (flonum 0.4))
                  (flonum 0.196026577955319))
     (test/approx "srfi-144.625 " (flfirst-bessel 2 (flonum 0.4))
                  (flonum 0.01973466311703027))
     (test/approx "srfi-144.626 " (flfirst-bessel 3 (flonum 0.4))
                  (flonum 1.320053214983958e-3))
     (test/approx "srfi-144.627 " (flfirst-bessel 4 (flonum 0.4))
                  (flonum 6.613510772909677e-5))
     (test/approx "srfi-144.628 " (flfirst-bessel 5 (flonum 0.4))
                  (flonum 2.648939597977585e-6))
     (test/approx "srfi-144.629 " (flfirst-bessel 6 (flonum 0.4))
                  (flonum 8.838222034285578e-8))
     (test/approx "srfi-144.630 " (flfirst-bessel 7 (flonum 0.4))
                  (flonum 2.527012308088268e-9))
     (test/approx "srfi-144.631 " (flfirst-bessel 8 (flonum 0.4))
                  (flonum 6.321044023358773e-11))
     (test/approx "srfi-144.632 " (flfirst-bessel 9 (flonum 0.4))
                  (flonum 1.405301255241872e-12))

     (test/approx "srfi-144.633 " (flfirst-bessel 0 one)
                  (flonum 0.765197686557967))
     (test/approx "srfi-144.634 " (flfirst-bessel 1 one)
                  (flonum 0.440050585744934))
     (test/approx "srfi-144.635 " (flfirst-bessel 2 one)
                  (flonum 0.114903484931900))
     (test/approx "srfi-144.636 " (flfirst-bessel 3 one)
                  (flonum 1.956335398266841e-2))
     (test/approx "srfi-144.637 " (flfirst-bessel 4 one)
                  (flonum 2.476638964109955e-3))
     (test/approx "srfi-144.638 " (flfirst-bessel 5 one)
                  (flonum 2.497577302112344e-4))
     (test/approx "srfi-144.639 " (flfirst-bessel 6 one)
                  (flonum 2.093833800238927e-5))
     (test/approx "srfi-144.640 " (flfirst-bessel 7 one)
                  (flonum 1.502325817436808e-6))
     (test/approx "srfi-144.641 " (flfirst-bessel 8 one)
                  (flonum 9.422344172604501e-8))
     (test/approx "srfi-144.642 " (flfirst-bessel 9 one)
                  (flonum 5.249250179911875e-9))

     (test/approx "srfi-144.643 " (flfirst-bessel 0 (flonum 17))
                  (flonum -0.1698542521511835))
     (test/approx "srfi-144.644 " (flfirst-bessel 1 (flonum 17))
                  (flonum -0.09766849275778065))
     (test/approx "srfi-144.645 " (flfirst-bessel 2 (flonum 17))
                  (flonum 0.1583638412385035))
     (test/approx "srfi-144.646 " (flfirst-bessel 3 (flonum 17))
                  (flonum 0.1349305730591932))
     (test/approx "srfi-144.647 " (flfirst-bessel 4 (flonum 17))
                  (flonum -0.1107412860446706))
     (test/approx "srfi-144.648 " (flfirst-bessel 5 (flonum 17))
                  (flonum -0.1870441194231559))
     (test/approx "srfi-144.649 " (flfirst-bessel 6 (flonum 17))
                  (flonum 0.0007153334428141831))
     (test/approx "srfi-144.650 " (flfirst-bessel 7 (flonum 17))
                  (flonum 0.1875490606769070))
     (test/approx "srfi-144.651 " (flfirst-bessel 8 (flonum 17))
                  (flonum 0.1537368341734622))
     (test/approx "srfi-144.652 " (flfirst-bessel 9 (flonum 17))
                  (flonum -0.04285556969011908))

     (test/approx "srfi-144.653 " (flfirst-bessel 0 (flonum 50))
                  (flonum +5.581232766925182e-2))
     (test/approx "srfi-144.654 " (flfirst-bessel 1 (flonum 50))
                  (flonum -9.751182812517514e-2))
     (test/approx "srfi-144.655 " (flfirst-bessel 2 (flonum 50))
                  (flonum -5.971280079425882e-2))
     (test/approx "srfi-144.656 " (flfirst-bessel 3 (flonum 50))
                  (flonum +9.273480406163443e-2))
     (test/approx "srfi-144.657 " (flfirst-bessel 4 (flonum 50))
                  (flonum +7.084097728165495e-2))
     (test/approx "srfi-144.658 " (flfirst-bessel 5 (flonum 50))
                  (flonum -8.140024769656964e-2))
     (test/approx "srfi-144.659 " (flfirst-bessel 6 (flonum 50))
                  (flonum -8.712102682096888e-2))
     (test/approx "srfi-144.660 " (flfirst-bessel 7 (flonum 50))
                  (flonum +6.049120125953711e-2))
     (test/approx "srfi-144.661 " (flfirst-bessel 8 (flonum 50))
                  (flonum +1.040585631736393e-1))
     (test/approx "srfi-144.662 " (flfirst-bessel 9 (flonum 50))
                  (flonum -2.719246104397254e-2))

     (let ((f (lambda (n x y)
                (test/approx "srfi-144.663 " (fl/ (flfirst-bessel n x) y)
                             (flexpt x (flonum n))))))
       (f 10 (flonum 8) 5.659370382712330e-11)
       (f 11 (flonum 8) 2.979844833403859e-12)
       (f 20 (flonum 8) 1.804618055659560e-25)
       (f 21 (flonum 8) 4.456237531615702e-27))

     (test/approx "srfi-144.664 " (flfirst-bessel 10 (flonum 10))  2.074861066333589e-1)
     (test/approx "srfi-144.665 " (flfirst-bessel 15 (flonum 10))  4.507973143721253e-3)
     (test/approx "srfi-144.666 " (flfirst-bessel 20 (flonum 10))  1.151336924781340e-5)
     (test/approx "srfi-144.667 " (flfirst-bessel 50 (flonum 10))  1.784513607871595e-30)
     (test/approx "srfi-144.668 " (flfirst-bessel 100 (flonum 10)) 6.597316064155381e-89)

     (test/approx "srfi-144.669 " (flfirst-bessel 10 (flonum 100))  -5.473217693547201e-2)
     (test/approx "srfi-144.670 " (flfirst-bessel 15 (flonum 100))  +1.519812122392732e-2)
     (test/approx "srfi-144.671 " (flfirst-bessel 20 (flonum 100))  +6.221745849833875e-2)
     (test/approx "srfi-144.672 " (flfirst-bessel 50 (flonum 100))  -3.869833972852538e-2)
     (test/approx "srfi-144.673 " (flfirst-bessel 100 (flonum 100)) +9.636667329586156e-2)


     (test "srfi-144.674 " (flsecond-bessel 0 zero) neginf)
     (test "srfi-144.675 " (flsecond-bessel 1 zero) neginf)
     (test "srfi-144.676 " (flsecond-bessel 2 zero) neginf)
     (test "srfi-144.677 " (flsecond-bessel 3 zero) neginf)
     (test "srfi-144.678 " (flsecond-bessel 4 zero) neginf)
     (test "srfi-144.679 " (flsecond-bessel 5 zero) neginf)
     (test "srfi-144.680 " (flsecond-bessel 6 zero) neginf)
     (test "srfi-144.681 " (flsecond-bessel 7 zero) neginf)
     (test "srfi-144.682 " (flsecond-bessel 8 zero) neginf)
     (test "srfi-144.683 " (flsecond-bessel 9 zero) neginf)
     (test "srfi-144.684 " (flsecond-bessel 10 zero) neginf)
     (test "srfi-144.685 " (flsecond-bessel 20 zero) neginf)

     (test/approx "srfi-144.686 " (flsecond-bessel 0 (flonum 0.4))
                  (flonum -0.6060245684270096))
     (test/approx "srfi-144.687 " (flsecond-bessel 1 (flonum 0.4))
                  (flonum -1.780872044270051))
     (test/approx "srfi-144.688 " (flsecond-bessel 2 (flonum 0.4))
                  (flonum -8.298335652923247))
     (test/approx "srfi-144.689 " (flsecond-bessel 3 (flonum 0.4))
                  (flonum -8.120248448496242e1))
     (test/approx "srfi-144.690 " (flsecond-bessel 4 (flonum 0.4))
                  (flonum -1.209738931621513e3))
     (test/approx "srfi-144.691 " (flsecond-bessel 5 (flonum 0.4))
                  (flonum -2.411357614794530e4))
     (test/approx "srfi-144.692 " (flsecond-bessel 6 (flonum 0.4))
                  (flonum -6.016296647670110e5))
     (test/approx "srfi-144.693 " (flsecond-bessel 7 (flonum 0.4))
                  (flonum -1.802477636686238e7))
     (test/approx "srfi-144.694 " (flsecond-bessel 8 (flonum 0.4))
                  (flonum -6.302655431754164e8))
     (test/approx "srfi-144.695 " (flsecond-bessel 9 (flonum 0.4))
                  (flonum -2.519259695064979e10))

     (test/approx "srfi-144.696 " (flsecond-bessel 0 one)
                  (flonum +0.08825696421567696))
     (test/approx "srfi-144.697 " (flsecond-bessel 1 one)
                  (flonum -0.7812128213002887))
     (test/approx "srfi-144.698 " (flsecond-bessel 2 one)
                  (flonum -1.650682606816254))
     (test/approx "srfi-144.699 " (flsecond-bessel 3 one)
                  (flonum -5.821517605964729))
     (test/approx "srfi-144.700 " (flsecond-bessel 4 one)
                  (flonum -3.327842302897212e1))
     (test/approx "srfi-144.701 " (flsecond-bessel 5 one)
                  (flonum -2.604058666258122e2))
     (test/approx "srfi-144.702 " (flsecond-bessel 6 one)
                  (flonum -2.570780243229150e3))
     (test/approx "srfi-144.703 " (flsecond-bessel 7 one)
                  (flonum -3.058895705212399e4))
     (test/approx "srfi-144.704 " (flsecond-bessel 8 one)
                  (flonum -4.256746184865067e5))
     (test/approx "srfi-144.705 " (flsecond-bessel 9 one)
                  (flonum -6.780204938731983e6))

     (test/approx "srfi-144.706 " (flsecond-bessel 0 (flonum 17))
                  (flonum -0.09263719844232369))
     (test/approx "srfi-144.707 " (flsecond-bessel 1 (flonum 17))
                  (flonum +0.1672050360772337))
     (test/approx "srfi-144.708 " (flsecond-bessel 2 (flonum 17))
                  (flonum +0.1123083791572924))
     (test/approx "srfi-144.709 " (flsecond-bessel 3 (flonum 17))
                  (flonum -0.1407795350990472))
     (test/approx "srfi-144.710 " (flsecond-bessel 4 (flonum 17))
                  (flonum -0.1619952738981326))
     (test/approx "srfi-144.711 " (flsecond-bessel 5 (flonum 17))
                  (flonum +0.06454646502933781))
     (test/approx "srfi-144.712 " (flsecond-bessel 6 (flonum 17))
                  (flonum +0.1999637827389195))
     (test/approx "srfi-144.713 " (flsecond-bessel 7 (flonum 17))
                  (flonum +0.07660444043342891))
     (test/approx "srfi-144.714 " (flsecond-bessel 8 (flonum 17))
                  (flonum -0.1368777729702134))
     (test/approx "srfi-144.715 " (flsecond-bessel 9 (flonum 17))
                  (flonum -0.2054305796995121))

     (test/approx "srfi-144.716 " (flsecond-bessel 0 (flonum 50))
                  (flonum -9.806499547007708e-2))
     (test/approx "srfi-144.717 " (flsecond-bessel 1 (flonum 50))
                  (flonum -5.679566856201477e-2))
     (test/approx "srfi-144.718 " (flsecond-bessel 2 (flonum 50))
                  (flonum +9.579316872759649e-2))
     (test/approx "srfi-144.719 " (flsecond-bessel 3 (flonum 50))
                  (flonum +6.445912206022249e-2))
     (test/approx "srfi-144.720 " (flsecond-bessel 4 (flonum 50))
                  (flonum -8.805807408036979e-2))
     (test/approx "srfi-144.721 " (flsecond-bessel 5 (flonum 50))
                  (flonum -7.854841391308165e-2))
     (test/approx "srfi-144.722 " (flsecond-bessel 6 (flonum 50))
                  (flonum +7.234839129775346e-2))
     (test/approx "srfi-144.723 " (flsecond-bessel 7 (flonum 50))
                  (flonum +9.591202782454248e-2))
     (test/approx "srfi-144.724 " (flsecond-bessel 8 (flonum 50))
                  (flonum -4.549302350688156e-2))
     (test/approx "srfi-144.725 " (flsecond-bessel 9 (flonum 50))
                  (flonum -1.104697953467446e-1))

     (let ((f (lambda (n x y)
                (test/approx "srfi-144.726 " (fl/ (flsecond-bessel n x) y)
                             (flexpt x (flonum (- n)))))))
       (f 10 (flonum 8) -0.97356279e9)
       (f 20 (flonum 8) -0.962608e23)
       )

     (test/approx "srfi-144.727 " (flsecond-bessel 10 (flonum 10))   -3.598141521834027e-1)
     (test/approx "srfi-144.728 " (flsecond-bessel 15 (flonum 10))   -6.364745876939129e0)
     (test/approx "srfi-144.729 " (flsecond-bessel 20 (flonum 10))   -1.597483848269626e3)
     (test/approx "srfi-144.730 " (flsecond-bessel 50 (flonum 10))   -3.641066501800740e27)
     (test/approx "srfi-144.731 " (flsecond-bessel 100 (flonum 10))  -4.849148271180607e85)

     (test/approx "srfi-144.732 " (flsecond-bessel 10 (flonum 100))  +5.833157423641493e-2)
     (test/approx "srfi-144.733 " (flsecond-bessel 15 (flonum 100))  +7.879068694670284e-2)
     (test/approx "srfi-144.734 " (flsecond-bessel 20 (flonum 100))  +5.124797307618842e-2)
     (test/approx "srfi-144.735 " (flsecond-bessel 50 (flonum 100))  +7.650526394480304e-2)
     (test/approx "srfi-144.736 " (flsecond-bessel 100 (flonum 100)) -1.669214114175765e-1)


     (test "srfi-144.737 " (flerf zero) zero)
     (test "srfi-144.738 " (flerf posinf) one)
     (test "srfi-144.739 " (flerf neginf) (fl- one))

     (test/approx "srfi-144.740 " (flerf (flonum -0.5)) -0.5204998778130465)
     (test/approx "srfi-144.741 " (flerf (flonum -1.0)) -0.8427007929497149)
     (test/approx "srfi-144.742 " (flerf (flonum -1.5)) -0.9661051464753107)
     (test/approx "srfi-144.743 " (flerf (flonum -2.0)) -0.9953222650189527)

     (test/approx "srfi-144.744 " (flerf (flonum 0.25))  0.2763263901682369)
     (test/approx "srfi-144.745 " (flerf (flonum 0.50))  0.5204998778130465)
     (test/approx "srfi-144.746 " (flerf (flonum 0.75))  0.7111556336535151)
     (test/approx "srfi-144.747 " (flerf (flonum 1.00))  0.8427007929497149)
     (test/approx "srfi-144.748 " (flerf (flonum 1.25))  0.9229001282564582)
     (test/approx "srfi-144.749 " (flerf (flonum 1.50))  0.9661051464753107)
     (test/approx "srfi-144.750 " (flerf (flonum 1.75))  0.9866716712191824)
     (test/approx "srfi-144.751 " (flerf (flonum 2.00))  0.9953222650189527)

     (test "srfi-144.752 " (flerfc zero) one)
     (test "srfi-144.753 " (flerfc posinf) zero)
     (test "srfi-144.754 " (flerfc neginf) two)

     (test/approx "srfi-144.755 " (flerfc (flonum -0.5)) 1.520499877813047)
     (test/approx "srfi-144.756 " (flerfc (flonum -1.0)) 1.842700792949715)
     (test/approx "srfi-144.757 " (flerfc (flonum -1.5)) 1.966105146475310)
     (test/approx "srfi-144.758 " (flerfc (flonum -2.0)) 1.995322265018953)

     (test/approx "srfi-144.759 " (flerfc (flonum 0.25)) (- 1.0 0.2763263901682369))
     (test/approx "srfi-144.760 " (flerfc (flonum 0.50)) (- 1.0 0.5204998778130465))
     (test/approx "srfi-144.761 " (flerfc (flonum 0.75)) (- 1.0 0.7111556336535151))
     (test/approx "srfi-144.762 " (flerfc (flonum 1.00)) (- 1.0 0.8427007929497149))
     (test/approx "srfi-144.763 " (flerfc (flonum 1.25)) (- 1.0 0.9229001282564582))
     (test/approx "srfi-144.764 " (flerfc (flonum 1.50)) (- 1.0 0.9661051464753107))
     (test/approx "srfi-144.765 " (flerfc (flonum 1.75)) (- 1.0 0.9866716712191824))
     (test/approx "srfi-144.766 " (flerfc (flonum 2.00)) (- 1.0 0.9953222650189527))

     (let* ((f (lambda (x y)
                 (test/approx "srfi-144.767 " (fl* x (flexp (flsquare x)) (flerfc x))
                              y)))
            (g (lambda (x^-2 y)
                 (f (flsqrt (fl/ x^-2)) y))))
       (g (flonum 0.250) 0.5107913526210115)
       (g (flonum 0.125) 0.5340672374463438)
       (g (flonum 0.100) 0.5394141079847177)
       (g (flonum 0.075) 0.5450551142044333)
       (g (flonum 0.050) 0.5510294916242269)
       (g (flonum 0.025) 0.5573864515094235)
       (g (flonum 0.020) 0.5587090260270524)
       (g (flonum 0.015) 0.5600499741400112)
       (g (flonum 0.010) 0.5614099274382259)
       (g (flonum 0.005) 0.5627895581750243))
