Class RouteDecimal
A decimal from a binary floating-point value the way an expression, a JSONPath read or a converted body needs it: the
decimal of the shortest text that reads back as the same double ("R"), so 19.95 stays 19.95 and round(2.567, 2)
stays 2.57 on every runtime. The same technique as redb.Core's RedbDecimal, for the packages that do not
reference redb.Core.
public static class RouteDecimal
Inheritance
Methods
ChangeType(object?, Type, IFormatProvider?)
, except that a double or a float asked for as a
public static object? ChangeType(object? value, Type targetType, IFormatProvider? provider = null)
FromDouble(double)
The decimal the double stands for. NaN, an infinity or a value outside the decimal range throws
public static decimal FromDouble(double value)
FromSingle(float)
The decimal the float stands for (the shortest text of the float itself, not of its widening to double).
public static decimal FromSingle(float value)
Remarks
The explicit conversion (decimal)double, which and
use, rounds to 15 significant digits up to .NET 10
(12345678901234.56 became 12345678901234.6) and gives the exact binary value from .NET 11 on
(19.95 became 19.949999999999999289457264240). Neither is the number that was written.