Table of Contents

Struct Fixed64

Namespace
FixedMathSharp
Assembly
FixedMathSharp.dll

Represents a Q(64-SHIFT_AMOUNT).SHIFT_AMOUNT fixed-point number. Provides high precision for fixed-point arithmetic where SHIFT_AMOUNT bits are used for the fractional part and (64 - SHIFT_AMOUNT) bits for the integer part. The precision is determined by SHIFT_AMOUNT, which defines the resolution of fractional values.

[MemoryPackable(GenerateType.Object)]
public struct Fixed64 : IEquatable<Fixed64>, IComparable<Fixed64>, IEqualityComparer<Fixed64>, ISpanFormattable, IFormattable, IMemoryPackable<Fixed64>, IMemoryPackFormatterRegister
Implements
IMemoryPackable<Fixed64>
IMemoryPackFormatterRegister
Inherited Members
Extension Methods

Remarks

MemoryPack GenerateType: unmanaged

long m_rawValue

Constructors

Fixed64(int)

Constructs a Fixed64 from an integer, with the fractional part set to zero.

public Fixed64(int value)

Parameters

value int

Integer value to convert to

Fields

m_rawValue

The underlying raw long value representing the fixed-point number.

[JsonInclude]
[MemoryPackInclude]
public long m_rawValue

Field Value

long

Properties

Deg2Rad

Degrees to radians conversion factor (π / 180)

public static Fixed64 Deg2Rad { get; }

Property Value

Fixed64

Eighth

Represents the value 0.125 shifted left by the number of bits specified by SHIFT_AMOUNT_I.

public static Fixed64 Eighth { get; }

Property Value

Fixed64

Epsilon

Default tolerance for fuzzy comparisons. Approximately 2^-24 (~5.96e-8) in value space.

public static Fixed64 Epsilon { get; }

Property Value

Fixed64

Half

Represents the value 0.5 shifted left by the number of bits specified by SHIFT_AMOUNT_I.

public static Fixed64 Half { get; }

Property Value

Fixed64

HalfPi

Represents the mathematical constant π divided by 2 as a fixed-point value.

public static Fixed64 HalfPi { get; }

Property Value

Fixed64

Remarks

This value is used where π/2 is required.

InvertedPi

Represents the multiplicative inverse of the mathematical constant π (pi) as a fixed-point value.

public static Fixed64 InvertedPi { get; }

Property Value

Fixed64

Ln2

public static Fixed64 Ln2 { get; }

Property Value

Fixed64

Log2Max

Represents the maximum value for the base-2 logarithm that can be represented by a Fixed64 instance.

public static Fixed64 Log2Max { get; }

Property Value

Fixed64

Remarks

This constant is useful when performing logarithmic calculations to ensure results do not exceed the representable range of the Fixed64 type.

Log2Min

Represents the minimum base-2 logarithm value supported by the Fixed64 type.

public static Fixed64 Log2Min { get; }

Property Value

Fixed64

Remarks

This constant can be used as a lower bound when performing logarithmic calculations with Fixed64 values to prevent underflow or invalid results.

MaxValue

Represents the largest possible value for a 64-bit fixed-point number.

public static Fixed64 MaxValue { get; }

Property Value

Fixed64

Remarks

Use this constant to perform comparisons or to initialize variables that require the maximum representable value for a 64-bit fixed-point type.

MinIncrement

The smallest non-zero raw increment representable by Fixed64.

public static Fixed64 MinIncrement { get; }

Property Value

Fixed64

MinValue

Represents the smallest possible value for a 64-bit fixed-point number.

public static Fixed64 MinValue { get; }

Property Value

Fixed64

Remarks

Use this constant to check for underflow conditions or to initialize variables that require the minimum representable value for a 64-bit fixed-point type.

NegOne

Represents the value -1 shifted left by the number of bits specified by SHIFT_AMOUNT_I.

public static Fixed64 NegOne { get; }

Property Value

Fixed64

One

Represents the value 1 shifted left by the number of bits specified by SHIFT_AMOUNT_I.

public static Fixed64 One { get; }

Property Value

Fixed64

OneEighty

Represents the fixed-point value for 180.

public static Fixed64 OneEighty { get; }

Property Value

Fixed64

Pi

public static Fixed64 Pi { get; }

Property Value

Fixed64

PiOver3

Represents the mathematical constant π divided by 3 as a fixed-point value.

public static Fixed64 PiOver3 { get; }

Property Value

Fixed64

PiOver4

Represents the mathematical constant π divided by 4 as a fixed-point value.

public static Fixed64 PiOver4 { get; }

Property Value

Fixed64

PiOver6

Represents the mathematical constant π divided by 6 as a fixed-point value.

public static Fixed64 PiOver6 { get; }

Property Value

Fixed64

Quarter

Represents the value 0.25 shifted left by the number of bits specified by SHIFT_AMOUNT_I.

public static Fixed64 Quarter { get; }

Property Value

Fixed64

Rad2Deg

Radians to degrees conversion factor (180 / π)

public static Fixed64 Rad2Deg { get; }

Property Value

Fixed64

Three

Represents the value 3 shifted left by the number of bits specified by SHIFT_AMOUNT_I.

public static Fixed64 Three { get; }

Property Value

Fixed64

Two

Represents the value 2 shifted left by the number of bits specified by SHIFT_AMOUNT_I.

public static Fixed64 Two { get; }

Property Value

Fixed64

TwoPi

Represents the mathematical constant 2π as a fixed-point value.

public static Fixed64 TwoPi { get; }

Property Value

Fixed64

Remarks

This value is commonly used to represent a full rotation in radians.

Zero

Represents the value 0 as a fixed-point number.

public static Fixed64 Zero { get; }

Property Value

Fixed64

Methods

CompareProducts(Fixed64, Fixed64, Fixed64, Fixed64)

Compares the exact mathematical product leftFirst * leftSecond with rightFirst * rightSecond without rounding or saturation.

public static int CompareProducts(Fixed64 leftFirst, Fixed64 leftSecond, Fixed64 rightFirst, Fixed64 rightSecond)

Parameters

leftFirst Fixed64
leftSecond Fixed64
rightFirst Fixed64
rightSecond Fixed64

Returns

int

A negative value when the left product is smaller, zero when the exact products are equal, or a positive value when the left product is larger.

CompareProducts(Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64)

Compares the exact four-factor mathematical product leftFirst * leftSecond * leftThird * leftFourth with rightFirst * rightSecond * rightThird * rightFourth without rounding or saturation.

public static int CompareProducts(Fixed64 leftFirst, Fixed64 leftSecond, Fixed64 leftThird, Fixed64 leftFourth, Fixed64 rightFirst, Fixed64 rightSecond, Fixed64 rightThird, Fixed64 rightFourth)

Parameters

leftFirst Fixed64
leftSecond Fixed64
leftThird Fixed64
leftFourth Fixed64
rightFirst Fixed64
rightSecond Fixed64
rightThird Fixed64
rightFourth Fixed64

Returns

int

A negative value when the left product is smaller, zero when the exact products are equal, or a positive value when the left product is larger.

CompareTo(Fixed64)

Compares this instance to another

public int CompareTo(Fixed64 other)

Parameters

other Fixed64

The Fixed64 to compare with.

Returns

int

-1 if less than, 0 if equal, 1 if greater than other.

Equals(Fixed64)

public bool Equals(Fixed64 other)

Parameters

other Fixed64

Returns

bool

Equals(Fixed64, Fixed64)

public bool Equals(Fixed64 x, Fixed64 y)

Parameters

x Fixed64
y Fixed64

Returns

bool

Equals(object?)

Determines whether this instance equals another object.

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

FromDecimal(decimal)

Constructs a Fixed64 from a decimal value.

public static Fixed64 FromDecimal(decimal value)

Parameters

value decimal

Decimal value to convert.

Returns

Fixed64

Remarks

The value is multiplied by the scaling factor (2^SHIFT_AMOUNT) and rounded to the nearest raw integer using midpoint-to-even rounding. Values outside the Q32.32 range throw an OverflowException.

FromDouble(double)

Constructs a Fixed64 from a double-precision floating-point value.

public static Fixed64 FromDouble(double value)

Parameters

value double

Double value to convert.

Returns

Fixed64

Remarks

The value is multiplied by the scaling factor (2^SHIFT_AMOUNT) and rounded to the nearest raw integer using midpoint-to-even rounding. Non-finite values throw an ArgumentOutOfRangeException. Finite values outside the Q32.32 range throw an OverflowException.

FromFraction(double, double)

Creates a Fixed64 from a fractional number.

public static Fixed64 FromFraction(double numerator, double denominator)

Parameters

numerator double

The numerator of the fraction.

denominator double

The denominator of the fraction.

Returns

Fixed64

A Fixed64 representing the fraction.

Remarks

The quotient is converted through FromDouble(double), so non-finite results throw ArgumentOutOfRangeException and finite results outside the Q32.32 range throw OverflowException.

FromRaw(long)

Creates a Fixed64 from a raw long value.

public static Fixed64 FromRaw(long rawValue)

Parameters

rawValue long

The raw fixed-point payload.

Returns

Fixed64

A Fixed64 representing the raw value.

Remarks

This method interprets rawValue as an already-scaled Q32.32 payload. Use the integer constructors or explicit numeric conversions for user-facing integer values.

GetHashCode()

public override int GetHashCode()

Returns

int

GetHashCode(Fixed64)

public int GetHashCode(Fixed64 obj)

Parameters

obj Fixed64

Returns

int

IsInteger(Fixed64)

Returns true if the number has no decimal part (i.e., if the number is equivalent to an integer) and False otherwise.

public static bool IsInteger(Fixed64 value)

Parameters

value Fixed64

Returns

bool

MultiplyAdd(Fixed64, Fixed64, Fixed64)

Multiplies two values, adds a third, and performs one final round-half-to-even conversion. An unrepresentable result saturates.

public static Fixed64 MultiplyAdd(Fixed64 left, Fixed64 right, Fixed64 addend)

Parameters

left Fixed64
right Fixed64
addend Fixed64

Returns

Fixed64

Offset(int)

Offsets the current Fixed64 by an integer value.

public Fixed64 Offset(int x)

Parameters

x int

The integer value to add.

Returns

Fixed64

Remarks

Unlike the operator +(Fixed64, int), this method performs a simple addition of the integer value to the raw fixed-point representation without any overflow checks or saturation behavior.

Parse(string)

Parses a decimal string to create a Fixed64 instance.

public static Fixed64 Parse(string s)

Parameters

s string

The string representation of the Fixed64 value.

Returns

Fixed64

The parsed Fixed64 value.

Parse(string, IFormatProvider?)

Parses a decimal string to create a Fixed64 instance.

public static Fixed64 Parse(string s, IFormatProvider? formatProvider)

Parameters

s string

The string representation of the Fixed64 value.

formatProvider IFormatProvider

The provider to use for culture-specific parsing information.

Returns

Fixed64

The parsed Fixed64 value.

ParseRaw(string)

Parses a raw Q32.32 payload string to create a Fixed64 instance.

public static Fixed64 ParseRaw(string s)

Parameters

s string

The raw fixed-point payload.

Returns

Fixed64

The parsed Fixed64 value.

Sign(Fixed64)

Returns a number indicating the sign of a Fix64 number. Returns 1 if the value is positive, 0 if is 0, and -1 if it is negative.

public static int Sign(Fixed64 value)

Parameters

value Fixed64

Returns

int

Remarks

Optimized for branchless comparison.

ToDecimal(long)

Converts a Fixed64s RawValue (Int64) into a decimal

public static decimal ToDecimal(long f1)

Parameters

f1 long

Returns

decimal

ToDouble(long)

Converts a Fixed64s RawValue (Int64) into a double

public static double ToDouble(long f1)

Parameters

f1 long

Returns

double

ToFloat(long)

Converts a Fixed64s RawValue (Int64) into a float

public static float ToFloat(long f1)

Parameters

f1 long

Returns

float

ToInt(Fixed64)

Converts a Fixed64's RawValue (Int64) into an integer by discarding the fractional part.

public static int ToInt(Fixed64 value)

Parameters

value Fixed64

The Fixed64 value to convert.

Returns

int

The integer representation of the Fixed64 value.

ToRawString()

Returns the raw value as a string.

public string ToRawString()

Returns

string

ToString()

Returns the string representation of this Fixed64 instance.

public override string ToString()

Returns

string

Remarks

Up to 10 decimal places.

ToString(string?)

Converts the numeric value of the current Fixed64 object to its equivalent string representation.

public string ToString(string? format)

Parameters

format string

A format specification that governs how the current Fixed64 object is converted.

Returns

string

The string representation of the value of the current Fixed64 object.

ToString(string?, IFormatProvider?)

Converts the numeric value of the current Fixed64 object to its equivalent string representation.

public string ToString(string? format, IFormatProvider? formatProvider)

Parameters

format string

A format specification that governs how the current Fixed64 object is converted.

formatProvider IFormatProvider

The provider to use for culture-specific formatting information.

Returns

string

The string representation of the value of the current Fixed64 object.

TryAdd(Fixed64, Fixed64, out Fixed64)

Attempts to add two values without saturation.

public static bool TryAdd(Fixed64 left, Fixed64 right, out Fixed64 result)

Parameters

left Fixed64

The left operand.

right Fixed64

The right operand.

result Fixed64

The exact sum when representable; otherwise, default.

Returns

bool

true when the exact sum is representable; otherwise, false.

TryAddSubtract(Fixed64, Fixed64, Fixed64, out Fixed64)

Attempts to add two values and subtract a third without intermediate saturation.

public static bool TryAddSubtract(Fixed64 firstAddend, Fixed64 secondAddend, Fixed64 subtrahend, out Fixed64 result)

Parameters

firstAddend Fixed64

The first addend.

secondAddend Fixed64

The second addend.

subtrahend Fixed64

The value to subtract from the exact sum.

result Fixed64

The exact result when representable; otherwise, default.

Returns

bool

true when the exact result is representable; otherwise, false.

TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)

Formats the value into the provided destination buffer.

public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)

Parameters

destination Span<char>
charsWritten int
format ReadOnlySpan<char>
provider IFormatProvider

Returns

bool

TryMultiplyAdd(Fixed64, Fixed64, Fixed64, out Fixed64)

Attempts to multiply two values and add a third with one final round-half-to-even conversion and no intermediate saturation.

public static bool TryMultiplyAdd(Fixed64 left, Fixed64 right, Fixed64 addend, out Fixed64 result)

Parameters

left Fixed64
right Fixed64
addend Fixed64
result Fixed64

Returns

bool

TryMultiplyDifference(Fixed64, Fixed64, Fixed64, Fixed64, out Fixed64)

Attempts to evaluate (value - subtrahend) * firstMultiplier * secondMultiplier with one final round-half-to-even conversion.

public static bool TryMultiplyDifference(Fixed64 value, Fixed64 subtrahend, Fixed64 firstMultiplier, Fixed64 secondMultiplier, out Fixed64 result)

Parameters

value Fixed64
subtrahend Fixed64
firstMultiplier Fixed64
secondMultiplier Fixed64
result Fixed64

Returns

bool

Remarks

The subtraction and both products remain exact even when an intermediate value lies outside the public Q32.32 domain.

TryMultiplyDivide(Fixed64, Fixed64, Fixed64, Fixed64, out Fixed64)

Attempts to multiply three values and divide by a fourth with one final round-half-to-even operation and no intermediate saturation.

public static bool TryMultiplyDivide(Fixed64 first, Fixed64 second, Fixed64 third, Fixed64 divisor, out Fixed64 result)

Parameters

first Fixed64

The first factor.

second Fixed64

The second factor.

third Fixed64

The third factor.

divisor Fixed64

The divisor.

result Fixed64

The fused result when representable; otherwise, default.

Returns

bool

true when the divisor is nonzero and the final result is representable; otherwise, false.

TryMultiplyDivide(Fixed64, Fixed64, Fixed64, out Fixed64)

Attempts to multiply two values and divide by a third with one final round-half-to-even operation and no intermediate saturation.

public static bool TryMultiplyDivide(Fixed64 left, Fixed64 right, Fixed64 divisor, out Fixed64 result)

Parameters

left Fixed64

The first factor.

right Fixed64

The second factor.

divisor Fixed64

The divisor.

result Fixed64

The fused result when representable; otherwise, default.

Returns

bool

true when the divisor is nonzero and the final result is representable; otherwise, false.

TryMultiplyDivideBySum(Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, out Fixed64)

Attempts to multiply four values and divide by the exact sum of four values with one final round-half-to-even operation.

public static bool TryMultiplyDivideBySum(Fixed64 first, Fixed64 second, Fixed64 third, Fixed64 fourth, Fixed64 firstDivisorTerm, Fixed64 secondDivisorTerm, Fixed64 thirdDivisorTerm, Fixed64 fourthDivisorTerm, out Fixed64 result)

Parameters

first Fixed64
second Fixed64
third Fixed64
fourth Fixed64
firstDivisorTerm Fixed64
secondDivisorTerm Fixed64
thirdDivisorTerm Fixed64
fourthDivisorTerm Fixed64
result Fixed64

Returns

bool

TryMultiplySubtractClamped(Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, out Fixed64)

Attempts to compute max(0, minuendFirst * minuendSecond * minuendThird * minuendFourth - subtrahendFirst * subtrahendSecond * subtrahendThird * subtrahendFourth) with no intermediate saturation and one final round-half-to-even conversion.

public static bool TryMultiplySubtractClamped(Fixed64 minuendFirst, Fixed64 minuendSecond, Fixed64 minuendThird, Fixed64 minuendFourth, Fixed64 subtrahendFirst, Fixed64 subtrahendSecond, Fixed64 subtrahendThird, Fixed64 subtrahendFourth, out Fixed64 result)

Parameters

minuendFirst Fixed64

The first factor of the minuend product.

minuendSecond Fixed64

The second factor of the minuend product.

minuendThird Fixed64

The third factor of the minuend product.

minuendFourth Fixed64

The fourth factor of the minuend product.

subtrahendFirst Fixed64

The first factor of the subtrahend product.

subtrahendSecond Fixed64

The second factor of the subtrahend product.

subtrahendThird Fixed64

The third factor of the subtrahend product.

subtrahendFourth Fixed64

The fourth factor of the subtrahend product.

result Fixed64

The nonnegative fused result; otherwise, default when a positive rounded result is not representable.

Returns

bool

true when the exact difference is nonpositive or its final round-half-to-even result is representable; otherwise, false.

TryMultiplySubtractClamped(Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, out Fixed64)

Attempts to compute max(0, minuendFirst * minuendSecond * minuendThird - subtrahendFirst * subtrahendSecond * subtrahendThird) with no intermediate saturation and one final round-half-to-even conversion.

public static bool TryMultiplySubtractClamped(Fixed64 minuendFirst, Fixed64 minuendSecond, Fixed64 minuendThird, Fixed64 subtrahendFirst, Fixed64 subtrahendSecond, Fixed64 subtrahendThird, out Fixed64 result)

Parameters

minuendFirst Fixed64

The first factor of the minuend product.

minuendSecond Fixed64

The second factor of the minuend product.

minuendThird Fixed64

The third factor of the minuend product.

subtrahendFirst Fixed64

The first factor of the subtrahend product.

subtrahendSecond Fixed64

The second factor of the subtrahend product.

subtrahendThird Fixed64

The third factor of the subtrahend product.

result Fixed64

The nonnegative fused result; otherwise, default when a positive rounded result is not representable.

Returns

bool

true when the exact difference is nonpositive or its final round-half-to-even result is representable; otherwise, false.

TryMultiplySubtractClamped(Fixed64, Fixed64, Fixed64, Fixed64, out Fixed64)

Attempts to compute max(0, minuendFirst * minuendSecond - subtrahendFirst * subtrahendSecond) with no intermediate saturation and one final round-half-to-even conversion.

public static bool TryMultiplySubtractClamped(Fixed64 minuendFirst, Fixed64 minuendSecond, Fixed64 subtrahendFirst, Fixed64 subtrahendSecond, out Fixed64 result)

Parameters

minuendFirst Fixed64

The first factor of the minuend product.

minuendSecond Fixed64

The second factor of the minuend product.

subtrahendFirst Fixed64

The first factor of the subtrahend product.

subtrahendSecond Fixed64

The second factor of the subtrahend product.

result Fixed64

The nonnegative fused result; otherwise, default when a positive rounded result is not representable.

Returns

bool

true when the exact difference is nonpositive or its final round-half-to-even result is representable; otherwise, false.

TryParse(string?, out Fixed64)

Tries to parse a decimal string to create a Fixed64 instance.

public static bool TryParse(string? s, out Fixed64 result)

Parameters

s string

The string representation of the Fixed64 value.

result Fixed64

The parsed Fixed64 value.

Returns

bool

True if parsing succeeded; otherwise, false.

TryParse(string?, IFormatProvider?, out Fixed64)

Tries to parse a decimal string to create a Fixed64 instance.

public static bool TryParse(string? s, IFormatProvider? formatProvider, out Fixed64 result)

Parameters

s string

The string representation of the Fixed64 value.

formatProvider IFormatProvider

The provider to use for culture-specific parsing information.

result Fixed64

The parsed Fixed64 value.

Returns

bool

True if parsing succeeded; otherwise, false.

TryParseRaw(string?, out Fixed64)

Tries to parse a raw Q32.32 payload string to create a Fixed64 instance.

public static bool TryParseRaw(string? s, out Fixed64 result)

Parameters

s string

The raw fixed-point payload.

result Fixed64

The parsed Fixed64 value.

Returns

bool

True if parsing succeeded; otherwise, false.

TrySubtract(Fixed64, Fixed64, out Fixed64)

Attempts to subtract two values without saturation.

public static bool TrySubtract(Fixed64 left, Fixed64 right, out Fixed64 result)

Parameters

left Fixed64

The left operand.

right Fixed64

The right operand.

result Fixed64

The exact difference when representable; otherwise, default.

Returns

bool

true when the exact difference is representable; otherwise, false.

TrySubtractSums(Fixed64, Fixed64, Fixed64, Fixed64, out Fixed64)

Attempts to compute (firstLeft + firstRight) - (secondLeft + secondRight) without intermediate saturation.

public static bool TrySubtractSums(Fixed64 firstLeft, Fixed64 firstRight, Fixed64 secondLeft, Fixed64 secondRight, out Fixed64 result)

Parameters

firstLeft Fixed64

The first value in the minuend sum.

firstRight Fixed64

The second value in the minuend sum.

secondLeft Fixed64

The first value in the subtrahend sum.

secondRight Fixed64

The second value in the subtrahend sum.

result Fixed64

The exact difference when representable; otherwise, default.

Returns

bool

true when the exact result is representable; otherwise, false.

Operators

operator +(Fixed64, Fixed64)

Adds two Fixed64 numbers, with saturating behavior in case of overflow.

public static Fixed64 operator +(Fixed64 x, Fixed64 y)

Parameters

x Fixed64
y Fixed64

Returns

Fixed64

operator +(Fixed64, int)

Adds an int to a Fixed64, with saturating behavior in case of overflow.

public static Fixed64 operator +(Fixed64 x, int y)

Parameters

x Fixed64
y int

Returns

Fixed64

operator +(int, Fixed64)

Adds an int to a Fixed64, with saturating behavior in case of overflow.

public static Fixed64 operator +(int x, Fixed64 y)

Parameters

x int
y Fixed64

Returns

Fixed64

operator --(Fixed64)

Decrements a Fixed64 number by one, with saturating behavior in case of overflow.

public static Fixed64 operator --(Fixed64 a)

Parameters

a Fixed64

The Fixed64 number to decrement.

Returns

Fixed64

The decremented Fixed64 number.

operator /(Fixed64, Fixed64)

Divides one Fixed64 number by another, handling division by zero and overflow.

public static Fixed64 operator /(Fixed64 x, Fixed64 y)

Parameters

x Fixed64
y Fixed64

Returns

Fixed64

operator /(Fixed64, int)

Divides a Fixed64 by an integer, handling division by zero and overflow.

public static Fixed64 operator /(Fixed64 x, int y)

Parameters

x Fixed64
y int

Returns

Fixed64

operator /(int, Fixed64)

Divides an integer by a Fixed64, handling division by zero and overflow.

public static Fixed64 operator /(int y, Fixed64 x)

Parameters

y int
x Fixed64

Returns

Fixed64

operator ==(Fixed64, Fixed64)

Determines whether two Fixed64 instances are equal.

public static bool operator ==(Fixed64 left, Fixed64 right)

Parameters

left Fixed64
right Fixed64

Returns

bool

operator ==(Fixed64, int)

Determines whether a Fixed64 instance is equal to an integer.

public static bool operator ==(Fixed64 left, int right)

Parameters

left Fixed64
right int

Returns

bool

operator ==(int, Fixed64)

Determines whether an integer is equal to a Fixed64 instance.

public static bool operator ==(int left, Fixed64 right)

Parameters

left int
right Fixed64

Returns

bool

explicit operator decimal(Fixed64)

Converts a Fixed64 value to its decimal representation.

public static explicit operator decimal(Fixed64 value)

Parameters

value Fixed64

The Fixed64 value to convert to decimal.

Returns

decimal

Remarks

This operator provides an explicit conversion from Fixed64 to decimal, preserving the numeric value as closely as possible. Use this conversion when precise decimal arithmetic is required.

explicit operator double(Fixed64)

Converts a Fixed64 value to its equivalent double-precision floating-point representation.

public static explicit operator double(Fixed64 value)

Parameters

value Fixed64

The Fixed64 value to convert to a double.

Returns

double

Remarks

This conversion may result in a loss of precision if the Fixed64 value cannot be exactly represented as a double.

explicit operator int(Fixed64)

Converts a Fixed64 value to a 32-bit signed integer by discarding the fractional part.

public static explicit operator int(Fixed64 value)

Parameters

value Fixed64

The Fixed64 value to convert to an integer.

Returns

int

Remarks

The conversion truncates any fractional component. The result is equivalent to rounding toward zero.

explicit operator long(Fixed64)

Converts a Fixed64 value to a 64-bit signed integer by discarding the fractional part.

public static explicit operator long(Fixed64 value)

Parameters

value Fixed64

The Fixed64 value to convert to a long integer.

Returns

long

Remarks

The conversion truncates any fractional component. The result represents the integer portion of the Fixed64 value.

explicit operator float(Fixed64)

Converts a Fixed64 value to its equivalent single-precision floating-point representation.

public static explicit operator float(Fixed64 value)

Parameters

value Fixed64

The Fixed64 value to convert to a float.

Returns

float

Remarks

This conversion may result in a loss of precision if the Fixed64 value cannot be exactly represented as a float.

explicit operator Fixed64(decimal)

Defines an explicit conversion from a decimal value to a Fixed64 instance.

public static explicit operator Fixed64(decimal value)

Parameters

value decimal

The decimal value to convert to a Fixed64 instance.

Returns

Fixed64

explicit operator Fixed64(double)

Defines an explicit conversion from a double-precision floating-point number to a Fixed64 value.

public static explicit operator Fixed64(double value)

Parameters

value double

The double-precision floating-point number to convert to a Fixed64 value.

Returns

Fixed64

Remarks

This conversion may result in loss of precision if the double value cannot be exactly represented as a Fixed64.

explicit operator Fixed64(int)

Defines an explicit conversion from a 32-bit signed integer to a Fixed64 value.

public static explicit operator Fixed64(int value)

Parameters

value int

The 32-bit signed integer to convert to a Fixed64 value.

Returns

Fixed64

explicit operator Fixed64(long)

Converts a 64-bit signed integer to a Fixed64 value using explicit casting.

public static explicit operator Fixed64(long value)

Parameters

value long

The 64-bit signed integer to convert to a Fixed64 value.

Returns

Fixed64

Remarks

The conversion interprets the input value as the integer part of the fixed-point number and saturates to MinValue or MaxValue when the integer cannot fit in Q32.32 value space. Use FromRaw(long) when a raw fixed-point payload is required.

explicit operator Fixed64(float)

Defines an explicit conversion from a single-precision floating-point value to a Fixed64 instance.

public static explicit operator Fixed64(float value)

Parameters

value float

The single-precision floating-point value to convert to Fixed64.

Returns

Fixed64

operator >(Fixed64, Fixed64)

Determines whether one Fixed64 is greater than another.

public static bool operator >(Fixed64 x, Fixed64 y)

Parameters

x Fixed64
y Fixed64

Returns

bool

operator >(Fixed64, int)

Determines whether a Fixed64 is greater than an integer.

public static bool operator >(Fixed64 x, int y)

Parameters

x Fixed64
y int

Returns

bool

operator >(int, Fixed64)

Determines whether an integer is greater than a Fixed64.

public static bool operator >(int y, Fixed64 x)

Parameters

y int
x Fixed64

Returns

bool

operator >=(Fixed64, Fixed64)

Determines whether one Fixed64 is greater than or equal to another.

public static bool operator >=(Fixed64 x, Fixed64 y)

Parameters

x Fixed64
y Fixed64

Returns

bool

operator >=(Fixed64, int)

Determines whether Fixed64 is greater than or equal to an integer.

public static bool operator >=(Fixed64 x, int y)

Parameters

x Fixed64
y int

Returns

bool

operator >=(int, Fixed64)

Determines whether an integer is greater than or equal to a Fixed64.

public static bool operator >=(int y, Fixed64 x)

Parameters

y int
x Fixed64

Returns

bool

operator ++(Fixed64)

Increments a Fixed64 number by one, with saturating behavior in case of overflow.

public static Fixed64 operator ++(Fixed64 a)

Parameters

a Fixed64

The Fixed64 number to increment.

Returns

Fixed64

The incremented Fixed64 number.

operator !=(Fixed64, Fixed64)

Determines whether two Fixed64 instances are not equal.

public static bool operator !=(Fixed64 left, Fixed64 right)

Parameters

left Fixed64
right Fixed64

Returns

bool

operator !=(Fixed64, int)

Determines whether a Fixed64 instance is not equal to an integer.

public static bool operator !=(Fixed64 left, int right)

Parameters

left Fixed64
right int

Returns

bool

operator !=(int, Fixed64)

Determines whether an integer is equal to a Fixed64 instance.

public static bool operator !=(int left, Fixed64 right)

Parameters

left int
right Fixed64

Returns

bool

operator <<(Fixed64, int)

Bitwise left shift operator.

public static Fixed64 operator <<(Fixed64 a, int shift)

Parameters

a Fixed64

Operand to shift.

shift int

Number of bits to shift.

Returns

Fixed64

The shifted value.

operator <(Fixed64, Fixed64)

Determines whether one Fixed64 is less than another.

public static bool operator <(Fixed64 x, Fixed64 y)

Parameters

x Fixed64
y Fixed64

Returns

bool

operator <(Fixed64, int)

Determines whether one Fixed64 is less than an integer.

public static bool operator <(Fixed64 x, int y)

Parameters

x Fixed64
y int

Returns

bool

operator <(int, Fixed64)

Determines whether an integer is less than a Fixed64.

public static bool operator <(int y, Fixed64 x)

Parameters

y int
x Fixed64

Returns

bool

operator <=(Fixed64, Fixed64)

Determines whether one Fixed64 is less than or equal to another.

public static bool operator <=(Fixed64 x, Fixed64 y)

Parameters

x Fixed64
y Fixed64

Returns

bool

operator <=(Fixed64, int)

Determines whether a Fixed64 is less than or equal to an integer.

public static bool operator <=(Fixed64 x, int y)

Parameters

x Fixed64
y int

Returns

bool

operator <=(int, Fixed64)

Determines whether an integer is less than or equal to a Fixed64.

public static bool operator <=(int y, Fixed64 x)

Parameters

y int
x Fixed64

Returns

bool

operator %(Fixed64, Fixed64)

Computes the remainder of division of one Fixed64 number by another.

public static Fixed64 operator %(Fixed64 x, Fixed64 y)

Parameters

x Fixed64
y Fixed64

Returns

Fixed64

operator %(Fixed64, int)

Computes the remainder of division of a Fixed64 by an int.

public static Fixed64 operator %(Fixed64 x, int y)

Parameters

x Fixed64
y int

Returns

Fixed64

operator %(int, Fixed64)

Computes the remainder of division of an int by a Fixed64.

public static Fixed64 operator %(int x, Fixed64 y)

Parameters

x int
y Fixed64

Returns

Fixed64

operator *(Fixed64, Fixed64)

Multiplies two Fixed64 numbers, handling overflow and rounding.

public static Fixed64 operator *(Fixed64 x, Fixed64 y)

Parameters

x Fixed64
y Fixed64

Returns

Fixed64

operator *(Fixed64, int)

Multiplies a Fixed64 by an integer, with overflow handling.

public static Fixed64 operator *(Fixed64 x, int y)

Parameters

x Fixed64
y int

Returns

Fixed64

operator *(int, Fixed64)

Multiplies a Fixed64 by an integer, with overflow handling.

public static Fixed64 operator *(int x, Fixed64 y)

Parameters

x int
y Fixed64

Returns

Fixed64

operator >>(Fixed64, int)

Bitwise right shift operator.

public static Fixed64 operator >>(Fixed64 a, int shift)

Parameters

a Fixed64

Operand to shift.

shift int

Number of bits to shift.

Returns

Fixed64

The shifted value.

operator -(Fixed64, Fixed64)

Subtracts one Fixed64 number from another, with saturating behavior in case of overflow.

public static Fixed64 operator -(Fixed64 x, Fixed64 y)

Parameters

x Fixed64
y Fixed64

Returns

Fixed64

operator -(Fixed64, int)

Subtracts an int from a Fixed64, with saturating behavior in case of overflow.

public static Fixed64 operator -(Fixed64 x, int y)

Parameters

x Fixed64
y int

Returns

Fixed64

operator -(int, Fixed64)

Subtracts a Fixed64 from an int, with saturating behavior in case of overflow.

public static Fixed64 operator -(int x, Fixed64 y)

Parameters

x int
y Fixed64

Returns

Fixed64

operator -(Fixed64)

Unary negation operator.

public static Fixed64 operator -(Fixed64 x)

Parameters

x Fixed64

Returns

Fixed64