Re: Motion 46: finalise interval literals
On 2013-07-11 07:26:44 -0700, Dmitry Nadezhin wrote:
> Vincent,
>
> > You should give an example with a power of 10, because not everyone
> > has the same definition of ulp for such a number. Say, "100?" is
> > [99.5,100.5]. Also, it is ambiguous for 0: is it defined or not?
> > For instance, "0?", "0.0?", etc. The ulp of 0 is not defined, but
> > it can make sense to define "0?", "0.0?", etc.
>
> I think that this phrase from the text is sufficient:
> "One ulp equals one unit in the last place of the number m as written."
Perhaps, however it isn't very well said: "the number m as written"
still refers to a number, not a string or representation. I would
prefer something like:
One ulp equals the unit (weight) of the last written digit.
> It defines ulp not in terms of value but in terms of string. So
> 0? = [-0.5,+0.5]
> 0.0? = [-0.05,+0.05]
But I think that such examples would be useful.
> > Moreover the grammar doesn't match (1). According to (1), "011" is
> > 9 in C, but according to the grammar, it is 11, in the context of
> > ratNumLit.
>
> I suggest that interval intervals in the standard are portable.
> Program P1 in language L1 in locale Loc1 writes text file with
> interval literals and program P2 in language L2 in Local Loc2 reads
> them correctly.
I agree that this would be preferable. But the standard should be
clear on this point, in particular that the current locale mustn't
have an influence on the result, because this is not the usual
behavior.
A language or implementation could still have its own locale-dependent
functions (for humans). Since there are many possibilities and the
format may be more language-specific, they don't need to (and
shouldn't) be standardized here, IMHO.
> So I would replace host-language items by concrete items
> langNumLit {langNumLiMant} {langNumLitExp}?
> langNumLitMant {sign}? ( {digit}+ ( "." {digit}* )? | "." {digit}+ )
> langNumLitExp anycase("e") {sign}? {digit}+
> sp ( " " | "\t" )*
>
> Then "011" in interval literals is always 11.
> We may write a warning in the standard.
Yes.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)