Currency and displaying decimal place

Hello,

I am working with a template that includes pricing that is per transaction, the pricing is in USD, and the price is often below a dollar.

The ClauseBase default is that the last decimal place is left off the value if it ends with 0, which makes sense for most decimals. However, for prices in USD it is more common to see $0.70 instead of $0.7. I tried @abs, but that still leads to the rounding. (which still makes sense, but I was hoping it would work)

Thanks,
Elmer

Hi Elmer,

I assume that you do not want to change the default into always having two decimals (which you can do by changing Styling -> Locale -> Decimals), and that you instead want to force just a few numbers into having two decimals.

If so, then please try the @format-nr special function, e.g.

@format-nr(0.7212 USD, "$123.45")

or even simpler (taking the currency symbol & placement from the default styling):

@format-nr(0.7212 USD, 2)

The documentation explains the different options.