var() is not equal to sd()^2 in R Mathematically, it is evident that var = sd^2 (or var^0.5 = sd), but R seems to answer TRUE for the latter and FALSE for the former.
To my knowledge, both var() and sd() function use n-1 for degree of freedom.
What would be the problem?
data <- c(20, 20, 30, 20, 16, 13, 20)

var(data)^0.5 == sd(data)
var(data) == sd(data)^2


Recommended read for you is

Goldberg, D. (1991). What every computer scientist should know about
floating-point arithmetic. ACM computing surveys (CSUR), 23(1),
5-48.

TL;DR you should never use == (or its equivalent in any other programming language) to compare floating point numbers because they represent numbers only approximately. As in your example, two different computations can lead to floating point representations that are different though close enough given the guarantees given by such representation. What you should do instead is to compare them with some precision, e.g. $|x - y| < \epsilon$, but this is also not a perfect solution and there are better ones. Happily, in most cases, they would be already implemented for you in the programming language you are using (like the mentioned all.equal in R).
