From: Robin Hankin <r.hankin_at_soc.soton.ac.uk>

Date: Fri 29 Apr 2005 - 20:36:09 EST

[1] 9.298027e-12

R> stopifnot(abs(f1(x)-f2(x)) < 1e-11)

Date: Fri 29 Apr 2005 - 20:36:09 EST

Hi

R> f1 <- function(x){ (x-1)*(x+1)} R> f2 <- function(x){x^2-1} R> x <- pi+100i R> abs(f1(x) - f2(x))

[1] 9.298027e-12

R> stopifnot(abs(f1(x)-f2(x)) < 1e-11)

My question is, I am unhappy about the numerical value of the tolerance
used in the last line.

The tolerance should be as small as possible, but If I make it too
small, the test may fail

when executed on a machine with different architecture from mine.

How do I deal with this?

-- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlReceived on Fri Apr 29 20:42:48 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:30 EST
*