fix: Don't cast numeric types via boxing
This is illegal
This commit is contained in:
1 parent
195c24ffef
commit
af816bb905
1 file changed
+2
-2
@@ -218,8 +218,8 @@ namespace bts.utils {
|
||||
public static decimal round_to_decimal<T>(T value, int decimals = API_DECIMAL_PRECISION)
|
||||
where T : IFloatingPoint<T> =>
|
||||
T.IsNaN(value) ? 0 :
|
||||
// TODO: avoid boxing/unboxing
|
||||
(decimal)(object)T.Round(value, decimals, MidpointRounding.AwayFromZero);
|
||||
NumericCastInConverter<T>.to_decimal(
|
||||
T.Round(value, decimals, MidpointRounding.AwayFromZero));
|
||||
|
||||
public static bool is_int<T>(T value) where T : IFloatingPoint<T> =>
|
||||
epsilon_equals(value, T.Round(value));
|
||||
|
||||
Reference in new issue
Block a user