IM
/* minmax.c - finds min, max, suggested sub and div for a set of
binary single precision floating point numbers */
#include
main()
{
int In;
union {
unsigned long image;
float x;
} both;
unsigned long in0, in1, in2, in3;
unsigned char c, j = 0;
float sub, div;
float min = 10e37;
float max = 10e-40;
while ((In = getchar()) != EOF)
{
in0 = In; in1 = getchar(); in2 = getchar(); in3 = getchar();
in0 <<= 24; in1 <<= 16; in2 <<= 8;
both.image = (in0 | in1 | in2 | in3);
both.image &= 0x7fffffff;
if (max < both.x) {max = both.x;}
if (min > both.x) {min = both.x;}
}
sub = min;
div = (max - min)/256;
printf("%s %e %s %e %s %e %s %e\n"," max =",max," min =",min,
" sub =",sub," div =",div);
}