2026-06-05 13:44:39 +09:00

26 lines
669 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WeldingCommon.Utils
{
public class ConvertHelper
{
// 1.000001 or 0.999998 이런 문제로 인하여 추가..
public static decimal DownScaleDecimal(double value, int placePoint)
{
// 10^n을 decimal로 만들어서 스케일
decimal pow = Pow10(placePoint);
return (decimal)value / pow;
}
private static decimal Pow10(int n)
{
decimal d = 1m;
for (int i = 0; i < n; i++) d *= 10m;
return d;
}
}
}