From ripley at stats.ox.ac.uk  Mon Nov 21 08:49:39 2011
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 21 Nov 2011 07:49:39 +0000 (GMT)
Subject: [Rd] Fortran runtime error with package cts on CRAN/Mac
In-Reply-To: <4EC96C87020000DD00022CC4@gwmail3.harthosp.org>
References: <4EC96C87020000DD00022CC4@gwmail3.harthosp.org>
Message-ID: <alpine.LFD.2.02.1111210741490.14975@gannet.stats.ox.ac.uk>

Well, as Writing R Extensions says, packages should do no Fortran I/O 
at all.  So please pass the binary value to your code from R.

You cannot expect to write out extreme values without some 
representation error, and adjacent values cannot be read in again.

In any case, these values are essentially the same for all R 
platforms, being mandated by IEC60559.

On Sun, 20 Nov 2011, Zhu Wang wrote:

> Hello,
>
> As the author of package cts, I hope somebody on this list can kindly help (perhaps off-list)
> to resolve the build/check issue with package cts for Mac. The error occurred on Mac machines only:
> http://cran.r-project.org/web/checks/check_results_cts.html.
>
> Here is the error message:
>
> At line 10 of file machine.f
> Fortran runtime error: Range error during floating point read
>
> The source file machine.f is to read machine dependent parameters stored in machine.txt, which was saved from R function .Machine. For convenience, the source file machine.f is listed below, along with machine.txt from a non Mac system (the last line NA was added for a test version of cts).
>
> CCC READ MACHINE INFORMATION SAVED WITH R CODE
>      SUBROUTINE MACHINE(EPS, BASE, T, EMIN, RMIN)
>      DOUBLE PRECISION EPS, RMIN
>      INTEGER BASE, T, EMIN
>      OPEN(UNIT=3,FILE='machine.txt',STATUS='OLD')
>      READ(3,*)EPS
>      READ(3,*)BASE
>      READ(3,*)T
>      READ(3,*)EMIN
>      READ(3,*)RMIN
>      CLOSE(UNIT=3)
>      RETURN
>      END
>
> machine.txt:
>
> 1.11022302462516e-16
> 2
> 53
> -1022
> 2.2250738585072e-308
> NA
>
> Another question is whether there is a way to submit a test to just 
> one platform. I know this can be done for Windows, but I'm not sure 
> for Mac.

What does 'submit a test mean'?  Any test you write can check the 
value of Sys.info()["sysname"]: it is "Darwin" on Mac OS X.
Or R.version$platform, which will be something like 
i386-apple-darwin9.8.0.

>
> Thanks in advance.
>
> Zhu Wang
>
> Department of Research
> Connecticut Children's Medical Center
> Hartford, CT 06106
>
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Fortran runtime error with package cts on CRAN/Mac
Prof Brian Ripley