Learn R Programming

lrstat (version 0.2.13)

float_to_fraction: Converting a decimal to a fraction

Description

Converts a decimal to a fraction based on the algorithm from http://stackoverflow.com/a/5128558/221955.

Usage

float_to_fraction(x, tol = 1e-06)

Arguments

x

The fraction in decimal form.

tol

The tolerance level for the conversion error.

Author

Kaifeng Lu, kaifenglu@gmail.com

Examples

Run this code

float_to_fraction(5/3)

Run the code above in your browser using DataLab