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

- Implemented exp2()/exp2f() and log2()/log2f() as suggested by

Henning Nielsen Lund. Thank you very much!


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14988 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-06-26 09:06:12 +00:00
parent ae1ac21c71
commit 17e3b3b0e2
10 changed files with 114 additions and 102 deletions

View File

@ -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 # :ts=8
# #
@ -566,6 +566,8 @@ MATH_LIB = \
math_erff.o \ math_erff.o \
math_exp.o \ math_exp.o \
math_expf.o \ math_expf.o \
math_exp2.o \
math_exp2f.o \
math_expm1.o \ math_expm1.o \
math_expm1f.o \ math_expm1f.o \
math_fabs.o \ math_fabs.o \
@ -596,6 +598,8 @@ MATH_LIB = \
math_lgamma.o \ math_lgamma.o \
math_lgammaf.o \ math_lgammaf.o \
math_log.o \ math_log.o \
math_log2.o \
math_log2f.o \
math_log10.o \ math_log10.o \
math_log10f.o \ math_log10f.o \
math_log1p.o \ math_log1p.o \

View File

@ -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 # :ts=8
# #
@ -580,6 +580,8 @@ MATH_LIB = \
math_erff.o \ math_erff.o \
math_exp.o \ math_exp.o \
math_expf.o \ math_expf.o \
math_exp2.o \
math_expf2.o \
math_expm1.o \ math_expm1.o \
math_expm1f.o \ math_expm1f.o \
math_fabs.o \ math_fabs.o \
@ -616,6 +618,8 @@ MATH_LIB = \
math_lgamma.o \ math_lgamma.o \
math_lgammaf.o \ math_lgammaf.o \
math_log.o \ math_log.o \
math_log2.o \
math_log2f.o \
math_log10.o \ math_log10.o \
math_log10f.o \ math_log10f.o \
math_log1p.o \ math_log1p.o \

View File

@ -1,12 +1,8 @@
C99 math functions: C99 math functions:
(functions generally missing, including their "float" counterparts) (functions generally missing, including their "float" counterparts)
exp2
exp2f
fma fma
fmaf fmaf
log2
log2f
lrint lrint
lrintf lrintf
lround lround

View File

@ -13,6 +13,10 @@
- lstat would overwrite the name parameter via ReadLink(..., name, ...) - lstat would overwrite the name parameter via ReadLink(..., name, ...)
instead of ReadLink(..., new_name, ...) <tfrieden> instead of ReadLink(..., new_name, ...) <tfrieden>
- Implemented exp2()/exp2f() and log2()/log2f() as suggested by
Henning Nielsen Lund. Thank you very much!
c.lib 1.193 (4.6.2005) c.lib 1.193 (4.6.2005)

View File

@ -1,83 +1,83 @@
/* /*
* $Id: getopt.h,v 1.1 2005-06-14 15:22:56 tfrieden Exp $ * $Id: getopt.h,v 1.2 2005-06-26 09:06:12 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
* Portable ISO 'C' (1994) runtime library for the Amiga computer * Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de> * Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* *
* - Redistributions of source code must retain the above copyright * - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* *
* - Neither the name of Olaf Barthel nor the names of contributors * - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this * may be used to endorse or promote products derived from this
* software without specific prior written permission. * software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _GETOPT_H #ifndef _GETOPT_H
#define _GETOPT_H #define _GETOPT_H
/****************************************************************************/ /****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */ /* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/ /****************************************************************************/
#include <unistd.h> #include <unistd.h>
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/****************************************************************************/ /****************************************************************************/
#define no_argument 0 #define no_argument 0
#define required_argument 1 #define required_argument 1
#define optional_argument 2 #define optional_argument 2
struct option struct option
{ {
const char * name; const char * name;
int has_arg; int has_arg;
int * flag; int * flag;
int val; int val;
}; };
/****************************************************************************/ /****************************************************************************/
extern int getopt_long(int argc, const char **argv, const char *optstring, extern int getopt_long(int argc, const char **argv, const char *optstring,
const struct option *longopts, int *longindex); const struct option *longopts, int *longindex);
/*extern int getopt_long_only(int argc, const char **argv, const char *optstring, /*extern int getopt_long_only(int argc, const char **argv, const char *optstring,
const struct option *longopts, int *longindex); const struct option *longopts, int *longindex);
*/ */
extern int optreset; extern int optreset;
/****************************************************************************/ /****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
/****************************************************************************/ /****************************************************************************/
#endif /* _GETOPT_H */ #endif /* _GETOPT_H */

View File

@ -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 * :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 #define FLT_EVAL_METHOD 0
/****************************************************************************/ /****************************************************************************/

View File

@ -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 * :ts=4
* *
@ -44,8 +44,7 @@
double double
exp2(double x) exp2(double x)
{ {
/* ZZZ unimplemented */ return(pow(2.0, x));
return(0);
} }
/****************************************************************************/ /****************************************************************************/

View File

@ -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 * :ts=4
* *
@ -44,8 +44,7 @@
float float
exp2f(float x) exp2f(float x)
{ {
/* ZZZ unimplemented */ return(powf(2.0, x));
return(0);
} }
/****************************************************************************/ /****************************************************************************/

View File

@ -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 * :ts=4
* *
@ -44,8 +44,7 @@
double double
log2(double x) log2(double x)
{ {
/* ZZZ unimplemented */ return(log(x) / log(2.0));
return(0);
} }
/****************************************************************************/ /****************************************************************************/

View File

@ -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 * :ts=4
* *
@ -44,8 +44,7 @@
float float
log2f(float x) log2f(float x)
{ {
/* ZZZ unimplemented */ return(logf(x) / logf(2.0));
return(0);
} }
/****************************************************************************/ /****************************************************************************/