Table of Contents

Class DoubleUtils

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Contains static methods and properties related to double handling.

public static class DoubleUtils
Inheritance
DoubleUtils

Methods

AreClose(RectD, RectD)

Compares two rectangles for fuzzy equality. This function helps compensate for the fact that double values can acquire error when operated upon

AreClose(SizeD, SizeD)

Compares two Size instances for fuzzy equality. This function helps compensate for the fact that double values can acquire error when operated upon

AreClose(double, double)

AreClose - Returns whether or not two doubles are "close". That is, whether or not they are within epsilon of each other. Note that this epsilon is proportional to the numbers themselves to that AreClose survives scalar multiplication. There are plenty of ways for this to return false even for numbers which are theoretically identical, so no code calling this should fail to work if this returns false. This is important enough to repeat: NB: NO CODE CALLING THIS FUNCTION SHOULD DEPEND ON ACCURATE RESULTS - this should be used for optimizations only.

DoubleToInt(double)
GreaterThan(double, double)

GreaterThan - Returns whether or not the first double is greater than the second double. That is, whether or not the first is strictly greater than and not within epsilon of the other number. Note that this epsilon is proportional to the numbers themselves to that AreClose survives scalar multiplication. Note, There are plenty of ways for this to return false even for numbers which are theoretically identical, so no code calling this should fail to work if this returns false. This is important enough to repeat: NB: NO CODE CALLING THIS FUNCTION SHOULD DEPEND ON ACCURATE RESULTS - this should be used for optimizations only.

GreaterThanOrClose(double, double)

GreaterThanOrClose - Returns whether or not the first double is greater than or close to the second double. That is, whether or not the first is strictly greater than or within epsilon of the other number. Note that this epsilon is proportional to the numbers themselves to that AreClose survives scalar multiplication. Note, There are plenty of ways for this to return false even for numbers which are theoretically identical, so no code calling this should fail to work if this returns false. This is important enough to repeat: NB: NO CODE CALLING THIS FUNCTION SHOULD DEPEND ON ACCURATE RESULTS - this should be used for optimizations only.

IsNaN(double)

Fast implementation of the IsNaN(double) method.

IsOne(double)

IsOne - Returns whether or not the double is "close" to 1. Same as AreClose(double, 1), but this is faster.

IsZero(double)

IsZero - Returns whether or not the double is "close" to 0. Same as AreClose(double, 0), but this is faster.

LessThan(double, double)

LessThan - Returns whether or not the first double is less than the second double. That is, whether or not the first is strictly less than and not within epsilon of the other number. Note that this epsilon is proportional to the numbers themselves to that AreClose survives scalar multiplication. Note, There are plenty of ways for this to return false even for numbers which are theoretically identical, so no code calling this should fail to work if this returns false. This is important enough to repeat: NB: NO CODE CALLING THIS FUNCTION SHOULD DEPEND ON ACCURATE RESULTS - this should be used for optimizations only.

LessThanOrClose(double, double)

LessThanOrClose - Returns whether or not the first double is less than or close to the second double. That is, whether or not the first is strictly less than or within epsilon of the other number. Note that this epsilon is proportional to the numbers themselves to that AreClose survives scalar multiplication. Note, There are plenty of ways for this to return false even for numbers which are theoretically identical, so no code calling this should fail to work if this returns false. This is important enough to repeat: NB: NO CODE CALLING THIS FUNCTION SHOULD DEPEND ON ACCURATE RESULTS - this should be used for optimizations only.