Thanks for all the replies about single-flonum uses!

I've pushed the change to try out disabling single-flonum literals as
of v7.3.0.5.

Note that this change doesn't remove the concept of single-flonum
values from the language. It just removes single-flonum literals from
`#lang racket` and other languages that use the S-expression reader.


If you have a program with a single-flonum literal expression in it,
such as

 3.4f5

then you can convert to a use of `real->signle-flonum`:

 (real->single-flonum 3.4e5)

On a Racket variant that supports single-flonum values (like the
current version of Racket), the compiler will constant-fold that
expression to a single-flonum value, so the compiled code is the same
as writing a single-flonum literal. On a Racket variant that does
support single-flonum values, however, that expression will raise an
exception.

Here's an example in `degrees->radians` in `racket/math`:

https://github.com/racket/racket/blob/master/racket/collects/racket/math.rkt#L97

The call to `real->single-flonum` is in a `cond` clause that is guarded
with a `single-flonum?` test. Obviously, that guard will succeed only
in a Racket variant that supports single-flonum values, so we don't
need to worry about the `real->single-flonum` operation failing.

For cases where there's no natural `single-flonum?` guard, a new
`single-flonum-available?` function reports whether single-flonum
values are supported. It currently produces #t in the current version
of Racket and #f in Racket CS.

Finally, you can set the new `read-single-flonum` parameter to #t to
restore single-flonum parsing at the level of `read`. You can set
`read-single-flonum` to #t on Racket variant that does not support
single-flonum values, but `read` will raise an exception if it
encounters a single-flonum number.

Although we could make a language or a language constructor that
enables single-flonum literals by setting `real-single-flonum`, I think
we should try discouraging that, for now. Admittedly, I used a little
reader to do that in the test suite for the core single-flonum
operations, but that feels like a special case.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/5cf66da2.1c69fb81.baabf.95f9SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to