delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/12/05/13:24:01

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=qv0
4AgBwJMIW6o2bnB4Nhu2h6oWdCRW+AqYAB1kzYG+K9B8vW60nz+T/EnS89aDlUqD
nZ52ScP4G06TECs5zzKnFWSss9aZt9CujvHB2mKCYbNsJkLYKYTLDeMFkNWa8nuP
MiWh0Oq7Fi+WvI81CNBzdzLOu3YdmtIMqSG/KnpQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; s=default; bh=Ynt+68AOf
5HAEjNszms2J7xaGc8=; b=cIp8925iZnGbQNcciDTzNDCzmr0/AXE+0A7tJpj3+
hENzhrlB/U0k0tJ0ZphxvB1h+9sLVkaj6Keai7rJnx4fLEyzH0K5mGo0nMiJCOcF
p3C5Fh/FW3wMryoa/vspeAk3sRoJwKMxNioex4HhVX9Qf0r0ouZtky/Luk0bgorb
zs=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=poland, Poland, H*r:182, H*F:D*eu
X-HELO: turtleware.eu
User-agent: mu4e 0.9.19; emacs 26.3
From: Daniel =?utf-8?Q?Kochma=C5=84ski?= <daniel AT turtleware DOT eu>
To: "cygwin\@cygwin.com" <cygwin AT cygwin DOT com>
Subject: [gcc libm][coshl, acoshl, cacoshf, cacosh wrong results]
Date: Thu, 05 Dec 2019 19:24:47 +0100
Message-ID: <855ziutyts.fsf@turtleware.eu>
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id xB5INhmw032669

Hey,

while testing ECL on Cygwin I've encountered a few issues with how the
functions coshl and acoshl treat infinities (long double
functions). Results are invalid and that does not happen on Linux.

Please consider the following code:

-- cut --
#include <math.h>
#include <stdio.h>
#include <complex.h>

int main () {
  long double num1 = -INFINITY;
  double      num2 = -INFINITY;

  printf("negative infinities\n");
  printf("long double: %Lf, double: %f\n", num1, num2);

  num1 = coshl(num1);
  num2 = cosh (num2);

  printf("map cosh (should flip infinities to positive)\n");
  printf("long double: %Lf, double: %f\n", num1, num2);

  num1 = INFINITY;
  num2 = INFINITY;

  printf("positive infinities\n");
  printf("long double: %Lf, double: %f\n", num1, num2);

  num1 = acoshl(num1);
  num2 = acosh (num2);

  printf("map acosh (should remain positive infinities)\n");
  printf("long double: %Lf, double: %f\n", num1, num2);

  return 0;
}
-- cut --

coshl returns negative infinity (incorrectly) and acoshl returns a nan.

Moreover cacoshf and cacosh for infinities return nan, and a surprise,
long double variant works fine. I didn't test for other values than
infinities.

GCC 7.4.0
Cygwin installed from Setup version 2.897 (64 bit)
Platform: Windows 7 Professional (x86-64)

Best regards,
Daniel

--
Daniel Kochmański ;; aka jackdaniel | Przemyśl, Poland
TurtleWare - Daniel Kochmański      | www.turtleware.eu

"Be the change that you wish to see in the world." - Mahatma Gandhi

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019