diff options
author | Mark H Weaver <mhw@netris.org> | 2011-01-30 08:48:28 -0500 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-01-30 23:00:38 +0100 |
commit | ff62c16828d41955455805dd1b427966944b7d27 (patch) | |
tree | 2e4b9bc32fe3ee012180139077fc6308e1380e69 /NEWS | |
parent | a16982ca4fafe7d68907c5bf2aae4eb627a1a448 (diff) | |
download | guile-ff62c16828d41955455805dd1b427966944b7d27.tar.gz |
Add two new sets of fast quotient and remainder operators
* libguile/numbers.c (scm_euclidean_quo_and_rem, scm_euclidean_quotient,
scm_euclidean_remainder, scm_centered_quo_and_rem,
scm_centered_quotient, scm_centered_remainder): New extensible
procedures `euclidean/', `euclidean-quotient', `euclidean-remainder',
`centered/', `centered-quotient', `centered-remainder'.
* libguile/numbers.h: Add function prototypes.
* module/rnrs/base.scm: Remove incorrect stub implementations of `div',
`mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. Instead do
renaming imports of `euclidean-quotient', `euclidean-remainder',
`euclidean/', `centered-quotient', `centered-remainder', and
`centered/', which are equivalent to the R6RS operators.
* module/rnrs/arithmetic/fixnums.scm (fxdiv, fxmod, fxdiv-and-mod,
fxdiv0, fxmod0, fxdiv0-and-mod0): Remove redundant checks for division
by zero and unnecessary complexity.
(fx+/carry): Remove unneeded calls to `inexact->exact'.
* module/rnrs/arithmetic/flonums.scm (fldiv, flmod, fldiv-and-mod,
fldiv0, flmod0, fldiv0-and-mod0): Remove redundant checks for division
by zero and unnecessary complexity. Remove unneeded calls to
`inexact->exact' and `exact->inexact'
* test-suite/tests/numbers.test: (test-eqv?): New internal predicate for
comparing numerical outputs with expected values.
Add extensive test code for `euclidean/', `euclidean-quotient',
`euclidean-remainder', `centered/', `centered-quotient',
`centered-remainder'.
* test-suite/tests/r6rs-arithmetic-fixnums.test: Fix some broken test
cases, and remove `unresolved' test markers for `fxdiv', `fxmod',
`fxdiv-and-mod', `fxdiv0', `fxmod0', and `fxdiv0-and-mod0'.
* test-suite/tests/r6rs-arithmetic-flonums.test: Remove `unresolved'
test markers for `fldiv', `flmod', `fldiv-and-mod', `fldiv0',
`flmod0', and `fldiv0-and-mod0'.
* doc/ref/api-data.texi (Arithmetic): Document `euclidean/',
`euclidean-quotient', `euclidean-remainder', `centered/',
`centered-quotient', and `centered-remainder'.
(Operations on Integer Values): Add cross-references to `euclidean/'
et al, from `quotient', `remainder', and `modulo'.
* doc/ref/r6rs.texi (rnrs base): Improve documentation for `div', `mod',
`div-and-mod', `div0', `mod0', and `div0-and-mod0'. Add
cross-references to `euclidean/' et al.
* NEWS: Add NEWS entry.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -12,6 +12,29 @@ Changes in 1.9.15 (since the 1.9.14 prerelease): ** Changes and bugfixes in numerics code +*** Added two new sets of fast quotient and remainder operators + +Added two new sets of fast quotient and remainder operator pairs with +different semantics than the R5RS operators. They support not only +integers, but all reals, including exact rationals and inexact +floating point numbers. + +These procedures accept two real numbers N and D, where the divisor D +must be non-zero. `euclidean-quotient' returns the integer Q and +`euclidean-remainder' returns the real R such that N = Q*D + R and +0 <= R < |D|. `euclidean/' returns both Q and R, and is more +efficient than computing each separately. Note that when D > 0, +`euclidean-quotient' returns floor(N/D), and when D < 0 it returns +ceiling(N/D). + +`centered-quotient', `centered-remainder', and `centered/' are similar +except that the range of remainders is -abs(D/2) <= R < abs(D/2), and +`centered-quotient' rounds N/D to the nearest integer. + +Note that these operators are equivalent to the R6RS integer division +operators `div', `mod', `div-and-mod', `div0', `mod0', and +`div0-and-mod0'. + *** `eqv?' and `equal?' now compare numbers equivalently scm_equal_p `equal?' now behaves equivalently to scm_eqv_p `eqv?' for @@ -64,6 +87,12 @@ NaNs are neither finite nor infinite. *** R6RS base library changes +**** `div', `mod', `div-and-mod', `div0', `mod0', `div0-and-mod0' + +Efficient versions of these R6RS division operators are now supported. +See the NEWS entry entitled `Added two new sets of fast quotient and +remainder operators' for more information. + **** `infinite?' changes `infinite?' now returns #t for non-real complex infinities, and throws |