Currency: Difference between revisions
Content added Content deleted
(Added Wren) |
(→{{header|Ruby}}: Added Ruby) |
||
Line 1,262: | Line 1,262: | ||
tax thereon @ 7.65 : 1683000000.44 |
tax thereon @ 7.65 : 1683000000.44 |
||
total price after tax : 23683000006.16 |
total price after tax : 23683000006.16 |
||
</pre> |
|||
=={{header|Ruby}}== |
|||
<lang ruby>require 'bigdecimal/util' |
|||
before_tax = 4000000000000000 * 5.50.to_d + 2 * 2.86.to_d |
|||
tax = (before_tax * 0.0765.to_d).round(2) |
|||
total = before_tax + tax |
|||
puts "Before tax: $#{before_tax.to_s('F')} |
|||
Tax: $#{tax.to_s('F')} |
|||
Total: $#{total.to_s('F')}" |
|||
</lang> |
|||
{{out}} |
|||
<pre>Pre tax: $22000000000000005.72 |
|||
Tax: $1683000000000000.44 |
|||
Total: $23683000000000006.16 |
|||
</pre> |
</pre> |
||