GNU bug report logs -
#26259
~f SRFI-19 format broken for small nanoseconds values
Previous Next
Reported by: Zefram <zefram <at> fysh.org>
Date: Sun, 26 Mar 2017 02:02:01 UTC
Severity: normal
Done: Andy Wingo <wingo <at> igalia.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26259 in the body.
You can then email your comments to 26259 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#26259
; Package
guile
.
(Sun, 26 Mar 2017 02:02:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Zefram <zefram <at> fysh.org>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Sun, 26 Mar 2017 02:02:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Reply sent
to
Andy Wingo <wingo <at> igalia.com>
:
You have taken responsibility.
(Wed, 19 Apr 2017 13:51:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Zefram <zefram <at> fysh.org>
:
bug acknowledged by developer.
(Wed, 19 Apr 2017 13:51:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 26259-done <at> debbugs.gnu.org (full text, mbox):
On Sun 26 Mar 2017 04:00, Zefram <zefram <at> fysh.org> writes:
> scheme@(guile-user)> (date->string (make-date 550000 56 34 12 26 3 2017 0) "~f")
> $2 = "56.5e-4"
Thanks for the report. Fixed in the the fix for #26260; added the test
case anyway. Cheers.
Andy
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 18 May 2017 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 345 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.