delorie.com/archives/browse.cgi | search |
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:message-id:date:from:mime-version:to:subject | |
:content-type; q=dns; s=default; b=pQA6D74NylfAwBGV2H+xSqb4KPhwl | |
cQKJ8kwJH6Wkk9URM7Rk1/tiFrwyHMeKdj7VvwjSrnq4+fL2VK5+5dvxcjmEwzFw | |
ZgIQhJffnCdU4s20HfxbyOEJz0oc2Kv814frFlvZTDa8bhW5bHKWknRKHh/ysfYp | |
rrq6ICm0ZM0J1A= | |
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:message-id:date:from:mime-version:to:subject | |
:content-type; s=default; bh=r3qDISNRE7ZDQXa9iU/H72V/YeU=; b=iKg | |
c7uIAH1PbUBuk7gJzmU5yL6s5ic7SwQDvjArUlK0UdUn90BAxrUikARlAkEdtg4J | |
y0j5eRDIvufSUlh3hm4v6JGBx+5fPELhP+zq/wm474VWQjgkuAjFRn19/uhaXqy0 | |
Y/zBYwUNqzPxTt/5S/HjiWe9+ee6mQkGWeLQ5IMU= | |
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 |
Message-ID: | <5150B737.3020800@quicknet.nl> |
Date: | Mon, 25 Mar 2013 21:44:39 +0100 |
From: | "a DOT rburgers AT quicknet DOT nl" <a DOT rburgers AT quicknet DOT nl> |
User-Agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | possible issue withC formatted input/output |
X-Ziggo-spambar: | -- |
X-Ziggo-spamscore: | -2.4 |
X-Ziggo-spamreport: | ALL_TRUSTED=-1,BAYES_00=-1.9,CM_META_TB_NOARR=0.5 |
X-Ziggo-Spam-Status: | No |
X-Virus-Found: | No |
--------------020800020209080606070901 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit While preparing gsl packages, one of the check fails. The failure is reproduced by attached .c file, which writes doubles to a file, and reads them back. On linux this is the output (all zero differences in the last column). ivals[0]=1: 0.002518891687657430663 0.002518891687657430663 0 ivals[1]=6: 0.01511335012594458398 0.01511335012594458398 0 ivals[2]=41: 0.1032745591939546598 0.1032745591939546598 0 ivals[3]=45: 0.113350125944584379 0.113350125944584379 0 ivals[4]=46: 0.1158690176322418192 0.1158690176322418192 0 dawn.ad.intra{~/tmp }75: uname -a Linux dawn.ad.intra 2.6.9-89.31.1.ELsmp #1 SMP Mon Oct 4 21:41:59 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux on cygwin (both 32 and 64 bit): $ ./tst ivals[0]=1: 0.002518891687657430663 0.002518891687657430663 0 ivals[1]=6: 0.01511335012594458398 0.01511335012594458224 1.7347e-18 ivals[2]=41: 0.1032745591939546598 0.1032745591939546459 1.3878e-17 ivals[3]=45: 0.113350125944584379 0.1133501259445843651 1.3878e-17 ivals[4]=46: 0.1158690176322418192 0.1158690176322418053 1.3878e-17 the gsl test expects 0 differences and reports a fail. I am not sure whether this is a bug. Maybe something with extended precision registers, when I wild guess. Teun --------------020800020209080606070901 Content-Type: text/plain; charset=windows-1252; name="tst.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tst.c" #include <stdio.h> #include <math.h> #define NVALS 5 int main(void) { int N = 397; int i, ivals[NVALS] = {1, 6, 41, 45, 46}; double xr, x; FILE *f; for (i = 0; i < NVALS; i++) { x = ivals[i]/ ((double) N); f = fopen("test.txt", "w"); fprintf(f, "%.19e\n", x); fclose(f); f = fopen("test.txt", "r"); fscanf(f, "%lg", &xr); fprintf(stderr, "ivals[%d]=%d: %.19g %.19g %.5g\n", i, ivals[i], x, xr, fabs(x-xr)); } fclose(f); } --------------020800020209080606070901 Content-Type: text/plain; charset=us-ascii -- 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 --------------020800020209080606070901--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |