epoc32/include/libc/math.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/libc/math.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/libc/math.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,281 @@
     1.4 -math.h
     1.5 +/*
     1.6 +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +
    1.24 +
    1.25 +
    1.26 +
    1.27 +/**
    1.28 + @file
    1.29 + @publishedAll
    1.30 + @released
    1.31 +*/
    1.32 +
    1.33 +#ifndef  _MATH_H
    1.34 +#ifdef __cplusplus
    1.35 +extern "C" {
    1.36 +#endif
    1.37 +#define  _MATH_H
    1.38 +
    1.39 +#include <sys/reent.h>
    1.40 +#include <machine/ieeefp.h>
    1.41 +#include "_ansi.h"
    1.42 +
    1.43 +void MapSymbianErrorCodeToErrno(int, int);
    1.44 +   
    1.45 +/**
    1.46 +Reentrant ANSI C functions
    1.47 +*/
    1.48 +IMPORT_C double atan (double) __SOFTFP;
    1.49 +IMPORT_C double cos (double) __SOFTFP;
    1.50 +IMPORT_C double sin (double) __SOFTFP;
    1.51 +IMPORT_C double tan (double) __SOFTFP;
    1.52 +IMPORT_C double tanh (double) __SOFTFP;
    1.53 +IMPORT_C double frexp (double, int *) __SOFTFP;
    1.54 +IMPORT_C double modf (double, double *) __SOFTFP;
    1.55 +IMPORT_C double ceil (double) __SOFTFP;
    1.56 +IMPORT_C double fabs (double) __SOFTFP;
    1.57 +IMPORT_C double floor (double) __SOFTFP;
    1.58 +
    1.59 +/**
    1.60 +Non reentrant ANSI C functions.  
    1.61 +*/
    1.62 +#ifndef _REENT_ONLY
    1.63 +IMPORT_C double acos (double) __SOFTFP;
    1.64 +IMPORT_C double asin (double) __SOFTFP;
    1.65 +IMPORT_C double atan2 (double, double) __SOFTFP;
    1.66 +IMPORT_C double cosh (double) __SOFTFP;
    1.67 +IMPORT_C double sinh (double) __SOFTFP;
    1.68 +IMPORT_C double exp (double) __SOFTFP;
    1.69 +IMPORT_C double ldexp (double, int) __SOFTFP;
    1.70 +IMPORT_C double log (double) __SOFTFP;
    1.71 +IMPORT_C double log10 (double) __SOFTFP;
    1.72 +IMPORT_C double pow (double, double) __SOFTFP;
    1.73 +IMPORT_C double sqrt (double) __SOFTFP;
    1.74 +IMPORT_C double fmod (double, double) __SOFTFP;
    1.75 +#endif /* ! defined (_REENT_ONLY) */
    1.76 +
    1.77 +/**
    1.78 +Non ANSI functions provided by EPOC32 
    1.79 +*/
    1.80 +IMPORT_C double	copysign(double, double) __SOFTFP;
    1.81 +IMPORT_C double	expm1	(double) __SOFTFP;
    1.82 +IMPORT_C int	finite	(double) __SOFTFP;
    1.83 +IMPORT_C int	isnan	(double) __SOFTFP;
    1.84 +IMPORT_C int	isinf	(double) __SOFTFP;
    1.85 +IMPORT_C double	rint	(double) __SOFTFP;
    1.86 +IMPORT_C double	scalbn	(double, int) __SOFTFP;
    1.87 +
    1.88 +/* 
    1.89 +strtod, atof, etc. may return HUGE_VAL 
    1.90 +@internalComponent
    1.91 +*/
    1.92 +#define	HUGE_VAL	1.7976931348623157E+308 /* KMaxTReal from e32math.h */
    1.93 +
    1.94 +#ifndef _STRICT_ANSI
    1.95 +
    1.96 +/**
    1.97 +Non ANSI double precision functions.  
    1.98 +*/
    1.99 +extern double infinity (void);
   1.100 +extern double nan (void);
   1.101 +extern int ilogb (double);
   1.102 +
   1.103 +extern double asinh (double);
   1.104 +extern double cbrt (double);
   1.105 +extern double nextafter (double, double);
   1.106 +
   1.107 +extern double log1p (double);
   1.108 +
   1.109 +#ifndef _REENT_ONLY
   1.110 +extern double acosh (double);
   1.111 +extern double atanh (double);
   1.112 +extern double remainder (double, double);
   1.113 +extern double gamma (double);
   1.114 +extern double gamma_r (double, int *);
   1.115 +extern double lgamma (double);
   1.116 +extern double lgamma_r (double, int *);
   1.117 +extern double erf (double);
   1.118 +extern double erfc (double);
   1.119 +extern double y0 (double);
   1.120 +extern double y1 (double);
   1.121 +extern double yn (int, double);
   1.122 +extern double j0 (double);
   1.123 +extern double j1 (double);
   1.124 +extern double jn (int, double);
   1.125 +#define log2(x) (log (x) / M_LOG2_E)
   1.126 +
   1.127 +extern double hypot (double, double);
   1.128 +
   1.129 +extern double cabs();
   1.130 +extern double drem (double, double);
   1.131 +
   1.132 +#endif /* ! defined (_REENT_ONLY) */
   1.133 +
   1.134 +/**
   1.135 +Single precision versions of ANSI functions.  
   1.136 +*/
   1.137 +extern float atanf (float);
   1.138 +extern float cosf (float);
   1.139 +extern float sinf (float);
   1.140 +extern float tanf (float);
   1.141 +extern float tanhf (float);
   1.142 +extern float frexpf (float, int *);
   1.143 +extern float modff (float, float *);
   1.144 +extern float ceilf (float);
   1.145 +extern float fabsf (float);
   1.146 +extern float floorf (float);
   1.147 +
   1.148 +#ifndef _REENT_ONLY
   1.149 +extern float acosf (float);
   1.150 +extern float asinf (float);
   1.151 +extern float atan2f (float, float);
   1.152 +extern float coshf (float);
   1.153 +extern float sinhf (float);
   1.154 +extern float expf (float);
   1.155 +extern float ldexpf (float, int);
   1.156 +extern float logf (float);
   1.157 +extern float log10f (float);
   1.158 +extern float powf (float, float);
   1.159 +extern float sqrtf (float);
   1.160 +extern float fmodf (float, float);
   1.161 +#endif /* ! defined (_REENT_ONLY) */
   1.162 +
   1.163 +/**
   1.164 +Other single precision functions.  
   1.165 +*/
   1.166 +extern float infinityf (void);
   1.167 +extern float nanf (void);
   1.168 +extern int isnanf (float);
   1.169 +extern int isinff (float);
   1.170 +extern int finitef (float);
   1.171 +extern float copysignf (float, float);
   1.172 +extern int ilogbf (float);
   1.173 +extern float asinhf (float);
   1.174 +extern float cbrtf (float);
   1.175 +extern float nextafterf (float, float);
   1.176 +extern float rintf (float);
   1.177 +extern float scalbnf (float, int);
   1.178 +extern float log1pf (float);
   1.179 +extern float expm1f (float);
   1.180 +
   1.181 +#ifndef _REENT_ONLY
   1.182 +extern float acoshf (float);
   1.183 +extern float atanhf (float);
   1.184 +extern float remainderf (float, float);
   1.185 +extern float gammaf (float);
   1.186 +extern float gammaf_r (float, int *);
   1.187 +extern float lgammaf (float);
   1.188 +extern float lgammaf_r (float, int *);
   1.189 +extern float erff (float);
   1.190 +extern float erfcf (float);
   1.191 +extern float y0f (float);
   1.192 +extern float y1f (float);
   1.193 +extern float ynf (int, float);
   1.194 +extern float j0f (float);
   1.195 +extern float j1f (float);
   1.196 +extern float jnf (int, float);
   1.197 +#define log2f(x) (logf (x) / (float) M_LOG2_E)
   1.198 +extern float hypotf (float, float);
   1.199 +extern float cabsf();
   1.200 +extern float dremf (float, float);
   1.201 +#endif /* ! defined (_REENT_ONLY) */
   1.202 +
   1.203 +/**
   1.204 +The gamma functions use a global variable, signgam.
   1.205 +*/
   1.206 +extern int signgam;
   1.207 +
   1.208 +/** 
   1.209 +The exception structure passed to the matherr routine.  
   1.210 +*/
   1.211 +struct exception 
   1.212 +{
   1.213 +  int type;
   1.214 +  char *name;
   1.215 +  double arg1;
   1.216 +  double arg2;
   1.217 +  double retval;
   1.218 +  int err;
   1.219 +};
   1.220 +
   1.221 +extern int matherr (struct exception *e);
   1.222 +
   1.223 +/**
   1.224 +Values for the type field of struct exception.  
   1.225 +*/
   1.226 +#define DOMAIN 1
   1.227 +#define SING 2
   1.228 +#define OVERFLOW 3
   1.229 +#define UNDERFLOW 4
   1.230 +#define TLOSS 5
   1.231 +#define PLOSS 6
   1.232 +
   1.233 +/** 
   1.234 +Useful constants.  
   1.235 +*/
   1.236 +#define M_E		2.7182818284590452354
   1.237 +#define M_LOG2E		1.4426950408889634074
   1.238 +#define M_LOG10E	0.43429448190325182765
   1.239 +#define M_LN2		0.69314718055994530942
   1.240 +#define M_LN10		2.30258509299404568402
   1.241 +#define M_PI		3.14159265358979323846
   1.242 +#define M_TWOPI         (M_PI * 2.0)
   1.243 +#define M_PI_2		1.57079632679489661923
   1.244 +#define M_PI_4		0.78539816339744830962
   1.245 +#define M_3PI_4		2.3561944901923448370E0
   1.246 +#define M_SQRTPI        1.77245385090551602792981
   1.247 +#define M_1_PI		0.31830988618379067154
   1.248 +#define M_2_PI		0.63661977236758134308
   1.249 +#define M_2_SQRTPI	1.12837916709551257390
   1.250 +#define M_SQRT2		1.41421356237309504880
   1.251 +#define M_SQRT1_2	0.70710678118654752440
   1.252 +#define M_LN2LO         1.9082149292705877000E-10
   1.253 +#define M_LN2HI         6.9314718036912381649E-1
   1.254 +#define M_SQRT3   	1.73205080756887719000
   1.255 +#define M_IVLN10        0.43429448190325182765 /* 1 / log(10) */
   1.256 +#define M_LOG2_E        0.693147180559945309417
   1.257 +#define M_INVLN2        1.4426950408889633870E0  /* 1 / log(2) */
   1.258 +
   1.259 +/**
   1.260 +Global control over fdlibm error handling.  
   1.261 +*/
   1.262 +enum __fdlibm_version
   1.263 +{
   1.264 +  __fdlibm_ieee = -1,
   1.265 +  __fdlibm_svid,
   1.266 +  __fdlibm_xopen,
   1.267 +  __fdlibm_posix
   1.268 +};
   1.269 +
   1.270 +#define _LIB_VERSION_TYPE enum __fdlibm_version
   1.271 +#define _LIB_VERSION __fdlib_version
   1.272 +
   1.273 +extern _LIB_VERSION_TYPE _LIB_VERSION;
   1.274 +
   1.275 +#define _IEEE_  __fdlibm_ieee
   1.276 +#define _SVID_  __fdlibm_svid
   1.277 +#define _XOPEN_ __fdlibm_xopen
   1.278 +#define _POSIX_ __fdlibm_posix
   1.279 +
   1.280 +#endif /* ! defined (_STRICT_ANSI) */
   1.281 +
   1.282 +#ifdef __cplusplus
   1.283 +}
   1.284 +#endif
   1.285 +#endif /* _MATH_H */