w_logf.c revision 1.7 1 1.1 jtc /* w_logf.c -- float version of w_log.c.
2 1.1 jtc * Conversion to float by Ian Lance Taylor, Cygnus Support, ian (at) cygnus.com.
3 1.1 jtc */
4 1.1 jtc
5 1.1 jtc /*
6 1.1 jtc * ====================================================
7 1.1 jtc * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 1.1 jtc *
9 1.1 jtc * Developed at SunPro, a Sun Microsystems, Inc. business.
10 1.1 jtc * Permission to use, copy, modify, and distribute this
11 1.5 simonb * software is freely granted, provided that this notice
12 1.1 jtc * is preserved.
13 1.1 jtc * ====================================================
14 1.1 jtc */
15 1.1 jtc
16 1.4 lukem #include <sys/cdefs.h>
17 1.2 jtc #if defined(LIBM_SCCS) && !defined(lint)
18 1.7 drochner __RCSID("$NetBSD: w_logf.c,v 1.7 2007/08/20 16:01:40 drochner Exp $");
19 1.1 jtc #endif
20 1.1 jtc
21 1.1 jtc /*
22 1.1 jtc * wrapper logf(x)
23 1.1 jtc */
24 1.1 jtc
25 1.7 drochner #include "namespace.h"
26 1.1 jtc #include "math.h"
27 1.1 jtc #include "math_private.h"
28 1.1 jtc
29 1.7 drochner #ifdef __weak_alias
30 1.7 drochner __weak_alias(logf, _logf)
31 1.7 drochner #endif
32 1.1 jtc
33 1.6 wiz float
34 1.6 wiz logf(float x) /* wrapper logf */
35 1.1 jtc {
36 1.1 jtc #ifdef _IEEE_LIBM
37 1.1 jtc return __ieee754_logf(x);
38 1.1 jtc #else
39 1.1 jtc float z;
40 1.1 jtc z = __ieee754_logf(x);
41 1.1 jtc if(_LIB_VERSION == _IEEE_ || isnanf(x) || x > (float)0.0) return z;
42 1.1 jtc if(x==(float)0.0)
43 1.1 jtc /* logf(0) */
44 1.1 jtc return (float)__kernel_standard((double)x,(double)x,116);
45 1.5 simonb else
46 1.1 jtc /* logf(x<0) */
47 1.1 jtc return (float)__kernel_standard((double)x,(double)x,117);
48 1.1 jtc #endif
49 1.1 jtc }
50