Decimal place is hurting my head, I did try hacky way tonumber(tostring(0.2)), and math.floor(2*10)/10, pls help

`math.floor(0.2000003*10)/10`

should work though, did you have any issues with it?

The same issue with accuracy for floating point numbers, just save the string 0.2 instead directly.

`math.floor`

should work for the purpose too since it’ll return the largest integer lesser than or equal to the number.

Yeah, I did this, I write into the datastore directly with tostring(0.2), but I wish there is someway to make it look better

nope, try it, doesnt work, I tried alot of hacky way

I don’t mean actually storing `math.floor(0.2000003*10)/10`

into the datastore, I mean storing `0.2`

into the datastore and then when retrieving the value, rounding it. If you round it and store it into the datastore, you’ll still get the floating point error.

If we are looking for lossy accuracy in our points (anything in the hundredths) we convert them to an integer. I.e 0.2 → 20.

Reason being 20 takes up less room than “0.2” or “20”.

If you are storing precise decimals, i.e 0.38367362, you can still convert it to an integer (38367362) and then convert that integer to base64 (CSXCC)

It is worth noting that converting small numbers such as 0.18 to the base 64 format (0.18 → 18 → S) is not recommended because 18 in the datastore as a number takes up less space than “S”

I took ur advice

but instead of 20, I did 2, My datastore is really limited, cause I am saving CFrame Components of alot of stuff

Are you sure you should be saving the CFrame components of every object? You should probably be storing the orientation and position instead as CFrame components take up more space I think.

Hope this helped