Peter has kindly made most of the points I'd intended to make, and a few
more.
These bad values are tested for equality, even floating point,
against pixel values, hence the bit patterns matter.
> > And what's with those bit patterns? Given that that FF7FFFFF is just
Interesting that my old SUN/39 has FFFFFFFF as the hex pattern.
> > an integer (that is, it's in significance order rather than memory
> > order, which makes sense), then it corresponds to the most negative
> > finite IEEE float, and that means that VAL__BADR is equal to NUM__MINR,
Yes values were taken to be the most extreme and hence least likely to
be needed for actual values. NUM ignores bad values hence the NUM__MINR
is the same as BAD__VALR.
> > which is slightly surprising. But then this is clearly not a special
> > number on a VAX -- and possibly not even a legal float, I can't remember.
It's a legal float on a Vax.
> > It would also be sensible, I think, to take the minimum and maximum
> > values from something like float.h, and just set the VAL__BADR and
> > NUm__MINR values, for example, to be the same as float.h's FLT_MIN.
>
> Yes, from img.h:
>
> /* Define BAD values. */
>
> #include <float.h>
> #include <limits.h>
>
> #define VAL__BADF -FLT_MAX
> #define VAL__BADD -DBL_MAX
> #define VAL__BADI INT_MIN
> #define VAL__BADS SHRT_MIN
> #define VAL__BADUS USHRT_MAX
> #define VAL__BADB CHAR_MIN
> #define VAL__BADUB UCHAR_MAX
What about the VAL_MINx, i.e. one bit different from VAL__BADx?
Malcolm
|