Description Usage Arguments Examples
Functions for doing basic arithmetic with fractions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | add_fractions(x1, x2)
subtract_fractions(x1, x2)
multiply_fractions(x1, x2)
divide_fractions(x1, x2)
x1 %f+% x2
x1 %f-% x2
x1 %f*% x2
x1 %f/% x2
|
x1 |
The first fraction to be used. |
x2 |
The second fraction to be used. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Use as a function
add_fractions("1/2", "1/4")
# Use with the defined infix operator
"1/8" %f+% "2/3"
"1/2" %f/% "1/2"
# Infix operators can be chained
# Operations go from left to right
"-2" %f-% "1/2" %f+% "2 1/3"
# Use parentheses to control order of operations
"-2" %f-% "1/2" %f+% "2 1/3" %f*% "2"
"-2" %f-% "1/2" %f+% ("2 1/3" %f*% "2")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.