Are you familiar with the difference between floating point and fixed point number? SC2 doesn't use FPU, and the fixed type is the way around it, which comes at the cost of low precision.
Fixed type consists of 32 bits:
--------------------------------------------------- -- 1 sign | 19 integer part | 12 fractional part -- ---------------------------------------------------
I won't tell you how the internal implementation of this function looks like, as I don't really know myself. But there are certainly couple of methods it could've been done.
SquareRoot(10.5) ==> 3.2402
The result was trimmed to 4 decimal places, but in reality it is exactly equal to .240234375 (result of 984/4096). The next possible value would be .240478515625 (result of 985/4096). What is above the expected result of sqrt, thus it returned the closest possible that was equal - rounded down.
The fractional part of 10.5 is represented as 2048/4096. Now if you iterate over next possible values:
Are you familiar with the difference between floating point and fixed point number?
SC2 doesn't use FPU, and the fixed type is the way around it, which comes at the cost of low precision.
Fixed type consists of 32 bits:
I won't tell you how the internal implementation of this function looks like, as I don't really know myself. But there are certainly couple of methods it could've been done.
The result was trimmed to 4 decimal places, but in reality it is exactly equal to .240234375 (result of 984/4096).
The next possible value would be .240478515625 (result of 985/4096). What is above the expected result of sqrt, thus it returned the closest possible that was equal - rounded down.
The fractional part of 10.5 is represented as 2048/4096. Now if you iterate over next possible values:
So yeah, that's as far as explanation goes.
btw. You can increase the verbosity of FixedToText when it comes to decimal places - it just defaults to 4 at most.
Previously known as: SomeoneTookMyNameTT