編集

次の方法で共有


FloatExtensions.Approximately(Single, Single, Single) Method

Definition

Checks if two numbers are approximately equal. Similar to Mathf.Approximately(float, float), but the tolerance can be specified.

public:
[System::Runtime::CompilerServices::Extension]
 static bool Approximately(float number, float other, float tolerance);
public static bool Approximately (this float number, float other, float tolerance);
static member Approximately : single * single * single -> bool
<Extension()>
Public Function Approximately (number As Single, other As Single, tolerance As Single) As Boolean

Parameters

number
Single

One of the numbers to compare.

other
Single

The other number to compare.

tolerance
Single

The amount of tolerance to allow while still considering the numbers approximately equal.

Returns

True if the difference between the numbers is less than or equal to the tolerance, false otherwise.

Applies to