From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: Effects of updated number fixes on parsing Date: Wed, 02 Feb 2011 23:01:56 -0500 Message-ID: <87bp2tu5or.fsf@yeeloong.netris.org> References: <559961.81235.qm@web37904.mail.mud.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1296705736 27130 80.91.229.12 (3 Feb 2011 04:02:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 3 Feb 2011 04:02:16 +0000 (UTC) Cc: guile-devel To: Mike Gran Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Feb 03 05:02:10 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PkqOX-0002jD-Rw for guile-devel@m.gmane.org; Thu, 03 Feb 2011 05:02:10 +0100 Original-Received: from localhost ([127.0.0.1]:45764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PkqOX-0006sz-B2 for guile-devel@m.gmane.org; Wed, 02 Feb 2011 23:02:09 -0500 Original-Received: from [140.186.70.92] (port=39552 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PkqOT-0006sb-LK for guile-devel@gnu.org; Wed, 02 Feb 2011 23:02:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PkqOS-0002al-EC for guile-devel@gnu.org; Wed, 02 Feb 2011 23:02:05 -0500 Original-Received: from world.peace.net ([216.204.32.208]:33215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PkqOS-0002aU-8L for guile-devel@gnu.org; Wed, 02 Feb 2011 23:02:04 -0500 Original-Received: from ip68-9-118-38.ri.ri.cox.net ([68.9.118.38] helo=freedomincluded) by world.peace.net with esmtpa (Exim 4.69) (envelope-from ) id 1PkqOM-0006us-E6; Wed, 02 Feb 2011 23:01:58 -0500 Original-Received: from mhw by freedomincluded with local (Exim 4.69) (envelope-from ) id 1PkqOK-0006E4-JT; Wed, 02 Feb 2011 23:01:56 -0500 In-Reply-To: <559961.81235.qm@web37904.mail.mud.yahoo.com> (Mike Gran's message of "Wed, 2 Feb 2011 16:47:15 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 216.204.32.208 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11527 Archived-At: Mike Gran writes: > One of the things that looks odd are the complex numbers in polar format > > 0@+nan.0 equals zero, for example. If that we accept the R6RS's (admittedly dubious) claim that +nan.0 is a real number, I think this is correct. We can deduce that mag*e^(i*ang) is 0 when MAG is 0, as long as ANG is real, because the complex exponential is known to be finite (and in fact has unit magnitude). The limit as ANG goes to infinity is 0 as well. However, I think the following cases are probably incorrect: #i0@9 : 0.0 : 0.0 #i0@+9 : 0.0 : 0.0 #i0@-9 : 0.0 : 0.0 #i0@+nan.0 : 0.0 : 0.0 #i0@+inf.0 : 0.0 : 0.0 #i0@-nan.0 : 0.0 : 0.0 #i0@-inf.0 : 0.0 : 0.0 The #i prefix is apparently causing the _result_ of scm_make_polar to be made inexact. Instead, I think that the specified magnitude and angle should be made inexact _before_ calling scm_make_polar. That would cause the magnitude to be inexact, and therefore all of these cases above would become non-real complex numbers. However, it would cause the last three to become +nan.0+nan.0i, as they were before, but we can do better than that. They should instead be 0.0+0.0i. scm_make_polar should check for another case: if the magnitude is an inexact zero and the angle is not an exact zero, the result should be 0.0+0.0i. Does this make sense? Mark