Mail Archives: cygwin/2011/03/07/05:39:47
X-Recipient: | archive-cygwin AT delorie DOT com
|
X-SWARE-Spam-Status: | No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL
|
X-Spam-Check-By: | sourceware.org
|
MIME-Version: | 1.0
|
In-Reply-To: | <AANLkTinwzNz4X8btcrjVm+3Lxp_30iqr4FkuB1U=rrr6@mail.gmail.com>
|
References: | <AANLkTinwzNz4X8btcrjVm+3Lxp_30iqr4FkuB1U=rrr6 AT mail DOT gmail DOT com>
|
Date: | Mon, 7 Mar 2011 11:39:36 +0100
|
Message-ID: | <AANLkTikjRzFQGaW=hHJt9JDNJYH7y9rgRDNTs=TAPsas@mail.gmail.com>
|
Subject: | Re: 1.7.8: Fortran I/O rounding inaccuracy
|
From: | marco atzeri <marco DOT atzeri AT gmail DOT com>
|
To: | cygwin AT cygwin DOT com
|
X-IsSubscribed: | yes
|
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm
|
List-Id: | <cygwin.cygwin.com>
|
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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
|
On Mon, Mar 7, 2011 at 10:39 AM, Thomas Henlich wrote:
> Hi,
>
> I found the following bug in cygwin 1.7.8 on Windows XP:
>
> Fortran I/O rounding truncates the result after a certain number of
> digits. The following program:
> =3D=3D=3D
> write(*, '(f35.32)') 0.14285714285714285d0
> end
> =3D=3D=3D
> gives this output:
> =A00.14285714285714284921269000000000
> The expected output is:
> =A00.14285714285714284921269268124888
>
> This is in violation of the Fortran 2008 standard which demands:
I doubt our compiler is Fortran 2008 compliant, as at maximum it will
be Fortran 2003
http://gcc.gnu.org/gcc-4.3/changes.html
>
> =3D=3D=3D
> 10.7.2.3.7 I/O rounding mode
>
> 2. In what follows, the term "decimal value" means the exact decimal numb=
er as
> given by the character string, while the term "internal value" means the =
number
> actually stored in the processor. =A0For example, in dealing with the dec=
imal
> constant 0.1, the decimal value is the mathematical quantity 1/10, which =
has no
> exact representation in binary form. =A0Formatted output of real data inv=
olves
> conversion from an internal value to a decimal value; formatted input inv=
olves
> conversion from a decimal value to an internal value.
>
> 3. =A0When the I/O rounding mode is UP, the value resulting from conversi=
on shall
> be the smallest representable value that is greater than or equal to the
> original value. When the I/O rounding mode is DOWN, the value resulting
> from conversion shall be the largest representable value that is less tha=
n or
> equal to the original value. ...
> =3D=3D=3D
>
> Applied to the example this means, 0.14285714285714284921269268124888
> is the largest representable
> (with 32 decimal digits) value that is less than the original value (bina=
ry
> 1.001001001001001001001001001001001001001001001001001 * 2^-3 =3D decimal
> 0.1428571428571428492126926812488818...), but
> 0.14285714285714284921269000000000 is NOT.
>
> The problem seems limited to the Fortran language, because the C call
> printf("%35.32f\n", 0.14285714285714285) prints the expected result:
> =A00.14285714285714284921269268124888
>
> --
> Problem reports: =A0 =A0 =A0 http://cygwin.com/problems.html
> FAQ: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 http://cygwin.com/faq/
> Documentation: =A0 =A0 =A0 =A0 http://cygwin.com/docs.html
> Unsubscribe info: =A0 =A0 =A0http://cygwin.com/ml/#unsubscribe-simple
>
Have you tested gfortran 4.3 on other platform ?
Marco
--
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 -