The R Project SVN R

Rev

Rev 56002 | Rev 64895 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 56002 Rev 59321
Line 60... Line 60...
60
##  log() and "pow()" -- POSIX is not specific enough..
60
##  log() and "pow()" -- POSIX is not specific enough..
61
log(0) == -Inf
61
log(0) == -Inf
62
is.nan(log(-1))# TRUE and warning
62
is.nan(log(-1))# TRUE and warning
63
 
63
 
64
rp <- c(1:2,Inf); rn <- rev(- rp)
64
rp <- c(1:2,Inf); rn <- rev(- rp)
65
r <- c(rn, 0, rp)
65
r <- c(rn, 0, rp, NA, NaN)
66
all(r^0 == 1)
66
all(r^0 == 1)
-
 
67
ir <- suppressWarnings(as.integer(r))
-
 
68
all(ir^0  == 1)
-
 
69
all(ir^0L == 1)# not in R <= 2.15.0
-
 
70
all( 1^r  == 1)# not in R 0.64
-
 
71
all(1L^r  == 1)
-
 
72
all(1L^ir == 1)# not in R <= 2.15.0
67
all((rn ^ -3) == -((-rn) ^ -3))
73
all((rn ^ -3) == -((-rn) ^ -3))
68
#
74
#
69
all(c(1.1,2,Inf) ^ Inf == Inf)
75
all(c(1.1,2,Inf) ^ Inf == Inf)
70
all(c(1.1,2,Inf) ^ -Inf == 0)
76
all(c(1.1,2,Inf) ^ -Inf == 0)
71
.9 ^ Inf == 0
77
.9 ^ Inf == 0
72
.9 ^ -Inf == Inf
78
.9 ^ -Inf == Inf
73
## Wasn't ok in 0.64:
79
## Wasn't ok in 0.64:
74
all(1^c(-Inf,Inf) == 1)
-
 
75
all(is.nan(rn ^ .5))# in some C's : (-Inf) ^ .5 gives Inf, instead of NaN
80
all(is.nan(rn ^ .5))# in some C's : (-Inf) ^ .5 gives Inf, instead of NaN
76
 
81
 
77
 
82
 
78
## Real Trig.:
83
## Real Trig.:
79
cos(0) == 1
84
cos(0) == 1