liveBook · Manning

Monetary amount

Also called Money

A monetary amount is a quantity of money represented by a numeric value together with a currency.

How 2 Manning books explain it

Learn Go with Pocket-Sized Projects

An amount is a monetary value whose numeric representation is interpreted with a currency and subject to supported precision constraints.

How it is used
Models the input and output values of a currency-conversion command-line tool.
How deep it goes
Implements construction, fixed-precision representation, conversion, validation, and testing, while bounding supported values.
Examples
Uses 19.8875 Canadian dollars to demonstrate excess precision and 34.98 USD to EUR as a conversion test.
What you can do after
Build it from scratch as a Go amount type with precision checks and conversion-result validation.

Read how Learn Go with Pocket-Sized Projects explains monetary amount →

Building User-Friendly DSLs

A DSL type whose values represent monetary amounts.

How it is used
Enables rental-price attributes and expressions to represent dollar values distinctly from percentages and date ranges.
How deep it goes
Works through bottom-up expression typing on ASTs, including references, binary operations, parentheses, and an untyped fallback.
Examples
Uses a discounted rental-price expression with amount references, a percentage discount, of, and subtraction.
What you can do after
Evaluate/understand whether rental-price expressions compute to an amount and why invalid type combinations require errors.

Read how Building User-Friendly DSLs explains monetary amount →

Also covered in

What to know first

Related concepts

Questions about monetary amount

What is monetary amount?

A monetary amount is a quantity of money represented by a numeric value together with a currency.

Which Manning books explain monetary amount?

Learn Go with Pocket-Sized Projects and Building User-Friendly DSLs.

What should I know before learning monetary amount?

Manning books that teach monetary amount usually introduce float64 and floating-point arithmetic first.

What kinds of monetary amount are there?

Kinds of monetary amount include account balance.

What are the parts of monetary amount?

Monetary amount includes currency.

What is monetary amount also called?

Monetary amount is also called Money.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.