GNU bug report logs - #33773
Problem with format ~g mantdigits argument

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Luther Thompson <lutheroto@HIDDEN>; dated Sun, 16 Dec 2018 20:12:02 UTC; Maintainer for guile is bug-guile@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 16 Dec 2018 20:11:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 16 15:11:42 2018
Received: from localhost ([127.0.0.1]:50600 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gYclI-0004oh-P4
	for submit <at> debbugs.gnu.org; Sun, 16 Dec 2018 15:11:40 -0500
Received: from eggs.gnu.org ([208.118.235.92]:36406)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <lutheroto@HIDDEN>) id 1gYclF-0004oP-7G
 for submit <at> debbugs.gnu.org; Sun, 16 Dec 2018 15:11:39 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <lutheroto@HIDDEN>) id 1gYcl9-00017b-64
 for submit <at> debbugs.gnu.org; Sun, 16 Dec 2018 15:11:31 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:37097)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <lutheroto@HIDDEN>) id 1gYcl9-00017T-2g
 for submit <at> debbugs.gnu.org; Sun, 16 Dec 2018 15:11:31 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46009)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <lutheroto@HIDDEN>) id 1gYcl8-0002WA-2D
 for bug-guile@HIDDEN; Sun, 16 Dec 2018 15:11:30 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <lutheroto@HIDDEN>) id 1gYcl7-00016Y-5a
 for bug-guile@HIDDEN; Sun, 16 Dec 2018 15:11:30 -0500
Received: from mail-yw1-xc30.google.com ([2607:f8b0:4864:20::c30]:32880)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <lutheroto@HIDDEN>) id 1gYcl7-00016M-0W
 for bug-guile@HIDDEN; Sun, 16 Dec 2018 15:11:29 -0500
Received: by mail-yw1-xc30.google.com with SMTP id v20so3005150ywc.0
 for <bug-guile@HIDDEN>; Sun, 16 Dec 2018 12:11:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=date:from:to:subject:message-id:mime-version
 :content-transfer-encoding;
 bh=Y5BnFN0y4bt/SqjIbOkV46DqiQezKi0GdU9ofahHZF8=;
 b=Aberq5R36EQod+wUVVdMrZWEuXWfg+zo57ZBwHrytL0jIyKviYa7kYsZBPe/q4yFx3
 UBwFpOjPj2FNXKGQoveOMmrzL6FAiEIqD1YcWKmX2YPxyTplShXUl0C5LE0LPsV/DsAG
 wFhbcgESKIQQbJ2OG/XqQnUTKV26dDmJQd9OsLNPbrKl9jUMav+DCW5eMKcfokgbRc7f
 nTqfAEyid6jmNwUvk55dnAET8uA+UubdVWK6w0AfCl5Q7GRzVE7pz7AY5vkOpZVBK2eb
 JqgOfpO1vnh2b0lCRGjsFZ6KL8dtV3gsiQZyYGRzwXuP/cSO6Xjawf7rk7XWznmi03Ss
 uvzQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:subject:message-id:mime-version
 :content-transfer-encoding;
 bh=Y5BnFN0y4bt/SqjIbOkV46DqiQezKi0GdU9ofahHZF8=;
 b=Hquo5TssGoUz5xKNOSJk8g8ta+DVZcKMTEaFAUOvSpYXs5nsbaRpUTneCYLS/cAzVq
 dt7c4JIHdwDx2ow0H3ZutVx6TEuWkGzufZ2b9+VZM4M9BuQsBuVgPilfDHYoYdA05jNk
 fxfgGMqzZULyFnhg4x1zBFExRHVWMyDB4Y1SX390OE/9yvlO8Ds2Ualk/NYc8KxSRHw5
 CV58iaqxdipnbvj39qggSsmmgBkUEa3uvo68sql9mWWpP4k2NxUWiO8YmPRUx1V4xm4L
 WfAMVNjZajHBfwesanQpxmMEJ/YSOfcNORmcOFdHJXSEwtM8TmJD1Xo9L2+j74PcwY8Q
 F17Q==
X-Gm-Message-State: AA+aEWY/+get5lCalejzq2u6jWnXHd7OahF2cpXenaKmWs4/1OinjSuo
 x2Blok4qJJK7YSm/Ks7qc+44qp3ubzw=
X-Google-Smtp-Source: AFSGD/WHstqvGw1Hq33nZsMjOtTwD/K4sEOcQTRNqYLeBDxAqZe5UIWa6oMYpx/DNO707Lky4jvYyA==
X-Received: by 2002:a81:67d6:: with SMTP id b205mr11161980ywc.94.1544991088171; 
 Sun, 16 Dec 2018 12:11:28 -0800 (PST)
Received: from localhost ([2601:c6:cf00:1c9::9584])
 by smtp.gmail.com with ESMTPSA id j65sm3603070ywf.21.2018.12.16.12.11.27
 for <bug-guile@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 16 Dec 2018 12:11:27 -0800 (PST)
Date: Sun, 16 Dec 2018 15:11:20 -0500
From: Luther Thompson <lutheroto@HIDDEN>
To: bug-guile@HIDDEN
Subject: Problem with format ~g mantdigits argument
Message-ID: <20181216151120.0356bcd9@HIDDEN>
X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-unknown-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

I'm running Guile 2.2.4 on GuixSD.

In the documentation for `format`[0], under `~g`, it says this about
the mantdigits argument:

"When fixed-point is used, the decimals parameter to ~f is established
from mantdigits, so as to give a total mantdigits+1 figures."

The example just above this sentence contradicts this, as we can see
here:

---BEGIN---
$ guile
GNU Guile 2.2.4
Copyright (C) 1995-2017 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (format #f "~,4g" 999)
$1 = "999.0    "
scheme@(guile-user)> (format #f "~,4g" 100000)
$2 = "1.0000E+5"
---END---

When ~g uses fixed-point, it shows mantdigits significant digits. When
~g uses an exponent, it shows mantdigits+1 significant digits.

I think it's important that ~g does not change the number of
significant digits depending on fixed-point vs. exponential.

Also, I think ~g should show a number of significant digits equal to
mantdigits. In my opinion, this would be more intuitive than adding 1,
and would be more in line with C's printf. (I figure it's worth it to
ask for this, because fixing this bug means having to choose between
the two behaviors anyway. I don't know if backward compatibility
factors into this.)

uname -a:
Linux targaryen 4.19.6-gnu #1 SMP 1 x86_64 GNU/Linux

[0]
https://www.gnu.org/software/guile/manual/html_node/Formatted-Output.html#Formatted-Output

Luther




Acknowledgement sent to Luther Thompson <lutheroto@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#33773; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.