0

When I enter float(1)/(2^7) in the Python console it outputs 0.2. But it is actually 0.0078125.

Could anyone please tell what I am doing wrong?

Omar Shehab
  • 1,004
  • 3
  • 14
  • 26

1 Answers1

3

You probably want to use the ** operator instead of ^. ** is the power operator in python, ^ is the Binary XOR operator.

float(1)/(2**7) yields the correct 0.0078125.

bcongdon
  • 137
  • 3
  • 9