0

I am sure that I am missing something obvious, but how is

sqrt(144) == 12^2

False

> sqrt(144)
[1] 12
> 12^2
[1] 144

My gut is that it has something to do with precision, but curious as to understand why this takes shape.

Btibert3
  • 38,798
  • 44
  • 129
  • 168

1 Answers1

1

Yeah, it's precision...

options("scipen"=100, "digits"=22)
sqrt(144) * 10000000000000
[1] 1199999999999999899362824

> 12 * 100000000000000000000000
[1] 1199999999999999899362824

On R 3.5.2 on Windows 10

cory
  • 6,529
  • 3
  • 21
  • 41