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

◆ operator float()

static System.Half.operator float ( Half value)
inlineexplicitstatic

Definition at line 447 of file Half.cs.

448 {
449 bool flag = IsNegative(value);
450 int num = value.Exponent;
451 uint num2 = value.Significand;
452 switch (num)
453 {
454 case 31:
455 if (num2 != 0)
456 {
457 return CreateSingleNaN(flag, (ulong)num2 << 54);
458 }
459 if (!flag)
460 {
461 return float.PositiveInfinity;
462 }
463 return float.NegativeInfinity;
464 case 0:
465 {
466 if (num2 == 0)
467 {
468 return BitConverter.UInt32BitsToSingle(flag ? 2147483648u : 0u);
469 }
470 (int Exp, uint Sig) tuple = NormSubnormalF16Sig(num2);
471 num = tuple.Exp;
472 num2 = tuple.Sig;
473 num--;
474 break;
475 }
476 }
477 return CreateSingle(flag, (byte)(num + 112), num2 << 13);
478 }
static float CreateSingle(bool sign, byte exp, uint sig)
Definition Half.cs:604
static bool IsNegative(Half value)
Definition Half.cs:175
static float CreateSingleNaN(bool sign, ulong significand)
Definition Half.cs:590
static int Exp
Definition Half.cs:522
static int uint Sig NormSubnormalF16Sig(uint sig)
Definition Half.cs:522

References System.Half.CreateSingle(), System.Half.CreateSingleNaN(), System.Half.Exp, System.Half.IsNegative(), System.Half.NormSubnormalF16Sig(), System.BitConverter.UInt32BitsToSingle(), and System.value.