Class RedbDecimal

Namespace: redb.Core.Utils
Assembly: redb.Core.dll

A decimal from a binary floating-point value, the way a reader of a REAL or FLOAT column, an aggregate over one or a
computed result needs it: the decimal of the shortest text that reads back as the same double ("R"). So 123.45
stored as REAL comes back as 123.45 on every runtime.

public static class RedbDecimal

Inheritance

Object→RedbDecimal

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)

From(object)

with a double or a float read through

public static decimal From(object value)

FromDouble(double)

The decimal the double stands for. A value outside the decimal range, NaN or an infinity 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 (123.45 became
123.45000000000000284217094304). Neither is the number that was stored.