Re: int2interval, frac2interval, rat2interval
On 2012-04-20 15:19:33 +0100, N.M. Maclaren wrote:
> On Apr 20 2012, Vincent Lefevre wrote:
> >
> >I think it could be (b) with very simple rules:
> > * the type contains integers, and possibly other values (numeric
> > or not).
> > * int2interval(i) is specified on integer values by P1788.
> > * On other values, int2interval(i) returns NaI (if accepted for
> > other constructors).
>
> So far, fine.
>
> >Note: in practice, the type can provide infinities, but they should
> >be seen as other values, because infinities cannot be produced in a
> >correct integer expression.
>
> Er, why not? It is as easy to specify and produce integral infinities
> as rational / real / floating-point ones. Not all languages use ISO
> C's aberrant numeric type model.
I agree, but I meant that infinities are not part of math integers
(with an exact arithmetic). For instance, 1/0 as an expression on
integers is undefined. For floating-point arithmetic, there is the
concept of limit, but not in integer arithmetic.
I think that infinities may be useful in integer types, but only in
order to signal overflows. However overflows would mean that the value
is inexact, while the context here is that i is an exact integer.
--
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)