Perhaps I'm missing a simpler method, but I've tried using a while() loop like this:
while (floor(val) != val) {
val *= 10;
}But precision errors completely messed that up. My test of 15.15 ended up being changed to 15.14999999999999999999999999999, which caused the loop to crash with an unexpected error after 20 iterations.
Is there another way to do this? Or else a way around the precision issues? And yes, I do have a reason for not wanting to convert to a string, so please don't suggest that.
-IMP











