Skip to content

Modern Finance Currency

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

Home › Finance › Finance › Currency

Currency

Holds an exact amount with four decimal places, for money that needs no more.

Syntax

Currency(1)
Currency(2)

Examples

#import "std/money"
using money

'' A FIXED-POINT decimal: four decimal places in a longint, so money
'' arithmetic is exact where a double is not
dim as Currency c = CurrencyFromDouble( 0.1 )
dim as Currency d = CurrencyFromDouble( 0.2 )

print ( c + d ).ToString( )  '' 0.3000 -- exact

'' The double sum PRINTS as 0.3, which is why the error is so easy to
'' miss, but it is not 0.3 and the comparison says so
print 0.1 + 0.2              '' 0.3
print ( 0.1 + 0.2 = 0.3 )    '' 0 -- false

print c.Raw( )               '' 1000 -- the underlying scaled integer

Library: Finance
Category: Finance
Documented under: Nothing Becomes A Keyword

Clone this wiki locally