Changeset dab7ac7 for src/libcfa


Ignore:
Timestamp:
Jul 20, 2017, 11:20:32 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
21a5dde1
Parents:
921fe6a
Message:

inline math routines, remove math.c, add exponential operator to math tests

Location:
src/libcfa
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/Makefile.am

    r921fe6a rdab7ac7  
    1111## Created On       : Sun May 31 08:54:01 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Thu Jul 20 15:38:28 2017
    14 ## Update Count     : 219
     13## Last Modified On : Thu Jul 20 23:09:34 2017
     14## Update Count     : 220
    1515###############################################################################
    1616
     
    4242CC = ${abs_top_srcdir}/src/driver/cfa
    4343
    44 headers = fstream iostream iterator limits math rational stdlib \
     44headers = fstream iostream iterator limits rational stdlib \
    4545          containers/maybe containers/pair containers/result containers/vector
    4646
     
    9191
    9292cfa_includedir = $(CFA_INCDIR)
    93 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} gmp concurrency/invoke.h
     93nobase_cfa_include_HEADERS = ${headers} ${stdhdr} math gmp concurrency/invoke.h
    9494
    9595CLEANFILES = libcfa-prelude.c
  • src/libcfa/Makefile.in

    r921fe6a rdab7ac7  
    150150am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c interpose.c \
    151151        libhdr/libdebug.c fstream.c iostream.c iterator.c limits.c \
    152         math.c rational.c stdlib.c containers/maybe.c \
    153         containers/pair.c containers/result.c containers/vector.c \
     152        rational.c stdlib.c containers/maybe.c containers/pair.c \
     153        containers/result.c containers/vector.c \
    154154        concurrency/coroutine.c concurrency/thread.c \
    155155        concurrency/kernel.c concurrency/monitor.c assert.c \
     
    164164am__objects_2 = libcfa_d_a-fstream.$(OBJEXT) \
    165165        libcfa_d_a-iostream.$(OBJEXT) libcfa_d_a-iterator.$(OBJEXT) \
    166         libcfa_d_a-limits.$(OBJEXT) libcfa_d_a-math.$(OBJEXT) \
    167         libcfa_d_a-rational.$(OBJEXT) libcfa_d_a-stdlib.$(OBJEXT) \
     166        libcfa_d_a-limits.$(OBJEXT) libcfa_d_a-rational.$(OBJEXT) \
     167        libcfa_d_a-stdlib.$(OBJEXT) \
    168168        containers/libcfa_d_a-maybe.$(OBJEXT) \
    169169        containers/libcfa_d_a-pair.$(OBJEXT) \
     
    185185am__libcfa_a_SOURCES_DIST = libcfa-prelude.c interpose.c \
    186186        libhdr/libdebug.c fstream.c iostream.c iterator.c limits.c \
    187         math.c rational.c stdlib.c containers/maybe.c \
    188         containers/pair.c containers/result.c containers/vector.c \
     187        rational.c stdlib.c containers/maybe.c containers/pair.c \
     188        containers/result.c containers/vector.c \
    189189        concurrency/coroutine.c concurrency/thread.c \
    190190        concurrency/kernel.c concurrency/monitor.c assert.c \
     
    198198am__objects_6 = libcfa_a-fstream.$(OBJEXT) libcfa_a-iostream.$(OBJEXT) \
    199199        libcfa_a-iterator.$(OBJEXT) libcfa_a-limits.$(OBJEXT) \
    200         libcfa_a-math.$(OBJEXT) libcfa_a-rational.$(OBJEXT) \
    201         libcfa_a-stdlib.$(OBJEXT) containers/libcfa_a-maybe.$(OBJEXT) \
     200        libcfa_a-rational.$(OBJEXT) libcfa_a-stdlib.$(OBJEXT) \
     201        containers/libcfa_a-maybe.$(OBJEXT) \
    202202        containers/libcfa_a-pair.$(OBJEXT) \
    203203        containers/libcfa_a-result.$(OBJEXT) \
     
    261261  esac
    262262am__nobase_cfa_include_HEADERS_DIST = fstream iostream iterator limits \
    263         math rational stdlib containers/maybe containers/pair \
     263        rational stdlib containers/maybe containers/pair \
    264264        containers/result containers/vector concurrency/coroutine \
    265265        concurrency/thread concurrency/kernel concurrency/monitor \
    266         ${shell echo stdhdr/*} gmp concurrency/invoke.h
     266        ${shell echo stdhdr/*} math gmp concurrency/invoke.h
    267267HEADERS = $(nobase_cfa_include_HEADERS)
    268268am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     
    414414EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@
    415415AM_CCASFLAGS = @CFA_FLAGS@
    416 headers = fstream iostream iterator limits math rational stdlib \
     416headers = fstream iostream iterator limits rational stdlib \
    417417        containers/maybe containers/pair containers/result \
    418418        containers/vector $(am__append_3)
     
    426426stdhdr = ${shell echo stdhdr/*}
    427427cfa_includedir = $(CFA_INCDIR)
    428 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} gmp concurrency/invoke.h
     428nobase_cfa_include_HEADERS = ${headers} ${stdhdr} math gmp concurrency/invoke.h
    429429CLEANFILES = libcfa-prelude.c
    430430all: all-am
     
    592592@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-libcfa-prelude.Po@am__quote@
    593593@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-limits.Po@am__quote@
    594 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-math.Po@am__quote@
    595594@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-rational.Po@am__quote@
    596595@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-stdlib.Po@am__quote@
     
    604603@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-libcfa-prelude.Po@am__quote@
    605604@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-limits.Po@am__quote@
    606 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-math.Po@am__quote@
    607605@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-rational.Po@am__quote@
    608606@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@
     
    757755@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-limits.obj `if test -f 'limits.c'; then $(CYGPATH_W) 'limits.c'; else $(CYGPATH_W) '$(srcdir)/limits.c'; fi`
    758756
    759 libcfa_d_a-math.o: math.c
    760 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-math.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-math.Tpo -c -o libcfa_d_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c
    761 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-math.Tpo $(DEPDIR)/libcfa_d_a-math.Po
    762 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='math.c' object='libcfa_d_a-math.o' libtool=no @AMDEPBACKSLASH@
    763 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    764 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c
    765 
    766 libcfa_d_a-math.obj: math.c
    767 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-math.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-math.Tpo -c -o libcfa_d_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi`
    768 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-math.Tpo $(DEPDIR)/libcfa_d_a-math.Po
    769 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='math.c' object='libcfa_d_a-math.obj' libtool=no @AMDEPBACKSLASH@
    770 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    771 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi`
    772 
    773757libcfa_d_a-rational.o: rational.c
    774758@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-rational.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-rational.Tpo -c -o libcfa_d_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c
     
    10641048@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    10651049@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-limits.obj `if test -f 'limits.c'; then $(CYGPATH_W) 'limits.c'; else $(CYGPATH_W) '$(srcdir)/limits.c'; fi`
    1066 
    1067 libcfa_a-math.o: math.c
    1068 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-math.o -MD -MP -MF $(DEPDIR)/libcfa_a-math.Tpo -c -o libcfa_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c
    1069 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-math.Tpo $(DEPDIR)/libcfa_a-math.Po
    1070 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='math.c' object='libcfa_a-math.o' libtool=no @AMDEPBACKSLASH@
    1071 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1072 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c
    1073 
    1074 libcfa_a-math.obj: math.c
    1075 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-math.obj -MD -MP -MF $(DEPDIR)/libcfa_a-math.Tpo -c -o libcfa_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi`
    1076 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-math.Tpo $(DEPDIR)/libcfa_a-math.Po
    1077 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='math.c' object='libcfa_a-math.obj' libtool=no @AMDEPBACKSLASH@
    1078 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1079 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi`
    10801050
    10811051libcfa_a-rational.o: rational.c
  • src/libcfa/math

    r921fe6a rdab7ac7  
    1010// Created On       : Mon Apr 18 23:37:04 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  7 09:34:15 2017
    13 // Update Count     : 61
     12// Last Modified On : Thu Jul 20 21:45:07 2017
     13// Update Count     : 77
    1414//
    1515
    1616#pragma once
    1717
    18 extern "C" {
    19 #include <math.h>                                                                               // fpclassify, isfinite, isnormal, isnan, isinf
    20 } // extern "C"
    21 
    22 float ?%?( float, float );
    23 float fmod( float, float );
    24 double ?%?( double, double );
     18#include <math.h>
     19#include <complex.h>
     20
     21static inline float ?%?( float x, float y ) { return fmodf( x, y ); }
     22static inline float fmod( float x, float y ) { return fmodf( x, y ); }
     23static inline double ?%?( double x, double y ) { return fmod( x, y ); }
    2524// extern "C" { double fmod( double, double ); }
    26 long double ?%?( long double, long double );
    27 long double fmod( long double, long double );
    28 
    29 float remainder( float, float );
     25static inline long double ?%?( long double x, long double y ) { return fmodl( x, y ); }
     26static inline long double fmod( long double x, long double y ) { return fmodl( x, y ); }
     27
     28static inline float remainder( float x, float y ) { return remainderf( x, y ); }
    3029// extern "C" { double remainder( double, double ); }
    31 long double remainder( long double, long double );
    32 
    33 [ int, float ] remquo( float, float );
    34 float remquo( float, float, int * );
    35 [ int, double ] remquo( double, double );
    36 // extern "C" { double remquo( double, double, int * ); }
    37 [ int, long double ] remquo( long double, long double );
    38 long double remquo( long double, long double, int * );
    39 
    40 [ int, float ] div( float, float );                                             // alternative name for remquo
    41 float div( float, float, int * );
    42 [ int, double ] div( double, double );
    43 // extern "C" { double div( double, double, int * ); }
    44 [ int, long double ] div( long double, long double );
    45 long double div( long double, long double, int * );
    46 
    47 float fma( float, float, float );
     30static inline long double remainder( long double x, long double y ) { return remainderl( x, y ); }
     31
     32static inline float remquo( float x, float y, int * quo ) { return remquof( x, y, quo ); }
     33// extern "C" { double remquo( double x, double y, int * quo ); }
     34static inline long double remquo( long double x, long double y, int * quo ) { return remquol( x, y, quo ); }
     35static inline [ int, float ] remquo( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
     36static inline [ int, double ] remquo( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
     37static inline [ int, long double ] remquo( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
     38
     39// alternative name for remquo
     40static inline float div( float x, float y, int * quo ) { return remquof( x, y, quo ); }
     41static inline double div( double x, double y, int * quo ) { return remquo( x, y, quo ); }
     42static inline long double div( long double x, long double y, int * quo ) { return remquol( x, y, quo ); }
     43static inline [ int, float ] div( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
     44static inline [ int, double ] div( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
     45static inline [ int, long double ] div( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
     46
     47static inline float fma( float x, float y, float z ) { return fmaf( x, y, z ); }
    4848// extern "C" { double fma( double, double, double ); }
    49 long double fma( long double, long double, long double );
    50 
    51 float fdim( float, float );
     49static inline long double fma( long double x, long double y, long double z ) { return fmal( x, y, z ); }
     50
     51static inline float fdim( float x, float y ) { return fdimf( x, y ); }
    5252// extern "C" { double fdim( double, double ); }
    53 long double fdim( long double, long double );
    54 
    55 float nan( const char * );
     53static inline long double fdim( long double x, long double y ) { return fdiml( x, y ); }
     54
     55static inline float nan( const char * tag ) { return nanf( tag ); }
    5656// extern "C" { double nan( const char * ); }
    57 long double nan( const char * );
     57static inline long double nan( const char * tag ) { return nanl( tag ); }
    5858
    5959//---------------------- Exponential ----------------------
    6060
    61 float exp( float );
     61static inline float exp( float x ) { return expf( x ); }
    6262// extern "C" { double exp( double ); }
    63 long double exp( long double );
    64 float _Complex exp( float _Complex );
    65 double _Complex exp( double _Complex );
    66 long double _Complex exp( long double _Complex );
    67 
    68 float exp2( float );
     63static inline long double exp( long double x ) { return expl( x ); }
     64static inline float _Complex exp( float _Complex x ) { return cexpf( x ); }
     65static inline double _Complex exp( double _Complex x ) { return cexp( x ); }
     66static inline long double _Complex exp( long double _Complex x ) { return cexpl( x ); }
     67
     68static inline float exp2( float x ) { return exp2f( x ); }
    6969// extern "C" { double exp2( double ); }
    70 long double exp2( long double );
    71 // float _Complex exp2( float _Complex );
    72 // double _Complex exp2( double _Complex );
    73 // long double _Complex exp2( long double _Complex );
    74 
    75 float expm1( float );
     70static inline long double exp2( long double x ) { return exp2l( x ); }
     71//static inline float _Complex exp2( float _Complex x ) { return cexp2f( x ); }
     72//static inline double _Complex exp2( double _Complex x ) { return cexp2( x ); }
     73//static inline long double _Complex exp2( long double _Complex x ) { return cexp2l( x ); }
     74
     75static inline float expm1( float x ) { return expm1f( x ); }
    7676// extern "C" { double expm1( double ); }
    77 long double expm1( long double );
    78 
    79 float log( float );
     77static inline long double expm1( long double x ) { return expm1l( x ); }
     78
     79static inline float pow( float x, float y ) { return powf( x, y ); }
     80// extern "C" { double pow( double, double ); }
     81static inline long double pow( long double x, long double y ) { return powl( x, y ); }
     82static inline float _Complex pow( float _Complex x, float _Complex y ) { return cpowf( x, y ); }
     83static inline double _Complex pow( double _Complex x, double _Complex y ) { return cpow( x, y ); }
     84static inline long double _Complex pow( long double _Complex x, long double _Complex y ) { return cpowl( x, y ); }
     85
     86static inline float ?\?( float x, float y ) { return powf( x, y ); }
     87static inline double ?\?( double x, double y ) { return pow( x, y ); }
     88static inline long double ?\?( long double x, long double y ) { return powl( x, y ); }
     89static inline float _Complex ?\?( float _Complex x, _Complex float y ) { return cpowf(x, y ); }
     90static inline double _Complex ?\?( double _Complex x, _Complex double y ) { return cpow( x, y ); }
     91static inline long double _Complex ?\?( long double _Complex x, _Complex long double y ) { return cpowl( x, y ); }
     92
     93static inline float ?\=?( float * x, float y ) { *x = *x \ y; return *x; }
     94static inline double ?\=?( double * x, double y ) { *x = *x \ y; return *x; }
     95static inline long double ?\=?( long double * x, long double y ) { *x = *x \ y; return *x; }
     96static inline float _Complex ?\=?( float _Complex * x, _Complex float y ) { *x = *x \ y; return *x; }
     97static inline double _Complex ?\=?( double _Complex * x, _Complex double y ) { *x = *x \ y; return *x; }
     98static inline long double _Complex ?\=?( long double _Complex * x, _Complex long double y ) { *x = *x \ y; return *x; }
     99
     100static inline long int ?\?( long int x, unsigned long y ) {     // disallow negative exponent
     101    if ( y == 0 ) return 1;
     102    if ( x == 2 ) return x << (y - 1);
     103    long int prod = 1;
     104    for ( unsigned int i = 0; i < y; i += 1 ) {
     105                prod = prod * x;
     106    } // for
     107    return prod;
     108}
     109static inline double ?\?( long int x, signed long y ) { // allow negative exponent
     110    if ( y >=  0 ) return (double)(x \ (unsigned int)y);
     111    else return 1.0 / x \ (unsigned int)(-y);
     112}
     113static inline forall( otype T | { void ?{}( T * this, one_t ); T ?*?( T, T ); } )
     114T ?\?( T x, unsigned long y ) {
     115    T prod = 1;
     116    for ( unsigned int i = 1; i < y; i += 1 ) {
     117                prod = prod * x;
     118    } // for
     119    return prod;
     120}
     121static inline long int ?\=?( long int * x, unsigned long y ) { *x = *x \ y; return *x; }
     122static inline int ?\=?( int * x, unsigned long y ) { *x = *x \ y; return *x; }
     123
     124//---------------------- Logarithm ----------------------
     125
     126static inline float log( float x ) { return logf( x ); }
    80127// extern "C" { double log( double ); }
    81 long double log( long double );
    82 float _Complex log( float _Complex );
    83 double _Complex log( double _Complex );
    84 long double _Complex log( long double _Complex );
    85 
    86 float log2( float );
     128static inline long double log( long double x ) { return logl( x ); }
     129static inline float _Complex log( float _Complex x ) { return clogf( x ); }
     130static inline double _Complex log( double _Complex x ) { return clog( x ); }
     131static inline long double _Complex log( long double _Complex x ) { return clogl( x ); }
     132
     133static inline float log2( float x ) { return log2f( x ); }
    87134// extern "C" { double log2( double ); }
    88 long double log2( long double );
    89 // float _Complex log2( float _Complex );
    90 // double _Complex log2( double _Complex );
    91 // long double _Complex log2( long double _Complex );
    92 
    93 float log10( float );
     135static inline long double log2( long double x ) { return log2l( x ); }
     136// static inline float _Complex log2( float _Complex x ) { return clog2f( x ); }
     137// static inline double _Complex log2( double _Complex x ) { return clog2( x ); }
     138// static inline long double _Complex log2( long double _Complex x ) { return clog2l( x ); }
     139
     140static inline float log10( float x ) { return log10f( x ); }
    94141// extern "C" { double log10( double ); }
    95 long double log10( long double );
    96 // float _Complex log10( float _Complex );
    97 // double _Complex log10( double _Complex );
    98 // long double _Complex log10( long double _Complex );
    99 
    100 float log1p( float );
     142static inline long double log10( long double x ) { return log10l( x ); }
     143// static inline float _Complex log10( float _Complex x ) { return clog10f( x ); }
     144// static inline double _Complex log10( double _Complex x ) { return clog10( x ); }
     145// static inline long double _Complex log10( long double _Complex x ) { return clog10l( x ); }
     146
     147static inline float log1p( float x ) { return log1pf( x ); }
    101148// extern "C" { double log1p( double ); }
    102 long double log1p( long double );
    103 
    104 int ilogb( float );
     149static inline long double log1p( long double x ) { return log1pl( x ); }
     150
     151static inline int ilogb( float x ) { return ilogbf( x ); }
    105152// extern "C" { int ilogb( double ); }
    106 int ilogb( long double );
    107 
    108 float logb( float );
     153static inline int ilogb( long double x ) { return ilogbl( x ); }
     154
     155static inline float logb( float x ) { return logbf( x ); }
    109156// extern "C" { double logb( double ); }
    110 long double logb( long double );
    111 
    112 //---------------------- Power ----------------------
    113 
    114 float sqrt( float );
     157static inline long double logb( long double x ) { return logbl( x ); }
     158
     159static inline float sqrt( float x ) { return sqrtf( x ); }
    115160// extern "C" { double sqrt( double ); }
    116 long double sqrt( long double );
    117 float _Complex sqrt( float _Complex );
    118 double _Complex sqrt( double _Complex );
    119 long double _Complex sqrt( long double _Complex );
    120 
    121 float cbrt( float );
     161static inline long double sqrt( long double x ) { return sqrtl( x ); }
     162static inline float _Complex sqrt( float _Complex x ) { return csqrtf( x ); }
     163static inline double _Complex sqrt( double _Complex x ) { return csqrt( x ); }
     164static inline long double _Complex sqrt( long double _Complex x ) { return csqrtl( x ); }
     165
     166static inline float cbrt( float x ) { return cbrtf( x ); }
    122167// extern "C" { double cbrt( double ); }
    123 long double cbrt( long double );
    124 
    125 float hypot( float, float );
     168static inline long double cbrt( long double x ) { return cbrtl( x ); }
     169
     170static inline float hypot( float x, float y ) { return hypotf( x, y ); }
    126171// extern "C" { double hypot( double, double ); }
    127 long double hypot( long double, long double );
    128 
    129 float pow( float, float );
    130 // extern "C" { double pow( double, double ); }
    131 long double pow( long double, long double );
    132 float _Complex pow( float _Complex, float _Complex );
    133 double _Complex pow( double _Complex, double _Complex );
    134 long double _Complex pow( long double _Complex, long double _Complex );
     172static inline long double hypot( long double x, long double y ) { return hypotl( x, y ); }
    135173
    136174//---------------------- Trigonometric ----------------------
    137175
    138 float sin( float );
     176static inline float sin( float x ) { return sinf( x ); }
    139177// extern "C" { double sin( double ); }
    140 long double sin( long double );
    141 float _Complex sin( float _Complex );
    142 double _Complex sin( double _Complex );
    143 long double _Complex sin( long double _Complex );
    144 
    145 float cos( float );
     178static inline long double sin( long double x ) { return sinl( x ); }
     179static inline float _Complex sin( float _Complex x ) { return csinf( x ); }
     180static inline double _Complex sin( double _Complex x ) { return csin( x ); }
     181static inline long double _Complex sin( long double _Complex x ) { return csinl( x ); }
     182
     183static inline float cos( float x ) { return cosf( x ); }
    146184// extern "C" { double cos( double ); }
    147 long double cos( long double );
    148 float _Complex cos( float _Complex );
    149 double _Complex cos( double _Complex );
    150 long double _Complex cos( long double _Complex );
    151 
    152 float tan( float );
     185static inline long double cos( long double x ) { return cosl( x ); }
     186static inline float _Complex cos( float _Complex x ) { return ccosf( x ); }
     187static inline double _Complex cos( double _Complex x ) { return ccos( x ); }
     188static inline long double _Complex cos( long double _Complex x ) { return ccosl( x ); }
     189
     190static inline float tan( float x ) { return tanf( x ); }
    153191// extern "C" { double tan( double ); }
    154 long double tan( long double );
    155 float _Complex tan( float _Complex );
    156 double _Complex tan( double _Complex );
    157 long double _Complex tan( long double _Complex );
    158 
    159 float asin( float );
     192static inline long double tan( long double x ) { return tanl( x ); }
     193static inline float _Complex tan( float _Complex x ) { return ctanf( x ); }
     194static inline double _Complex tan( double _Complex x ) { return ctan( x ); }
     195static inline long double _Complex tan( long double _Complex x ) { return ctanl( x ); }
     196
     197static inline float asin( float x ) { return asinf( x ); }
    160198// extern "C" { double asin( double ); }
    161 long double asin( long double );
    162 float _Complex asin( float _Complex );
    163 double _Complex asin( double _Complex );
    164 long double _Complex asin( long double _Complex );
    165 
    166 float acos( float );
     199static inline long double asin( long double x ) { return asinl( x ); }
     200static inline float _Complex asin( float _Complex x ) { return casinf( x ); }
     201static inline double _Complex asin( double _Complex x ) { return casin( x ); }
     202static inline long double _Complex asin( long double _Complex x ) { return casinl( x ); }
     203
     204static inline float acos( float x ) { return acosf( x ); }
    167205// extern "C" { double acos( double ); }
    168 long double acos( long double );
    169 float _Complex acos( float _Complex );
    170 double _Complex acos( double _Complex );
    171 long double _Complex acos( long double _Complex );
    172 
    173 float atan( float );
     206static inline long double acos( long double x ) { return acosl( x ); }
     207static inline float _Complex acos( float _Complex x ) { return cacosf( x ); }
     208static inline double _Complex acos( double _Complex x ) { return cacos( x ); }
     209static inline long double _Complex acos( long double _Complex x ) { return cacosl( x ); }
     210
     211static inline float atan( float x ) { return atanf( x ); }
    174212// extern "C" { double atan( double ); }
    175 long double atan( long double );
    176 float _Complex atan( float _Complex );
    177 double _Complex atan( double _Complex );
    178 long double _Complex atan( long double _Complex );
    179 
    180 float atan2( float, float );
     213static inline long double atan( long double x ) { return atanl( x ); }
     214static inline float _Complex atan( float _Complex x ) { return catanf( x ); }
     215static inline double _Complex atan( double _Complex x ) { return catan( x ); }
     216static inline long double _Complex atan( long double _Complex x ) { return catanl( x ); }
     217
     218static inline float atan2( float x, float y ) { return atan2f( x, y ); }
    181219// extern "C" { double atan2( double, double ); }
    182 long double atan2( long double, long double );
    183 
    184 float atan( float, float );                                                             // alternative name for atan2
    185 double atan( double, double );
    186 long double atan( long double, long double );
     220static inline long double atan2( long double x, long double y ) { return atan2l( x, y ); }
     221
     222// alternative name for atan2
     223static inline float atan( float x, float y ) { return atan2f( x, y ); }
     224static inline double atan( double x, double y ) { return atan2( x, y ); }
     225static inline long double atan( long double x, long double y ) { return atan2l( x, y ); }
    187226
    188227//---------------------- Hyperbolic ----------------------
    189228
    190 float sinh( float );
     229static inline float sinh( float x ) { return sinhf( x ); }
    191230// extern "C" { double sinh( double ); }
    192 long double sinh( long double );
    193 float _Complex sinh( float _Complex );
    194 double _Complex sinh( double _Complex );
    195 long double _Complex sinh( long double _Complex );
    196 
    197 float cosh( float );
     231static inline long double sinh( long double x ) { return sinhl( x ); }
     232static inline float _Complex sinh( float _Complex x ) { return csinhf( x ); }
     233static inline double _Complex sinh( double _Complex x ) { return csinh( x ); }
     234static inline long double _Complex sinh( long double _Complex x ) { return csinhl( x ); }
     235
     236static inline float cosh( float x ) { return coshf( x ); }
    198237// extern "C" { double cosh( double ); }
    199 long double cosh( long double );
    200 float _Complex cosh( float _Complex );
    201 double _Complex cosh( double _Complex );
    202 long double _Complex cosh( long double _Complex );
    203 
    204 float tanh( float );
     238static inline long double cosh( long double x ) { return coshl( x ); }
     239static inline float _Complex cosh( float _Complex x ) { return ccoshf( x ); }
     240static inline double _Complex cosh( double _Complex x ) { return ccosh( x ); }
     241static inline long double _Complex cosh( long double _Complex x ) { return ccoshl( x ); }
     242
     243static inline float tanh( float x ) { return tanhf( x ); }
    205244// extern "C" { double tanh( double ); }
    206 long double tanh( long double );
    207 float _Complex tanh( float _Complex );
    208 double _Complex tanh( double _Complex );
    209 long double _Complex tanh( long double _Complex );
    210 
    211 float asinh( float );
     245static inline long double tanh( long double x ) { return tanhl( x ); }
     246static inline float _Complex tanh( float _Complex x ) { return ctanhf( x ); }
     247static inline double _Complex tanh( double _Complex x ) { return ctanh( x ); }
     248static inline long double _Complex tanh( long double _Complex x ) { return ctanhl( x ); }
     249
     250static inline float asinh( float x ) { return asinhf( x ); }
    212251// extern "C" { double asinh( double ); }
    213 long double asinh( long double );
    214 float _Complex asinh( float _Complex );
    215 double _Complex asinh( double _Complex );
    216 long double _Complex asinh( long double _Complex );
    217 
    218 float acosh( float );
     252static inline long double asinh( long double x ) { return asinhl( x ); }
     253static inline float _Complex asinh( float _Complex x ) { return casinhf( x ); }
     254static inline double _Complex asinh( double _Complex x ) { return casinh( x ); }
     255static inline long double _Complex asinh( long double _Complex x ) { return casinhl( x ); }
     256
     257static inline float acosh( float x ) { return acoshf( x ); }
    219258// extern "C" { double acosh( double ); }
    220 long double acosh( long double );
    221 float _Complex acosh( float _Complex );
    222 double _Complex acosh( double _Complex );
    223 long double _Complex acosh( long double _Complex );
    224 
    225 float atanh( float );
     259static inline long double acosh( long double x ) { return acoshl( x ); }
     260static inline float _Complex acosh( float _Complex x ) { return cacoshf( x ); }
     261static inline double _Complex acosh( double _Complex x ) { return cacosh( x ); }
     262static inline long double _Complex acosh( long double _Complex x ) { return cacoshl( x ); }
     263
     264static inline float atanh( float x ) { return atanhf( x ); }
    226265// extern "C" { double atanh( double ); }
    227 long double atanh( long double );
    228 float _Complex atanh( float _Complex );
    229 double _Complex atanh( double _Complex );
    230 long double _Complex atanh( long double _Complex );
     266static inline long double atanh( long double x ) { return atanhl( x ); }
     267static inline float _Complex atanh( float _Complex x ) { return catanhf( x ); }
     268static inline double _Complex atanh( double _Complex x ) { return catanh( x ); }
     269static inline long double _Complex atanh( long double _Complex x ) { return catanhl( x ); }
    231270
    232271//---------------------- Error / Gamma ----------------------
    233272
    234 float erf( float );
     273static inline float erf( float x ) { return erff( x ); }
    235274// extern "C" { double erf( double ); }
    236 long double erf( long double );
     275static inline long double erf( long double x ) { return erfl( x ); }
    237276// float _Complex erf( float _Complex );
    238277// double _Complex erf( double _Complex );
    239278// long double _Complex erf( long double _Complex );
    240279
    241 float erfc( float );
     280static inline float erfc( float x ) { return erfcf( x ); }
    242281// extern "C" { double erfc( double ); }
    243 long double erfc( long double );
     282static inline long double erfc( long double x ) { return erfcl( x ); }
    244283// float _Complex erfc( float _Complex );
    245284// double _Complex erfc( double _Complex );
    246285// long double _Complex erfc( long double _Complex );
    247286
    248 float lgamma( float );
     287static inline float lgamma( float x ) { return lgammaf( x ); }
    249288// extern "C" { double lgamma( double ); }
    250 long double lgamma( long double );
    251 float lgamma( float, int * );
    252 double lgamma( double, int * );
    253 long double lgamma( long double, int * );
    254 
    255 float tgamma( float );
     289static inline long double lgamma( long double x ) { return lgammal( x ); }
     290static inline float lgamma( float x, int * sign ) { return lgammaf_r( x, sign ); }
     291static inline double lgamma( double x, int * sign ) { return lgamma_r( x, sign ); }
     292static inline long double lgamma( long double x, int * sign ) { return lgammal_r( x, sign ); }
     293
     294static inline float tgamma( float x ) { return tgammaf( x ); }
    256295// extern "C" { double tgamma( double ); }
    257 long double tgamma( long double );
     296static inline long double tgamma( long double x ) { return tgammal( x ); }
    258297
    259298//---------------------- Nearest Integer ----------------------
    260299
    261 float floor( float );
     300static inline float floor( float x ) { return floorf( x ); }
    262301// extern "C" { double floor( double ); }
    263 long double floor( long double );
    264 
    265 float ceil( float );
     302static inline long double floor( long double x ) { return floorl( x ); }
     303
     304static inline float ceil( float x ) { return ceilf( x ); }
    266305// extern "C" { double ceil( double ); }
    267 long double ceil( long double );
    268 
    269 float trunc( float );
     306static inline long double ceil( long double x ) { return ceill( x ); }
     307
     308static inline float trunc( float x ) { return truncf( x ); }
    270309// extern "C" { double trunc( double ); }
    271 long double trunc( long double );
    272 
    273 float rint( float );
    274 long double rint( long double );
    275 long int rint( float );
    276 long int rint( double );
    277 long int rint( long double );
    278 long long int rint( float );
    279 long long int rint( double );
    280 long long int rint( long double );
    281 
    282 long int lrint( float );
     310static inline long double trunc( long double x ) { return truncl( x ); }
     311
     312static inline float rint( float x ) { return rintf( x ); }
     313// extern "C" { double rint( double x ); }
     314static inline long double rint( long double x ) { return rintl( x ); }
     315static inline long int rint( float x ) { return lrintf( x ); }
     316static inline long int rint( double x ) { return lrint( x ); }
     317static inline long int rint( long double x ) { return lrintl( x ); }
     318static inline long long int rint( float x ) { return llrintf( x ); }
     319static inline long long int rint( double x ) { return llrint( x ); }
     320static inline long long int rint( long double x ) { return llrintl( x ); }
     321
     322static inline long int lrint( float x ) { return lrintf( x ); }
    283323// extern "C" { long int lrint( double ); }
    284 long int lrint( long double );
    285 long long int llrint( float );
     324static inline long int lrint( long double x ) { return lrintl( x ); }
     325static inline long long int llrint( float x ) { return llrintf( x ); }
    286326// extern "C" { long long int llrint( double ); }
    287 long long int llrint( long double );
    288 
    289 float nearbyint( float );
     327static inline long long int llrint( long double x ) { return llrintl( x ); }
     328
     329static inline float nearbyint( float x ) { return nearbyintf( x ); }
    290330// extern "C" { double nearbyint( double ); }
    291 long double nearbyint( long double );
    292 
    293 float round( float );
    294 long double round( long double );
    295 long int round( float );
    296 long int round( double );
    297 long int round( long double );
    298 long long int round( float );
    299 long long int round( double );
    300 long long int round( long double );
    301 
    302 long int lround( float );
     331static inline long double nearbyint( long double x ) { return nearbyintl( x ); }
     332
     333static inline float round( float x ) { return roundf( x ); }
     334// extern "C" { double round( double x ); }
     335static inline long double round( long double x ) { return roundl( x ); }
     336static inline long int round( float x ) { return lroundf( x ); }
     337static inline long int round( double x ) { return lround( x ); }
     338static inline long int round( long double x ) { return lroundl( x ); }
     339static inline long long int round( float x ) { return llroundf( x ); }
     340static inline long long int round( double x ) { return llround( x ); }
     341static inline long long int round( long double x ) { return llroundl( x ); }
     342
     343static inline long int lround( float x ) { return lroundf( x ); }
    303344// extern "C" { long int lround( double ); }
    304 long int lround( long double );
    305 long long int llround( float );
     345static inline long int lround( long double x ) { return lroundl( x ); }
     346static inline long long int llround( float x ) { return llroundf( x ); }
    306347// extern "C" { long long int llround( double ); }
    307 long long int llround( long double );
     348static inline long long int llround( long double x ) { return llroundl( x ); }
    308349
    309350//---------------------- Manipulation ----------------------
    310351
    311 float copysign( float, float );
     352static inline float copysign( float x, float y ) { return copysignf( x, y ); }
    312353// extern "C" { double copysign( double, double ); }
    313 long double copysign( long double, long double );
    314 
    315 float frexp( float, int * );
     354static inline long double copysign( long double x, long double y ) { return copysignl( x, y ); }
     355
     356static inline float frexp( float x, int * ip ) { return frexpf( x, ip ); }
    316357// extern "C" { double frexp( double, int * ); }
    317 long double frexp( long double, int * );
    318 
    319 float ldexp( float, int );
     358static inline long double frexp( long double x, int * ip ) { return frexpl( x, ip ); }
     359
     360static inline float ldexp( float x, int exp2 ) { return ldexpf( x, exp2 ); }
    320361// extern "C" { double ldexp( double, int ); }
    321 long double ldexp( long double, int );
    322 
    323 [ float, float ] modf( float );
    324 float modf( float, float * );
    325 [ double, double ] modf( double );
     362static inline long double ldexp( long double x, int exp2 ) { return ldexpl( x, exp2 ); }
     363
     364static inline [ float, float ] modf( float x ) { float i; x = modff( x, &i ); return [ i, x ]; }
     365static inline float modf( float x, float * i ) { return modff( x, i ); }
     366static inline [ double, double ] modf( double x ) { double i; x = modf( x, &i ); return [ i, x ]; }
    326367// extern "C" { double modf( double, double * ); }
    327 [ long double, long double ] modf( long double );
    328 long double modf( long double, long double * );
    329 
    330 float nextafter( float, float );
     368static inline [ long double, long double ] modf( long double x ) { long double i; x = modfl( x, &i ); return [ i, x ]; }
     369static inline long double modf( long double x, long double * i ) { return modfl( x, i ); }
     370
     371static inline float nextafter( float x, float y ) { return nextafterf( x, y ); }
    331372// extern "C" { double nextafter( double, double ); }
    332 long double nextafter( long double, long double );
    333 
    334 float nexttoward( float, long double );
     373static inline long double nextafter( long double x, long double y ) { return nextafterl( x, y ); }
     374
     375static inline float nexttoward( float x, long double y ) { return nexttowardf( x, y ); }
    335376// extern "C" { double nexttoward( double, long double ); }
    336 long double nexttoward( long double, long double );
    337 
    338 float scalbn( float, int );
     377static inline long double nexttoward( long double x, long double y ) { return nexttowardl( x, y ); }
     378
     379static inline float scalbn( float x, int exp ) { return scalbnf( x, exp ); }
    339380// extern "C" { double scalbn( double, int ); }
    340 long double scalbn( long double, int );
    341 
    342 float scalbln( float, long int );
     381static inline long double scalbn( long double x, int exp ) { return scalbnl( x, exp ); }
     382static inline float scalbn( float x, long int exp ) { return scalblnf( x, exp ); }
     383static inline double scalbn( double x, long int exp ) { return scalbln( x, exp ); }
     384static inline long double scalbn( long double x, long int exp ) { return scalblnl( x, exp ); }
     385
     386static inline float scalbln( float x, long int exp ) { return scalblnf( x, exp ); }
    343387// extern "C" { double scalbln( double, long int ); }
    344 long double scalbln( long double, long int );
     388static inline long double scalbln( long double x, long int exp ) { return scalblnl( x, exp ); }
    345389
    346390// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.