On Thu, Sep 22, 2016 at 2:32 PM, Bradley Lucier <xxxxxx@math.purdue.edu> wrote:

1.  Under  (flonum number)  you state

 Returns the closest flonum equivalent to number in the sense of = and <.

I don't know what this means. 

The idea is that there is a flonum = to the argument, we return it; if not, we return the nearest flonum equivalent.  I sort of conflated those two things.
Changed to:

If <em>number</em> is inexact and there exists a flonum that is the same
(in the sense of <tt>=</tt>) to <em>number</em>, returns that flonum. If
there does not exist such a flonum, returns the nearest flonum, where
"nearest" is implementation-dependent. If <em>number</em> is exact,
applies <tt>inexact</tt> or <tt>exact->inexact</tt> to <em>number</em> first.
 
(I'm presuming that I'm an example of a person who should understand everything in this SRFI.)

You know much more about it than I do, and I'm very grateful for your review.


2.  Under  (make-binary-flonum x n) it says

 Returns the flonum (fl* x (expt fl-radix n)), where n is a non-negative integer with an implementation-dependent maximum value. (C99 scalbn)

Why is this "make-binary-flonum", when "make-flonum" assumes that the fl-radix is 2?

Cut and paste disease.  Fixed.  

3. Under (flinteger-fraction x) it says

 Returns two values, the integral part of x as a flonum and the fractional part of x as a flonum. (C99 modf)

This site http://en.cppreference.com/w/cpp/numeric/math/modf gives a much more detailed specification of modf.

In general, this SRFI does not specify what is returned by many functions when the arguments are +inf.0, -inf.0, or a Not-a-Number (NaN).

Is this SRFI meant just as a FFI interface to C library routines, or as something different?


The ones with C library equivalents are, the rest are not.  I'll add that to the spec.  However, the spec is supposed to sort-of work even on systems without IEEE floats.
 
4. Under (flnormalized-fraction-exponent x) you use the form

(fl* y (flexpt 2 n))

flexpt takes flonum arguments; "2" is not a flonum; is "n" supposed to be a flonum?

I removed the fl prefixes here, and clarified that the second result is an exact integer.
 
5.  Under (flinteger? x`)‌‌, (flodd? ix), (fleven? ix), you don't state what happens with infinite arguments.  Does flodd? and fleven? assume that (flinteger? x) is true?

Infinite arguments are not integers.  This is true in R6RS and R7RS-small.
 
6.  Under (fl+* x y z), you state

 Returns (fl+ (fl* x y) z), possibly faster. If the constant fl-fast-fl+* is #t, it will definitely be faster. (C99 fma)

To my understanding, the point is not that fma is faster (even if that is generally true), but that it's more accurate, i.e., that it is computed as if x*y+z is computed exactly and then only one rounding is applied.  I would be more interested in a constant fl-accurate-fl+* rather than fl-fast-fl+*.

I've added the point that it is more accurate.  However, the constant is signaling that you are using a hardware FMA instruction or equivalent,
so fast is what it is about.
 
7. Under (flnumerator x) and (flnumerator x) you don't specify what happens with infinities and NaNs.

Added:  infinities are +inf.0/1.0 and -inf.0/1.0; nans are +nan.0/nan.0.
 
8. Under (flexp-1 x) you want it to mean (- (exp x) 1).

Fixed.
 
9.  Under (flsqrt x) I think you want that (flsqrt x) is NaN for x < 0.

10. Under (fllog x) I think you want that (fllog x) is NaN for x < 0.

It already says at the top of the Specification section that if the mathematical result is complex, these functions return NaN.
 
11.  I think you should prefix first-bessel,  second-bessel, erf, and erfc with fl.

Fixed.
 
12.  Generally speaking, I don't know what type an argument "n" is supposed to be.  An exact integer?  A floating-point integer?

An exact integer; noted at the top.
 
In general, again, I wonder whether you want this formally to be just a renaming and thin FFI layer over the C library functions.  There seem to be some functions that are not from the C library; perhaps these would need to be more carefully specified than functions that take their meanings from the C library.

Brad
To unsubscribe from this list please goto http://www.simplelists.com/confirm.php?u=IBEg7VvnBXjoEIPrD3cR4cCONJD546pC