1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-18 17:50:29 +02:00

Add four new sets of fast quotient and remainder operators

* libguile/numbers.c (scm_floor_divide, scm_floor_quotient,
  scm_floor_remainder, scm_ceiling_divide, scm_ceiling_quotient,
  scm_ceiling_remainder, scm_truncate_divide, scm_truncate_quotient,
  scm_truncate_remainder, scm_round_divide, scm_round_quotient,
  scm_round_remainder): New extensible procedures `floor/',
  `floor-quotient', `floor-remainder', `ceiling/', `ceiling-quotient',
  `ceiling-remainder', `truncate/', `truncate-quotient',
  `truncate-remainder', `round/', `round-quotient', and
  `round-remainder'.

* libguile/numbers.h: Add function prototypes.

* test-suite/tests/numbers.test: Add tests.

* doc/ref/api-data.texi (Arithmetic): Add documentation.

* NEWS: Add NEWS entry.
This commit is contained in:
Mark H Weaver 2011-02-13 09:16:27 -05:00 committed by Andy Wingo
parent 03ddd15bae
commit 8f9da3406b
5 changed files with 2451 additions and 3 deletions

File diff suppressed because it is too large Load diff

View file

@ -181,9 +181,21 @@ SCM_API SCM scm_modulo (SCM x, SCM y);
SCM_API void scm_euclidean_divide (SCM x, SCM y, SCM *q, SCM *r);
SCM_API SCM scm_euclidean_quotient (SCM x, SCM y);
SCM_API SCM scm_euclidean_remainder (SCM x, SCM y);
SCM_API void scm_floor_divide (SCM x, SCM y, SCM *q, SCM *r);
SCM_API SCM scm_floor_quotient (SCM x, SCM y);
SCM_API SCM scm_floor_remainder (SCM x, SCM y);
SCM_API void scm_ceiling_divide (SCM x, SCM y, SCM *q, SCM *r);
SCM_API SCM scm_ceiling_quotient (SCM x, SCM y);
SCM_API SCM scm_ceiling_remainder (SCM x, SCM y);
SCM_API void scm_truncate_divide (SCM x, SCM y, SCM *q, SCM *r);
SCM_API SCM scm_truncate_quotient (SCM x, SCM y);
SCM_API SCM scm_truncate_remainder (SCM x, SCM y);
SCM_API void scm_centered_divide (SCM x, SCM y, SCM *q, SCM *r);
SCM_API SCM scm_centered_quotient (SCM x, SCM y);
SCM_API SCM scm_centered_remainder (SCM x, SCM y);
SCM_API void scm_round_divide (SCM x, SCM y, SCM *q, SCM *r);
SCM_API SCM scm_round_quotient (SCM x, SCM y);
SCM_API SCM scm_round_remainder (SCM x, SCM y);
SCM_API SCM scm_gcd (SCM x, SCM y);
SCM_API SCM scm_lcm (SCM n1, SCM n2);
SCM_API SCM scm_logand (SCM n1, SCM n2);
@ -200,7 +212,11 @@ SCM_API SCM scm_logcount (SCM n);
SCM_API SCM scm_integer_length (SCM n);
SCM_INTERNAL SCM scm_i_euclidean_divide (SCM x, SCM y);
SCM_INTERNAL SCM scm_i_floor_divide (SCM x, SCM y);
SCM_INTERNAL SCM scm_i_ceiling_divide (SCM x, SCM y);
SCM_INTERNAL SCM scm_i_truncate_divide (SCM x, SCM y);
SCM_INTERNAL SCM scm_i_centered_divide (SCM x, SCM y);
SCM_INTERNAL SCM scm_i_round_divide (SCM x, SCM y);
SCM_INTERNAL SCM scm_i_gcd (SCM x, SCM y, SCM rest);
SCM_INTERNAL SCM scm_i_lcm (SCM x, SCM y, SCM rest);