1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Implemented fmin()/fminf(), fmax()/fmaxf(), fdim()/fdimf() for C99.

- Ported acosf(), asinf(), atan2f(), atanf(), ceilf(), expf(), floorf(),
  fmodf(), frexpf(), ldexpf(), log10f(), logbf(), logf(), modff(), powf(), sqrtf(),
  scalbn() and scalbnf() for C99.

- Ported cbrt(), cbrtf(), erf(), erff(), erfc(), erfcf(), expm1(),
  expm1f(), ilogb(), ilogbf(), log1p() and log1pf() for C99.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14963 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-05-29 14:45:33 +00:00
parent 49e98713d4
commit 3c220c3939
36 changed files with 2501 additions and 161 deletions

View File

@@ -1,5 +1,5 @@
/*
* $Id: math_log10f.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $
* $Id: math_log10f.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $
*
* :ts=4
*
@@ -29,6 +29,18 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* PowerPC math library based in part on work by Sun Microsystems
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
*
*
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
*/
#ifndef _MATH_HEADERS_H
@@ -41,11 +53,38 @@
/****************************************************************************/
static const float
two25 = 3.3554432000e+07, /* 0x4c000000 */
ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
log10_2lo = 7.9034151668e-07; /* 0x355427db */
static const float zero = 0.0;
float
log10f(float x)
{
/* ZZZ unimplemented */
return(0);
float y,z;
LONG i,k,hx;
GET_FLOAT_WORD(hx,x);
k=0;
if (hx < 0x00800000) { /* x < 2**-126 */
if ((hx&0x7fffffff)==0)
return -two25/zero; /* log(+-0)=-inf */
if (hx<0) return (x-x)/zero; /* log(-#) = NaN */
k -= 25; x *= two25; /* subnormal number, scale up x */
GET_FLOAT_WORD(hx,x);
}
if (hx >= 0x7f800000) return x+x;
k += (hx>>23)-127;
i = ((ULONG)k&0x80000000U)>>31;
hx = (hx&0x007fffff)|((0x7f-i)<<23);
y = (float)(k+i);
SET_FLOAT_WORD(x,hx);
z = y*log10_2lo + ivln10*logf(x);
return z+y*log10_2hi;
}
/****************************************************************************/