mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
Fix the R6RS exact-integer-sqrt and import into core guile
* libguile/numbers.c (scm_exact_integer_sqrt): New C procedure to compute exact integer square root and remainder. (scm_i_exact_integer_sqrt): New Scheme procedure `exact-integer-sqrt' from the R6RS, imported into core guile. * libguile/numbers.h: Add prototypes. * module/rnrs/base.scm: Remove broken stub implementation, which would fail badly when applied to large integers. * doc/ref/api-data.texi: Add documentation. * doc/ref/r6rs.texi: Change documentation for `exact-integer-sqrt' to a stub that xrefs the core docs, as is done for other operations available in core. * test-suite/tests/numbers.test: Add tests. * NEWS: Add news entries.
This commit is contained in:
parent
b1e13fb530
commit
882c89636a
7 changed files with 142 additions and 8 deletions
|
@ -103,9 +103,6 @@
|
|||
(let ((sym (car syms)))
|
||||
(and (symbol? sym) (symbol=?-internal (cdr syms) sym)))))
|
||||
|
||||
(define (exact-integer-sqrt x)
|
||||
(let* ((s (exact (floor (sqrt x)))) (e (- x (* s s)))) (values s e)))
|
||||
|
||||
(define (real-valued? x)
|
||||
(and (complex? x)
|
||||
(zero? (imag-part x))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue