Strange behavior of R
问题 So, I have the following code in R: y a <- -0.1 test <- (1/((y+as.numeric(!y))*(a-1))) test test^a -0.9090909^a Giving me the output: > y [1] 0.00000000 0.06024096 0.00000000 0.01098901 0.00000000 0.00000000 [7] 0.01829268 0.00000000 0.06976744 0.00000000 0.04380665 0.01351351 [13] 0.00000000 0.00000000 0.00000000 0.00000000 0.00310559 0.00000000 [19] 0.00000000 0.00000000 0.09957447 0.00000000 0.03738318 0.00000000 > a <- -0.1 > test <- (1/((y+as.numeric(!y))*(a-1))) > test [1] -0.9090909