From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: JihemD Newsgroups: gmane.lisp.guile.user Subject: Re: (real? (* +i +i)) -> #f Date: Fri, 3 Aug 2012 04:04:29 -0700 (PDT) Message-ID: <34250430.post@talk.nabble.com> References: <34250234.post@talk.nabble.com> <87r4rotgcq.fsf@Kagami.home> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1343991881 12379 80.91.229.3 (3 Aug 2012 11:04:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 3 Aug 2012 11:04:41 +0000 (UTC) To: Guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Aug 03 13:04:41 2012 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SxFgO-00051X-5g for guile-user@m.gmane.org; Fri, 03 Aug 2012 13:04:40 +0200 Original-Received: from localhost ([::1]:46841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxFgN-0005JP-FZ for guile-user@m.gmane.org; Fri, 03 Aug 2012 07:04:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxFgF-0005J4-Hv for Guile-user@gnu.org; Fri, 03 Aug 2012 07:04:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxFgE-0000Zx-7F for Guile-user@gnu.org; Fri, 03 Aug 2012 07:04:31 -0400 Original-Received: from sam.nabble.com ([216.139.236.26]:40120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxFgE-0000Zq-2H for Guile-user@gnu.org; Fri, 03 Aug 2012 07:04:30 -0400 Original-Received: from telerig.nabble.com ([192.168.236.162]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1SxFgD-0001OW-Bs for Guile-user@gnu.org; Fri, 03 Aug 2012 04:04:29 -0700 In-Reply-To: <87r4rotgcq.fsf@Kagami.home> X-Nabble-From: jihem01@online.fr X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 216.139.236.26 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9546 Archived-At: Ian Price wrote: >=20 > I believe guile only considers numbers with an _exact_ 0 imaginary part > to be real. However, since all guile complex numbers are inexact, this > means that (* +i +i) is not considered real. >=20 > scheme@(guile=E2=88=92user)> (* +i +i) > $19 =3D =E2=88=921.0+0.0i > scheme@(guile=E2=88=92user)> (exact? (imag-part $19)) > $20 =3D #f >=20 > While I don't know if this was a specific concern when writing, this is > in line with the interpretation in section 11.7.4 Numerical operations > of the r6rs document. >=20 > http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_sec_11.7.4.1 >=20 > If x is a real number object, then (rational? x) is true if and only if > there exist exact integer objects k1 and k2 such that (=3D x (/ k1 k2)) > and (=3D (numerator x) k1) and (=3D (denominator x) k2) are all true. Thu= s > infinities and NaNs are not rational number objects. >=20 > (real? -2.5+0.0i) =E2=87=92 #f > (real? -2.5+0i) =E2=87=92 #t >=20 > --=20 > Ian Price >=20 Thx Ian, the concept of exactness is new for me : scheme@(guile-user)> (real? +0i) $1 =3D #t scheme@(guile-user)> (inexact->exact 1.0) $2 =3D 1 scheme@(guile-user)> (inexact->exact (* +i +i)) $3 =3D -1 scheme@(guile-user)> (* +i +i) $4 =3D -1.0+0.0i scheme@(guile-user)> (real? (* +i +i)) $5 =3D #f scheme@(guile-user)> (real? (inexact->exact (* +i +i))) $6 =3D #t --=20 View this message in context: http://old.nabble.com/%28real--%28*-%2Bi-%2Bi= %29%29--%3E--f-tp34250234p34250430.html Sent from the Gnu - Guile - User mailing list archive at Nabble.com.