From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Luther Thompson Newsgroups: gmane.lisp.guile.bugs Subject: bug#33773: Problem with format ~g mantdigits argument Date: Sun, 16 Dec 2018 15:11:20 -0500 Message-ID: <20181216151120.0356bcd9@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1544991007 23265 195.159.176.226 (16 Dec 2018 20:10:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 16 Dec 2018 20:10:07 +0000 (UTC) To: 33773@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Dec 16 21:10:03 2018 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gYcjg-0005qH-IP for guile-bugs@m.gmane.org; Sun, 16 Dec 2018 21:10:00 +0100 Original-Received: from localhost ([::1]:43653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYclm-0002p7-SP for guile-bugs@m.gmane.org; Sun, 16 Dec 2018 15:12:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYclf-0002oA-Vg for bug-guile@gnu.org; Sun, 16 Dec 2018 15:12:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYcle-0001Mq-V9 for bug-guile@gnu.org; Sun, 16 Dec 2018 15:12:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46342) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gYcle-0001Mi-RL for bug-guile@gnu.org; Sun, 16 Dec 2018 15:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gYcle-0004pY-J9 for bug-guile@gnu.org; Sun, 16 Dec 2018 15:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Luther Thompson Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 16 Dec 2018 20:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33773 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.154499110218528 (code B ref -1); Sun, 16 Dec 2018 20:12:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Dec 2018 20:11:42 +0000 Original-Received: from localhost ([127.0.0.1]:50600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gYclI-0004oh-P4 for submit@debbugs.gnu.org; Sun, 16 Dec 2018 15:11:40 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gYclF-0004oP-7G for submit@debbugs.gnu.org; Sun, 16 Dec 2018 15:11:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYcl9-00017b-64 for submit@debbugs.gnu.org; Sun, 16 Dec 2018 15:11:31 -0500 Original-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 ) id 1gYcl9-00017T-2g for submit@debbugs.gnu.org; Sun, 16 Dec 2018 15:11:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYcl8-0002WA-2D for bug-guile@gnu.org; Sun, 16 Dec 2018 15:11:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYcl7-00016Y-5a for bug-guile@gnu.org; Sun, 16 Dec 2018 15:11:30 -0500 Original-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 ) id 1gYcl7-00016M-0W for bug-guile@gnu.org; Sun, 16 Dec 2018 15:11:29 -0500 Original-Received: by mail-yw1-xc30.google.com with SMTP id v20so3005150ywc.0 for ; 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) Original-Received: from localhost ([2601:c6:cf00:1c9::9584]) by smtp.gmail.com with ESMTPSA id j65sm3603070ywf.21.2018.12.16.12.11.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Dec 2018 12:11:27 -0800 (PST) X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.lisp.guile.bugs:9290 Archived-At: 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