
import Foundation

var amount = Decimal(string: "19.498743")!
var rate = Decimal(string: "2.1743")!

var taxes = amount * rate / 100
var rounded = Decimal()
NSDecimalRound(&rounded, &taxes, 2, .plain)
print(rounded.formatted(.currency(code: "USD")))  // US$0.42
