Skip to content

Modern Finance MoneyRounding

Paul Squires edited this page Oct 19, 2026 · 4 revisions

Home › Finance › Finance › MoneyRounding

MoneyRounding

Holds a rounding policy: decimal places, rounding mode, and whether to round each amount.

Syntax

p.Digits_  p.Mode_  p.RoundEach_

Examples

#import "std/money"
using money

'' A rounding policy: how many places, which mode, and whether to round
'' every posted amount or only on output.
dim as MoneyRounding p = MoneyRoundingCents( )

dim as boolean halfEven = ( p.Mode_ = DEC_HALF_EVEN )
print p.Digits_                          '' 2
print halfEven                           '' true
print p.RoundEach_                       '' true

'' The mode enum is decimal.tiko's own -- one rule to learn, not two.
dim as MoneyRounding up_ = MoneyRoundingMake( 2, DEC_HALF_UP, true )
print MoneyRound( DecimalParse( "2.665" ).Value( ), p ).ToString( )    '' 2.66
print MoneyRound( DecimalParse( "2.665" ).Value( ), up_ ).ToString( )  '' 2.67

Library: Finance
Category: Finance
Documented under: Nothing Becomes A Keyword
Source: pkg/std/money/fincore.tiko in the tiko repository.

Clone this wiki locally