[racket-dev] Single-flonum-ness not preserved in racket/math functions

From: Neil Toronto (neil.toronto at gmail.com)
Date: Tue Jun 5 17:45:09 EDT 2012

I'm currently adding degrees->radians, radians->degrees, exact-round, 
exact-floor, exact-ceiling, exact-truncate, nan?, and infinite? to 
racket/math. (Along with docs and test cases, of course.)

When I started to add their types to Typed Racket's base environment, I 
found that some of the existing function's types didn't match their 
behavior. I think it's racket/math's fault, not TR's.

As long as I'm working on racket/math, should I just fix it?


   > (sinh 1.0f0)
   - : Single-Flonum [generalized from Positive-Single-Flonum]

That's obviously wrong. The fix is simple: change 2.0 in the definition 
of sinh to 2.

Vincent, is there a quick way for me to test whether the types I give 
the new functions are sound?

A related question: In some timing tests, I've found that wrapping the 
definitions in racket/math with begin-encourage-inline made some things 
faster; in particular, expressions which, when inlined, would be 
constant-lifted. Is there any reason to not add the inline hint?

Neil ⊥

Posted on the dev mailing list.