Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4973 right-hear 1
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2
/* s_frexpf.c -- float version of s_frexp.c.
3
 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
4
 */
5
 
6
/*
7
 * ====================================================
8
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9
 *
10
 * Developed at SunPro, a Sun Microsystems, Inc. business.
11
 * Permission to use, copy, modify, and distribute this
12
 * software is freely granted, provided that this notice
13
 * is preserved.
14
 * ====================================================
15
 */
16
 
17
#if defined(LIBM_SCCS) && !defined(lint)
18
static char rcsid[] = "$Id: s_frexpf.c,v 1.2 1994/08/18 23:06:51 jtc Exp $";
19
#endif
20
 
21
#include "math.h"
22
#include "math_private.h"
23
 
24
#ifdef __STDC__
25
static const float
26
#else
27
static float
28
#endif
29
one   =  1.0000000000e+00, /* 0x3F800000 */
30
two25 =  3.3554432000e+07; /* 0x4c000000 */
31
 
32
#ifdef __STDC__
33
	float frexpf(float x, int *eptr)
34
#else
35
	float frexpf(x, eptr)
36
	float x; int *eptr;
37
#endif
38
{
39
	int32_t hx,ix;
40
	GET_FLOAT_WORD(hx,x);
41
	ix = 0x7fffffff&hx;
42
	*eptr = 0;
43
	if(ix>=0x7f800000||(ix==0)) return x;	/* 0,inf,nan */
44
	if (ix<0x00800000) {		/* subnormal */
45
	    x *= two25;
46
	    GET_FLOAT_WORD(hx,x);
47
	    ix = hx&0x7fffffff;
48
	    *eptr = -25;
49
	}
50
	*eptr += (ix>>23)-126;
51
	hx = (hx&0x807fffff)|0x3f000000;
52
	*(int*)&x = hx;
53
	return x;
54
}