mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-23 00:38:47 +00:00
Add float/double.ToBoolean
This commit is contained in:
parent
1ee7e59f91
commit
27a370cffe
@ -130,6 +130,18 @@ namespace X10D.DoubleExtensions
|
||||
return Math.Round(value / nearest) * nearest;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the value of the current double-precision floating-point number to an equivalent Boolean value.
|
||||
/// </summary>
|
||||
/// <param name="value">The value to convert.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true" /> if <paramref name="value" /> is not zero, or <see langword="false" /> otherwise.
|
||||
/// </returns>
|
||||
public static bool ToBoolean(this float value)
|
||||
{
|
||||
return value != 0.0;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static double LerpInternal(double a, double b, double t)
|
||||
{
|
||||
|
@ -131,6 +131,18 @@ namespace X10D.SingleExtensions
|
||||
return (float)((double)value).Round(nearest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the value of the current single-precision floating-point number to an equivalent Boolean value.
|
||||
/// </summary>
|
||||
/// <param name="value">The value to convert.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true" /> if <paramref name="value" /> is not zero, or <see langword="false" /> otherwise.
|
||||
/// </returns>
|
||||
public static bool ToBoolean(this float value)
|
||||
{
|
||||
return value != 0.0f;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static float LerpInternal(float a, float b, float t)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user