FloatParse
static class FloatParseimport FloatParse from Wax;Low-level decimal-to-IEEE parser and its arithmetic helpers. ParseFloat/ParseDouble return bits, outcome, and consumed byte position without throwing. Prefer float.Parse/double.Parse or ParseDetailed for normal application code. Other helpers operate on parser-specific intermediate representations and require the matching kind selector and table bounds.
Inherits from object. Follow these links for inherited members.
Members
Umul128method
public static fn Umul128(uint64 a, uint64 b) : FpU128Returns the complete unsigned 64-by-64-bit product as low/high halves.
CountLeadingZeros64method
public static fn CountLeadingZeros64(uint64 x) : uint32Counts leading zero bits; zero returns 64.
B10ToB2method
public static fn B10ToB2(int32 q) : int32Computes the parser's fixed-point binary exponent estimate from a decimal exponent. Use only within the parser's bounded decimal exponent range.
kKindFloatconst
const int32 kKindFloat = 0Selects binary32 arithmetic in the low-level conversion helpers.
kKindDoubleconst
const int32 kKindDouble = 1Selects binary64 arithmetic in the low-level conversion helpers.
kOutcomeOkconst
const int32 kOutcomeOk = 0Successful parsing or conversion (zero).
kOutcomeInvalidInputconst
const int32 kOutcomeInvalidInput = 1Invalid numeric input (one).
kOutcomeOutOfRangeconst
const int32 kOutcomeOutOfRange = 2A converted value outside the accepted representable range (two).
ComputeProductApproximationmethod
public static fn ComputeProductApproximation(int64 q, uint64 w, int32 vk) : FpU128Computes a guarded cached-power product for decimal conversion. q must lie in the cached double power-of-ten range; vk selects float or double precision.
ComputeFloatmethod
public static fn ComputeFloat(int64 q, uint64 w, int32 vk) : AdjustedMantissaAttempts conversion of w*10^q to rounded IEEE mantissa/exponent fields for vk. A negative power2 signals that the caller must use the digit-comparison slow path.
ComputeErrormethod
public static fn ComputeError(int64 q, uint64 w, int32 vk) : AdjustedMantissaBuilds the error-path mantissa/exponent intermediate used before digit comparison. Requires a nonzero decimal significand and a supported cached-power exponent.
ClingerFastPathDoublemethod
public static fn ClingerFastPathDouble(uint64 mantissa, int64 exponent, bool negative) : ClingerResultAttempts exact fast-path binary64 conversion of a decimal significand and exponent. Check ok before reading bits64.
ClingerFastPathFloatmethod
public static fn ClingerFastPathFloat(uint64 mantissa, int64 exponent, bool negative) : ClingerResultAttempts exact fast-path binary32 conversion of a decimal significand and exponent. Check ok before reading bits32.
ParseInfnanmethod
public static fn ParseInfnan(ReadOnlySpan<uint8> s, uint64 fmt) : InfnanResultRecognizes case-insensitive inf/infinity/nan prefixes in a nonempty byte span. A minus is allowed; a plus requires AllowLeadingPlus. The caller enforces NoInfnan and whitespace policy. Check ok and lastMatch; trailing bytes can remain.
AmToFloatDoublemethod
public static fn AmToFloatDouble(bool negative, AdjustedMantissa am) : uint64Packs a successfully rounded mantissa/exponent and sign into binary64 bits. Requires IEEE packing fields, not an extended or failed intermediate.
AmToFloatFloatmethod
public static fn AmToFloatFloat(bool negative, AdjustedMantissa am) : uint32Packs a successfully rounded mantissa/exponent and sign into binary32 bits. Requires IEEE packing fields, not an extended or failed intermediate.
IsOutOfRangemethod
public static fn IsOutOfRange(uint64 originalMantissa, AdjustedMantissa am, int32 vk) : boolChecks whether a nonzero decimal input rounded to zero or infinity for vk. Expects a rounded conversion result.
MakeAdjustedMantissamethod
public static fn MakeAdjustedMantissa(uint64 mantissa, int32 power2) : AdjustedMantissaCreates a mantissa/exponent record without validation.
MakeOptionsmethod
public static fn MakeOptions(uint64 fmt, uint8 dp) : FloatParseOptionsCreates explicit format-bit and one-byte decimal-point options, like FloatParseOptions.Custom.
ParseNumberStringmethod
public static fn ParseNumberString(ReadOnlySpan<uint8> s, FloatParseOptions options, bool jsonFmt) : ParsedNumberScans a numeric prefix from a nonempty span. Returned ranges are relative to that span; jsonFmt must agree with the selected JSON grammar. Check valid before consuming the significand.
ParseMantissamethod
public static fn ParseMantissa(ReadOnlySpan<uint8> s, ParsedNumber num, int32 maxDigits) : ParseMantissaResultCollects significant digits from the original span using ranges in a valid ParsedNumber. Use the matching parser limit: 769 digits for double or 114 for float.
ScientificExponentmethod
public static fn ScientificExponent(uint64 mantissa, int32 exponent) : int32Adds the number of decimal significand digits minus one to exponent. A zero mantissa leaves exponent unchanged.
ToExtendedDoublemethod
public static fn ToExtendedDouble(uint64 bits) : AdjustedMantissaExtracts an unsigned extended significand and binary exponent from finite binary64 bits. Sign is handled separately.
ToExtendedFloatmethod
public static fn ToExtendedFloat(uint32 bits) : AdjustedMantissaExtracts an unsigned extended significand and binary exponent from finite binary32 bits. Sign is handled separately.
ToExtendedHalfwayDoublemethod
public static fn ToExtendedHalfwayDouble(uint64 bits) : AdjustedMantissaBuilds the extended halfway value above the finite positive binary64 value, for rounding comparisons.
ToExtendedHalfwayFloatmethod
public static fn ToExtendedHalfwayFloat(uint32 bits) : AdjustedMantissaBuilds the extended halfway value above the finite positive binary32 value, for rounding comparisons.
RoundDownmethod
public static fn RoundDown(AdjustedMantissa am, int32 vk) : AdjustedMantissaRounds the parser's scaled intermediate downward to IEEE mantissa/exponent fields for vk.
RoundTieEvenTruncatedmethod
public static fn RoundTieEvenTruncated(AdjustedMantissa am, bool truncated, int32 vk) : AdjustedMantissaRounds a scaled intermediate to nearest, ties to even, using truncated to account for discarded nonzero digits.
RoundTieEvenCmpmethod
public static fn RoundTieEvenCmp(AdjustedMantissa am, int32 ord, int32 vk) : AdjustedMantissaRounds a scaled intermediate to nearest, ties to even, using the comparison ordering against the exact halfway value.
DigitCompmethod
public static fn DigitComp(ReadOnlySpan<uint8> s, ParsedNumber num, AdjustedMantissa am, int32 vk) : AdjustedMantissaResolves an uncertain conversion by comparing decimal digits against the binary boundary. Pass the original span, its valid ParsedNumber, and matching intermediate/kind.
ParseDoublemethod
public static fn ParseDouble(ReadOnlySpan<uint8> s, FloatParseOptions options) : DoubleResultParses a binary64 numeric prefix without throwing. Returns bits, outcome, and a byte position. Success can leave trailing bytes; require outcome == kOutcomeOk and position == s.length for whole-span consumption.
ParseFloatmethod
public static fn ParseFloat(ReadOnlySpan<uint8> s, FloatParseOptions options) : FloatResultParses a binary32 numeric prefix without throwing. Returns bits, outcome, and a byte position. Success can leave trailing bytes; require outcome == kOutcomeOk and position == s.length for whole-span consumption.