NetBSD/lib/libc/gen/ieee754_infinity.c
simonb 2d8577fb83 Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
 - Use the above for the __infinity and __nan constants on all
   architectures that use the standard ieee754 representation of
   those constants.
 - Add a single copy of various ieee754 math functions (frexp, isinf,
   isnan, ldexp and modf) that had numerous duplicates among the
   arch-specific directories.
 - Use the above functions on all architectures where the generic C
   versions where used.  Architectures that had local assembly
   routines are untouched (for those functions only).
2002-02-19 13:08:12 +00:00

16 lines
343 B
C

/* $NetBSD: ieee754_infinity.c,v 1.1 2002/02/19 13:08:13 simonb Exp $ */
/*
* IEEE-compatible infinity.c -- public domain.
*/
#include <math.h>
#include <machine/endian.h>
const union __double_u __infinity =
#if BYTE_ORDER == BIG_ENDIAN
{ { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0} };
#else
{ { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f} };
#endif