mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c449cb631 | ||
|
|
16407d5389 | ||
|
|
c18e21ee36 | ||
|
|
3f284b7fb8 | ||
|
|
0a3962a105 |
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# $Id: GNUmakefile.68k,v 1.3 2004-08-07 09:15:32 obarthel Exp $
|
# $Id: GNUmakefile.68k,v 1.5 2004-08-14 08:54:25 obarthel Exp $
|
||||||
#
|
#
|
||||||
# :ts=8
|
# :ts=8
|
||||||
#
|
#
|
||||||
@@ -458,6 +458,7 @@ MATH_LIB = \
|
|||||||
math_ldexp.o \
|
math_ldexp.o \
|
||||||
math_log.o \
|
math_log.o \
|
||||||
math_log10.o \
|
math_log10.o \
|
||||||
|
math_logb.o \
|
||||||
math_modf.o \
|
math_modf.o \
|
||||||
math_pow.o \
|
math_pow.o \
|
||||||
math_rint.o \
|
math_rint.o \
|
||||||
@@ -698,11 +699,6 @@ STARTUPS := nrcrt0.o nbcrt0.o nr32crt0.o nb32crt0.o ncrt0.o mainnb.o mainb.o mai
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
all: \
|
all: \
|
||||||
lib/libm020/libm.a \
|
|
||||||
lib/libm.a \
|
|
||||||
lib/libb/libm020/libm.a \
|
|
||||||
lib/libb/libm.a \
|
|
||||||
lib/libb32/libm020/libm.a \
|
|
||||||
lib/nrcrt0.o \
|
lib/nrcrt0.o \
|
||||||
lib/nbcrt0.o \
|
lib/nbcrt0.o \
|
||||||
lib/ncrt0.o \
|
lib/ncrt0.o \
|
||||||
@@ -710,7 +706,12 @@ all: \
|
|||||||
lib/n32rcrt0.o \
|
lib/n32rcrt0.o \
|
||||||
lib/mainnb.o \
|
lib/mainnb.o \
|
||||||
lib/mainb.o \
|
lib/mainb.o \
|
||||||
lib/mainb32.o
|
lib/mainb32.o \
|
||||||
|
lib/libm.a \
|
||||||
|
lib/libm020/libm.a \
|
||||||
|
lib/libb/libm.a \
|
||||||
|
lib/libb/libm020/libm.a \
|
||||||
|
lib/libb32/libm020/libm.a
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# $Id: GNUmakefile.os4,v 1.3 2004-08-07 09:15:32 obarthel Exp $
|
# $Id: GNUmakefile.os4,v 1.4 2004-08-12 12:31:15 obarthel Exp $
|
||||||
#
|
#
|
||||||
# :ts=8
|
# :ts=8
|
||||||
#
|
#
|
||||||
@@ -450,6 +450,7 @@ MATH_LIB = \
|
|||||||
math_ldexp.o \
|
math_ldexp.o \
|
||||||
math_log.o \
|
math_log.o \
|
||||||
math_log10.o \
|
math_log10.o \
|
||||||
|
math_logb.o \
|
||||||
math_modf.o \
|
math_modf.o \
|
||||||
math_pow.o \
|
math_pow.o \
|
||||||
math_rint.o \
|
math_rint.o \
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 168
|
#define REVISION 170
|
||||||
#define DATE "7.8.2004"
|
#define DATE "14.8.2004"
|
||||||
#define VERS "amiga.lib 1.168"
|
#define VERS "amiga.lib 1.170"
|
||||||
#define VSTRING "amiga.lib 1.168 (7.8.2004)\r\n"
|
#define VSTRING "amiga.lib 1.170 (14.8.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: amiga.lib 1.168 (7.8.2004)"
|
#define VERSTAG "\0$VER: amiga.lib 1.170 (14.8.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
168
|
170
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 168
|
#define REVISION 170
|
||||||
#define DATE "7.8.2004"
|
#define DATE "14.8.2004"
|
||||||
#define VERS "c.lib 1.168"
|
#define VERS "c.lib 1.170"
|
||||||
#define VSTRING "c.lib 1.168 (7.8.2004)\r\n"
|
#define VSTRING "c.lib 1.170 (14.8.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: c.lib 1.168 (7.8.2004)"
|
#define VERSTAG "\0$VER: c.lib 1.170 (14.8.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
168
|
170
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 168
|
#define REVISION 170
|
||||||
#define DATE "7.8.2004"
|
#define DATE "14.8.2004"
|
||||||
#define VERS "debug.lib 1.168"
|
#define VERS "debug.lib 1.170"
|
||||||
#define VSTRING "debug.lib 1.168 (7.8.2004)\r\n"
|
#define VSTRING "debug.lib 1.170 (14.8.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: debug.lib 1.168 (7.8.2004)"
|
#define VERSTAG "\0$VER: debug.lib 1.170 (14.8.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
168
|
170
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: ctype.h,v 1.2 2004-08-07 09:15:33 obarthel Exp $
|
* $Id: ctype.h,v 1.3 2004-08-07 10:42:04 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -63,12 +63,6 @@ extern int toupper(int c);
|
|||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/* The following is not part of the ISO 'C' (1994) standard. */
|
|
||||||
|
|
||||||
#define isascii(c) ((unsigned)(c) <= 127)
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If requested, reimplement the character classification functions as macros;
|
* If requested, reimplement the character classification functions as macros;
|
||||||
* note that the macro variants ignore the current locale and default to the
|
* note that the macro variants ignore the current locale and default to the
|
||||||
@@ -113,6 +107,12 @@ extern const unsigned char * const __ctype_table;
|
|||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||||
|
|
||||||
|
#define isascii(c) ((unsigned)(c) <= 127)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: math.h,v 1.2 2004-08-07 09:15:33 obarthel Exp $
|
* $Id: math.h,v 1.3 2004-08-12 12:31:29 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -89,6 +89,7 @@ extern double rint(double x);
|
|||||||
extern float rintf(float x);
|
extern float rintf(float x);
|
||||||
extern int isinf(double x);
|
extern int isinf(double x);
|
||||||
extern int isnan(double x);
|
extern int isnan(double x);
|
||||||
|
extern double logb(double x);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 168
|
#define REVISION 170
|
||||||
#define DATE "7.8.2004"
|
#define DATE "14.8.2004"
|
||||||
#define VERS "m.lib 1.168"
|
#define VERS "m.lib 1.170"
|
||||||
#define VSTRING "m.lib 1.168 (7.8.2004)\r\n"
|
#define VSTRING "m.lib 1.170 (14.8.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: m.lib 1.168 (7.8.2004)"
|
#define VERSTAG "\0$VER: m.lib 1.170 (14.8.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
168
|
170
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 168
|
#define REVISION 170
|
||||||
#define DATE "7.8.2004"
|
#define DATE "14.8.2004"
|
||||||
#define VERS "m881.lib 1.168"
|
#define VERS "m881.lib 1.170"
|
||||||
#define VSTRING "m881.lib 1.168 (7.8.2004)\r\n"
|
#define VSTRING "m881.lib 1.170 (14.8.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: m881.lib 1.168 (7.8.2004)"
|
#define VERSTAG "\0$VER: m881.lib 1.170 (14.8.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
168
|
170
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: math_fp_support.h,v 1.1.1.1 2004-07-26 16:30:44 obarthel Exp $
|
* $Id: math_fp_support.h,v 1.2 2004-08-08 10:55:57 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -36,9 +36,47 @@
|
|||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* If any of the three supported floating point support flavours is
|
||||||
|
enabled, make sure that the generic 'FLOATING_POINT_SUPPORT' symbol
|
||||||
|
is defined, too.*/
|
||||||
#if (defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT) || defined(PPC_FLOATING_POINT_SUPPORT))
|
#if (defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT) || defined(PPC_FLOATING_POINT_SUPPORT))
|
||||||
#define FLOATING_POINT_SUPPORT
|
#define FLOATING_POINT_SUPPORT
|
||||||
#endif
|
#endif /* IEEE_FLOATING_POINT_SUPPORT || M68881_FLOATING_POINT_SUPPORT || PPC_FLOATING_POINT_SUPPORT */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* This selects whether or not the 'long double' type should be used. So far,
|
||||||
|
only 'double' can be supported, and 'long double' defaults to 'double'. */
|
||||||
|
/*#define USE_LONG_DOUBLE*/
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(USE_LONG_DOUBLE)
|
||||||
|
typedef long double __long_double_t;
|
||||||
|
#else
|
||||||
|
typedef double __long_double_t;
|
||||||
|
#endif /* USE_LONG_DOUBLE */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* 'Portable' raw representations of three IEEE floating point formats. */
|
||||||
|
union ieee_long_double
|
||||||
|
{
|
||||||
|
long double value;
|
||||||
|
unsigned long raw[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
union ieee_double
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
unsigned long raw[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
union ieee_single
|
||||||
|
{
|
||||||
|
float value;
|
||||||
|
unsigned long raw[1];
|
||||||
|
};
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: math_headers.h,v 1.1.1.1 2004-07-26 16:30:45 obarthel Exp $
|
* $Id: math_headers.h,v 1.2 2004-08-12 12:31:16 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: math_init_exit.c,v 1.1.1.1 2004-07-26 16:30:46 obarthel Exp $
|
* $Id: math_init_exit.c,v 1.2 2004-08-08 10:55:57 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -121,41 +121,45 @@ __math_init(void)
|
|||||||
#endif /* IEEE_FLOATING_POINT_SUPPORT */
|
#endif /* IEEE_FLOATING_POINT_SUPPORT */
|
||||||
|
|
||||||
/* Now fill in the HUGE_VAL constant, which is set to
|
/* Now fill in the HUGE_VAL constant, which is set to
|
||||||
* +Infinity.
|
the largest representable floating point value. */
|
||||||
*/
|
|
||||||
if(sizeof(__huge_val) == 4) /* single precision */
|
if(sizeof(__huge_val) == 4) /* single precision */
|
||||||
{
|
{
|
||||||
static const unsigned long infinity[] =
|
static const unsigned long largest_fp_value[1] =
|
||||||
{
|
{
|
||||||
0x7F800000
|
/* Exponent = +126, Mantissa = 8,388,607 */
|
||||||
|
0x7f7fffff
|
||||||
};
|
};
|
||||||
|
|
||||||
assert( sizeof(infinity) == sizeof(__huge_val) );
|
assert( sizeof(largest_fp_value) == sizeof(__huge_val) );
|
||||||
|
|
||||||
memmove((void *)&__huge_val,infinity,sizeof(infinity));
|
memmove((void *)&__huge_val,largest_fp_value,sizeof(largest_fp_value));
|
||||||
}
|
}
|
||||||
else if (sizeof(__huge_val) == 8) /* double precision */
|
else if (sizeof(__huge_val) == 8) /* double precision */
|
||||||
{
|
{
|
||||||
static const unsigned long infinity[] =
|
static const unsigned long largest_fp_value[2] =
|
||||||
{
|
{
|
||||||
0x7FF00000,0x00000000
|
/* Exponent = +1022, Mantissa = 4,503,599,627,370,495 */
|
||||||
|
0x7fefffff,0xffffffff
|
||||||
};
|
};
|
||||||
|
|
||||||
assert( sizeof(infinity) == sizeof(__huge_val) );
|
assert( sizeof(largest_fp_value) == sizeof(__huge_val) );
|
||||||
|
|
||||||
memmove((void *)&__huge_val,infinity,sizeof(infinity));
|
memmove((void *)&__huge_val,largest_fp_value,sizeof(largest_fp_value));
|
||||||
}
|
}
|
||||||
|
#if defined(USE_LONG_DOUBLE)
|
||||||
else if (sizeof(__huge_val) == 12) /* extended precision */
|
else if (sizeof(__huge_val) == 12) /* extended precision */
|
||||||
{
|
{
|
||||||
static const unsigned long infinity[] =
|
static const unsigned long largest_fp_value[3] =
|
||||||
{
|
{
|
||||||
0x7FFF0000,0x00000000,0x00000000
|
/* Exponent = +32766, Mantissa = 18,446,744,073,709,551,615 */
|
||||||
|
0x7ffe0000,0xffffffff,0xffffffff
|
||||||
};
|
};
|
||||||
|
|
||||||
assert( sizeof(infinity) == sizeof(__huge_val) );
|
assert( sizeof(largest_fp_value) == sizeof(__huge_val) );
|
||||||
|
|
||||||
memmove((void *)&__huge_val,infinity,sizeof(infinity));
|
memmove((void *)&__huge_val,largest_fp_value,sizeof(largest_fp_value));
|
||||||
}
|
}
|
||||||
|
#endif /* USE_LONG_DOUBLE */
|
||||||
|
|
||||||
result = OK;
|
result = OK;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: math_isinf.c,v 1.1 2004-08-07 09:15:32 obarthel Exp $
|
* $Id: math_isinf.c,v 1.2 2004-08-08 10:55:57 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -45,26 +45,6 @@
|
|||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
union ieee_long_double
|
|
||||||
{
|
|
||||||
long double value;
|
|
||||||
unsigned long raw[3];
|
|
||||||
};
|
|
||||||
|
|
||||||
union ieee_double
|
|
||||||
{
|
|
||||||
double value;
|
|
||||||
unsigned long raw[2];
|
|
||||||
};
|
|
||||||
|
|
||||||
union ieee_single
|
|
||||||
{
|
|
||||||
float value;
|
|
||||||
unsigned long raw[1];
|
|
||||||
};
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
int
|
int
|
||||||
isinf(double number)
|
isinf(double number)
|
||||||
{
|
{
|
||||||
@@ -93,6 +73,7 @@ isinf(double number)
|
|||||||
/* Exponent = 2047 and fraction = 0.0 */
|
/* Exponent = 2047 and fraction = 0.0 */
|
||||||
is_infinity = (((x.raw[0] & 0x7FFFFFFF) == 0x7FF00000) && (x.raw[1] == 0));
|
is_infinity = (((x.raw[0] & 0x7FFFFFFF) == 0x7FF00000) && (x.raw[1] == 0));
|
||||||
}
|
}
|
||||||
|
#if defined(USE_LONG_DOUBLE)
|
||||||
else if (sizeof(number) == 12) /* extended precision */
|
else if (sizeof(number) == 12) /* extended precision */
|
||||||
{
|
{
|
||||||
union ieee_long_double x;
|
union ieee_long_double x;
|
||||||
@@ -102,6 +83,7 @@ isinf(double number)
|
|||||||
/* Exponent = 32767 and fraction = 0.0 */
|
/* Exponent = 32767 and fraction = 0.0 */
|
||||||
is_infinity = (((x.raw[0] & 0x7FFF0000) == 0x7FFF0000) && (x.raw[1] & 0x7FFFFFFF) == 0 && (x.raw[2] == 0));
|
is_infinity = (((x.raw[0] & 0x7FFF0000) == 0x7FFF0000) && (x.raw[1] & 0x7FFFFFFF) == 0 && (x.raw[2] == 0));
|
||||||
}
|
}
|
||||||
|
#endif /* USE_LONG_DOUBLE */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Can't happen */
|
/* Can't happen */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: math_isnan.c,v 1.1 2004-08-07 09:15:32 obarthel Exp $
|
* $Id: math_isnan.c,v 1.2 2004-08-08 10:55:57 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -45,26 +45,6 @@
|
|||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
union ieee_long_double
|
|
||||||
{
|
|
||||||
long double value;
|
|
||||||
unsigned long raw[3];
|
|
||||||
};
|
|
||||||
|
|
||||||
union ieee_double
|
|
||||||
{
|
|
||||||
double value;
|
|
||||||
unsigned long raw[2];
|
|
||||||
};
|
|
||||||
|
|
||||||
union ieee_single
|
|
||||||
{
|
|
||||||
float value;
|
|
||||||
unsigned long raw[1];
|
|
||||||
};
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
int
|
int
|
||||||
isnan(double number)
|
isnan(double number)
|
||||||
{
|
{
|
||||||
@@ -92,15 +72,17 @@ isnan(double number)
|
|||||||
/* Exponent = 2047 and fraction != 0.0 */
|
/* Exponent = 2047 and fraction != 0.0 */
|
||||||
result = (((x.raw[0] & 0x7FF00000) == 0x7FF00000) && ((x.raw[0] & 0x000FFFFF) != 0 || (x.raw[1] != 0)));
|
result = (((x.raw[0] & 0x7FF00000) == 0x7FF00000) && ((x.raw[0] & 0x000FFFFF) != 0 || (x.raw[1] != 0)));
|
||||||
}
|
}
|
||||||
|
#if defined(USE_LONG_DOUBLE)
|
||||||
else if (sizeof(number) == 12) /* extended precision */
|
else if (sizeof(number) == 12) /* extended precision */
|
||||||
{
|
{
|
||||||
union ieee_long_double x;
|
union ieee_long_double x;
|
||||||
|
|
||||||
x.value = number;
|
x.value = number;
|
||||||
|
|
||||||
/* Exponent = 32767 and fraction != 0.0 */
|
/* Exponent = 32766 and fraction != 0.0 */
|
||||||
result = (((x.raw[0] & 0x7FFF0000) == 0x7FFF0000) && ((x.raw[1] & 0x7FFFFFFF) != 0 || x.raw[2] != 0));
|
result = (((x.raw[0] & 0x7FFF0000) == 0x7FFF0000) && ((x.raw[1] & 0x7FFFFFFF) != 0 || x.raw[2] != 0));
|
||||||
}
|
}
|
||||||
|
#endif /* USE_LONG_DOUBLE */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Can't happen */
|
/* Can't happen */
|
||||||
|
|||||||
136
library/math_logb.c
Normal file
136
library/math_logb.c
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* $Id: math_logb.c,v 1.1 2004-08-12 12:31:16 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
INLINE static const double
|
||||||
|
__logb(double x)
|
||||||
|
{
|
||||||
|
double result;
|
||||||
|
|
||||||
|
result = log(x) / log(FLT_RADIX);
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* IEEE_FLOATING_POINT_SUPPORT || M68881_FLOATING_POINT_SUPPORT */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(PPC_FLOATING_POINT_SUPPORT)
|
||||||
|
|
||||||
|
INLINE static const double
|
||||||
|
__logb(double x)
|
||||||
|
{
|
||||||
|
unsigned int lx,ix;
|
||||||
|
|
||||||
|
EXTRACT_WORDS(ix,lx,x);
|
||||||
|
|
||||||
|
ix &= 0x7fffffff; /* high |x| */
|
||||||
|
if((ix|lx)==0)
|
||||||
|
return -1.0/fabs(x);
|
||||||
|
|
||||||
|
if(ix>=0x7ff00000)
|
||||||
|
return x*x;
|
||||||
|
|
||||||
|
if((ix>>=20)==0) /* IEEE 754 logb */
|
||||||
|
return -1022.0;
|
||||||
|
else
|
||||||
|
return (double) (ix-1023);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* PPC_FLOATING_POINT_SUPPORT */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
double
|
||||||
|
logb(double x)
|
||||||
|
{
|
||||||
|
double result;
|
||||||
|
|
||||||
|
int sign;
|
||||||
|
|
||||||
|
if(x == 0.0)
|
||||||
|
{
|
||||||
|
result = -HUGE_VAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isnan(x))
|
||||||
|
{
|
||||||
|
result = x;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
sign = isinf(x);
|
||||||
|
if(sign != 0)
|
||||||
|
{
|
||||||
|
if(sign < 0)
|
||||||
|
result = (-x);
|
||||||
|
else
|
||||||
|
result = x;
|
||||||
|
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = __logb(x);
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* FLOATING_POINT_SUPPORT */
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 168
|
#define REVISION 170
|
||||||
#define DATE "7.8.2004"
|
#define DATE "14.8.2004"
|
||||||
#define VERS "net.lib 1.168"
|
#define VERS "net.lib 1.170"
|
||||||
#define VSTRING "net.lib 1.168 (7.8.2004)\r\n"
|
#define VSTRING "net.lib 1.170 (14.8.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: net.lib 1.168 (7.8.2004)"
|
#define VERSTAG "\0$VER: net.lib 1.170 (14.8.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
168
|
170
|
||||||
|
|||||||
@@ -1,3 +1,24 @@
|
|||||||
|
c.lib 1.170 (14.8.2004)
|
||||||
|
|
||||||
|
- Added "math_logb.c", and it appears to work, too.
|
||||||
|
|
||||||
|
|
||||||
|
c.lib 1.169 (8.8.2004)
|
||||||
|
|
||||||
|
- Since the 'long double' data type is not really supported by the GCC
|
||||||
|
versions we use (and not supported by SAS/C either) building the
|
||||||
|
library with support code for it is now a configurable option. Unless
|
||||||
|
enabled, 'long double' is now treated like 'double'.
|
||||||
|
|
||||||
|
- Reworked the HUGE_VAL definition which previously would default to
|
||||||
|
Infinity. The new code properly defines this to the largest
|
||||||
|
representable floating point number. The 'great' thing about the
|
||||||
|
HUGE_VAL definition in this library is that it's a reference to
|
||||||
|
a binary constant initialized by the library startup code. So any
|
||||||
|
application checking for HUGE_VAL merely needs to be relinked
|
||||||
|
rather than recompiled.
|
||||||
|
|
||||||
|
|
||||||
c.lib 1.168 (7.8.2004)
|
c.lib 1.168 (7.8.2004)
|
||||||
|
|
||||||
- Ditched __is_infinity() and __is_not_a_number(), brought them back
|
- Ditched __is_infinity() and __is_not_a_number(), brought them back
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# $Id: smakefile,v 1.4 2004-08-07 09:15:32 obarthel Exp $
|
# $Id: smakefile,v 1.5 2004-08-12 12:31:27 obarthel Exp $
|
||||||
#
|
#
|
||||||
# :ts=8
|
# :ts=8
|
||||||
#
|
#
|
||||||
@@ -195,6 +195,7 @@ MATH_OBJ = \
|
|||||||
math_ldexp.o \
|
math_ldexp.o \
|
||||||
math_log.o \
|
math_log.o \
|
||||||
math_log10.o \
|
math_log10.o \
|
||||||
|
math_logb.o \
|
||||||
math_modf.o \
|
math_modf.o \
|
||||||
math_pow.o \
|
math_pow.o \
|
||||||
math_rint.o \
|
math_rint.o \
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 168
|
#define REVISION 170
|
||||||
#define DATE "7.8.2004"
|
#define DATE "14.8.2004"
|
||||||
#define VERS "stack.lib 1.168"
|
#define VERS "stack.lib 1.170"
|
||||||
#define VSTRING "stack.lib 1.168 (7.8.2004)\r\n"
|
#define VSTRING "stack.lib 1.170 (14.8.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: stack.lib 1.168 (7.8.2004)"
|
#define VERSTAG "\0$VER: stack.lib 1.170 (14.8.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
168
|
170
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: stdio_protos.h,v 1.1.1.1 2004-07-26 16:31:39 obarthel Exp $
|
* $Id: stdio_protos.h,v 1.2 2004-08-08 10:55:57 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -200,22 +200,4 @@ extern void __duplicate_fd(struct fd * duplicate_fd,struct fd * original_fd);
|
|||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
#if defined(FLOATING_POINT_SUPPORT)
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
/* stdio_isnotanumber.c */
|
|
||||||
extern int __is_not_a_number(long double number);
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
/* stdio_isinfinity.c */
|
|
||||||
extern int __is_infinity(long double number);
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
#endif /* FLOATING_POINT_SUPPORT */
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
#endif /* _STDIO_PROTOS_H */
|
#endif /* _STDIO_PROTOS_H */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: stdio_vfprintf.c,v 1.2 2004-08-07 09:15:32 obarthel Exp $
|
* $Id: stdio_vfprintf.c,v 1.3 2004-08-08 10:55:57 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_num_leading_digits(long double v)
|
get_num_leading_digits(__long_double_t v)
|
||||||
{
|
{
|
||||||
int num_digits;
|
int num_digits;
|
||||||
|
|
||||||
@@ -634,14 +634,14 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
const char * buffer_stop = &buffer[sizeof(buffer)-1];
|
const char * buffer_stop = &buffer[sizeof(buffer)-1];
|
||||||
char * buffer_start = buffer;
|
char * buffer_start = buffer;
|
||||||
|
|
||||||
long double v;
|
__long_double_t v;
|
||||||
|
|
||||||
output_buffer = buffer_start;
|
output_buffer = buffer_start;
|
||||||
|
|
||||||
D(("sizeof(long double) == %ld",sizeof(v)));
|
D(("sizeof(long double) == %ld",sizeof(v)));
|
||||||
|
|
||||||
if(parameter_size == parameter_size_long_double)
|
if(parameter_size == parameter_size_long_double)
|
||||||
v = va_arg(arg, long double);
|
v = va_arg(arg, __long_double_t);
|
||||||
else
|
else
|
||||||
v = va_arg(arg, double);
|
v = va_arg(arg, double);
|
||||||
|
|
||||||
@@ -676,7 +676,7 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
BOOL strip_trailing_zeroes = FALSE;
|
BOOL strip_trailing_zeroes = FALSE;
|
||||||
long double roundoff_fudge = 0.0;
|
__long_double_t roundoff_fudge = 0.0;
|
||||||
int max_digits = -1;
|
int max_digits = -1;
|
||||||
int exponent = 0;
|
int exponent = 0;
|
||||||
int digit;
|
int digit;
|
||||||
@@ -713,7 +713,7 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
/* Figure out whether 'e' or 'f' format should be used. */
|
/* Figure out whether 'e' or 'f' format should be used. */
|
||||||
if(conversion_type == 'g' || conversion_type == 'e')
|
if(conversion_type == 'g' || conversion_type == 'e')
|
||||||
{
|
{
|
||||||
long double local_v = v;
|
__long_double_t local_v = v;
|
||||||
int local_exponent = 0;
|
int local_exponent = 0;
|
||||||
|
|
||||||
/* Put one single digit in front of the decimal point. */
|
/* Put one single digit in front of the decimal point. */
|
||||||
@@ -978,7 +978,7 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
/* Remove the parameter from the argument vector and
|
/* Remove the parameter from the argument vector and
|
||||||
don't produce any output. */
|
don't produce any output. */
|
||||||
if(parameter_size == parameter_size_long_double)
|
if(parameter_size == parameter_size_long_double)
|
||||||
(void)va_arg(arg, long double);
|
(void)va_arg(arg, __long_double_t);
|
||||||
else
|
else
|
||||||
(void)va_arg(arg, double);
|
(void)va_arg(arg, double);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: stdio_vfscanf.c,v 1.1.1.1 2004-07-26 16:31:48 obarthel Exp $
|
* $Id: stdio_vfscanf.c,v 1.2 2004-08-08 10:55:57 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -456,8 +456,8 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
|
|||||||
{
|
{
|
||||||
#if defined(FLOATING_POINT_SUPPORT)
|
#if defined(FLOATING_POINT_SUPPORT)
|
||||||
{
|
{
|
||||||
long double sum = 0.0;
|
__long_double_t sum = 0.0;
|
||||||
long double new_sum;
|
__long_double_t new_sum;
|
||||||
BOOL is_negative = FALSE;
|
BOOL is_negative = FALSE;
|
||||||
BOOL decimal_point_matches = FALSE;
|
BOOL decimal_point_matches = FALSE;
|
||||||
BOOL have_exponent = FALSE;
|
BOOL have_exponent = FALSE;
|
||||||
@@ -495,7 +495,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
|
|||||||
{
|
{
|
||||||
SHOWMSG("extended format (long double)");
|
SHOWMSG("extended format (long double)");
|
||||||
|
|
||||||
next_parameter = va_arg(arg,long double *);
|
next_parameter = va_arg(arg,__long_double_t *);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert( next_parameter != NULL );
|
assert( next_parameter != NULL );
|
||||||
@@ -520,7 +520,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*((long double *)next_parameter) = 0;
|
*((__long_double_t *)next_parameter) = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -869,7 +869,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*((long double *)next_parameter) = sum;
|
*((__long_double_t *)next_parameter) = sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
num_assignments++;
|
num_assignments++;
|
||||||
@@ -912,7 +912,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
|
|||||||
{
|
{
|
||||||
SHOWMSG("extended format (long double)");
|
SHOWMSG("extended format (long double)");
|
||||||
|
|
||||||
next_parameter = va_arg(arg,long double *);
|
next_parameter = va_arg(arg,__long_double_t *);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert( next_parameter != NULL );
|
assert( next_parameter != NULL );
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 168
|
#define REVISION 170
|
||||||
#define DATE "7.8.2004"
|
#define DATE "14.8.2004"
|
||||||
#define VERS "unix.lib 1.168"
|
#define VERS "unix.lib 1.170"
|
||||||
#define VSTRING "unix.lib 1.168 (7.8.2004)\r\n"
|
#define VSTRING "unix.lib 1.170 (14.8.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: unix.lib 1.168 (7.8.2004)"
|
#define VERSTAG "\0$VER: unix.lib 1.170 (14.8.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
168
|
170
|
||||||
|
|||||||
Reference in New Issue
Block a user