Numbers with mantissa width are not read properly
Bug #406976 reported by
G. Weinholt
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ikarus Scheme |
Fix Committed
|
Low
|
Abdulaziz Ghuloum |
Bug Description
Numbers of the form x|p aren't handled by string->number:
Ikarus Scheme version 0.0.4-rc1+, 64-bit (revision 1833, build 2009-07-30)
Copyright (c) 2006-2009 Abdulaziz Ghuloum
> (string->number "1.1|53")
#f
>
The reader also seems to treat `|' like a delimiter:
> 1.1|53
1.1
> |
Unhandled exception
Condition components:
1. &undefined
2. &who: eval
3. &message: "unbound variable"
4. &irritants: (\x35;3\xA;)
Here's another "interesting" side-effect of all this:
> #!r6rs (+ 1 1.1|53)
>
Related branches
To post a comment you must log in.
In reverse order:
On Jul 30, 2009, at 7:28 PM, Göran Weinholt wrote:
> Public bug reported:
>
> Here's another "interesting" side-effect of all this:
>> #!r6rs (+ 1 1.1|53)
>
>>
>
This was actually due to not raising the proper &lexical condition
which I fixed in revision 1834. So, you now get the more informative
error:
> #!r6rs (+ 1 1.1|53)
Unhandled exception
Condition components:
1. &lexical
2. &message: "|symbol| syntax is invalid in #!r6rs mode"
3. &source-position:
file-name: *stdin*
character: 17
> ^D
> The reader also seems to treat `|' like a delimiter:
>> 1.1|53
> 1.1
>> |
> Unhandled exception
> Condition components:
> 1. &undefined
> 2. &who: eval
> 3. &message: "unbound variable"
> 4. &irritants: (\x35;3\xA;)
Yes, I've turned it into a delimiter 3 revisions ago in order to
let the scribble reader be able to read @{@|bar|.} without error.
I don't think it's a big violation of R6RS to treat | as delimiter
and this is regardless of the number syntax (e.g., it will not be
treated as a delimiter inside numbers just like it's not one inside
strings).
And now the real issue:
> Numbers of the form x|p aren't handled by string->number:
> Ikarus Scheme version 0.0.4-rc1+, 64-bit (revision 1833, build
> 2009-07-30)
> Copyright (c) 2006-2009 Abdulaziz Ghuloum
>
>> (string->number "1.1|53")
> #f
>>
This is correct. The short answer is: I don't know what to do with
the mantissa width, so, I can either go the route of the other
implementations (i.e., read it and ignore it) which does not sound
like the right thing to do, or, since no one does it correctly, be
the scapegoat and not support it at all. Don't know what's the
best action for this.
Aziz,,,