| 1 | /* |
| 2 | * IBM Accurate Mathematical Library |
| 3 | * Written by International Business Machines Corp. |
| 4 | * Copyright (C) 2001-2020 Free Software Foundation, Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU Lesser General Public License as published by |
| 8 | * the Free Software Foundation; either version 2.1 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public License |
| 17 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | /********************************************************************/ |
| 21 | /* Ultimate math functions. Each function computes the exact */ |
| 22 | /* theoretical value of its argument rounded to nearest or even. */ |
| 23 | /* */ |
| 24 | /* Assumption: Machine arithmetic operations are performed in */ |
| 25 | /* round nearest mode of IEEE 754 standard. */ |
| 26 | /********************************************************************/ |
| 27 | |
| 28 | #ifndef UMATH_LIB |
| 29 | #define UMATH_LIB |
| 30 | /********************************************************************/ |
| 31 | /* Function changes the precision mode to IEEE 754 double precision */ |
| 32 | /* and the rounding mode to nearest or even. */ |
| 33 | /* It returns the original status of these modes. */ |
| 34 | /* See further explanations of usage in DPChange.h */ |
| 35 | /********************************************************************/ |
| 36 | unsigned short Init_Lib (void); |
| 37 | |
| 38 | /********************************************************************/ |
| 39 | /* Function that changes the precision and rounding modes to the */ |
| 40 | /* specified by the argument received. See further explanations in */ |
| 41 | /* DPChange.h */ |
| 42 | /********************************************************************/ |
| 43 | void Exit_Lib (unsigned short); |
| 44 | |
| 45 | |
| 46 | /* The asin() function calculates the arc sine of its argument. */ |
| 47 | /* The function returns the arc sine in radians */ |
| 48 | /* (between -PI/2 and PI/2). */ |
| 49 | /* If the argument is greater than 1 or less than -1 it returns */ |
| 50 | /* a NaN. */ |
| 51 | double uasin (double); |
| 52 | |
| 53 | |
| 54 | /* The acos() function calculates the arc cosine of its argument. */ |
| 55 | /* The function returns the arc cosine in radians */ |
| 56 | /* (between -PI/2 and PI/2). */ |
| 57 | /* If the argument is greater than 1 or less than -1 it returns */ |
| 58 | /* a NaN. */ |
| 59 | double uacos (double); |
| 60 | |
| 61 | /* The atan() function calculates the arctanget of its argument. */ |
| 62 | /* The function returns the arc tangent in radians */ |
| 63 | /* (between -PI/2 and PI/2). */ |
| 64 | double uatan (double); |
| 65 | |
| 66 | |
| 67 | /* The uatan2() function calculates the arc tangent of the two arguments x */ |
| 68 | /* and y (x is the right argument and y is the left one).The signs of both */ |
| 69 | /* arguments are used to determine the quadrant of the result. */ |
| 70 | /* The function returns the result in radians, which is between -PI and PI */ |
| 71 | double uatan2 (double, double); |
| 72 | |
| 73 | /* Compute log(x). The base of log is e (natural logarithm) */ |
| 74 | double ulog (double); |
| 75 | |
| 76 | /* Compute e raised to the power of argument x. */ |
| 77 | double uexp (double); |
| 78 | |
| 79 | /* Compute sin(x). The argument x is assumed to be given in radians.*/ |
| 80 | double usin (double); |
| 81 | |
| 82 | /* Compute cos(x). The argument x is assumed to be given in radians.*/ |
| 83 | double ucos (double); |
| 84 | |
| 85 | /* Compute tan(x). The argument x is assumed to be given in radians.*/ |
| 86 | double utan (double); |
| 87 | |
| 88 | /* Compute the square root of non-negative argument x. */ |
| 89 | /* If x is negative the returned value is NaN. */ |
| 90 | double usqrt (double); |
| 91 | |
| 92 | /* Compute x raised to the power of y, where x is the left argument */ |
| 93 | /* and y is the right argument. The function returns a NaN if x<0. */ |
| 94 | /* If x equals zero it returns -inf */ |
| 95 | double upow (double, double); |
| 96 | |
| 97 | /* Computing x mod y, where x is the left argument and y is the */ |
| 98 | /* right one. */ |
| 99 | double uremainder (double, double); |
| 100 | #endif |
| 101 | |