VB.NET
'''
<summary>
''' 特定の小数点以下で切り捨てをする方法
'''
</summary>
'''
<param name="dblValue"></param>
'''
<param name="intDG"></param>
'''
<returns></returns>
Public Shared Function
FloorWithDgt(dblValue As Double, intDG As Integer) As Double
Dim
dblCF As Double = System.Math.Pow(10, intDG)
Return If(dblValue
> 0, System.Math.Floor(dblValue * dblCF) / dblCF, System.Math.Ceiling(dblValue
* dblCF) / dblCF)
End Function
C#
///
<summary>
/// 特定の小数点以下で切り捨てをする方法
///
</summary>
///
<param name="dblValue"></param>
///
<param name="intDG"></param>
///
<returns></returns>
public static double
FloorWithDgt(double dblValue, int intDG)
{
double
dblCF = System.Math.Pow(10, intDG);
return
dblValue > 0 ? System.Math.Floor(dblValue * dblCF) / dblCF :
System.Math.Ceiling(dblValue
* dblCF) / dblCF;
}