I am trying to find when two numbers of class brob are equal, but I guess this does not work because of the precision stored in these numbers that is not shown. For example, I have two numbers:
a= 634.7984
b= 641.71
library(Brobdingnag)
a_brob = as.brob(exp(1))^a = +exp(634.8)
b_brob = as.brob(exp(1))^b*0.001 = +exp(634.8)
I would like to output TRUE in this condition:
a_brob==b_brob
>[1] FALSE
But I get FALSE.I also tried using 'numeric' or double or rounding them, but nothign works. Can you please help?
Thank you
I think you get FALSE because your brobs aren't equals, event they are printed by the same number.
Use dput
to see this :
> library(Brobdingnag)
> (a_brob <- as.brob(exp(1))^a )
[1] +exp(634.8)
> (b_brob <- as.brob(exp(1))^b*0.001)
[1] +exp(634.8)
> (dput(a_brob))
new("brob"
, x = 634.7984
, positive = TRUE
)
NULL
> (dput(b_brob))
new("brob"
, x = 634.802244721018
, positive = TRUE
)
NULL
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.