Actual Behavior
I get 1.0000000116861e-07 for some reason
Workaround
I tried to do math.floor(0), did not change fix however
Issue Area: Studio Issue Type: Other Impact: High Frequency: Constantly Date First Experienced: 2021-09-07 00:09:00 (+08:00) Date Last Experienced: 2021-09-09 00:09:00 (+08:00)
Thatβs basically 0. Notice the e-07? That means * 10^-7, so your number is actually 0.0000001... in value.
Not really a bug, just how floating numbers work. Although it is slightly strange that the Scale cannot properly model 0 since that can normally be represented perfectly as a floating point, you should expect inaccuracies like this when working with floating point numbers.
For float comparison that is always a good idea yeah. You compare against some epsilon (small number) and if your value is within epsilon of some other value, you assume they are equal.
eps = 0.0001 should be fine for most use cases.
This is not unique to Roblox β everyone that deals with floating point comparisons anywhere in their code base needs to do this.