Re: R-alpha: seq

Kurt Hornik (Kurt.Hornik@ci.tuwien.ac.at)
Wed, 4 Dec 1996 17:04:22 +0100


Date: Wed, 4 Dec 1996 17:04:22 +0100
Message-Id: <199612041604.RAA25052@aragorn.ci.tuwien.ac.at>
From: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>
To: Douglas Bates <bates@stat.wisc.edu>
Subject: Re: R-alpha: seq
In-Reply-To: <m0vVHcw-000hhyC@franz.stat.wisc.edu>
 <199612040917.KAA21871@aragorn.ci.tuwien.ac.at>

>>>>> On Wed, 4 Dec 1996 07:44:42 -0600 (CST),
>>>>> Douglas Bates <bates@stat.wisc.edu> said:

>>>>> "Peter" == Peter Dalgaard BSA <pd@kubism.ku.dk> writes:
Peter> Well, that is obviously buggy and we need to find a fix for
Peter> it before something will actually rely on .Machine$whatever.

Peter> However, -ffloat-store will (a) reduce precision in
Peter> computations and (b) remove all efficiency gained by keeping
Peter> variables in FPU registers. So I think that your
Peter> recommendation is throwing the baby out with the bathing
Peter> water.

> I agree.  The only times that -ffloat-store is needed are when you are
> doing naughty things like making equality comparisons on floating
> point values or in the routine that computes the machine arithmetic
> characteristics (is it called machar in the R sources - I haven't
> looked.)

> I don't think it is giving away big secrets to say that the way machar
> is handled in the compilation of S is to compile machar separately
> using -ffloat-store and store the results as a printable
> representation of the numbers.  These are used to create a header file
> and a file of S code that defines .Machine.  After the rest of S has
> been compiled the file without -ffloat-store the S source file is read
> into S in the appropriate library.

> An alterative is to use the "volatile" keyword in the code for machar.
> Values declared as volatile are supposed to be written to memory and
> read back before they are used.  I'm not sure if this keyword only
> exists in gcc or if it is part of ANSI C.

> Perhaps the simplest alternative is to skip the calculation altogether
> and see if the <values.h> include file is defined.  If so the important
> characteristics of the floating point arithmetic are already
> available.  Perhaps this could be checked by the configure script.  If
> values.h is available then trust the library writers to have gotten it
> right and use those values.  Otherwise run machar.

I agree, too.  Perhaps my wording was confusing ... what I meant to say
is that if someone wants to compile 0.14 under Linux/Elf and use the new
.Machine object etc, either drop -O or add -ffloat-store (or don't and
report any problems :-)).

`volatile' would be fine with gcc.  But it should really be the right
thing to try using <values.h> and/or <float.h> first ... not sure how
standardized these files are, though.

-k
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-