[racket] the Numbers grammar

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Aug 10 17:35:28 EDT 2012

Thanks! I'll fix the documentation.

At Thu, 9 Aug 2012 02:07:43 +0100, milo arvidsson wrote:
> I've been studying the numbers grammar in section 1.3.3 of the Racket
> reference and I think I've spotted a few mistakes:
> 
> 1. <exact-complex_n> allows the imaginary part of an exact complex
> number to be signed given that an exact rational may be signed:
> 
> <exact-integer_n> ::= [<sign>] <unsigned-integer_n>
> <exact-rational_n> ::= <exact-integer_n> / <unsigned-integer_n>
> <exact-complex_n> ::= <exact-rational_n> <sign> <exact-rational_n> i
> 
> The rule allows exact complex numbers like this one: 1/2+-3/4i
> 
> but ...
> 
> >1/2+-3/4i
> 1/2+-3/4i: undefined;
>  cannot reference undefined identifier
> 
> 2. The three alternatives in <inexact-simple_n> should be unsigned
> given that <inexact-unsigned_n> uses <inexact-normal_n> which uses
> <inexact-simple_n>. But since exact integers may be signed, the second
> alternative in <inexact-simple_n> may be signed:
> 
> <inexact-simple_n> ::= [<exact-integer_n>] . <digits#_n>
> 
> 3. <inexact-normal_n> allows #  in an exponent:
> 
> <digits#_n> ::= <digit_n>+ #*
> ‹inexact-normal_n› ::= <inexact-simple_n> [<exp-mark_n> [<sign>] <digits#_n>]
> 
> but ...
> 
> >3.14e+87#
> 3.14e+87#: undefined;
>  cannot reference undefined identifier
> 
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.