Class NumberValue
Inherited Members
Namespace: Oracle.NoSQL.SDK
Assembly: Oracle.NoSQL.SDK.dll
Syntax
public class NumberValue : FieldValue
Remarks
This class is used to represent values of NoSQL data type Number. Data type Number represents arbitrary precision signed decimal numbers. This class represents the value as C# type Decimal and thus can only hold a subset of values that data type Number can hold. Decimal holds approximate range of ±1.0 x 10^28 to ±7.9228 x 10^28 and has a precision of 28 to 29 decimal digits. This makes it suitable for financial calculations more than for scientific calculations.
Currently it is not possible to retrieve values outside this range from a Number field of a table. Trying to retrieve a value less than MinValue or greater than MaxValue will throw OverflowException. Retrieving the value within this range but with a greater precision than allowed by Decimal will round this value to the nearest Decimal.
Note that because decimal
has higher precision but smaller
range than double
, when comparing
NumberValue and DoubleValue both are
compared as decimal
values if the value represented by
DoubleValue is within the decimal
range,
otherwise the result of comparison is based on the sign of the
double
value. See CompareTo(FieldValue) and
Equals(FieldValue) for more information.
Constructors
Name | Description |
---|---|
NumberValue(Decimal) |
Initializes a new instance of the NumberValue with
the specified decimal value.
|
Properties
Name | Description |
---|---|
AsDecimal |
Gets the value of this instance as decimal .
|
DbType | Gets DbType of this instance which represents the type of this value. |
Methods
Name | Description |
---|---|
SerializeAsJson(Utf8JsonWriter, JsonOutputOptions) | Writes JSON representation of the value to the stream represented by Utf8JsonWriter. |
ToDouble() | Converts the value represented by this instance to a double precision floating point number. |
ToInt32() | Converts the value represented by this instance to a 32-bit signed integer. |
ToInt64() | Converts the value represented by this instance to a 64-bit signed integer. |