]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libquadmath/math/expm1q.c
Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686).
[thirdparty/gcc.git] / libquadmath / math / expm1q.c
index 9060d480858bcab1ce7994cd4921b30b8aac839a..f64d8d56b7c4e11adbbcf25c10535f3b6c9ce3f4 100644 (file)
@@ -1,15 +1,15 @@
-/*                                                     expm1l.c
+/*                                                     expm1q.c
  *
  *     Exponential function, minus 1
- *      128-bit __float128 precision
+ *      128-bit long double precision
  *
  *
  *
  * SYNOPSIS:
  *
- * __float128 x, y, expm1l();
+ * long double x, y, expm1q();
  *
- * y = expm1l( x );
+ * y = expm1q( x );
  *
  *
  *
     Lesser General Public License for more details.
 
     You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+    License along with this library; if not, see
+    <http://www.gnu.org/licenses/>.  */
 
-
-
-#include <errno.h>
 #include "quadmath-imp.h"
 
 /* exp(x) - 1 = x + 0.5 x^2 + x^3 P(x)/Q(x)
@@ -83,7 +80,7 @@ static const __float128
   C1 = 6.93145751953125E-1Q,
   C2 = 1.428606820309417232121458176568075500134E-6Q,
 /* ln 2^-114 */
-  minarg = -7.9018778583833765273564461846232128760607E1Q;
+  minarg = -7.9018778583833765273564461846232128760607E1Q, big = 1e4932Q;
 
 
 __float128
@@ -108,7 +105,7 @@ expm1q (__float128 x)
     {
       /* Infinity (which must be negative infinity). */
       if (((ix & 0xffff) | u.words32.w1 | u.words32.w2 | u.words32.w3) == 0)
-       return -1.0Q;
+       return -1;
       /* NaN.  Invalid exception if signaling.  */
       return x + x;
     }
@@ -119,7 +116,7 @@ expm1q (__float128 x)
 
   /* Minimum value.  */
   if (x < minarg)
-    return (4.0/HUGE_VALQ - 1.0Q);
+    return (4.0/big - 1);
 
   /* Avoid internal underflow when result does not underflow, while
      ensuring underflow (without returning a zero of the wrong sign)
@@ -156,7 +153,7 @@ expm1q (__float128 x)
   exp(x) - 1 = 2^k (qx + 1) - 1
              = 2^k qx + 2^k - 1.  */
 
-  px = ldexpq (1.0Q, k);
+  px = ldexpq (1, k);
   x = px * qx + (px - 1.0);
   return x;
 }