# Round to the nearest hundredth

Greetings,
I’m working on a tween system to make this ball jiggle. To make the crossfades between multiple tweens work properly without locking up, I have the code set up so that if the tween value is EXACTLY the value, move on to the next tween…

But I ran into an issue…

Here’s my code:

Now, where I have it circled, this code is supposed to change the X value to 0.25, and the Y value to -0.25, and ONLY when the values are 0.25 and -0.25 respectively, move on to the next tween in the list.

When I run it though, the tween completely locks up, and leaves me with this…

These many extra digits cause the number to not be exact, thus, not advancing the code…

I tried round() and trunc(), but they just cancel the tween animation or lock it up…

Using floor() and ceil() just rounds to the nearest WHOLE number, not the decimal I’m looking for…

Using roundTo(), I can round to the nearest tenth, like so…

However, that’s the issue. It rounds to the nearest TENTH decimal place, not the nearest HUNDREDTH. So…

Yeah, not the 0.25 and -0.25 I’m looking for…

So my question is, how do I round to the nearest hundredth decimal place? Or is there another way to prevent this huge 16 digit decimal number? Any help is appreciated, thanks!

EDIT: As a workaround, I’m using “greater or equal” and “less or equal” operators to check for positive and negative numbers respectively. Regardless, I would like to know if rounding to the nearest hundreth is possible.

You could use:

However, you’d be better off giving each tween a unique name, and then checking if it’s finished and stopping the two: