From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.bugs Subject: bug#16987: Bad default mantissa width for ~g format string Date: Tue, 11 Mar 2014 14:40:40 +0100 Message-ID: <87lhwg7t0n.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1394545261 28906 80.91.229.3 (11 Mar 2014 13:41:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Mar 2014 13:41:01 +0000 (UTC) To: 16987@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Mar 11 14:41:10 2014 Return-path: Envelope-to: guile-bugs@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 1WNMvc-0003GQ-K3 for guile-bugs@m.gmane.org; Tue, 11 Mar 2014 14:41:08 +0100 Original-Received: from localhost ([::1]:55022 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNMvc-0008FE-2d for guile-bugs@m.gmane.org; Tue, 11 Mar 2014 09:41:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNMvX-0008F9-Rk for bug-guile@gnu.org; Tue, 11 Mar 2014 09:41:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNMvW-00060f-Ps for bug-guile@gnu.org; Tue, 11 Mar 2014 09:41:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNMvW-00060b-NK for bug-guile@gnu.org; Tue, 11 Mar 2014 09:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WNMvW-0000Gx-Dl for bug-guile@gnu.org; Tue, 11 Mar 2014 09:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Kastrup Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 11 Mar 2014 13:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16987 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13945452501010 (code B ref -1); Tue, 11 Mar 2014 13:41:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Mar 2014 13:40:50 +0000 Original-Received: from localhost ([127.0.0.1]:32798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WNMvJ-0000GE-UI for submit@debbugs.gnu.org; Tue, 11 Mar 2014 09:40:50 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39851) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WNMvF-0000G3-Sz for submit@debbugs.gnu.org; Tue, 11 Mar 2014 09:40:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNMvE-0005yn-KT for submit@debbugs.gnu.org; Tue, 11 Mar 2014 09:40:45 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:46882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNMvE-0005yj-He for submit@debbugs.gnu.org; Tue, 11 Mar 2014 09:40:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNMvD-0008CA-KI for bug-guile@gnu.org; Tue, 11 Mar 2014 09:40:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNMvB-0005yG-J5 for bug-guile@gnu.org; Tue, 11 Mar 2014 09:40:43 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35859) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNMvB-0005y9-90 for bug-guile@gnu.org; Tue, 11 Mar 2014 09:40:41 -0400 Original-Received: from localhost ([127.0.0.1]:43032 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNMvA-0003s6-TX for bug-guile@gnu.org; Tue, 11 Mar 2014 09:40:41 -0400 Original-Received: by lola (Postfix, from userid 1000) id 70AB9E278D; Tue, 11 Mar 2014 14:40:40 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7409 Archived-At: scheme@(guile-user)> (format #f "~g" (/ 1e100 3)) $19 = "3333333333333333000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0 " That, frankly, is pretty ludicrous. The reserved mantissa width should at least be constrained to the actually available precision of the data type. If it isn't, there is no useful way to output a variable with minimal width. Using ~S instead results in the much more reasonable "3.333333333333333e99" but it will not convert fractions to a floating point representation: scheme@(guile-user)> (format #f "~g" (/ 10000000000000000000000000000000 3)) $22 = "3333333333333333600000000000000.0 " scheme@(guile-user)> (format #f "~S" (/ 10000000000000000000000000000000 3)) $23 = "10000000000000000000000000000000/3" scheme@(guile-user)> -- David Kastrup