/*
 * Copyright (c) 2002-2006 MIPS Technologies, Inc.
 * 
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 *      * Redistributions of source code must retain the above copyright
 *        notice, this list of conditions and the following disclaimer.
 *      * Redistributions in binary form must reproduce the above
 *      copyright
 *        notice, this list of conditions and the following disclaimer
 *        in the documentation and/or other materials provided with
 *        the distribution.
 *      * Neither the name of MIPS Technologies Inc. nor the names of its
 *        contributors may be used to endorse or promote products derived
 *        from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * limits.h : MIPS floating point values 
 */


/* FOR COMPATIBILITY ONLY - DON'T USE FOR NEW CODE */

#ifndef _MIPS_VALUES_H_
#define _MIPS_VALUES_H_

#include <machine/limits.h>
#include <machine/float.h>

/* The bits per C type. */
#define	BITSPERBYTE	8
#define	BITS(type)	(BITSPERBYTE * sizeof(type))

/* The high-order bit for shorts, ints, longs. */
#define	HIBITS		((short)(1 << BITS(short) - 1))
#define	HIBITI		((int)(1 << BITS(int) - 1)
#define	HIBITL		((long)(1 << BITS(long) - 1)

/* Maximum short, int, long. */
#define	MAXSHORT	SHRT_MAX	/* Max short. */
#define	MAXINT		INT_MAX		/* Max int. */
#define	MAXLONG		LONG_MAX	/* Max long. */

#define	_IEEE		1		/* 1 if IEEE standard. */
#define	_HIDDENBIT	1		/* 1 if mantissa high-bit is implicit */

#define MAXDOUBLE	DBL_MAX		/* Max double. */
#define MINDOUBLE	DBL_MIN		/* Min double. */
#define	DMAXEXP		DBL_MAX_EXP	/* Max double exponent. */
#define	DMINEXP		DBL_MIN_EXP	/* Min double exponent. */
#define	DSIGNIF		DBL_MANT_DIG	/* Significant bits in a double. */
					/* Max power of 2 in a double */
#define	DMAXPOWTWO	((double)(1L << (32 - 2)) * (1L << ((32-11) + 1)))
#define	_DEXPLEN	11		/* Bits in double exponent. */
					/* natural log(MAXDOUBLE) */
#define	LN_MAXDOUBLE	709.78271289338399
					/* natural log(MINDOUBLE) */
#define	LN_MINDOUBLE	-708.3964185322641

#define MAXFLOAT	FLT_MAX		/* Max float. */
#define MINFLOAT	FLT_MIN		/* Min float. */
#define	FMAXEXP		FLT_MAX_EXP	/* Max float exponent. */
#define	FMINEXP		FLT_MIN_EXP	/* Min float exponent. */
#define	FSIGNIF		FLT_MANT_DIG	/* Significant bits in a float. */
					/* Max power of 2 in a double */
#define	FMAXPOWTWO	((float)(1L << (32-8) - 1))
#define	_FEXPLEN	8		/* Bits in float exponent. */
#define	LN_MAXFLOAT	88.722839	/* natural log(MAXFLOAT) */
#define	LN_MINFLOAT	-87.336544	/* natural log(MINFLOAT) */
#endif /* ! _MIPS_VALUES_H_ */
