completed the branch
This commit is contained in:
1 parent
ff10e9ca26
commit
c529ceae56
24 files changed
+1978
-315
No files matched your search
@@ -20,24 +20,88 @@
|
||||
/// 是否在正浮点数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="includeZero"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosDouble(object value, bool includeZero = false)
|
||||
public static bool IsInRangeOfPosDouble(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && (includeZero ? v >= 0 : v > 0);
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在正浮点数范围内(包括0)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosDoubleIncludeZero(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v >= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在负浮点数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="includeZero"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegDouble(object value, bool includeZero = false)
|
||||
public static bool IsInRangeOfNegDouble(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && (includeZero ? v <= 0 : v < 0);
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v < 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在负浮点数范围内(包括0)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegDoubleIncludeZero(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v <= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在正整数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosInt(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
return v > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在正整数范围内(包括0)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosIntIncludeZero(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
return v >= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在负整数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegInt(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
return v < 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在负整数范围内(包括0)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegIntIncludeZero(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
return v <= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user