Improve handling of signed zeroes
authorMark H Weaver <mhw@netris.org>
Wed, 2 Feb 2011 08:14:13 +0000 (03:14 -0500)
committerAndy Wingo <wingo@pobox.com>
Wed, 2 Feb 2011 20:28:18 +0000 (21:28 +0100)
commit9b9ef10cf06db2c0349fb6e0ce6a5c4fa48341d1
tree70b310d2d8661ec08f655a9181e6df982e088bd5
parent8deddc948d0b9cbd082d58e9c316a5380ea850a8
Improve handling of signed zeroes

* libguile/numbers.c (scm_abs): (abs -0.0) now returns 0.0.  Previously
  it returned -0.0.  Also move the REALP case above the BIGP case,
  and consider it SCM_LIKELY to be REALP if not INUMP.
  (scm_difference): (- 0 0.0) now returns -0.0.  Previously it returned
  0.0.  Also make sure that (- 0 0.0+0.0i) will return -0.0-0.0i.

* test-suite/tests/numbers.test (abs, -): Add test cases, and change
  some tests to use `eqv?' instead of `=', in order to test exactness
  and distinguish signed zeroes.
libguile/numbers.c
test-suite/tests/numbers.test