From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: How to format exact rationals? Date: Fri, 21 May 2010 19:35:05 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1274463235 13466 80.91.229.12 (21 May 2010 17:33:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 21 May 2010 17:33:55 +0000 (UTC) Cc: guile-user@gnu.org To: Sascha Ziemann Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri May 21 19:33:53 2010 connect(): No such file or directory Return-path: Envelope-to: guile-user@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 1OFW6Z-0002hR-R2 for guile-user@m.gmane.org; Fri, 21 May 2010 19:33:52 +0200 Original-Received: from localhost ([127.0.0.1]:42990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFW6Y-0000tG-V3 for guile-user@m.gmane.org; Fri, 21 May 2010 13:33:51 -0400 Original-Received: from [140.186.70.92] (port=37653 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFW66-0000iL-8O for guile-user@gnu.org; Fri, 21 May 2010 13:33:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFW62-0006Zp-El for guile-user@gnu.org; Fri, 21 May 2010 13:33:21 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:36256 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFW62-0006ZQ-CI for guile-user@gnu.org; Fri, 21 May 2010 13:33:18 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 99ABBB5BC2; Fri, 21 May 2010 13:33:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=YDGOczCGYJRq4GbUIrZGYR8iV5w=; b=LeIJqV mEeH5p+hTmAYbdpDP46Hsz4OMRwvrvzM3/1A3N3B/tvmD6zrZ0mg9jUWFft248ep Vuzyd5tMv/bALxtLva/Yo3R4CKavP87rj+GIqd1MFCFyEXHzIXXJHn8LvePA66QF V4aXvSMw3FvmzozMWuRMiYfGKnCjAeIKX97+g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=abBNZeRhKXdJpniPw8KkXrU/OK4GHxso weX0GdfvaOTiz04VFGPXmDLjB8FFhNglAOjUzPj5hmAlDTWbTt30Skq5uCqutJqW 1wpUEiQVyEGfejcV3L3lOya6Fj3aUSIevOUdr8YaYxDIRQ3wllQsSYnjNQWNDuQ9 QVTzUxMylJE= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 854ABB5BC0; Fri, 21 May 2010 13:33:15 -0400 (EDT) Original-Received: from unquote (unknown [79.151.125.11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id BCE9BB5BBF; Fri, 21 May 2010 13:33:13 -0400 (EDT) In-Reply-To: (Sascha Ziemann's message of "Fri, 21 May 2010 14:45:48 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: EFFB951C-64FE-11DF-9436-D033EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7798 Archived-At: Hi, On Fri 21 May 2010 14:45, Sascha Ziemann writes: > Is this the intended behavior for exact rationals? > > guile> (format #f "~f" (/ 1 3)) > > FORMAT: error with call: (format #f "~f<===" ===>1/3 ) > illegal character `/' in number->string I don't know. There is some pretty gnarly code there; for some reason it takes the argument, does number->string on it, parses the resulting string, and there it's failing because it doesn't seem to handle exact rationals. But, as rationals are real numbers, just as the exact integers, we should expect this function to format (/ 1 3) appropriately. > If so how to format them? As a workaround, use `(format #f "~f" (exact->inexact (1/3)))'. I'll commit a real fix to master sometime soon. Andy -- http://wingolog.org/