* possible issue withC formatted input/output
@ 2013-03-25 20:44 a.rburgers
2013-03-26 8:32 ` Corinna Vinschen
0 siblings, 1 reply; 2+ messages in thread
From: a.rburgers @ 2013-03-25 20:44 UTC (permalink / raw)
To: cygwin
[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]
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
[-- Attachment #2: tst.c --]
[-- Type: text/plain, Size: 462 bytes --]
#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);
}
[-- Attachment #3: Type: text/plain, Size: 218 bytes --]
--
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: possible issue withC formatted input/output
2013-03-25 20:44 possible issue withC formatted input/output a.rburgers
@ 2013-03-26 8:32 ` Corinna Vinschen
0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2013-03-26 8:32 UTC (permalink / raw)
To: cygwin
On Mar 25 21:44, a.rburgers@quicknet.nl wrote:
> 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.
Thanks for the testcase. This problem has been introduced in newlib a
while back and made it into 1.7.17, unfortunately. However, it's fixed
in the latest snapshots from http://cygwin.com/snapshots/ and will be in
1.7.18.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
--
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-26 8:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-25 20:44 possible issue withC formatted input/output a.rburgers
2013-03-26 8:32 ` Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).