Re: R-alpha: seq

Kurt Hornik (
Wed, 4 Dec 1996 17:04:22 +0100

Date: Wed, 4 Dec 1996 17:04:22 +0100
Message-Id: <>
From: Kurt Hornik <>
To: Douglas Bates <>
Subject: Re: R-alpha: seq
In-Reply-To: <>

>>>>> On Wed, 4 Dec 1996 07:44:42 -0600 (CST),
>>>>> Douglas Bates <> said:

>>>>> "Peter" == Peter Dalgaard BSA <> 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.

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: