[prev in list] [next in list] [prev in thread] [next in thread]
List: mingw-users
Subject: [Mingw-users] Fwd: Gfortran/GCC 4.6.2 - 4.7.2 significant digit differences.
From: Daniel Carrion <dcarrion87 () gmail ! com>
Date: 2013-01-30 14:24:07
Message-ID: CANzO+OUmTNSfDzQ0kWN8oi5o3epkTjLEqB-yzXDYA7z3CqKvXQ () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
That's the answer I was looking for.
Cheers Keith
---------- Forwarded message ----------
From: Keith Marshall <keithmarshall@users.sourceforge.net>
Date: Thu, Jan 31, 2013 at 1:13 AM
Subject: Re: [Mingw-users] Gfortran/GCC 4.6.2 - 4.7.2 significant digit
differences.
To: MinGW Users List <mingw-users@lists.sourceforge.net>
On 30 January 2013 13:54, Daniel Carrion <dcarrion87@gmail.com> wrote:
> A test fortran program:
>
> program simple
> implicit none
> real*8 test
> test = 0.0277777777777776
> write(*,*) 'test = ',test
> end program simple
> C:\MinGW-GCC462>gfortran.exe --version
> GNU Fortran (GCC) 4.6.2
> ...
> C:\MinGW-GCC462>gfortran -m32 -o test.exe test.f
> C:\MinGW-GCC462>test.exe
> test = 2.77777779847383499E-002 <-- 17 Significant digits.
How do you fit 17 decimal digits of precision into a 53 bit mantissa?
> C:\MinGW-GCC472>gfortran.exe --version
> GNU Fortran (GCC) 4.7.2
> ...
> C:\MinGW-GCC472>gfortran -m32 -o test.exe test.f
> C:\MinGW-GCC472>test
> test = 2.7777777984738350E-002 <-- 16 Significant digits.
Or even 16?
> Why does a GCC 4.7.2 produced binary spit double precision FPs out to 16
> places instead of 17 now by default. How annoying? Any thoughts?
Wrong question. You should be asking "why does gFORTRAN print REAL*8
values to a default precision of 17 digits, when the best that the format
can
support is a maximum of 15 digits"? In both cases, your output agrees, up
to the available accuracy of the data format; the additional 2 digits,
in both of
these cases, are garbage.
--
Regards,
Keith.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list
etiquette may cause your account to be moderated.
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@lists.sourceforge.net?subject=unsubscribe
[Attachment #5 (text/html)]
That's the answer I was looking for.<div><br></div><div>Cheers Keith<br><br><div \
class="gmail_quote">---------- Forwarded message ----------<br>From: <b \
class="gmail_sendername">Keith Marshall</b> <span dir="ltr"><<a \
href="mailto:keithmarshall@users.sourceforge.net">keithmarshall@users.sourceforge.net</a>></span><br>
Date: Thu, Jan 31, 2013 at 1:13 AM<br>Subject: Re: [Mingw-users] Gfortran/GCC 4.6.2 - \
4.7.2 significant digit differences.<br>To: MinGW Users List <<a \
href="mailto:mingw-users@lists.sourceforge.net">mingw-users@lists.sourceforge.net</a>><br>
<br><br><div class="im">On 30 January 2013 13:54, Daniel Carrion <<a \
href="mailto:dcarrion87@gmail.com">dcarrion87@gmail.com</a>> wrote:<br> > A \
test fortran program:<br> ><br>
> program simple<br>
> implicit none<br>
> real*8 test<br>
> test = 0.0277777777777776<br>
> write(*,*) 'test = ',test<br>
> end program simple<br>
<br>
</div><div class="im">> C:\MinGW-GCC462>gfortran.exe --version<br>
> GNU Fortran (GCC) 4.6.2<br>
> ...<br>
> C:\MinGW-GCC462>gfortran -m32 -o test.exe test.f<br>
> C:\MinGW-GCC462>test.exe<br>
> test = 2.77777779847383499E-002 <-- 17 Significant digits.<br>
<br>
</div>How do you fit 17 decimal digits of precision into a 53 bit mantissa?<br>
<div class="im"><br>
> C:\MinGW-GCC472>gfortran.exe --version<br>
> GNU Fortran (GCC) 4.7.2<br>
> ...<br>
> C:\MinGW-GCC472>gfortran -m32 -o test.exe test.f<br>
</div><div class="im">> C:\MinGW-GCC472>test<br>
> test = 2.7777777984738350E-002 <-- 16 Significant digits.<br>
<br>
</div>Or even 16?<br>
<div class="im"><br>
> Why does a GCC 4.7.2 produced binary spit double precision FPs out to 16<br>
> places instead of 17 now by default. How annoying? Any thoughts?<br>
<br>
</div>Wrong question. You should be asking "why does gFORTRAN print REAL*8<br>
values to a default precision of 17 digits, when the best that the format can<br>
support is a maximum of 15 digits"? In both cases, your output agrees, up<br>
to the available accuracy of the data format; the additional 2 digits,<br>
in both of<br>
these cases, are garbage.<br>
<br>
--<br>
Regards,<br>
Keith.<br>
<br>
------------------------------------------------------------------------------<br>
Everyone hates slow websites. So do we.<br>
Make your web apps faster with AppDynamics<br>
Download AppDynamics Lite for free today:<br>
<a href="http://p.sf.net/sfu/appdyn_d2d_jan" \
target="_blank">http://p.sf.net/sfu/appdyn_d2d_jan</a><br> \
_______________________________________________<br> MinGW-users mailing list<br>
<a href="mailto:MinGW-users@lists.sourceforge.net">MinGW-users@lists.sourceforge.net</a><br>
<br>
This list observes the Etiquette found at<br>
<a href="http://www.mingw.org/Mailing_Lists" \
target="_blank">http://www.mingw.org/Mailing_Lists</a>.<br> We ask that you be polite \
and do the same. Disregard for the list etiquette may cause your account to be \
moderated.<br> <br>
_______________________________________________<br>
You may change your MinGW Account Options or unsubscribe at:<br>
<a href="https://lists.sourceforge.net/lists/listinfo/mingw-users" \
target="_blank">https://lists.sourceforge.net/lists/listinfo/mingw-users</a><br>
Also: mailto:<a href="mailto:mingw-users-request@lists.sourceforge.net">mingw-users-request@lists.sourceforge.net</a>?subject=unsubscribe<br>
</div><br></div>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may \
cause your account to be moderated.
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@lists.sourceforge.net?subject=unsubscribe
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic