Re: implementation comments
Bradley Lucier 10 Aug 2026 15:10 UTC
In 278.sld you have
((library (srfi 144))
(import (only (srfi 144)
flonum
fl-greatest
fl-epsilon
fladjacent
fl-pi/2
fl-pi/4
make-flonum
flexponent
flasinh
flsinh
flcosh
flatanh
fllog1+))
(begin (define fl-least-normal
(- 1.0 (fladjacent 1.0 0.0)))))
I think that in 278.sld the definition you give of fl-least-normal is
the value of fl-epsilon.
The Gambit test suite has minimal unit tests for some routines in this
SRFI in this directory:
https://github.com/gambit/gambit/tree/master/tests/unit-tests/03-number
They use the following definitions:
;;; Naive, but correct, definitions of inverse trigonometric and
;;; hyperbolic functions in terms of log and sqrt.
(define (test-atanh z)
(declare (standard-bindings) (generic))
(* 1/2 (- (log (+ 1 z)) (log (- 1 z)))))
(define (test-atan z)
(declare (standard-bindings) (generic))
(/ (test-atanh (* +i z)) +i))
(define (test-asinh z)
(declare (standard-bindings) (generic))
(log (+ z (sqrt (+ (* z z) 1)))))
(define (test-asin z)
(declare (standard-bindings) (generic))
(/ (test-asinh (* +i z)) +i))
(define (test-acos z)
(declare (standard-bindings) (generic))
(- (macro-inexact-+pi/2) (test-asin z)))
(define (test-acosh z)
(declare (standard-bindings) (generic))
(* 2 (log (+ (sqrt (/ (+ z 1) 2)) (sqrt (/ (- z 1) 2))))))
Brad