Machine Epsilon in R
Purpose
Understanding Machine Epsilon
> macheps <- function() {
+ me <- 1
+ while (1 + me > 1) {
+ me <- me/2
+ }
+ return(me)
+ }
> print(2 * macheps())
[1] 2.220446049250313e-16 |
How do you know that you have reached
Machine Epsilon
> print(1 + macheps() > 1) [1] FALSE > print(1 + macheps() * 2 > 1) [1] TRUE |
If you add machine epsilon to 1, it results in 1.
> print(.Machine$double.eps) [1] 2.220446049250313e-16 |
- I am 33 years now and I have been using computers since the last 10 years in one form or the other.I am just learning this machine epsilon now!!! I am enjoying every bit of it and let god allow me to lead this life where I learn each day and die peacefully