guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] First batch of numerics changes


From: Mark H Weaver
Subject: Re: [PATCH] First batch of numerics changes
Date: Wed, 26 Jan 2011 17:46:25 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Attached is an improved version of my first 20 patches of numerics
bugfixes and changes for improved R6RS (and in some cases, R5RS!)
standards compliance.  The first seven patches are unchanged from my
last post, but I rebased them and they're not very large, so I include
them here for completeness.

There are many changes, but I would like to draw attention to one in
particular: R5RS requires that `equal?' must be equivalent to `eqv?' for
numbers, but that is not the case in the existing Guile code.  The two
differences of which I'm aware are NaNs and signed zeroes:

  (eqv?   +nan.0 +nan.0) => #t
  (equal? +nan.0 +nan.0) => #f

  (eqv?   0.0 -0.0) => #f
  (equal? 0.0 -0.0) => #t

After applying these patches, the behavior of `equal?' will change to
match that of `eqv?': henceforth, they will both be able to distinguish
signed zeroes and detect NaNs (although using `nan?' for the latter job
is highly recommended).

There are some other user-visible changes as well.  See the commit logs,
and the included NEWS patches for details.

[Note that I still have a 116 kilobyte patch with more numerics changes
 that aren't included here, because I haven't yet split that portion
 into small commits.  Most notably, the remaining changes allow non-real
 complex numbers to have inexact zero imaginary parts, as required by
 R6RS.  Only numbers with an _exact_ 0 imaginary part are considered
 real by R6RS.]

In any case, reviews of the attached patches are solicited.

    Thanks,
      Mark


Attachment: 0001-Do-not-apply-inf-or-nan-to-strings.patch
Description: Do not apply `inf?' or `nan?' to strings

Attachment: 0002-Fix-NEWS-entry-regarding-changes-to-expt-for-zero.patch
Description: Fix NEWS entry regarding changes to `expt' for zero base

Attachment: 0003-Add-SCM_INUM1-to-numbers.h-and-make-use-of-it-and-S.patch
Description: Add SCM_INUM1 to numbers.h, and make use of it and SCM_INUM0 in numbers.c

Attachment: 0004-Implement-finite-in-core-and-fix-R6RS-finite-a.patch
Description: Implement `finite?' in core and fix R6RS `finite?' and `infinite?'

Attachment: 0005-Optimize-scm_exact_p-by-making-use-of-SCM_INEXACTP.patch
Description: Optimize scm_exact_p by making use of SCM_INEXACTP

Attachment: 0006-Remove-useless-code-from-do_divide.patch
Description: Remove useless code from do_divide

Attachment: 0007-Add-case-for-fractions-with-differing-SCM_CELL_TYPE.patch
Description: Add case for fractions with differing SCM_CELL_TYPE to scm_equal_p

Attachment: 0008-equal-and-eqv-are-now-equivalent-for-numbers.patch
Description: equal? and eqv? are now equivalent for numbers

Attachment: 0009-Improve-docs-for-inf-regarding-non-real-complex-i.patch
Description: Improve docs for `inf?' regarding non-real complex infinities

Attachment: 0010--inf-and-nan-throw-exceptions-when-applied-to-n.patch
Description: `inf?' and `nan?' throw exceptions when applied to non-numbers

Attachment: 0011-Fix-bugs-when-negating-SCM_MOST_POSITIVE_FIXNUM-1.patch
Description: Fix bugs when negating SCM_MOST_POSITIVE_FIXNUM+1

Attachment: 0012-Infinities-and-NaNs-are-no-longer-rational.patch
Description: Infinities and NaNs are no longer rational

Attachment: 0013-Implement-R6RS-real-valued-rational-valued.patch
Description: Implement R6RS `real-valued?', `rational-valued?', `integer-valued?'

Attachment: 0014-Fix-R6RS-div-mod-div-and-mod-div0-mod0.patch
Description: Fix R6RS `div', `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'

Attachment: 0015--even-and-odd-now-throw-exceptions-only-for-non.patch
Description: `even?' and `odd?' now throw exceptions only for non-numbers

Attachment: 0016-Fix-bugs-in-rationalize.patch
Description: Fix bugs in `rationalize'

Attachment: 0017-More-discriminating-NaN-predicates-for-numbers.test.patch
Description: More discriminating NaN predicates for numbers.test

Attachment: 0018-Exact-0-times-infinity-or-a-NaN-yields-a-NaN.patch
Description: Exact 0 times infinity or a NaN yields a NaN

Attachment: 0019-Move-comment-about-trig-functions-back-where-it-belo.patch
Description: Move comment about trig functions back where it belongs

Attachment: 0020-Trigonometric-functions-return-exact-numbers-in-some.patch
Description: Trigonometric functions return exact numbers in some cases


reply via email to

[Prev in Thread] Current Thread [Next in Thread]