mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- The math kernel code no longer uses its own private scalbn() function.
- Added a function prototype for the _exit() function. Note that _exit() is not an ISO 'C' function. - Corrected the getopt() function prototype, as prompted by Henning Nielsen Lund. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15164 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,3 +1,10 @@
|
||||
- The math kernel code no longer uses its own private scalbn() function.
|
||||
|
||||
- Added a function prototype for the _exit() function. Note that _exit() is
|
||||
not an ISO 'C' function.
|
||||
|
||||
- Corrected the getopt() function prototype, as prompted by Henning Nielsen Lund.
|
||||
|
||||
- The printf() family no longer adds a 0 or 0x prefix if the alternate
|
||||
conversion modifier is present for the %o and %x conversions and the
|
||||
value to be converted is 0 already. Put another way, printf("%#x %#o",0,0);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib.h,v 1.17 2006-01-08 12:06:14 obarthel Exp $
|
||||
* $Id: stdlib.h,v 1.18 2006-11-13 09:51:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -156,6 +156,7 @@ extern long atol(const char *str);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern void _exit(int status);
|
||||
extern int rand_r(unsigned int * seed);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd.h,v 1.21 2006-08-02 06:49:47 obarthel Exp $
|
||||
* $Id: unistd.h,v 1.22 2006-11-13 09:51:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -114,7 +114,7 @@ extern int chdir(const char * path_name);
|
||||
extern int lockf(int file_descriptor, int function, off_t size);
|
||||
extern unsigned int sleep(unsigned int seconds);
|
||||
extern void usleep(unsigned long microseconds);
|
||||
extern int getopt(int argc, char * argv[], char *opts);
|
||||
extern int getopt(int argc, char * const argv[], const char *opts);
|
||||
extern pid_t getpid(void);
|
||||
extern char *realpath(const char *file_name, char *resolved_name);
|
||||
extern int fsync(int file_descriptor);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: libm.gmk,v 1.1 2006-09-17 17:37:27 obarthel Exp $
|
||||
# $Id: libm.gmk,v 1.2 2006-11-13 09:51:53 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -109,7 +109,6 @@ MATH_LIB := \
|
||||
math_kernel_cosf.o \
|
||||
math_kernel_expm1.o \
|
||||
math_kernel_rem_pio2.o \
|
||||
math_kernel_scalbn.o \
|
||||
math_kernel_sin.o \
|
||||
math_kernel_sinf.o \
|
||||
math_kernel_tan.o \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math_headers.h,v 1.14 2006-01-08 12:04:23 obarthel Exp $
|
||||
* $Id: math_headers.h,v 1.15 2006-11-13 09:51:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -216,7 +216,6 @@ extern double __kernel_sin(double x, double y, int iy);
|
||||
extern int __rem_pio2(double x, double *y);
|
||||
extern double __kernel_tan(double x, double y, int iy);
|
||||
extern double __expm1(double x);
|
||||
extern double __scalbn(double x, int n);
|
||||
extern float __kernel_cosf(float x, float y);
|
||||
extern float __kernel_sinf(float x, float y, int iy);
|
||||
extern LONG __rem_pio2f(float x, float *y);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math_kernel_rem_pio2.c,v 1.6 2006-11-13 09:25:28 obarthel Exp $
|
||||
* $Id: math_kernel_rem_pio2.c,v 1.7 2006-11-13 09:51:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -102,7 +102,7 @@ recompute:
|
||||
}
|
||||
|
||||
/* compute n */
|
||||
z = __scalbn(z,(int)q0); /* actual value of z */
|
||||
z = scalbn(z,(int)q0); /* actual value of z */
|
||||
z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */
|
||||
n = (int) z;
|
||||
z -= (double)n;
|
||||
@ -135,7 +135,7 @@ recompute:
|
||||
}
|
||||
if(ih==2) {
|
||||
z = one - z;
|
||||
if(carry!=0) z -= __scalbn(one,(int)q0);
|
||||
if(carry!=0) z -= scalbn(one,(int)q0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ recompute:
|
||||
jz -= 1; q0 -= 24;
|
||||
while(iq[jz]==0) { jz--; q0-=24;}
|
||||
} else { /* break z into 24-bit if necessary */
|
||||
z = __scalbn(z,-(int)q0);
|
||||
z = scalbn(z,-(int)q0);
|
||||
if(z>=two24) {
|
||||
fw = (double)((int)(twon24*z));
|
||||
iq[jz] = (int)(z-two24*fw);
|
||||
@ -171,7 +171,7 @@ recompute:
|
||||
}
|
||||
|
||||
/* convert integer "bit" chunk to floating-point value */
|
||||
fw = __scalbn(one,(int)q0);
|
||||
fw = scalbn(one,(int)q0);
|
||||
for(i=jz;i>=0;i--) {
|
||||
q[i] = fw*(double)iq[i]; fw*=twon24;
|
||||
}
|
||||
@ -331,7 +331,7 @@ int __rem_pio2(double x, double *y)
|
||||
}
|
||||
/* keep the compiler happy */
|
||||
z = 0;
|
||||
/* set z = __scalbn(|x|,ilogb(x)-23) */
|
||||
/* set z = scalbn(|x|,ilogb(x)-23) */
|
||||
GET_LOW_WORD(low,x);
|
||||
SET_LOW_WORD(z,low);
|
||||
e0 = (int)((ix>>20)-1046); /* e0 = ilogb(z)-23; */
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* $Id: math_kernel_scalbn.c,v 1.5 2006-01-08 12:04:23 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _MATH_HEADERS_H
|
||||
#include "math_headers.h"
|
||||
#endif /* _MATH_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(FLOATING_POINT_SUPPORT) && defined(PPC_FLOATING_POINT_SUPPORT)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static const double
|
||||
huge = 1.0e+300,
|
||||
tiny = 1.0e-300,
|
||||
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
|
||||
twom54 = 5.55111512312578270212e-17; /* 0x3C900000, 0x00000000 */
|
||||
|
||||
double __scalbn (double x, int n)
|
||||
{
|
||||
int k,hx,lx;
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
k = (hx&0x7ff00000)>>20; /* extract exponent */
|
||||
if (k==0) { /* 0 or subnormal x */
|
||||
if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
|
||||
x *= two54;
|
||||
GET_HIGH_WORD(hx,x);
|
||||
k = ((hx&0x7ff00000)>>20) - 54;
|
||||
if (n< -50000) return tiny*x; /*underflow*/
|
||||
}
|
||||
if (k==0x7ff) return x+x; /* NaN or Inf */
|
||||
k = k+n;
|
||||
if (k > 0x7fe) return huge*copysign(huge,x); /* overflow */
|
||||
if (k > 0) /* normal result */
|
||||
{SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
|
||||
if (k <= -54) {
|
||||
if (n > 50000) /* in case integer overflow in n+k */
|
||||
return huge*copysign(huge,x); /*overflow*/
|
||||
else return tiny*copysign(tiny,x); /*underflow*/
|
||||
}
|
||||
k += 54; /* subnormal result */
|
||||
SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
|
||||
return x*twom54;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* FLOATING_POINT_SUPPORT && PPC_FLOATING_POINT_SUPPORT */
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_getopt.c,v 1.6 2006-01-08 12:04:27 obarthel Exp $
|
||||
* $Id: unistd_getopt.c,v 1.7 2006-11-13 09:51:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -55,7 +55,7 @@ char * optarg;
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
getopt(int argc, char * argv[], char *opts)
|
||||
getopt(int argc, char * const argv[], const char *opts)
|
||||
{
|
||||
static int sp = 1;
|
||||
int result = EOF;
|
||||
|
||||
Reference in New Issue
Block a user