mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 09:21:24 +08:00
9d76e3f4d1
* feat: input and inputNumber Supports generics * fix: remove debug code * fix: inputNumber performance issues * fix: number type limit and style * fix: inputNumber code format optimization * fix: inputnumber bug * fix: inputnumber bug * fix: drawer demo input generic * fix: inputnumber Improve input experience * fix: fix bugs * fix: add some improvements Co-authored-by: ElderJames <shunjiey@hotmail.com>
51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace AntDesign
|
|
{
|
|
internal static class InputNumberMath
|
|
{
|
|
public static float Round(float x, int digits)
|
|
{
|
|
return MathF.Round(x, digits);
|
|
}
|
|
|
|
public static float? Round(float? x, int digits)
|
|
{
|
|
if (x.HasValue == false) return x;
|
|
return MathF.Round(x.Value, digits);
|
|
}
|
|
|
|
public static decimal Round(decimal d, int decimals)
|
|
{
|
|
return Math.Round(d, decimals);
|
|
}
|
|
|
|
public static decimal? Round(decimal? d, int decimals)
|
|
{
|
|
if (d.HasValue == false) return d;
|
|
return Math.Round(d.Value, decimals);
|
|
}
|
|
|
|
public static double Round(double value, int digits)
|
|
{
|
|
return Math.Round(value, digits);
|
|
}
|
|
public static double? Round(double? value, int digits)
|
|
{
|
|
if (value.HasValue == false) return value;
|
|
return Math.Round(value.Value, digits);
|
|
}
|
|
|
|
public static int Round(int value, int digits)
|
|
{
|
|
return value;
|
|
}
|
|
public static int? Round(int? value, int digits)
|
|
{
|
|
return value;
|
|
}
|
|
}
|
|
}
|