[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] Fix for #1016: allow non-integral flonums for numerato
From: |
Peter Bex |
Subject: |
[Chicken-hackers] Fix for #1016: allow non-integral flonums for numerator and denominator |
Date: |
Sun, 16 Jun 2013 21:35:59 +0200 |
User-agent: |
Mutt/1.4.2.3i |
Hi all,
Attached is a patch to allow non-integral flonum arguments for the
numerator and denominator procedures. They are supposed to accept
rational numbers, and flonums, though inexact, can be rational (if
they're not Inf or NaN). This fixes #1016 for core and brings us
closer to R5RS compliance (yes, this is required by R5RS!)
This code is a more-or-less straightforward port to C (+ specialization)
of the Scheme code for the inexact->exact procedure from the numbers egg.
Unfortunately, it does not give the "precise" results the numbers egg
gives, because bignums are unavailable. OTOH, this precision is usually
kind of misleading anyway since the inputs are inexact numbers!
Cheers,
Peter
--
http://www.more-magic.net
0001-Accept-flonums-in-numerator-and-denominator-procedur.patch
Description: Text document
- [Chicken-hackers] Fix for #1016: allow non-integral flonums for numerator and denominator,
Peter Bex <=