R-alpha: Probably <float.h> instead of <values.h> for an automatic .Machine

Ross Ihaka (ihaka@stat.auckland.ac.nz)
Thu, 5 Dec 1996 11:11:58 +1300 (NZDT)


From: Ross Ihaka <ihaka@stat.auckland.ac.nz>
Date: Thu, 5 Dec 1996 11:11:58 +1300 (NZDT)
Message-Id: <199612042211.LAA20451@stat13.stat.auckland.ac.nz>
To: R-testers <r-testers@stat.math.ethz.ch>
Subject: R-alpha: Probably <float.h> instead of <values.h> for an automatic .Machine
In-Reply-To: <m0vVMQu-000hhyC@franz.stat.wisc.edu>

Douglas Bates writes:
 > I checked with some ANSI gurus here are work and we can't see that
 > either <values.h> or <float.h> are required by the ANSI standard.
 > However, <float.h> is required by the POSIX standard and it appears to
 > define pretty well everything that is needed in the .Machine object
 > except (naturally) for the maximum integer and other values based on
 > the integer representation.

Hmmm.  Well, <values.h> and <float.h> are already required by R.  To
quote src/include/Mathlib.h.
	#include <float.h>
Nobody has complained yet...

I agree that it would be silly to miss out on any optimizations which
the compiler comes up with.  I kinda like the idea of using a bit of
run-time code to determine the machine parameters.  (I believe we had
this discussion a couple of weeks ago and that that was the
consensus).  The present values are determined by the "machar"
subroutine from Netlib.  I did in fact do some testing of whether
optimization of the f2c-ed code produced problems, but that may have
been with an older version of gcc.

Would anyone like to see if it is possible to tweak
	src/applc/machar.c
in such a way as to eliminate the problems?


I think the solution to the seq problem is just to add a small slop
factor before rounding.  My empirical experiments with Splus indicate
that they use a value of about 1.e-7.  I would propose using
FLT_EPSILON from <float.h>.  Does this seem reasonable?
	Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-