Re: R-alpha: seq

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


Message-Id: <m0vVHcw-000hhyC@franz.stat.wisc.edu>
Date: Wed, 4 Dec 1996 07:44:42 -0600 (CST)
From: Douglas Bates <bates@stat.wisc.edu>
To: r-testers@stat.math.ethz.ch (r-testers)
Subject: Re: R-alpha: seq
In-Reply-To: <x2wwuy7agb.fsf@bush.kubism.ku.dk>
 <199612040917.KAA21871@aragorn.ci.tuwien.ac.at>

>>>>> "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.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-