Skip to content

Commit 4c203ef

Browse files
author
smeyer
committed
tweak example(complex) for platforms with canonical NaN
git-svn-id: https://svn.r-project.org/R/trunk@88377 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent e40a36d commit 4c203ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/library/base/man/complex.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ abline(h = 0, v = 0, col = "blue", lty = 3)
150150
points(zz.shift, col = "orange")
151151
152152
## as.complex(<some NA>): numbers keep Im = 0:
153-
stopifnot(identical(as.complex(NA_real_), NA_real_ + 0i)) # has always been true
154153
NAs <- vapply(list(NA, NA_integer_, NA_real_, NA_character_, NA_complex_),
155154
as.complex, 0+0i)
156155
stopifnot(is.na(NAs), is.na(Re(NAs))) # has always been true
157156
showC <- function(z) noquote(paste0("(", Re(z), ",", Im(z), ")"))
158157
showC(NAs)
159158
Im(NAs) # [0 0 0 NA NA] \\\\ in R <= 4.3.x was [NA NA 0 NA NA]
160159
stopifnot(Im(NAs)[1:3] == 0)
160+
stopifnot(Im(NA_real_ + 0i) == 0) # has always been true
161161
162162
163163
## The exact result of this *depends* on the platform, compiler, math-library:

0 commit comments

Comments
 (0)