This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: REAL(16) (was Re: [Patch, Fortran] Two minor tweaks for type-bound procedure parsing)
On Mon, Aug 25, 2008 at 03:15:42PM -0700, Steve Kargl wrote:
> On Mon, Aug 25, 2008 at 11:50:16PM +0200, Dominique Dhumieres wrote:
> > > REAL(16) needs to be done in software -- on x86, x86-64 -- as it is not
> > > supported in hardware; if you want to use more than REAL(8) on x86,
> > > x86-64 you can use REAL(10). Or you use a system such as PowerPC which
> > > supports REAL(16) in silicon.
> >
> > As far as I can tell, the ifc implementation is a "real" one where the
> > full 128 bits are used to code the real number. So far i did not have the
> > time to play with it.
> >
> > Now concerning gfortran and since gcc requires gmp and mpfr, how difficult
> > (efficient) would it be to use these libraries to implement REAL(xxx)?
> >
>
> Getting +, -, *, and / working is almost trivial. The hard part is
> getting REAL(16) working in all the fun corners of the standard
> as well as getting IO working. Here's a start where one may need
> to distinguish between hardware FP and software emulation.
>
>
With the patch I sent earlier with an off-by-1 fix in exponents, I get
Kind: 4 8 10 16
Precision: 6 15 18 33
Digits: 24 53 64 113
Radix: 2 2 2 2
Min. exp.: -125 -1021 -16381 -16381
Max. exp.: 128 1024 16384 16384
on x86_64-*-freebsd.
program probe
real(4) a
real(8) b
real(10) c
real(16) d
print '(A,4(I0,x))', ' Kind: ', kind(a), kind(b), kind(c), kind(d)
print '(A,4(I0,x))', 'Precision: ', precision(a), precision(b), &
& precision(c), precision(d)
print '(A,4(I0,x))', ' Digits: ', digits(a), digits(b), digits(c), &
& digits(d)
print '(A,4(I0,x))', ' Radix: ', radix(a), radix(b), radix(c), radix(d)
print '(A,4(I0,x))', 'Min. exp.: ', minexponent(a), minexponent(b), &
& minexponent(c), minexponent(d)
print '(A,4(I0,x))', 'Max. exp.: ', maxexponent(a), maxexponent(b), &
& maxexponent(c), maxexponent(d)
end program probe
--
Steve