Re: Motion 46: finalise interval literals
On 12 Jul 2013, at 15:21, Vincent Lefevre wrote:
> Actually, for powers of 10 (the radix), I was thinking of Harrison's
> definition of ulp. From our Handbook of Floating-Point Arithmetic:
>
> [Harrison] $\ulp(x)$ is the distance between the closest straddling
> floating-point numbers $a$ and $b$ (i.e., those with $a \leq x \leq b$
> and $a \neq b$), assuming that the exponent range is not upper-bounded.
OK, here, with authority from an established book, is a (related but) separate concept of ulp. This is really a function ulp(x,F) where x is an arbitrary real number and F is a number format in the P1788 sense.
So the definition for interval literals needs stating more carefully. It is really ulp(s,b) where b is a radix and s is a string representing a number in radix b without exponent. Ignoring any weird coding that says what b is, s has the form
{sign}? ( {b-ary digit} | {point} ) +
where there is at least one b-ary digit and at most one point ".".
If there is no point, or no digits after the point, then ulp=1.
Otherwise ulp = 1/b^n where n is the number of digits after the point.
Example: 0 and 0. have ulp=1, while .0 and 0.0 have ulp=1/b.
Does that do?
John Pryce