147050Sbostic /*- 2*61232Sbostic * Copyright (c) 1991, 1993 3*61232Sbostic * The Regents of the University of California. All rights reserved. 447050Sbostic * 547050Sbostic * %sccs.include.redist.c% 647050Sbostic */ 747050Sbostic 847050Sbostic #if defined(LIBC_SCCS) && !defined(lint) 9*61232Sbostic static char sccsid[] = "@(#)frexp.c 8.1 (Berkeley) 06/04/93"; 1047050Sbostic #endif /* LIBC_SCCS and not lint */ 1147050Sbostic 1247050Sbostic #include <sys/types.h> 1347050Sbostic #include <math.h> 1447050Sbostic 1547050Sbostic double frexp(value,eptr)1647050Sbosticfrexp(value, eptr) 1747050Sbostic double value; 1847050Sbostic int *eptr; 1947050Sbostic { 2047050Sbostic union { 2147050Sbostic double v; 2247050Sbostic struct { 2347050Sbostic u_int u_mant1 : 7; 2447050Sbostic u_int u_exp : 8; 2547050Sbostic u_int u_sign : 1; 2647050Sbostic u_int u_mant2 : 16; 2747050Sbostic u_int u_mant3 : 32; 2847050Sbostic } s; 2947050Sbostic } u; 3047050Sbostic 3147050Sbostic if (value) { 3247050Sbostic u.v = value; 3347050Sbostic *eptr = u.s.u_exp - 128; 3447050Sbostic u.s.u_exp = 128; 3547050Sbostic return(u.v); 3647050Sbostic } else { 3747050Sbostic *eptr = 0; 3847050Sbostic return((double)0); 3947050Sbostic } 4047050Sbostic } 41