[RFC] Full float128, third iteration
Jerry DeLisle
jvdelisle@frontier.com
Sun Sep 12 11:44:00 GMT 2010
On 09/09/2010 01:58 PM, FX wrote:
>
> Things that need to be tested:
> * I/O, again and again and again :)
The following program now works correctly. I have also tested some basic
namelist I/O with real 16 variables and all looks OK. I am seeing some possible
issues with the F03 rounding modes. Still testing, may just be from having
extra precision.
program huge_real16_formatted
integer, parameter :: k = 16
real(kind=k) :: a,b(2), c
character(len=180) :: tmp
! Test real(k) scalar and array formatted IO with big value
b(:) = huge (1.0_k)/2
print *, 'real(16) big value: ', b(1)
write (tmp, *) b
read (tmp, *) a, c
print *, 'same value read again: ', a
print *, 'difference: looks OK now ', a-b(1)
! Test with really big value
b(:) = huge (1.0_k)
print *, 'huge value: ', b(1)
write (tmp, *) b
read (tmp, *) a, c
print *, "tmp=", tmp
print *, "These all work now!"
print *, a
print *, b(1)
print *, b(2)
print *, c
if (a /= b(1)) call abort ()
if (c /= b(2)) call abort ()
end program huge_real16_formatted
$ ./a.out
real(16) big value: 5.94865747678615882542879663314003508E+4931
same value read again: 5.94865747678615882542879663314003508E+4931
difference: looks OK now 0.0000000000000000000000000000000000
huge value: 1.18973149535723176508575932662800702E+4932
tmp= 1.18973149535723176508575932662800702E+4932
1.18973149535723176508575932662800702E+4932
These all work now!
1.18973149535723176508575932662800702E+4932
1.18973149535723176508575932662800702E+4932
1.18973149535723176508575932662800702E+4932
1.18973149535723176508575932662800702E+4932
jerry@eeepc:~/gcc/prs/quad$ gfc quad2.f90
jerry@eeepc:~/gcc/prs/quad$ ./a.out
real(16) big value: 5.94865747678615882542879663314003508E+4931
same value read again: 5.94865747678615882542879663314003508E+4931
difference: looks OK now 0.0000000000000000000000000000000000
huge value: 1.18973149535723176508575932662800702E+4932
tmp= 1.18973149535723176508575932662800702E+4932
1.18973149535723176508575932662800702E+4932
These all work now!
1.18973149535723176508575932662800702E+4932
1.18973149535723176508575932662800702E+4932
1.18973149535723176508575932662800702E+4932
1.18973149535723176508575932662800702E+4932
More information about the Fortran
mailing list