← Standard library

double

struct double

Available without an import.

IEEE 754 binary64 floating-point values, including signed zero, infinities, and NaNs. Default construction produces zero. Equals treats NaNs as equal and CompareTo sorts them last; operator equality follows floating-point comparison instead. Parsing accepts a numeric prefix; it does not validate that the entire input was consumed.

Floats.wax:356

Members

constructorconstructor

public constructor ()

Creates zero.

Floats.wax:361

NaNconst

const double NaN

A quiet not-a-number value. Test with IsNaN, since operator equality does not identify NaNs.

Floats.wax:370

Infinityconst

const double Infinity

Positive infinity.

Floats.wax:374

NegativeInfinityconst

const double NegativeInfinity

Negative infinity.

Floats.wax:378

MinValueconst

const double MinValue = -1.7976931348623157e+308

The smallest finite value representable by this type.

Floats.wax:382

MaxValueconst

const double MaxValue = 1.7976931348623157e+308

The largest finite value representable by this type.

Floats.wax:386

Epsilonconst

const double Epsilon = 2.2204460492503131e-16

The distance from 1 to the next larger representable value; this is not the smallest positive value.

Floats.wax:391

MinSafeIntegerconst

const int64 MinSafeInteger = 0 - 9007199254740991

The negative boundary of the interval in which every integer is exactly representable.

Floats.wax:395

MaxSafeIntegerconst

const int64 MaxSafeInteger = 9007199254740991

The positive boundary of the interval in which every integer is exactly representable.

Floats.wax:399

Piconst

const double Pi = 3.14159265358979323846

The circle constant pi.

Floats.wax:405

Tauconst

const double Tau = 6.28318530717958647692

One full revolution in radians, 2*pi.

Floats.wax:409

Econst

const double E = 2.71828182845904523536

The base of natural logarithms.

Floats.wax:413

HalfPiconst

const double HalfPi = 1.57079632679489661923

Half of pi, a right angle in radians.

Floats.wax:417

QuarterPiconst

const double QuarterPi = 0.78539816339744830962

One quarter of pi, 45 degrees in radians.

Floats.wax:421

InvPiconst

const double InvPi = 0.31830988618379067154

The reciprocal of pi.

Floats.wax:425

InvSqrtPiconst

const double InvSqrtPi = 0.56418958354775628695

The reciprocal of the square root of pi.

Floats.wax:429

Sqrt2const

const double Sqrt2 = 1.41421356237309504880

The positive square root of two.

Floats.wax:433

InvSqrt2const

const double InvSqrt2 = 0.70710678118654752440

The reciprocal of the square root of two.

Floats.wax:437

Ln2const

const double Ln2 = 0.69314718055994530942

The natural logarithm of two.

Floats.wax:441

Ln10const

const double Ln10 = 2.30258509299404568402

The natural logarithm of ten.

Floats.wax:445

Log2Econst

const double Log2E = 1.44269504088896340736

The base-2 logarithm of e.

Floats.wax:449

Log10Econst

const double Log10E = 0.43429448190325182765

The base-10 logarithm of e.

Floats.wax:453

GetHashCodemethod

public fn GetHashCode() : uint32

Returns a value hash, treating all NaNs alike and both signed zeros alike.

Floats.wax:459

ToStringmethod

public fn ToString() : string

Returns a shortest round-trippable decimal representation, with text for infinities and NaN.

Floats.wax:474

ToStringBuffermethod

public fn ToStringBuffer(StringBuilder builder) : int32

Appends the same text as ToString and returns the number of UTF-8 bytes appended.

Floats.wax:481

Formatmethod

public fn Format(string fmt) : string

Formats with F/f (fixed decimal places), E/e (scientific decimal places), or G/g (significant digits). A numeric suffix selects precision, capped at 99. Empty format uses shortest text; default F precision is 2 and E precision is 6.

Floats.wax:494

FormatBuffermethod

public fn FormatBuffer(StringBuilder builder, string fmt) : int32

Appends Format(fmt) text directly to a builder and returns the number of bytes appended.

Floats.wax:501

Equalsmethod

public fn Equals(double other) : bool

Compares values, treating all NaNs as equal and positive and negative zero as equal.

Floats.wax:511

CompareTomethod

public fn CompareTo(double other) : int32

Returns -1, 0, or 1 for less, equal, or greater. NaNs compare equal to each other and greater than every non-NaN value.

Floats.wax:522

IsNaNmethod

public fn IsNaN() : bool

Tests for any NaN bit pattern.

Floats.wax:536

IsInfinitymethod

public fn IsInfinity() : bool

Tests for either positive or negative infinity.

Floats.wax:544

IsFinitemethod

public fn IsFinite() : bool

Tests that the value is neither infinity nor NaN.

Floats.wax:552

IsNegativeInfinitymethod

public fn IsNegativeInfinity() : bool

Tests specifically for negative infinity.

Floats.wax:560

Parsemethod

public static fn Parse(string text, FloatParseOptions options = new FloatParseOptions.General()) : double?

Parses a numeric prefix according to options, returning null for invalid input or an out-of-range result. Trailing text can remain unconsumed.

Floats.wax:567

ParseDetailedmethod

public static fn ParseDetailed(string text, FloatParseOptions options = new FloatParseOptions.General()) : double throws ParseError

Parses a numeric prefix according to options. Throws ParseError with a byte position for invalid input or an out-of-range result. Does not require whole-input consumption; use the low-level parser result position when checking it.

Floats.wax:577

Reinterpretmethod

public fn Reinterpret<T>() : T where T is numeric

Reinterprets bits as a numeric type of the same width rather than converting the numeric value. Incompatible widths are rejected. Floating-point NaNs are canonicalized when entering or leaving a floating-point type; NaN payload bits are not preserved.

Floats.wax:592

nanosecondsgetter

public get nanoseconds() : timespan

Interprets this value as nanoseconds and converts to a duration stored in signed 64-bit nanoseconds. Fractional nanoseconds are truncated; supply a finite value within the duration range.

Floats.wax:600

microsecondsgetter

public get microseconds() : timespan

Interprets this value as microseconds and converts to a duration stored in signed 64-bit nanoseconds. Fractional nanoseconds are truncated; supply a finite value within the duration range.

Floats.wax:606

millisecondsgetter

public get milliseconds() : timespan

Interprets this value as milliseconds and converts to a duration stored in signed 64-bit nanoseconds. Fractional nanoseconds are truncated; supply a finite value within the duration range.

Floats.wax:612

secondsgetter

public get seconds() : timespan

Interprets this value as seconds and converts to a duration stored in signed 64-bit nanoseconds. Fractional nanoseconds are truncated; supply a finite value within the duration range.

Floats.wax:618

minutesgetter

public get minutes() : timespan

Interprets this value as minutes and converts to a duration stored in signed 64-bit nanoseconds. Fractional nanoseconds are truncated; supply a finite value within the duration range.

Floats.wax:624

hoursgetter

public get hours() : timespan

Interprets this value as hours and converts to a duration stored in signed 64-bit nanoseconds. Fractional nanoseconds are truncated; supply a finite value within the duration range.

Floats.wax:630

degreesgetter

public get degrees() : angle

Interprets this value as degrees and converts to an angle stored in float radians. Does not normalize the angle to one revolution.

Floats.wax:635

radiansgetter

public get radians() : angle

Interprets this value as radians and converts to an angle stored in float radians. Does not normalize the angle to one revolution.

Floats.wax:640

turnsgetter

public get turns() : angle

Interprets this value as turns and converts to an angle stored in float radians. Does not normalize the angle to one revolution.

Floats.wax:645