Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Infinity/R/infinity.r
Normal file
11
Task/Infinity/R/infinity.r
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Inf #positive infinity
|
||||
-Inf #negative infinity
|
||||
.Machine$double.xmax # largest finite floating-point number
|
||||
is.finite # function to test to see if a number is finite
|
||||
|
||||
# function that returns the input if it is finite, otherwise returns (plus or minus) the largest finite floating-point number
|
||||
forcefinite <- function(x) ifelse(is.finite(x), x, sign(x)*.Machine$double.xmax)
|
||||
|
||||
forcefinite(c(1, -1, 0, .Machine$double.xmax, -.Machine$double.xmax, Inf, -Inf))
|
||||
# [1] 1.000000e+00 -1.000000e+00 0.000000e+00 1.797693e+308
|
||||
# [5] -1.797693e+308 1.797693e+308 -1.797693e+308
|
||||
Loading…
Add table
Add a link
Reference in a new issue