Steve Kargl wrote:
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
This looks like a nice start. We already have support for real(16) I/O working
so that will be a minor piece.
There exists float-128 routines within the gcc libraries now. We need to figure
out how to adapt/configure and use these.
Steve, will you carry this patch forward to get +,-,*, and / working?
In the meantime, is there someone knowledgeable of the flt-128 library that can
guide us in this area. Maybe between Steve and I we can get it working with
some mentoring on the configuration stuff. (target gcc 4.5)
Jerry