Helmic said: I think you got those two switched around. The max function should be finding the lower of the two values (can't go above a given value), while the min should be finding the higher (can't go below a given value). That's useful though, that'll at least be useful until something not quite as ugly can come along. I'm not quite sure how the floor function isn't working as expected, I just tested it and got a logical result. It rounds down. That's not the definition of min and max used by... well, any language I've come across. max(x, y) returns x if x > y or y if y > x, and the reverse for min(x, y). Regardless, both options are available to you, so you can use what you need. The floor function rounds towards negative infinity, not towards zero (-1.5 becomes -2, not -1). This isn't what people are usually expecting, since it's the opposite of what the function does for positive numbers (1.5 becomes 1). However, if rounding towards negative infinity is what you want, then it's certainly the appropriate function to use.