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
valueintInteger 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
Properties
Deg2Rad
Degrees to radians conversion factor (π / 180)
public static Fixed64 Deg2Rad { get; }
Property Value
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
Epsilon
Default tolerance for fuzzy comparisons. Approximately 2^-24 (~5.96e-8) in value space.
public static Fixed64 Epsilon { get; }
Property Value
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
HalfPi
Represents the mathematical constant π divided by 2 as a fixed-point value.
public static Fixed64 HalfPi { get; }
Property Value
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
Ln2
public static Fixed64 Ln2 { get; }
Property Value
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
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
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
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
MinValue
Represents the smallest possible value for a 64-bit fixed-point number.
public static Fixed64 MinValue { get; }
Property Value
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
One
Represents the value 1 shifted left by the number of bits specified by SHIFT_AMOUNT_I.
public static Fixed64 One { get; }
Property Value
OneEighty
Represents the fixed-point value for 180.
public static Fixed64 OneEighty { get; }
Property Value
Pi
public static Fixed64 Pi { get; }
Property Value
PiOver3
Represents the mathematical constant π divided by 3 as a fixed-point value.
public static Fixed64 PiOver3 { get; }
Property Value
PiOver4
Represents the mathematical constant π divided by 4 as a fixed-point value.
public static Fixed64 PiOver4 { get; }
Property Value
PiOver6
Represents the mathematical constant π divided by 6 as a fixed-point value.
public static Fixed64 PiOver6 { get; }
Property Value
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
Rad2Deg
Radians to degrees conversion factor (180 / π)
public static Fixed64 Rad2Deg { get; }
Property Value
Three
Represents the value 3 shifted left by the number of bits specified by SHIFT_AMOUNT_I.
public static Fixed64 Three { get; }
Property Value
Two
Represents the value 2 shifted left by the number of bits specified by SHIFT_AMOUNT_I.
public static Fixed64 Two { get; }
Property Value
TwoPi
Represents the mathematical constant 2π as a fixed-point value.
public static Fixed64 TwoPi { get; }
Property Value
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
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
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
leftFirstFixed64leftSecondFixed64leftThirdFixed64leftFourthFixed64rightFirstFixed64rightSecondFixed64rightThirdFixed64rightFourthFixed64
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
otherFixed64The 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
otherFixed64
Returns
Equals(Fixed64, Fixed64)
public bool Equals(Fixed64 x, Fixed64 y)
Parameters
Returns
Equals(object?)
Determines whether this instance equals another object.
public override bool Equals(object? obj)
Parameters
objobject
Returns
FromDecimal(decimal)
Constructs a Fixed64 from a decimal value.
public static Fixed64 FromDecimal(decimal value)
Parameters
valuedecimalDecimal value to convert.
Returns
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
valuedoubleDouble value to convert.
Returns
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
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
rawValuelongThe 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
GetHashCode(Fixed64)
public int GetHashCode(Fixed64 obj)
Parameters
objFixed64
Returns
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
valueFixed64
Returns
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
Returns
Offset(int)
Offsets the current Fixed64 by an integer value.
public Fixed64 Offset(int x)
Parameters
xintThe integer value to add.
Returns
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
sstringThe 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
sstringThe string representation of the Fixed64 value.
formatProviderIFormatProviderThe 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
sstringThe 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
valueFixed64
Returns
Remarks
Optimized for branchless comparison.
ToDecimal(long)
Converts a Fixed64s RawValue (Int64) into a decimal
public static decimal ToDecimal(long f1)
Parameters
f1long
Returns
ToDouble(long)
Converts a Fixed64s RawValue (Int64) into a double
public static double ToDouble(long f1)
Parameters
f1long
Returns
ToFloat(long)
Converts a Fixed64s RawValue (Int64) into a float
public static float ToFloat(long f1)
Parameters
f1long
Returns
ToInt(Fixed64)
Converts a Fixed64's RawValue (Int64) into an integer by discarding the fractional part.
public static int ToInt(Fixed64 value)
Parameters
valueFixed64The 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
ToString()
Returns the string representation of this Fixed64 instance.
public override string ToString()
Returns
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
formatstringA 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
formatstringA format specification that governs how the current Fixed64 object is converted.
formatProviderIFormatProviderThe 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
leftFixed64The left operand.
rightFixed64The right operand.
resultFixed64The exact sum when representable; otherwise, default.
Returns
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
firstAddendFixed64The first addend.
secondAddendFixed64The second addend.
subtrahendFixed64The value to subtract from the exact sum.
resultFixed64The exact result when representable; otherwise, default.
Returns
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
destinationSpan<char>charsWrittenintformatReadOnlySpan<char>providerIFormatProvider
Returns
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
Returns
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
Returns
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
firstFixed64The first factor.
secondFixed64The second factor.
thirdFixed64The third factor.
divisorFixed64The divisor.
resultFixed64The fused result when representable; otherwise, default.
Returns
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
leftFixed64The first factor.
rightFixed64The second factor.
divisorFixed64The divisor.
resultFixed64The fused result when representable; otherwise, default.
Returns
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
firstFixed64secondFixed64thirdFixed64fourthFixed64firstDivisorTermFixed64secondDivisorTermFixed64thirdDivisorTermFixed64fourthDivisorTermFixed64resultFixed64
Returns
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
minuendFirstFixed64The first factor of the minuend product.
minuendSecondFixed64The second factor of the minuend product.
minuendThirdFixed64The third factor of the minuend product.
minuendFourthFixed64The fourth factor of the minuend product.
subtrahendFirstFixed64The first factor of the subtrahend product.
subtrahendSecondFixed64The second factor of the subtrahend product.
subtrahendThirdFixed64The third factor of the subtrahend product.
subtrahendFourthFixed64The fourth factor of the subtrahend product.
resultFixed64The 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
minuendFirstFixed64The first factor of the minuend product.
minuendSecondFixed64The second factor of the minuend product.
minuendThirdFixed64The third factor of the minuend product.
subtrahendFirstFixed64The first factor of the subtrahend product.
subtrahendSecondFixed64The second factor of the subtrahend product.
subtrahendThirdFixed64The third factor of the subtrahend product.
resultFixed64The 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
minuendFirstFixed64The first factor of the minuend product.
minuendSecondFixed64The second factor of the minuend product.
subtrahendFirstFixed64The first factor of the subtrahend product.
subtrahendSecondFixed64The second factor of the subtrahend product.
resultFixed64The 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
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
sstringThe string representation of the Fixed64 value.
formatProviderIFormatProviderThe provider to use for culture-specific parsing information.
resultFixed64The 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
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
leftFixed64The left operand.
rightFixed64The right operand.
resultFixed64The exact difference when representable; otherwise, default.
Returns
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
firstLeftFixed64The first value in the minuend sum.
firstRightFixed64The second value in the minuend sum.
secondLeftFixed64The first value in the subtrahend sum.
secondRightFixed64The second value in the subtrahend sum.
resultFixed64The exact difference when representable; otherwise, default.
Returns
Operators
operator +(Fixed64, Fixed64)
Adds two Fixed64 numbers, with saturating behavior in case of overflow.
public static Fixed64 operator +(Fixed64 x, Fixed64 y)
Parameters
Returns
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
Returns
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
Returns
operator --(Fixed64)
Decrements a Fixed64 number by one, with saturating behavior in case of overflow.
public static Fixed64 operator --(Fixed64 a)
Parameters
aFixed64The 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
Returns
operator /(Fixed64, int)
Divides a Fixed64 by an integer, handling division by zero and overflow.
public static Fixed64 operator /(Fixed64 x, int y)
Parameters
Returns
operator /(int, Fixed64)
Divides an integer by a Fixed64, handling division by zero and overflow.
public static Fixed64 operator /(int y, Fixed64 x)
Parameters
Returns
operator ==(Fixed64, Fixed64)
Determines whether two Fixed64 instances are equal.
public static bool operator ==(Fixed64 left, Fixed64 right)
Parameters
Returns
operator ==(Fixed64, int)
Determines whether a Fixed64 instance is equal to an integer.
public static bool operator ==(Fixed64 left, int right)
Parameters
Returns
operator ==(int, Fixed64)
Determines whether an integer is equal to a Fixed64 instance.
public static bool operator ==(int left, Fixed64 right)
Parameters
Returns
explicit operator decimal(Fixed64)
Converts a Fixed64 value to its decimal representation.
public static explicit operator decimal(Fixed64 value)
Parameters
valueFixed64The Fixed64 value to convert to decimal.
Returns
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
valueFixed64The Fixed64 value to convert to a double.
Returns
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
valueFixed64The Fixed64 value to convert to an integer.
Returns
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
valueFixed64The Fixed64 value to convert to a long integer.
Returns
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
valueFixed64The Fixed64 value to convert to a float.
Returns
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
valuedecimalThe decimal value to convert to a Fixed64 instance.
Returns
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
valuedoubleThe double-precision floating-point number to convert to a Fixed64 value.
Returns
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
valueintThe 32-bit signed integer to convert to a Fixed64 value.
Returns
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
valuelongThe 64-bit signed integer to convert to a Fixed64 value.
Returns
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
valuefloatThe single-precision floating-point value to convert to Fixed64.
Returns
operator >(Fixed64, Fixed64)
Determines whether one Fixed64 is greater than another.
public static bool operator >(Fixed64 x, Fixed64 y)
Parameters
Returns
operator >(Fixed64, int)
Determines whether a Fixed64 is greater than an integer.
public static bool operator >(Fixed64 x, int y)
Parameters
Returns
operator >(int, Fixed64)
Determines whether an integer is greater than a Fixed64.
public static bool operator >(int y, Fixed64 x)
Parameters
Returns
operator >=(Fixed64, Fixed64)
Determines whether one Fixed64 is greater than or equal to another.
public static bool operator >=(Fixed64 x, Fixed64 y)
Parameters
Returns
operator >=(Fixed64, int)
Determines whether Fixed64 is greater than or equal to an integer.
public static bool operator >=(Fixed64 x, int y)
Parameters
Returns
operator >=(int, Fixed64)
Determines whether an integer is greater than or equal to a Fixed64.
public static bool operator >=(int y, Fixed64 x)
Parameters
Returns
operator ++(Fixed64)
Increments a Fixed64 number by one, with saturating behavior in case of overflow.
public static Fixed64 operator ++(Fixed64 a)
Parameters
aFixed64The 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
Returns
operator !=(Fixed64, int)
Determines whether a Fixed64 instance is not equal to an integer.
public static bool operator !=(Fixed64 left, int right)
Parameters
Returns
operator !=(int, Fixed64)
Determines whether an integer is equal to a Fixed64 instance.
public static bool operator !=(int left, Fixed64 right)
Parameters
Returns
operator <<(Fixed64, int)
Bitwise left shift operator.
public static Fixed64 operator <<(Fixed64 a, int shift)
Parameters
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
Returns
operator <(Fixed64, int)
Determines whether one Fixed64 is less than an integer.
public static bool operator <(Fixed64 x, int y)
Parameters
Returns
operator <(int, Fixed64)
Determines whether an integer is less than a Fixed64.
public static bool operator <(int y, Fixed64 x)
Parameters
Returns
operator <=(Fixed64, Fixed64)
Determines whether one Fixed64 is less than or equal to another.
public static bool operator <=(Fixed64 x, Fixed64 y)
Parameters
Returns
operator <=(Fixed64, int)
Determines whether a Fixed64 is less than or equal to an integer.
public static bool operator <=(Fixed64 x, int y)
Parameters
Returns
operator <=(int, Fixed64)
Determines whether an integer is less than or equal to a Fixed64.
public static bool operator <=(int y, Fixed64 x)
Parameters
Returns
operator %(Fixed64, Fixed64)
Computes the remainder of division of one Fixed64 number by another.
public static Fixed64 operator %(Fixed64 x, Fixed64 y)
Parameters
Returns
operator %(Fixed64, int)
Computes the remainder of division of a Fixed64 by an int.
public static Fixed64 operator %(Fixed64 x, int y)
Parameters
Returns
operator %(int, Fixed64)
Computes the remainder of division of an int by a Fixed64.
public static Fixed64 operator %(int x, Fixed64 y)
Parameters
Returns
operator *(Fixed64, Fixed64)
Multiplies two Fixed64 numbers, handling overflow and rounding.
public static Fixed64 operator *(Fixed64 x, Fixed64 y)
Parameters
Returns
operator *(Fixed64, int)
Multiplies a Fixed64 by an integer, with overflow handling.
public static Fixed64 operator *(Fixed64 x, int y)
Parameters
Returns
operator *(int, Fixed64)
Multiplies a Fixed64 by an integer, with overflow handling.
public static Fixed64 operator *(int x, Fixed64 y)
Parameters
Returns
operator >>(Fixed64, int)
Bitwise right shift operator.
public static Fixed64 operator >>(Fixed64 a, int shift)
Parameters
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
Returns
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
Returns
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
Returns
operator -(Fixed64)
Unary negation operator.
public static Fixed64 operator -(Fixed64 x)
Parameters
xFixed64