# Shorten Decimal Place?

#### SQGTDev

##### Member
I've made a lot of headway with my platform engine that uses a mix of tiles and vectors. It does require a lot of precise calculations though and this is screwing me over.

Basically, when overlapping a vector (which is a line from x1, y1 to x2, y2), the player object basically does some math to get the y position that the point on the vector equal to the player's y position is. Sometimes this does not work, and this is why:

groundSensorYPos: 207.37316895
slopeYTemp: 207.37317943

slopeYTemp is what the player pushes themselves up to, if their groundSensorYPos is greater than or equal to it. But, if it's just slightly above slopeYTemp, it won't register. I checked and the last four decimal places there are consistently the problem. I tried math_set_epsilon(0.01) too, but that doesn't help it any, unless I'm using it wrong. Is there any way I can shorten the decimal place?

#### icuurd12b42

##### TMC Founder
GMC Elder
you can do floor(v*10000)... = 2073731

L

#### Lonewolff

##### Guest
Code:
``result = round(number * 100) / 100;``
This will round to 2 decimal places. 1000 will round to 3 decimal places, etc...

Last edited by a moderator:

#### SQGTDev

##### Member
you can do floor(v*10000)... = 2073731
Code:
``result = round(number * 100) / 100;``
This will round to 2 decimal places. 1000 will round to 3 decimal places, etc...
I wound up trying both, but each time the numbers would still be different.
I was able to fix my problem by coding it so you'd just snap to the vector. But thanks a bunch for your help!