From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sourceware.org (Postfix) with ESMTPS id 54B54385800E for ; Thu, 14 Jan 2021 07:13:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 54B54385800E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=inria.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Paul.Zimmermann@inria.fr X-IronPort-AV: E=Sophos;i="5.79,346,1602540000"; d="scan'208";a="486981692" Received: from tomate.loria.fr (HELO tomate) ([152.81.10.51]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2021 08:13:23 +0100 Date: Thu, 14 Jan 2021 08:13:23 +0100 Message-Id: From: Paul Zimmermann To: newlib@sourceware.org Subject: hypotl X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2021 07:13:38 -0000 Hi, it seems newlib only provides sqrtl and hypotl for double extended precision (long double on x86_64). Please can you confirm? However the hypotl function seems buggy for large inputs, where it returns +Inf: $ cat test_hypot.c #include #include #ifdef NEWLIB /* without this, newlib says: undefined reference to `__errno' */ int errno; int* __errno () { return &errno; } #endif int main() { long double x = 0xf.ffffffffffffffep+8188l; long double y = (long double) 0; long double z = hypotl (x, y); printf ("x=%La y=%La z=%La\n", x, y, z); x = 0xf.fffffffffffffffp+8188l; z = hypotl (x, y); printf ("x=%La y=%La z=%La\n", x, y, z); x = 0x1p+8192l; z = hypotl (x, y); printf ("x=%La y=%La z=%La\n", x, y, z); return 0; } $ gcc -DNEWLIB test_hypot.c /localdisk/zimmerma/newlib-4.1.0/libm.a -lm $ ./a.out x=0xf.ffffffffffffffep+8188 y=0x0p+0 z=0xf.ffffffffffffffep+8188 x=0xf.fffffffffffffffp+8188 y=0x0p+0 z=-0xcp+16380 x=0x8p+8189 y=0x0p+0 z=inf Note also the case x=0xf.fffffffffffffffp+8188 y=0x0p+0 where it returns an ill-formed number. Best regards, Paul