Boolean number comparison, whole numbers only?

This is a general coding question that came up for me as I was personally working on CSD Unit 3, Lesson 14, Step 9.

I was interested in testing the limits of the comparisons. It seems that the operators only look at the whole number portion of values. Is this right or am I missing something? If this is right, how would I write code to get a program to “look” to the right of the decimal point?


I would have to see what tests you ran to do those comparisons. For example, if I make the scales different for the two sprites, the 3rd comparison stays false, even when one is 1.5 and the other is 1.6.

However, I do know that storing numbers in decimal format is tricky in most programming languages (including javascript which is what GameLab is based on) and depending on what you are trying to accomplish, you may need to multiply a number by a power of 10 and then do what you want to do before dividing it again, but it’s hard to explain in abstract terms. If you have a specific example, I’d be happy to look at it and try to better explain myself!

I like how you’re exploring though. That’s how I learn best … just figuring it out…



When I have a minute or two, I’ll work on something specific. Hard to find those minutes in this teaching environment.

I’m with you there …