
From:  Mark H Weaver 
Subject:  [PATCH] Handle products with exact 0 differently, etc 
Date:  Tue, 01 Feb 2011 07:09:39 0500 
Here's another batch of numerics patches. The most important one changes the way products involving exact 0 are handled: * libguile/numbers.c (scm_product): Handle exact 0 differently. A product containing an exact 0 now returns an exact 0 if and only if the other arguments are all exact. An inexact zero is returned if and only if the other arguments are all finite but not all exact. If an infinite or NaN value is present, a NaN value is returned. Previously, any product containing an exact 0 yielded an exact 0, regardless of the other arguments. A note on the rationale for (* 0 0.0) returning 0.0 and not exact 0: The exactness propagation rules allow us to return an exact result in the presence of inexact arguments only if the values of the inexact arguments do not affect the result. In this case, the value of the inexact argument _does_ affect the result, because an infinite or NaN value causes the result to be a NaN. A note on the rationale for (* 0 +inf.0) being a NaN and not exact 0: The R6RS requires that (/ 0 0.0) return a NaN value, and that (/ 0.0) return +inf.0. We would like (/ x y) to be the same as (* x (/ y)), and in particular, for (/ 0 0.0) to be the same as (* 0 (/ 0.0)), which reduces to (* 0 +inf.0). Therefore (* 0 +inf.0) should return a NaN. Best, Mark
0001Fixbugsinrationalize.patch
Description: Fix bugs in `rationalize'
0002MorediscriminatingNaNpredicatesfornumbers.test.patch
Description: More discriminating NaN predicates for numbers.test
0003Handleproductswithexact0differently.patch
Description: Handle products with exact 0 differently
0004Movecommentabouttrigfunctionsbackwhereitbelo.patch
Description: Move comment about trig functions back where it belongs
0005Trigonometricfunctionsreturnexactnumbersinsome.patch
Description: Trigonometric functions return exact numbers in some cases
0006Improvediscussionofexactnesspropagationinmanua.patch
Description: Improve discussion of exactness propagation in manual
[Prev in Thread]  Current Thread  [Next in Thread] 