Add, subtract, multiply or divide two fractions and return the exact, fully-reduced result. All computation is done in BigInt so there is no floating-point error. Dividing by a zero fraction is a clean 400.
Add, subtract, multiply or divide two fractions and return the exact, fully-reduced result. All computation is done in BigInt so there is no floating-point error. Dividing by a zero fraction is a clean 400.
0.002 USD Coin / request · eip155:8453
POSTx402 · listed
https://fraction.openverbs.com/v1/from-decimal
Convert a decimal string to an exact reduced fraction. For a repeating decimal, set repeat to the number of trailing fractional digits that repeat (e.g. value='0.1666', repeat=1 → 1/6; value='0.3', repeat=1 → 1/3). A non-numeric value is a clean 400.
0.002 USD Coin / request · eip155:8453
POSTx402 · listed
https://fraction.openverbs.com/v1/simplify
Reduce a fraction to lowest terms and describe it: numerator/denominator (denominator normalized positive), sign, whether it is an integer, and a mixed-number form when improper. A zero denominator is a clean 400.
0.002 USD Coin / request · eip155:8453
POSTx402 · listed
https://fraction.openverbs.com/v1/to-decimal
Expand a fraction to its decimal form by exact long division, detecting a repeating cycle and rendering it in parenthesis notation (e.g. 1/6 → '0.1(6)', 1/7 → '0.(142857)'). maxDigits caps a non-repeating expansion. A zero denominator is a clean 400.