From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sourceware.org (Postfix) with ESMTPS id 3A5F53858414 for ; Mon, 3 Jan 2022 12:48:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3A5F53858414 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=inria.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:message-id:from:to:subject; bh=+tdbHwPdh/XU25x1fVdAtXgF+D1x558c7OrjPrGk4x8=; b=qmg5OvdvaQGfHQA+K3fpqADVg0gSWz0VHD3n1DDUAmDhffDNs+wvtQdr viwdzl6o/iuWfqSNunmbiynYQ+X2OMaa7st3tDhFUNMeLDiB8Yzznnpxj tfUDX6TuMFVPOnKH1QKpOFEOO1wDsxyaeBWLd6y4lVML01LkRj7puFUBj 4=; IronPort-Data: =?us-ascii?q?A9a23=3AljVptKsrmAWa9yJQ4wlpD24n7efnVEpcMUV32f8?= =?us-ascii?q?akzHdYEJGY0x3zjAYX2iPaP+JYTf2fohybd7iphkD7MCBm9QyGQBu/iBgHilAw?= =?us-ascii?q?SbnLYTAfx2oZ0t+DeWaERk5t51GAjX4wXFdokb0/n9BCZC86yksvU20buCkUrS?= =?us-ascii?q?cY3gqHVYMpBoJ0nqPpcZo2+aEvvDpW2thifuqyyHuEAfNNwxcagr42IrfwP9bh?= =?us-ascii?q?8kejRtD1rAIiV+ni3eF/5UdJMp3yahctBIUSKEMdgKxb76rIL1UYgrkExkR5tO?= =?us-ascii?q?Nyt4Xc2UWRbvbIQXmZnh+AvX4xEgb4HVqlPtiXBYfQR4/ZzGhp9lszJN/tJm1R?= =?us-ascii?q?B0sN6vKsOUbSRhRVS9kVUFD0OabfiTv6ZL7I0ruNiGEL+9VJEU3N4Zd8+JvAWh?= =?us-ascii?q?m7vsFMjsAcRmZiqSx2r3TdwXGrqzPN+H3O4YWpnwmyTbDDP9gT4qrfkkD3vcAt?= =?us-ascii?q?B9YuyyENa+2ixIlVAdS?= IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A+NYuOqqSvqIZQlirPi0sOWUaV5o+eYIsimQD?= =?us-ascii?q?101hICG9E/b4qynApp8mPHPP4gr5O0tPpTnjAsW9qBrnnPZICOIqUotKKTOW2l?= =?us-ascii?q?dAW7sSiLcKrQeMJ8SHzJ8/6U42SchDNOE=3D?= X-IronPort-AV: E=Sophos;i="5.88,257,1635199200"; d="scan'208";a="1474806" Received: from tomate.loria.fr (HELO tomate) ([152.81.10.51]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jan 2022 13:48:07 +0100 Date: Mon, 03 Jan 2022 13:48:05 +0100 Message-Id: From: Paul Zimmermann To: libc-alpha@sourceware.org Subject: correctly rounded mathematical functions X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jan 2022 12:48:08 -0000 The current C working draft [1, p392] has reserved names for correctly rounded functions (cr_exp, cr_log, cr_sin, ...). We propose to add such correctly rounded functions to the GNU libc, for the three IEEE formats (binary32, binary64, binary128) and the "extended double" format (long double on x86_64). These implementations should be correctly rounded for all rounding modes, for example one could do the following to emulate interval arithmetic: fesetround (FE_DOWNWARD); y_lo = cr_exp (x_lo); fesetround (FE_UPWARD); y_hi = cr_exp (x_hi); These functions will not replace the current functions (exp, log, sin, ...). Users who want a fast implementation will call the exp/log/sin/... functions, users who want a correctly rounded function and thus reproducible results (whatever the hardware, compiler or operating system) will use the cr_exp/cr_log/cr_sin/... functions. Our goal is nevertheless to get the best performance possible, and in some cases our implementation outperforms the GNU libc one. We have started to work on two functions (cbrt and acos), for which we provide presumably correctly rounded implementations (up to the knowledge of hard-to-round cases) [2]. [These implementations do replace the current glibc ones, since it was simpler to demonstrate our skills.] Christoph Lauter Jean-Michel Muller Alexei Sibidanov Paul Zimmermann [1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf [2] https://homepages.loria.fr/PZimmermann/CORE-MATH/