I think it can't be helped because it's an unreasonable number, but
Thus, even if the values are the same among rational numbers, they are not considered equal.What kind of explanation is possible?By the way,
Thus, even if the values are the same among integers, they may not be considered equal.Please let me know your generalization.r
This is an explanation from R's official FAQ.
The only numbers that can be presented exactly in R's numeric type
are integers and effects where denominator is a power of 2. Other
numbers have to be round to (typically) 53 binary digits acuity.
As a result, two floating point numbers will not be relatable be equal
unless they have been compiled by the same algorithm, and not always
In R, only integers and fractions whose denominators are で of 2 can be accurately represented.Other numbers are rounded (typically) to 53 binary accuracy.
As a result, the two floating-point numbers will not and in some cases even be guaranteed to be equal unless calculated by the same algorithm.
R number is a floating point, so you should be careful the same as the floating point comparison in a typical programming language.
As shown in , the comparison is FALSE because it is actually a different number.
A common method is to determine the tolerance in advance and include it.
In the following question post, there was also a suggestion that you prepare your own comparison functions that take into account these errors.
© 2022 OneMinuteCode. All rights reserved.