SRFI-19's ~f specifier is broken in interesting ways

Bug #596563 reported by Göran Weinholt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Scheme Libraries
High
Unassigned

Bug Description

Ikarus Scheme version 0.0.4-rc1+ (revision 1870, build 2010-06-19)
Copyright (c) 2006-2009 Abdulaziz Ghuloum

> (import (srfi :19 time))
> (date->string (make-date 42 59 59 23 20 6 2010 0) "~4 ~f") ;weird
"2010-06-20T23:59:59Z 59.2e-8"
> (date->string (make-date 555000000 59 59 12 20 6 2010 0) "~4 ~f") ;weird
"2010-06-20T12:59:59Z 59.5549999999999999"
> (date->string (make-date 90000000 59 59 23 20 6 2010 0) "~4 ~f") ;bad
Unhandled exception
 Condition components:
   1. &assertion
   2. &who: +
   3. &message: "not a number"
   4. &irritants: (#f)
>

The last one seems to happen when the nanosecond field is less than 100 000 000 and has a single non-zero digit.

One way to fix all these is perhaps to convert the nanoseconds (modulo something?) to a string (take the leftmost 9(?) characters), which is then padded and trimmed.

Tested with lp:~scheme-libraries-team/scheme-libraries/srfi revno 95.

Revision history for this message
Derick Eddington (derick-eddington) wrote :

I think this is a problem with the reference implementation. I don't have the time, or even my own computer anymore, to work on fixing it. I'm happy to apply anyone's patch which fixes it.

Changed in scheme-libraries:
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers