147048Sbostic /*- 2*61117Sbostic * Copyright (c) 1991, 1993 3*61117Sbostic * The Regents of the University of California. All rights reserved. 447048Sbostic * 547048Sbostic * %sccs.include.redist.c% 647048Sbostic */ 747048Sbostic 847048Sbostic #if defined(LIBC_SCCS) && !defined(lint) 9*61117Sbostic static char sccsid[] = "@(#)frexp.c 8.1 (Berkeley) 06/04/93"; 1047048Sbostic #endif /* LIBC_SCCS and not lint */ 1147048Sbostic 1247048Sbostic #include <sys/types.h> 1347048Sbostic #include <math.h> 1447048Sbostic 1547048Sbostic double frexp(value,eptr)1647048Sbosticfrexp(value, eptr) 1747048Sbostic double value; 1847048Sbostic int *eptr; 1947048Sbostic { 2047048Sbostic union { 2147048Sbostic double v; 2247048Sbostic struct { 2347048Sbostic u_int u_sign : 1; 2447048Sbostic u_int u_exp : 11; 2547048Sbostic u_int u_mant1 : 20; 2647048Sbostic u_int u_mant2 : 32; 2747048Sbostic } s; 2847048Sbostic } u; 2947048Sbostic 3047048Sbostic if (value) { 3147048Sbostic u.v = value; 3247048Sbostic *eptr = u.s.u_exp - 1022; 3347048Sbostic u.s.u_exp = 1022; 3447048Sbostic return(u.v); 3547048Sbostic } else { 3647048Sbostic *eptr = 0; 3747048Sbostic return((double)0); 3847048Sbostic } 3947048Sbostic } 40