Check Yourself

Why do computers use binary representations?

 View/hide answer

It's easy to build hardware with two states, on and off.

 

 

Why shouldn't we test for equality with floats?

 View/hide answer

Because computers use binary, floats are actually very close approximations of the actual values. Testing for equality can result in an unexpected error, so it's better to determine whether two numbers are close enough for our purposes rather than precisely equal.

 

 

When debugging, how can you ensure that the values in your program are the ones you think they are?

 View/hide answer

Use print statements.