From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 498C93896817 for ; Sat, 17 Apr 2021 14:02:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 498C93896817 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1lXlWZ-0000vN-RY for cygwin@cygwin.com; Sat, 17 Apr 2021 16:02:15 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: cygwin@cygwin.com From: airplanemath Subject: hypotl(LDBL_MAX, 0.0L) = inf Date: Sat, 17 Apr 2021 10:02:07 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (cygwin) Cancel-Lock: sha1:qGX99vfvw4WsBveCpqG2JtYVDl4= X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_GOODAOL, 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: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Apr 2021 14:02:27 -0000 --=-=-= Content-Type: text/plain Given that hypot(DBL_MAX, 0.0) = DBL_MAX and hypotf(FLT_MAX, 0.0f) = FLT_MAX, I suspect this is a problem in hypotl. Am I missing something? There is a similar difference in cabsl compared to cabs and cabsf, which probably has a similar cause. I attached my test case, which I compile with gcc -Og -O0 test_cabs_hypot.c -o test_cabs_hypot What should I expect here? --=-=-= Content-Type: text/x-csrc Content-Disposition: attachment; filename=test_cabs_hypot.c Content-Description: STC showing behavior of hypotl compared to hypot and hypotf #include #include #include #include int main(void) { _Complex long double test_cabsl = LDBL_MAX + 0.0L * _Complex_I; long double test_hypotl1 = LDBL_MAX, test_hypotl2 = 0.0L; _Complex double test_cabs = DBL_MAX + 0.0L * _Complex_I; double test_hypot1 = DBL_MAX, test_hypot2 = 0.0L; _Complex float test_cabsf = FLT_MAX + 0.0L * _Complex_I; float test_hypotf1 = FLT_MAX, test_hypotf2 = 0.0L; printf("cabsl(%Lg%+Lgi) = %Lg\n", creall(test_cabsl), cimagl(test_cabsl), cabsl(test_cabsl)); printf("hypotl(%Lg, %Lg) = %Lg\n\n", test_hypotl1, test_hypotl2, hypotl(test_hypotl1, test_hypotl2)); printf("cabs(%lg%+lgi) = %lg\n", creal(test_cabs), cimag(test_cabs), cabs(test_cabs)); printf("hypot(%lg, %lg) = %lg\n\n", test_hypot1, test_hypot2, hypot(test_hypot1, test_hypot2)); printf("cabsf(%g%+gi) = %g\n", crealf(test_cabsf), cimagf(test_cabsf), cabsf(test_cabsf)); printf("hypotf(%g, %g) = %g\n\n", test_hypotf1, test_hypotf2, hypotf(test_hypotf1, test_hypotf2)); return 0; } --=-=-=--