half and quad

Janice Caron caron800 at googlemail.com
Fri Oct 12 21:49:53 PDT 2007


On 10/13/07, Nathan Reed <nathaniel.reed at gmail.com> wrote:
> Frits van Bommel wrote:
> > Janice Caron wrote:
> >> real16, real32, real64, real80, real128...
> >
> > I'd prefer floatN over realN, as that's a more accurate description of
> > the type.
> > (Floating-point types can't represent all real numbers)
>
> Integer types can't represent all integers, either...

Yeah, I had that in mind. An "intN" may represent that subset of the
integers which may be expressed in N bits. Likewise "realN" may
represent that subset of the reals which may be expressed in N bits.

You could certainly argue that all floats are rational, but they don't
store all rational numbers exactly either. As soon as an operation
requires it, they start rounding. A float actually represents a kind
of "fuzzy real" - that is, the true real that it tries to represent
exists somewhere within plus or minus some error bound of the rational
value, and it tries to keep that error bound as small as possible.

That said, realN or floatN -- I'd be happy either way. If we get
realN, then I'd want complexN, not crealN (Yuk!), but if we get floatN
then I guess cfloatN would do.



More information about the Digitalmars-d mailing list