Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a decimal[1] value in an Ion stream.

[1] https://amazon-ion.github.io/ion-docs/docs/spec.html#decimal

Hierarchy

  • __type<NumberConstructor, this> & Number
    • Decimal

Index

Constructors

constructor

  • new Decimal(value: Decimal, annotations?: string[]): Decimal
  • new Decimal(value: string, annotations?: string[]): Decimal
  • new Decimal(value: number, annotations?: string[]): Decimal
  • Constructor.

    Parameters

    • value: Decimal

      The Ion decimal value to represent as a decimal.

    • Optional annotations: string[]

      An optional array of strings to associate with value.

    Returns Decimal

  • Constructor.

    Parameters

    • value: string

      The text Ion value to be parsed as a decimal.

    • Optional annotations: string[]

      An optional array of strings to associate with value.

    Returns Decimal

  • Constructor.

    Parameters

    • value: number

      The number value to represent as a decimal.

    • Optional annotations: string[]

      An optional array of strings to associate with value.

    Returns Decimal

Properties

_ionAnnotations

_ionAnnotations: string[]

_ionType

_ionType: IonType

Static Readonly EPSILON

EPSILON: number

The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 that is representable as a Number value, which is approximately: 2.2204460492503130808472633361816 x 10‍−‍16.

Static Readonly MAX_SAFE_INTEGER

MAX_SAFE_INTEGER: number

The value of the largest integer n such that n and n + 1 are both exactly representable as a Number value. The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.

Static Readonly MAX_VALUE

MAX_VALUE: number

The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308.

Static Readonly MIN_SAFE_INTEGER

MIN_SAFE_INTEGER: number

The value of the smallest integer n such that n and n − 1 are both exactly representable as a Number value. The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).

Static Readonly MIN_VALUE

MIN_VALUE: number

The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324.

Static Readonly NEGATIVE_INFINITY

NEGATIVE_INFINITY: number

A value that is less than the largest negative number that can be represented in JavaScript. JavaScript displays NEGATIVE_INFINITY values as -infinity.

Static Readonly NaN

NaN: number

A value that is not a number. In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function.

Static Readonly POSITIVE_INFINITY

POSITIVE_INFINITY: number

A value greater than the largest number that can be represented in JavaScript. JavaScript displays POSITIVE_INFINITY values as infinity.

Methods

_setAnnotations

  • _setAnnotations(annotations: string[]): void
  • Parameters

    • annotations: string[]

    Returns void

_unsupportedOperation

  • _unsupportedOperation<T>(functionName: string): never
  • Type parameters

    Parameters

    • functionName: string

    Returns never

_valueEquals

  • _valueEquals(other: any, options?: { coerceNumericType: boolean; epsilon?: null | number; ignoreAnnotations?: boolean; ignoreTimestampPrecision?: boolean; onlyCompareIon?: boolean }): boolean
  • Parameters

    • other: any
    • options: { coerceNumericType: boolean; epsilon?: null | number; ignoreAnnotations?: boolean; ignoreTimestampPrecision?: boolean; onlyCompareIon?: boolean } = ...
      • coerceNumericType: boolean
      • Optional epsilon?: null | number
      • Optional ignoreAnnotations?: boolean
      • Optional ignoreTimestampPrecision?: boolean
      • Optional onlyCompareIon?: boolean

    Returns boolean

allFields

  • allFields(): [string, Value[]][]
  • Returns [string, Value[]][]

as

bigIntValue

  • bigIntValue(): null | bigint
  • Returns null | bigint

booleanValue

  • booleanValue(): null | boolean
  • Returns null | boolean

dateValue

  • dateValue(): null | Date
  • Returns null | Date

decimalValue

deleteField

  • deleteField(name: string): boolean
  • Parameters

    • name: string

    Returns boolean

elements

equals

  • equals(other: any, options?: { epsilon?: null | number }): boolean
  • Implementation of the dom.Value interface method equals()

    Parameters

    • other: any
    • options: { epsilon?: null | number } = ...
      • Optional epsilon?: null | number

    Returns boolean

fieldNames

  • fieldNames(): string[]
  • Returns string[]

fields

  • fields(): [string, Value][]
  • Returns [string, Value][]

get

getAll

getAnnotations

  • getAnnotations(): string[]
  • Returns string[]

getType

ionEquals

  • ionEquals(other: Value, options?: { epsilon?: null | number; ignoreAnnotations?: boolean; ignoreTimestampPrecision?: boolean }): boolean
  • Implementation of the dom.Value interface method ionEquals()

    Parameters

    • other: Value
    • options: { epsilon?: null | number; ignoreAnnotations?: boolean; ignoreTimestampPrecision?: boolean } = ...
      • Optional epsilon?: null | number
      • Optional ignoreAnnotations?: boolean
      • Optional ignoreTimestampPrecision?: boolean

    Returns boolean

isNull

  • isNull(): boolean
  • Returns boolean

numberValue

  • numberValue(): number
  • Returns number

stringValue

  • stringValue(): null | string
  • Returns null | string

timestampValue

toExponential

  • toExponential(fractionDigits?: number): string
  • Returns a string containing a number represented in exponential notation.

    Parameters

    • Optional fractionDigits: number

      Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.

    Returns string

toFixed

  • toFixed(fractionDigits?: number): string
  • Returns a string representing a number in fixed-point notation.

    Parameters

    • Optional fractionDigits: number

      Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.

    Returns string

toLocaleString

  • toLocaleString(): string
  • toLocaleString(locales?: string | string[], options?: NumberFormatOptions): string
  • Returns a date converted to a string using the current locale.

    Returns string

  • Converts a number to a string by using the current or specified locale.

    Parameters

    • Optional locales: string | string[]

      A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.

    • Optional options: NumberFormatOptions

      An object that contains one or more properties that specify comparison options.

    Returns string

toPrecision

  • toPrecision(precision?: number): string
  • Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.

    Parameters

    • Optional precision: number

      Number of significant digits. Must be in the range 1 - 21, inclusive.

    Returns string

toString

  • toString(): string
  • Returns string

uInt8ArrayValue

  • uInt8ArrayValue(): null | Uint8Array
  • Returns null | Uint8Array

valueOf

  • valueOf(): number
  • Returns number

writeTo

  • writeTo(writer: Writer): void
  • Parameters

    Returns void

Static _fromJsValue

  • _fromJsValue(jsValue: any, annotations: string[]): Value
  • Parameters

    • jsValue: any
    • annotations: string[]

    Returns Value

Static _getIonType

Static isFinite

  • isFinite(number: unknown): boolean
  • Returns true if passed value is finite. Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a number. Only finite values of the type number, result in true.

    Parameters

    • number: unknown

      A numeric value.

    Returns boolean

Static isInteger

  • isInteger(number: unknown): boolean
  • Returns true if the value passed is an integer, false otherwise.

    Parameters

    • number: unknown

      A numeric value.

    Returns boolean

Static isNaN

  • isNaN(number: unknown): boolean
  • Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter to a number. Only values of the type number, that are also NaN, result in true.

    Parameters

    • number: unknown

      A numeric value.

    Returns boolean

Static isSafeInteger

  • isSafeInteger(number: unknown): boolean
  • Returns true if the value passed is a safe integer.

    Parameters

    • number: unknown

      A numeric value.

    Returns boolean

Static parseFloat

  • parseFloat(string: string): number
  • Converts a string to a floating-point number.

    Parameters

    • string: string

      A string that contains a floating-point number.

    Returns number

Static parseInt

  • parseInt(string: string, radix?: number): number
  • Converts A string to an integer.

    Parameters

    • string: string
    • Optional radix: number

      A value between 2 and 36 that specifies the base of the number in numString. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.

    Returns number