Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Motion P1788.1/M005 to avoid non-conforming interval standards



On 2016-08-07 18:09:28 -0400, Michel Hack wrote:
> The big deal is that 1788 allows <lower,upper> to specified in mixed
> radices, and we want to avoid this in 1788.1 because determining
> whether lower<=upper is difficult -- and in any case, 754 does not
> support mixed-radix comparisons.

But it does not return false in a mixed-radix comparison. In practice,
in a language (or some implementation of the language), either this
would be supported or one would get a failure at compilation time
(e.g. thanks to a type system).

> We may have made a mistake in allowing mixed-radix interval literals
> in 1788.

I don't think that allowing mixed-radix interval literals is a
mistake: one can easily return an interval that contains the input.
What may be somewhat difficult is:

1. return the tightest interval that contains the input;

2. for [l,u], detect whether l > u (this can be regarded as a
   particular case of (1));

For (2), in the worst case, if one decides not to detect whether
l > u, one misses some error detection *in the bare interval*, but
the bare interval would still contain the input. Nothing wrong.

IMHO, if mixed-radix interval literals is disallowed, then in practice
one should get something like a compilation error when this is used,
i.e. something that will *always* be noticed by the user. Otherwise
it is too easy to make a mistake. Even when working in radix 2, one
often uses radix 10 to represent some numbers that can obviously be
exactly representable, such as small integers.

Just because there are some issues with complex cases, one shouldn't
make easy cases unsafe.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)