Convert decimal to a fraction

Viewed 153

Given a decimal number, how can you find its fractional equivalent/approximation? For example:

as_fraction(0.1) -> 1/10
as_fraction(0.333333) -> 1/3
as_fraction(514.0/37.0) -> 514/37
0 Answers
Related