147052Sbostic /*- 2*61221Sbostic * Copyright (c) 1991, 1993 3*61221Sbostic * The Regents of the University of California. All rights reserved. 447052Sbostic * 547052Sbostic * %sccs.include.redist.c% 647052Sbostic */ 747052Sbostic 847052Sbostic #if defined(LIBC_SCCS) && !defined(lint) 9*61221Sbostic static char sccsid[] = "@(#)frexp.c 8.1 (Berkeley) 06/04/93"; 1047052Sbostic #endif /* LIBC_SCCS and not lint */ 1147052Sbostic 1247052Sbostic #include <sys/types.h> 1347052Sbostic #include <math.h> 1447052Sbostic 1547052Sbostic double frexp(value,eptr)1647052Sbosticfrexp(value, eptr) 1747052Sbostic double value; 1847052Sbostic int *eptr; 1947052Sbostic { 2047052Sbostic union { 2147052Sbostic double v; 2247052Sbostic struct { 2347052Sbostic u_int u_mant2 : 32; 2447052Sbostic u_int u_mant1 : 20; 2547052Sbostic u_int u_exp : 11; 2647052Sbostic u_int u_sign : 1; 2747052Sbostic } s; 2847052Sbostic } u; 2947052Sbostic 3047052Sbostic if (value) { 3147052Sbostic u.v = value; 3247052Sbostic *eptr = u.s.u_exp - 1022; 3347052Sbostic u.s.u_exp = 1022; 3447052Sbostic return(u.v); 3547052Sbostic } else { 3647052Sbostic *eptr = 0; 3747052Sbostic return((double)0); 3847052Sbostic } 3947052Sbostic } 40