Improve inexact division of exact integers.
authorMark H Weaver <mhw@netris.org>
Mon, 4 Mar 2013 23:46:33 +0000 (18:46 -0500)
committerMark H Weaver <mhw@netris.org>
Sun, 17 Mar 2013 20:37:55 +0000 (16:37 -0400)
commit982377849029f2840ebb105cda49390fecca4fe4
treef10eb7ada1971e00de015fd04be2dea518212818
parentb1c46fd30a4615b4ab534d6bd824a81e3f536660
Improve inexact division of exact integers.

* libguile/numbers.c (scm_i_divide2double): New function.
  (scm_i_divide2double_lo2b): New variable.
  (scm_i_fraction2double, log_of_fraction): Use 'scm_i_divide2double'.
  (do_divide): Removed.  Its code is now in 'scm_divide'.
  (scm_divide2real): Removed.  Superceded by 'scm_i_divide2double'.
  (scm_divide): Inherit code from 'do_divide', but without support for
  forcing a 'double' result (that functionality is now implemented by
  'scm_i_divide2double').  Add FIXME comments in cases where divisions
  might not be as precise as they should be.
  (scm_init_numbers): Initialize 'scm_i_divide2double_lo2b'.

* test-suite/tests/numbers.test (dbl-epsilon-exact, dbl-max-exp): New
  variables.
  ("exact->inexact"): Add tests.
  ("inexact->exact"): Add test for largest finite inexact.
libguile/numbers.c
test-suite/tests/numbers.test