SQL Server
是否为float
和real
类型定义epsilon常数?
换句话说,一个足够小的值被认为是无关紧要的?
在C#中,有double.Epsilon
和float.Epsilon
常量。
不幸的是,它们太小而无法在SQL Server中使用(AFAIK认为它们等于0)。
//C#
public struct Single
{
public const float Epsilon = (float)1.4e-45;
}
public struct Double
{
public const double Epsilon = 4.9406564584124654E-324;
}
//SQL Server
select CAST('4.9406564584124654e-324' AS float) //returns 0
select CAST('1.4e-45' AS real) //returns 0