diff --git a/library/GNUmakefile.68k b/library/GNUmakefile.68k index 0fd7b06..1227e29 100644 --- a/library/GNUmakefile.68k +++ b/library/GNUmakefile.68k @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.68k,v 1.62 2005-06-20 07:43:59 obarthel Exp $ +# $Id: GNUmakefile.68k,v 1.63 2005-06-26 09:06:09 obarthel Exp $ # # :ts=8 # @@ -566,6 +566,8 @@ MATH_LIB = \ math_erff.o \ math_exp.o \ math_expf.o \ + math_exp2.o \ + math_exp2f.o \ math_expm1.o \ math_expm1f.o \ math_fabs.o \ @@ -596,6 +598,8 @@ MATH_LIB = \ math_lgamma.o \ math_lgammaf.o \ math_log.o \ + math_log2.o \ + math_log2f.o \ math_log10.o \ math_log10f.o \ math_log1p.o \ diff --git a/library/GNUmakefile.os4 b/library/GNUmakefile.os4 index 7091ebf..035d798 100644 --- a/library/GNUmakefile.os4 +++ b/library/GNUmakefile.os4 @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.os4,v 1.68 2005-06-20 07:43:59 obarthel Exp $ +# $Id: GNUmakefile.os4,v 1.69 2005-06-26 09:06:10 obarthel Exp $ # # :ts=8 # @@ -580,6 +580,8 @@ MATH_LIB = \ math_erff.o \ math_exp.o \ math_expf.o \ + math_exp2.o \ + math_expf2.o \ math_expm1.o \ math_expm1f.o \ math_fabs.o \ @@ -616,6 +618,8 @@ MATH_LIB = \ math_lgamma.o \ math_lgammaf.o \ math_log.o \ + math_log2.o \ + math_log2f.o \ math_log10.o \ math_log10f.o \ math_log1p.o \ diff --git a/library/TODO b/library/TODO index a1a65d9..9650cc0 100755 --- a/library/TODO +++ b/library/TODO @@ -1,12 +1,8 @@ C99 math functions: (functions generally missing, including their "float" counterparts) - exp2 - exp2f fma fmaf - log2 - log2f lrint lrintf lround diff --git a/library/changes b/library/changes index 75f6c7c..489a71f 100644 --- a/library/changes +++ b/library/changes @@ -13,6 +13,10 @@ - lstat would overwrite the name parameter via ReadLink(..., name, ...) instead of ReadLink(..., new_name, ...) +- Implemented exp2()/exp2f() and log2()/log2f() as suggested by + Henning Nielsen Lund. Thank you very much! + + c.lib 1.193 (4.6.2005) diff --git a/library/include/getopt.h b/library/include/getopt.h index b2f3c80..a22fbc2 100644 --- a/library/include/getopt.h +++ b/library/include/getopt.h @@ -1,83 +1,83 @@ -/* - * $Id: getopt.h,v 1.1 2005-06-14 15:22:56 tfrieden Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -#ifndef _GETOPT_H -#define _GETOPT_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -struct option -{ - const char * name; - int has_arg; - int * flag; - int val; -}; - -/****************************************************************************/ - -extern int getopt_long(int argc, const char **argv, const char *optstring, - const struct option *longopts, int *longindex); - -/*extern int getopt_long_only(int argc, const char **argv, const char *optstring, - const struct option *longopts, int *longindex); -*/ -extern int optreset; - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _GETOPT_H */ +/* + * $Id: getopt.h,v 1.2 2005-06-26 09:06:12 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * 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. + */ + +#ifndef _GETOPT_H +#define _GETOPT_H + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +#include + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +struct option +{ + const char * name; + int has_arg; + int * flag; + int val; +}; + +/****************************************************************************/ + +extern int getopt_long(int argc, const char **argv, const char *optstring, + const struct option *longopts, int *longindex); + +/*extern int getopt_long_only(int argc, const char **argv, const char *optstring, + const struct option *longopts, int *longindex); +*/ +extern int optreset; + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _GETOPT_H */ diff --git a/library/include/math.h b/library/include/math.h index 13f8e03..6dff2b5 100644 --- a/library/include/math.h +++ b/library/include/math.h @@ -1,5 +1,5 @@ /* - * $Id: math.h,v 1.15 2005-05-30 08:47:41 obarthel Exp $ + * $Id: math.h,v 1.16 2005-06-26 09:06:12 obarthel Exp $ * * :ts=4 * @@ -288,6 +288,14 @@ extern int ilogb(double x); /****************************************************************************/ +extern float exp2f(float x); +extern double exp2(double x); + +extern double log2(double x); +extern float log2f(float x); + +/****************************************************************************/ + #define FLT_EVAL_METHOD 0 /****************************************************************************/ diff --git a/library/math_exp2.c b/library/math_exp2.c index d41b390..f3f4bd1 100644 --- a/library/math_exp2.c +++ b/library/math_exp2.c @@ -1,5 +1,5 @@ /* - * $Id: math_exp2.c,v 1.1 2005-05-29 11:19:00 obarthel Exp $ + * $Id: math_exp2.c,v 1.2 2005-06-26 09:06:11 obarthel Exp $ * * :ts=4 * @@ -44,8 +44,7 @@ double exp2(double x) { - /* ZZZ unimplemented */ - return(0); + return(pow(2.0, x)); } /****************************************************************************/ diff --git a/library/math_exp2f.c b/library/math_exp2f.c index d179ecb..b7965ed 100644 --- a/library/math_exp2f.c +++ b/library/math_exp2f.c @@ -1,5 +1,5 @@ /* - * $Id: math_exp2f.c,v 1.1 2005-05-29 11:19:00 obarthel Exp $ + * $Id: math_exp2f.c,v 1.2 2005-06-26 09:06:11 obarthel Exp $ * * :ts=4 * @@ -44,8 +44,7 @@ float exp2f(float x) { - /* ZZZ unimplemented */ - return(0); + return(powf(2.0, x)); } /****************************************************************************/ diff --git a/library/math_log2.c b/library/math_log2.c index e733bc9..85bf8e5 100644 --- a/library/math_log2.c +++ b/library/math_log2.c @@ -1,5 +1,5 @@ /* - * $Id: math_log2.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ + * $Id: math_log2.c,v 1.2 2005-06-26 09:06:11 obarthel Exp $ * * :ts=4 * @@ -44,8 +44,7 @@ double log2(double x) { - /* ZZZ unimplemented */ - return(0); + return(log(x) / log(2.0)); } /****************************************************************************/ diff --git a/library/math_log2f.c b/library/math_log2f.c index ddcf64e..1bc02bc 100644 --- a/library/math_log2f.c +++ b/library/math_log2f.c @@ -1,5 +1,5 @@ /* - * $Id: math_log2f.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ + * $Id: math_log2f.c,v 1.2 2005-06-26 09:06:11 obarthel Exp $ * * :ts=4 * @@ -44,8 +44,7 @@ float log2f(float x) { - /* ZZZ unimplemented */ - return(0); + return(logf(x) / logf(2.0)); } /****************************************************************************/