[gambit-list] API to parse floats in Scheme

Lassi Kortela lassi at lassi.io
Wed May 12 18:04:47 EDT 2021

Thanks for replying.

> I’m sorry, but I don’t know what the problem is that will be solved here.
> The inherently difficult part of inputting or outputting floating-point numbers is converting between a human-readable base 10 representation and a machine-usable base two representation while maintaining maximal accuracy (with some side conditions for special values, overflow, underflow, etc.)
> Are you proposing that this is what this pre-SRFI will do?

Yes, exactly! Each file format and programming language has a slightly 
different number syntax, so parsers for those are probably not fruitful 
to standardize. (RnRS string->number is serviceable for languages other 
than Scheme, but it supports such a wide range of syntax that one must 
be very careful to give it pre-validated input only. This is easy to get 
wrong.) A fundamental `make-inexact-real` procedure would be simple and 
useful. In the other reply, Marc proposes a better interface for it than 
what we came up with.

More information about the Gambit-list mailing list