From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Zefram Newsgroups: gmane.lisp.guile.bugs Subject: bug#26259: ~f SRFI-19 format broken for small nanoseconds values Date: Sun, 26 Mar 2017 03:00:50 +0100 Message-ID: <20170326020050.GC6453@fysh.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1490493735 12017 195.159.176.226 (26 Mar 2017 02:02:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 26 Mar 2017 02:02:15 +0000 (UTC) To: 26259@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Mar 26 04:02:06 2017 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 1crxVN-00024h-NL for guile-bugs@m.gmane.org; Sun, 26 Mar 2017 04:02:05 +0200 Original-Received: from localhost ([::1]:39311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crxVT-0008To-Ow for guile-bugs@m.gmane.org; Sat, 25 Mar 2017 22:02:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crxVL-0008Th-EM for bug-guile@gnu.org; Sat, 25 Mar 2017 22:02:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1crxVK-0007cN-J3 for bug-guile@gnu.org; Sat, 25 Mar 2017 22:02:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46643) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1crxVK-0007cG-Fm for bug-guile@gnu.org; Sat, 25 Mar 2017 22:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1crxVK-0006E8-6X for bug-guile@gnu.org; Sat, 25 Mar 2017 22:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 26 Mar 2017 02:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 26259 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.149049366923872 (code B ref -1); Sun, 26 Mar 2017 02:02:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Mar 2017 02:01:09 +0000 Original-Received: from localhost ([127.0.0.1]:44842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1crxUS-0006Cy-Vd for submit@debbugs.gnu.org; Sat, 25 Mar 2017 22:01:09 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53287) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1crxUQ-0006CM-Av for submit@debbugs.gnu.org; Sat, 25 Mar 2017 22:01:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1crxUK-00075C-0D for submit@debbugs.gnu.org; Sat, 25 Mar 2017 22:01:01 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49693) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1crxUJ-00074r-TY for submit@debbugs.gnu.org; Sat, 25 Mar 2017 22:00:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crxUI-0008PA-U2 for bug-guile@gnu.org; Sat, 25 Mar 2017 22:00:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1crxUH-00072U-VY for bug-guile@gnu.org; Sat, 25 Mar 2017 22:00:58 -0400 Original-Received: from river6.fysh.org ([2001:41d0:d:20da::2]:37126 helo=river.fysh.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1crxUH-0006xU-M7 for bug-guile@gnu.org; Sat, 25 Mar 2017 22:00:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fysh.org; s=20170316; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date; bh=7nIdjhndo8bN+up0FSxpmum47uJN/oHf5HU9mNVC34Y=; b=V7ij2AIsjI4ZYc7YU3uxV7QXfyrdUxQfxgu9fvA2Mao1cJ9YZqLxiga6Oo8haGc76wv3kgfWjlJBiRz0C0y31dhQp0Zu+WnyTv/UO2GCigpuue5NIoro78MDA8gfKYI4Culy7eZMdC0W3hofRvkoHAUml4vwY4cPsQ9KGQxTAM4=; Original-Received: from zefram by river.fysh.org with local (Exim 4.84_2 #1 (Debian)) id 1crxUA-0007PY-DQ; Sun, 26 Mar 2017 03:00:50 +0100 Content-Disposition: inline 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:8721 Archived-At: The ~f format specifier in SRFI-19's date->string function is supposed to produce a decimal string representation of the seconds and nanoseconds portions of a date together: scheme@(guile-user)> (use-modules (srfi srfi-19)) scheme@(guile-user)> (date->string (make-date 550000000 56 34 12 26 3 2017 0) "~f") $1 = "56.55" but it screws up for nanoseconds values in the range (0, 1000000), i.e., for any time that lies strictly within the first millisecond of a second: scheme@(guile-user)> (date->string (make-date 550000 56 34 12 26 3 2017 0) "~f") $2 = "56.5e-4" Looks like the fractional seconds value is being formatted through a mechanism that is not suitable for this purpose, which uses exponent notation for sufficiently small values and thereby surprises the date->string code. Note that just assembling the seconds+fraction value and putting the whole thing through the same formatter, as opposed to putting the fractional part through on its own, would fix the above test cases, and any others with non-zero integer seconds, but would leave the bug unfixed for the case where the integer seconds value is zero. Fixing this requires not using any formatting mechanism that would ever resort to exponent notation for values in the relevant range. -zefram