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