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

◆ Dragon4Half()

static void System.Number.Dragon4Half ( Half value,
int cutoffNumber,
bool isSignificantDigits,
ref NumberBuffer number )
inlinestatic

Definition at line 1289 of file Number.cs.

1290 {
1291 Half half = (Half.IsNegative(value) ? Half.Negate(value) : value);
1292 int exponent;
1293 ushort num = ExtractFractionAndBiasedExponent(value, out exponent);
1294 bool hasUnequalMargins = false;
1295 uint mantissaHighBitIdx;
1296 if (num >> 10 != 0)
1297 {
1298 mantissaHighBitIdx = 10u;
1299 hasUnequalMargins = num == 1024;
1300 }
1301 else
1302 {
1303 mantissaHighBitIdx = (uint)BitOperations.Log2(num);
1304 }
1305 int decimalExponent;
1306 int num2 = (int)Dragon4(num, exponent, mantissaHighBitIdx, hasUnequalMargins, cutoffNumber, isSignificantDigits, number.Digits, out decimalExponent);
1307 number.Scale = decimalExponent + 1;
1308 number.Digits[num2] = 0;
1309 number.DigitsCount = num2;
1310 }
static ulong ExtractFractionAndBiasedExponent(double value, out int exponent)
Definition Number.cs:3510
static unsafe uint Dragon4(ulong mantissa, int exponent, uint mantissaHighBitIdx, bool hasUnequalMargins, int cutoffNumber, bool isSignificantDigits, Span< byte > buffer, out int decimalExponent)
Definition Number.cs:1335
static int Log2(uint value)

References System.Number.Dragon4(), System.Number.ExtractFractionAndBiasedExponent(), System.Half.IsNegative(), System.Numerics.BitOperations.Log2(), System.Half.Negate(), and System.value.

Referenced by System.Number.FormatHalf().