Regarding Gambit's flonums and fixnums, besides R5RS, are these assertions right?:
- A flonum is a floating point number (double) - A fixnum is an integer (long) - An exact number is either a fixnum or a quotient numbers (a/b) - An inexact number is equal to a flonum
- fx operations apply to all exact numbers except quotient-like numbers. - All fl operations apply to flonums
In order to use an exact number that happens to be a quotient with fl operations you need to apply ROUND, FLOOR or CEILING.
Am I missing something out?
On Wed, Dec 26, 2012 at 6:53 PM, Álvaro Castro-Castilla < alvaro.castro.castilla@gmail.com> wrote:
Well, I was asking, so I can't really tell :) But SRFI-70 is supposed to be specifically designed to "improve" on R5RS, whether we/I agree or not that it is an improvement. The point is that Gambit is extending R5RS, even implementing some of the funcionality that R6RS specified (like flonum/fixnum operations). To be honest, I really don't get the difference between inexact/flonum exact/fixnum in Gambit. Documentation is not very extense on this topic, as far as I can tell the same operations apply to inexact/flonum, ditto exact/fixnum. But I think that if you are going to produce numeric code in Gambit, understanding this topic well enough is key.
SRFI-70 "redefines" R5RS number section (6.2). It modifies these areas (quoted from the SRFI):
- incorporates an inexact real positive infinity and an inexact real
negative infinity (Gambit implements this)
- extends number syntax to incorporate inexact real infinities, (Gambit
implements this) adapts Common-Lisp semantics for `expt' and extends them to include inexact real infinities, corrects the description of `sqrt', sharpens the distinction between exact and inexact numbers removes a contradiction related to exactness, extends `gcd' and `lcm' to exact rational numbers, extends `quotient', `modulo', and `remainder' to finite real numbers, clarifies the behavior of `inexact->exact' applied to an exact argument, clarifies the behavior of `exact->inexact' applied to an inexact argument, adds convenience procedures `exact-round', `exact-ceiling', `exact-floor', and `exact-truncate',
These topics, specially for numerical methods implementation, seem to me as topics to understand well. Now, I don's say SRFI-70 proposal is better than R5RS, but I'd like to know what "standard" follows Gambit, to work under those premises.
Thank you very much,
Best regards
On Wed, Dec 26, 2012 at 5:06 PM, Bradley Lucier lucier@math.purdue.eduwrote:
On Dec 25, 2012, at 9:49 AM, Álvaro Castro-Castilla wrote:
Hi,
- The SRFI-70 states that R5RS's number specification is inconsistent
for some cases, and describes a replacement for this section.
- Gambit does extend some of the functionality from R5RS, like
infinites, but mentions no SRFI-70.
- An then, SRFI-70 is superseded by R6RS.
So where does Gambit stand in this space?
Gambit does not consciously attempt to conform to R6RS, but if there are "inconsistencies" in Gambit's numbers implementation I'd be interested to hear about them and willing to fix them.
Brad