s_logbf.c revision 8870
12116Sjkh/* s_logbf.c -- float version of s_logb.c. 22116Sjkh * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. 32116Sjkh */ 42116Sjkh 52116Sjkh/* 62116Sjkh * ==================================================== 72116Sjkh * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 82116Sjkh * 92116Sjkh * Developed at SunPro, a Sun Microsystems, Inc. business. 102116Sjkh * Permission to use, copy, modify, and distribute this 118870Srgrimes * software is freely granted, provided that this notice 122116Sjkh * is preserved. 132116Sjkh * ==================================================== 142116Sjkh */ 152116Sjkh 162116Sjkh#ifndef lint 178870Srgrimesstatic char rcsid[] = "$Id: s_logbf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; 182116Sjkh#endif 192116Sjkh 202116Sjkh#include "math.h" 212116Sjkh#include "math_private.h" 222116Sjkh 232116Sjkh#ifdef __STDC__ 242116Sjkh float logbf(float x) 252116Sjkh#else 262116Sjkh float logbf(x) 272116Sjkh float x; 282116Sjkh#endif 292116Sjkh{ 302116Sjkh int32_t ix; 312116Sjkh GET_FLOAT_WORD(ix,x); 322116Sjkh ix &= 0x7fffffff; /* high |x| */ 332116Sjkh if(ix==0) return (float)-1.0/fabsf(x); 342116Sjkh if(ix>=0x7f800000) return x*x; 352116Sjkh if((ix>>=23)==0) /* IEEE 754 logb */ 368870Srgrimes return -126.0; 372116Sjkh else 388870Srgrimes return (float) (ix-127); 392116Sjkh} 40