Skip to main content Link Search Menu Expand Document (external link)

RoundingOption overview

This module implements a CVRoundingOption which describes the possible options to round a number or BigDecimal and implements the rounding algortithm


Table of contents


Constructors

make

Constructs a CVRoundingOption with the specified precision and roundingMode

Signature

export declare const make: ({
  precision,
  roundingMode
}?: {
  readonly precision?: number
  readonly roundingMode?: CVRoundingMode.Type
}) => Type

Destructors

precision

Returns the precision property of self

Signature

export declare const precision: MTypes.OneArgFunction<Type, number>

roundingMode

Returns the roundingMode property of self

Signature

export declare const roundingMode: MTypes.OneArgFunction<Type, CVRoundingMode.Type>

toBigDecimalRounder

Builds a BigDecimal Rounder implementing self, i.e a function that rounds a BigDecimal as specified by self

Signature

export declare const toBigDecimalRounder: (self: Type) => MTypes.OneArgFunction<BigDecimal.BigDecimal>

toNumberRounder

Builds a number Rounder implementing self, i.e a function that rounds a number as specified by self

Signature

export declare const toNumberRounder: (self: Type) => MTypes.OneArgFunction<number>

Equivalences

equivalence

Equivalence

Signature

export declare const equivalence: Equivalence.Equivalence<Type>

Guards

has

Type guard

Signature

export declare const has: (u: unknown) => u is Type

Instances

halfExpand2

CVRoundingOption instance that uses the HalfExpand CVRoundingMode and precision=2. Can be used in accounting apps of most countries througout the world

Signature

export declare const halfExpand2: Type

Models

Type (interface)

CVRoundingOption Type

Signature

export interface Type extends Equal.Equal, MInspectable.Type, Pipeable.Pipeable {
  /** The precision at which to round the number. Must be a finite positive integer. */
  readonly precision: number

  /** The rounding mode to use */
  readonly roundingMode: CVRoundingMode.Type

  /** @internal */
  readonly [_TypeId]: _TypeId
}

Module markers

moduleTag

Module tag

Signature

export declare const moduleTag: "@parischap/conversions/RoundingOption/"