Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Round() [1/4]

static float System.MathF.Round ( float x)
inlinestatic

Definition at line 326 of file MathF.cs.

327 {
328 uint num = BitConverter.SingleToUInt32Bits(x);
329 int num2 = float.ExtractExponentFromBits(num);
330 if (num2 <= 126)
331 {
332 if (num << 1 == 0)
333 {
334 return x;
335 }
336 float x2 = ((num2 == 126 && float.ExtractSignificandFromBits(num) != 0) ? 1f : 0f);
337 return CopySign(x2, x);
338 }
339 if (num2 >= 150)
340 {
341 return x;
342 }
343 uint num3 = (uint)(1 << 150 - num2);
344 uint num4 = num3 - 1;
345 num += num3 >> 1;
346 num = (((num & num4) != 0) ? (num & ~num4) : (num & ~num3));
347 return BitConverter.UInt32BitsToSingle(num);
348 }
static float CopySign(float x, float y)
Definition MathF.cs:174

References System.MathF.CopySign(), System.BitConverter.SingleToUInt32Bits(), and System.BitConverter.UInt32BitsToSingle().

Referenced by System.MathF.IEEERemainder(), System.Single.Round(), System.MathF.Round(), System.MathF.Round(), System.MathF.Round(), System.Single.Round(), System.Half.Round(), System.Half.Round(), System.Single.Round< TInteger >(), System.Single.Round< TInteger >(), System.Half.Round< TInteger >(), and System.Half.Round< TInteger >().