Table of Contents

Method AreClose

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

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.

public static bool AreClose(double value1, double value2)

Parameters

value1 double

The first double to compare.

value2 double

The second double to compare.

Returns

bool

bool - the result of the AreClose comparision.

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

public static bool AreClose(RectD rect1, RectD rect2)

Parameters

rect1 RectD

The first rectangle to compare

rect2 RectD

The second rectangle to compare

Returns

bool

Whether or not the two rectangles are equal

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

public static bool AreClose(SizeD size1, SizeD size2)

Parameters

size1 SizeD

The first size to compare

size2 SizeD

The second size to compare

Returns

bool

Whether or not the two Size instances are equal