mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 20:40:48 +01:00
Update README to include printed out values in comments
This commit is contained in:
parent
06a2bf2ff6
commit
2acc1d75ba
1 changed files with 6 additions and 6 deletions
12
README.md
12
README.md
|
@ -42,12 +42,12 @@ func main() {
|
|||
preTax := subtotal.Mul(fee.Add(decimal.NewFromFloat(1)))
|
||||
|
||||
total := preTax.Mul(taxRate.Add(decimal.NewFromFloat(1)))
|
||||
|
||||
fmt.Println("Subtotal:", subtotal)
|
||||
fmt.Println("Pre-tax:", preTax)
|
||||
fmt.Println("Taxes:", total.Sub(preTax))
|
||||
fmt.Println("Total:", total)
|
||||
fmt.Println("Tax rate:", total.Sub(preTax).Div(preTax))
|
||||
|
||||
fmt.Println("Subtotal:", subtotal) // => Subtotal: 408.06
|
||||
fmt.Println("Pre-tax:", preTax) // => Pre-tax: 422.3421
|
||||
fmt.Println("Taxes:", total.Sub(preTax)) // => Taxes: 37.482861375
|
||||
fmt.Println("Total:", total) // => Total: 459.824961375
|
||||
fmt.Println("Tax rate:", total.Sub(preTax).Div(preTax)) // => Tax rate: 0.08875
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue