From mschwartz at medanalytics.com  Sat Apr  5 18:45:54 2003
From: mschwartz at medanalytics.com (Marc Schwartz)
Date: Sun Apr  6 01:46:22 2003
Subject: [Rd] RH 9 and R 1.7.0 Beta - Errors Resolved
Message-ID: <3E8F6AB2.1080605@medanalytics.com>

Hi all,

As you may recall, earlier this week I posted about errors in make check 
using 1.7.0 Beta under RH 9.

Peter kindly contacted me off list and we have been running some checks 
and possible resolutions the past couple of days.

The errors turned out to be (run individually):

 > !is.nan(c(1.,NA))
[1]  TRUE FALSE

 > is.nan(c   (1.,NaN,NA))
[1] FALSE  TRUE  TRUE

 > is.nan(list(1.,NaN,NA))
[1] FALSE  TRUE FALSE

 > is.nan(as.numeric(NA))
[1] TRUE


After doing some debugging, we identified some problems that ultimately 
led us to the conclusion that there are optimization problems with the 
current gcc in RH 9, which is:

gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

We confirmed this running

./configure CFLAGS="-O0 -g"

and I was able to run make check without errors.

Bottom line, it appears that R_NaReal was not being set properly. It 
would take the value of nan(0x8000000000000) instead of 
nan(0x80000000007a2). This is set in R_NaReal = R_ValueOfNA().

The present version in arithmetic.c is:

  117 static double R_ValueOfNA(void)
  118 {
  119     ieee_double x;
  120     x.word[hw] = 0x7ff00000;
  121     x.word[lw] = 1954;
  122     return x.value;
  123 }

The change is in line 119 to:

volatile ieee_double x;

This has resolved the problem and now results in no errors being 
reported during make check with the default ./configure.

Thus, now using:

R : Copyright 2003, The R Development Core Team
Version 1.7.0 Under development (unstable) (2003-04-05)

I get:

 > !is.nan(c(1.,NA))
[1] TRUE TRUE

 > is.nan(c   (1.,NaN,NA))
[1] FALSE  TRUE FALSE

 > is.nan(list(1.,NaN,NA))
[1] FALSE  TRUE FALSE

 > is.nan(as.numeric(NA))
[1] FALSE


Many thanks to Peter for his patience and support is guiding me through 
this process!  Peter has indicated that he will incorporate this change 
into the base code.

Best regards,

Marc Schwartz


[Rd] RH 9 and R 1.7.0 Beta - Errors Resolved
Marc Schwartz