/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved. The Berkeley Software License Agreement
 * specifies the terms and conditions for redistribution.
 */
static char rcsid[] = "$Header:range.c 12.0$";
/*
char id_range[] = "@(#)range.c	1.2";
 *
 * routines to return extreme values
 * VERY MACHINE DEPENDENT
 */

#ifdef ibm032
#include <ieee.h>
#endif ibm032

union fi
{	float	f;
	long	i;
} ;

union dj
{	double	d;
	long	j[2];
} ;

float
flmax_()
{
	union fi n;
#if	pdp11
	n.i = 0x7fffffffL;
#else	pdp11
#if	vax
	n.i = 0xffff7fff;
#else	vax
#if	ibm032
	n.i = 0x7f7fffff;		/* nextfloat(infinity(),0.0); */
#else	ibm032
	UNKNOWN MACHINE!
#endif	ibm032
#endif  vax
#endif	pdp11
	return(n.f);
}

double
dflmax_()
{
	union dj n;
#if	pdp11
	n.j[0] = 0x7fffffffL;
	n.j[1] = 0xffffffffL;
#else	pdp11
#if	vax
	n.j[0] = 0xffff7fff;
	n.j[1] = 0xffffffff;
#else	vax
#if	ibm032
	n.j[0] = 0x7fefffff; 		/* nextdouble(infinity(),0.0); */
	n.j[1] = 0xffffffff;
#else	ibm032
	UNKNOWN MACHINE!
#endif	ibm032
#endif	vax
#endif	pdp11
	return(n.d);
}

float
flmin_()
{
	union fi n;
#if	pdp11
	n.i = 0x00800000L;
#else	pdp11
#if	vax
	n.i = 0x00000080;
#else	vax
#if	ibm032
			 		/* this is the smallest normal, */
					/* not the smallest (denormal)	*/
	n.i = 0x00800000; 		/* value should be: 		*/
					/* nextfloat(0.0,1.0)/		*/
					/* (1.0 - nextfloat(1.0,0.0));	*/
					/* but that too is off by 1 in	*/
					/* the exponent field		*/
#else	ibm032
	UNKNOWN MACHINE!
#endif	ibm032
#endif	vax
#endif	pdp11
	return(n.f);
}

double
dflmin_()
{
	union dj n;
#if	pdp11
	n.j[0] = 0x00800000L;
	n.j[1] = 0;
#else	pdp11
#if	vax
	n.j[0] = 0x00000800;
	n.j[1] = 0;
#else	vax
#if	ibm032
			 		/* this is the smallest normal, */
					/* not the smallest (denormal)	*/
	n.j[0] = 0x00100000;		/* value should be: 		*/
	n.j[1] = 0; 			/* nextdouble(0.0,1.0)/		*/
					/* (1.0 - nextdouble(1.0,0.0));	*/
					/* but that too is off by 1 in	*/
					/* the exponent field		*/
#else	ibm032
	UNKNOWN MACHINE!
#endif	ibm032
#endif	vax
#endif	pdp11
	return(n.d);
}

long int
inmax_()
{
	return(0x7fffffffL);
}


float
ffrac_()
{
	union fi n;
#if	pdp11
	n.i = 0x35000000L;
#else	pdp11
#if	vax
	n.i = 0x00003500;
#else 	vax
#if	ibm032
	n.i = 0x34000000; 		/* nextfloat(1.0,2.0) - 1.0; */
#else	ibm032
	UNKNOWN MACHINE!
#endif	ibm032
#endif	vax
#endif	pdp11
	return(n.f);
}

double
dffrac_()
{
	union dj n;
#if	pdp11
	n.j[0] = 0x25000000L;
	n.j[1] = 0;
#else	pdp11
#if	vax
	n.j[0] = 0x00002500;
	n.j[1] = 0;
#else 	vax
#if	ibm032
	n.j[0] = 0x3cb00000; 		/* nextdouble(1.0,2.0) - 1.0; */
	n.j[1] = 0;
#else	ibm032
	UNKNOWN MACHINE!
#endif	ibm032
#endif	vax
#endif	pdp11
	return(n.d);
}
