From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.1 required=3.0 tests=AWL,BAYES_00, DATE_IN_PAST_24_48,DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 63B471F4B4 for ; Wed, 6 Jan 2021 07:06:01 +0000 (UTC) Received: from localhost ([::1]:45050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kx2tM-0004Rq-3B for normalperson@yhbt.net; Wed, 06 Jan 2021 02:06:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kx2tI-0004RV-FA for bug-gnulib@gnu.org; Wed, 06 Jan 2021 02:05:56 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.21]:16596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kx2tF-0003aA-U0 for bug-gnulib@gnu.org; Wed, 06 Jan 2021 02:05:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1609916750; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:From:Subject:Sender; bh=7uBe5fuD7myGAsYNiSrrNWfHuKOd91DOg4jqDKoHWEo=; b=trHHvvigZ+WaLKlGiQJRXGWwMKsgnawGi+jANjZck255+VMjbwMBcg85S8pXjjid7M cF3RTYhtFy2sPVm363+n78BtdFRPreiFZDPMHTcJ9nrtrx/6ptCY+4EXxaetJ9RFBxN0 URHdeaLWsnX2Pb/oJIbpAb1m+Y6A0DdRDOpgsKiS36hzE6YZFgu1BKeoQ5OPNfaYIwRm 7FZhRY5ypccXQNbpa3x5lTgFnobneeUCuS40DFzN/y5B3/C7kz3bq4O7pKZ2MEtSEt8k kCNHQzUj0CP/RHiSD8xS0uyBbwFUUTgWFwmdtmSV3pzPiYkoH2KDpztwTeRG89TVzUCS JvNw== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOHqf3yZdW" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 47.10.7 DYNA|AUTH) with ESMTPSA id e012d5x0675oolv (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Wed, 6 Jan 2021 08:05:50 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: expm1f-ieee: Work around AIX 7.2 bug Date: Mon, 04 Jan 2021 22:30:27 +0100 Message-ID: <1951905.BfP2WutiAA@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=85.215.255.21; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_24_48=1.34, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On AIX 7.2 I see a test failure: FAIL: test-expm1f-ieee ====================== ../../gltests/test-expm1-ieee.h:37: assertion '!!signbit (z) == !!signbit (MINUS_ZERO)' failed FAIL test-expm1f-ieee (exit status: 134) The cause is that expm1f (-0.0f) return +0.0f instead of -0.0f. This patch fixes it. 2021-01-04 Bruno Haible expm1f-ieee: Work around AIX 7.2 bug. * m4/expm1f.m4 (gl_FUNC_EXPM1F): Initialize gl_expm1f_required. If module 'expm1f-ieee' is in use, check whether expm1f works according to IEEE. * m4/expm1f-ieee.m4: New file. * modules/expm1f-ieee (Files): Add it. (Depends-on): Update conditions. (configure.ac): Invoke gl_FUNC_EXPM1F_IEEE. * doc/posix-functions/expm1f.texi: Mention the AIX bug. diff --git a/doc/posix-functions/expm1f.texi b/doc/posix-functions/expm1f.texi index c732cfe..e95e510 100644 --- a/doc/posix-functions/expm1f.texi +++ b/doc/posix-functions/expm1f.texi @@ -4,9 +4,9 @@ POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/expm1f.html} -Gnulib module: expm1f +Gnulib module: expm1f or expm1f-ieee -Portability problems fixed by Gnulib: +Portability problems fixed by either Gnulib module @code{expm1f} or @code{expm1f-ieee}: @itemize @item This function is missing on some platforms: @@ -16,6 +16,14 @@ This function produces wrong results for arguments <= @minus{}17.32868 on some p IRIX 6.5. @end itemize +Portability problems fixed by Gnulib module @code{expm1f-ieee}: +@itemize +@item +This function returns a positive zero for a minus zero argument +on some platforms: +AIX 7.2. +@end itemize + Portability problems not fixed by Gnulib: @itemize @end itemize diff --git a/m4/expm1f-ieee.m4 b/m4/expm1f-ieee.m4 new file mode 100644 index 0000000..5344955 --- /dev/null +++ b/m4/expm1f-ieee.m4 @@ -0,0 +1,15 @@ +# expm1f-ieee.m4 serial 1 +dnl Copyright (C) 2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This macro is in a separate file (not in expm1f.m4 and not inlined in the +dnl module description), so that gl_FUNC_EXPM1F can test whether 'aclocal' has +dnl found uses of this macro. + +AC_DEFUN([gl_FUNC_EXPM1F_IEEE], +[ + m4_divert_text([INIT_PREPARE], [gl_expm1f_required=ieee]) + AC_REQUIRE([gl_FUNC_EXPM1F]) +]) diff --git a/m4/expm1f.m4 b/m4/expm1f.m4 index 5cb661f..c18ff1a 100644 --- a/m4/expm1f.m4 +++ b/m4/expm1f.m4 @@ -1,4 +1,4 @@ -# expm1f.m4 serial 3 +# expm1f.m4 serial 4 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,6 +6,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_EXPM1F], [ + m4_divert_text([DEFAULTS], [gl_expm1f_required=plain]) AC_REQUIRE([gl_MATH_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_EXPM1]) @@ -20,6 +21,7 @@ AC_DEFUN([gl_FUNC_EXPM1F], LIBS="$save_LIBS" if test $ac_cv_func_expm1f = yes; then EXPM1F_LIBM="$EXPM1_LIBM" + save_LIBS="$LIBS" LIBS="$LIBS $EXPM1F_LIBM" gl_FUNC_EXPM1F_WORKS @@ -28,6 +30,73 @@ AC_DEFUN([gl_FUNC_EXPM1F], *yes) ;; *) REPLACE_EXPM1F=1 ;; esac + + m4_ifdef([gl_FUNC_EXPM1F_IEEE], [ + if test $gl_expm1f_required = ieee && test $REPLACE_EXPM1F = 0; then + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether expm1f works according to ISO C 99 with IEC 60559], + [gl_cv_func_expm1f_ieee], + [ + save_LIBS="$LIBS" + LIBS="$LIBS $EXPM1F_LIBM" + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#ifndef __NO_MATH_INLINES +# define __NO_MATH_INLINES 1 /* for glibc */ +#endif +#include +]gl_FLOAT_MINUS_ZERO_CODE[ +]gl_FLOAT_SIGNBIT_CODE[ +#ifndef expm1f +extern +#ifdef __cplusplus +"C" +#endif +float expm1f (float); +#endif +/* Compare two numbers with ==. + This is a separate function because IRIX 6.5 "cc -O" miscompiles an + 'x == x' test. */ +static int +numeric_equal (float x, float y) +{ + return x == y; +} +static float dummy (float x) { return 0; } +int main (int argc, char *argv[]) +{ + float (* volatile my_expm1f) (float) = argc ? expm1f : dummy; + /* Test expm1f(-0.0f). + This test fails on AIX 7.2. */ + float y = my_expm1f (minus_zerof); + if (signbitf (minus_zerof) && !signbitf (y)) + return 1; + return 0; +} + ]])], + [gl_cv_func_expm1f_ieee=yes], + [gl_cv_func_expm1f_ieee=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_expm1f_ieee="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_expm1f_ieee="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_expm1f_ieee="guessing yes" ;; + # Guess no on AIX. + aix*) gl_cv_func_expm1f_ieee="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_expm1f_ieee="$gl_cross_guess_normal" ;; + esac + ]) + LIBS="$save_LIBS" + ]) + case "$gl_cv_func_expm1f_ieee" in + *yes) ;; + *) REPLACE_EXPM1F=1 ;; + esac + fi + ]) else HAVE_EXPM1F=0 fi diff --git a/modules/expm1f-ieee b/modules/expm1f-ieee index ed966e0..ffab1d7 100644 --- a/modules/expm1f-ieee +++ b/modules/expm1f-ieee @@ -2,14 +2,15 @@ Description: expm1f() function according to ISO C 99 with IEC 60559. Files: +m4/expm1f-ieee.m4 Depends-on: expm1f fpieee -expm1-ieee [test $HAVE_EXPM1F = 0] +expm1-ieee [test $HAVE_EXPM1F = 0 || test $REPLACE_EXPM1F = 1] configure.ac: -AC_REQUIRE([gl_FUNC_EXPM1F]) +gl_FUNC_EXPM1F_IEEE Makefile.am: