Page 133 - Programming Microcontrollers in C
P. 133

118    Chapter 2  Advanced C Topics

                            cosh(x)             hyperbolic cosine of x
                            tanh(x)             hyperbolic tangent of x
                            exp(x)              exponential function of x
                            log(x)              logarithm base e of x
                            log10(x)            common logarithm of x
                            pow(x,y)            raise x to the y power
                            sqrt(x)             square root of x
                            fabs(x)             absolute value of x
                            ceil(x)             smallest integer not less than x
                            floor(x)            largest integer not greater than x
                            ldexp(x,n)          x*2^n
                            frexp(x,int *exp)  split double into mantissa and exponent
                            modf(x,double *ip) Splits x into integral and fractional
                                                       parts. Puts integral in ip and returns
                                                       fractional part.
                            fmod(x,y)           floating-point remainder of x/y
                          These functions all require double arguments and return double values.

                          Utility functions—in stdlib.h

                            double atof(const char *s);
                            integer atoi(const char *s);
                            long atol(const char *s);
                            double strtod(char *str,char **scanstop);
                            long strtol(char *str,char **scanstop,int base);
                            unsigned long strtoul(char *str,char **scanstop,int base);
                            ldiv_t ldiv(long numer,long denom);
                            div_t div(int numer,int denom);
                            long labs(long n);
                            int abs(int n);
                            void *bsearch(void *key, void *base,size_t number,size_t size,
                                int(*compare)(void*,void*));
                            void qsort(void *base,size_t number, size_t size,
                                int(*compare)(void*,void*));
                            int rand(void);
                            int srand(unsigned int seed);
                            void *calloc(size_t nobj, size_t size);
                            void *malloc(size_t size);
                            void *realloc(void *p, size_t size);
   128   129   130   131   132   133   134   135   136   137   138