0

I am getting same value logarithm caluclation for different number while doing the same calculation in R or in excel gives the correct result. Is there a specific reason for this behaviour in python?

in R

> log2(124/14)
[1] 3.146841
> log2(702/87)
[1] 3.012384

in python:

>>> np.log2(124/14)
3.0
>>> np.log(124/14)/np.log(2)
3.0
>>> math.log(124/14, 2)
3.0
>>> math.log(702/87, 2)
3.0
Gaurav Jain
  • 275
  • 4
  • 15

0 Answers0