This loop is going over all the values of i
in range(92:1000)
and whichever value of i
is holding the condition true it is breaking the loop by setting that value of i
in c
and when i am trying to run this code block in R language it is giving me c=1000.
> c=0
> for (i in range(92:1000)){
+ if(dpois(i,94.32)<=dpois(5,94.32))
+ {c=i;
+ break;
+ }
+ }
> c
[1] 1000
But what i expected it should give value of c=235 as at i=235 as:--
> dpois(235,94.32)
[1] 2.201473e-34
> dpois(5,94.32)
[1] 6.779258e-34
> dpois(235,94.32)<=dpois(5,94.32)
[1] TRUE
And it should break whenever the condition is true for the first time.
Where am i going wrong ?