Learn R Programming

schoolmath (version 0.4.1)

decimal2fraction: convert a decimal-number into fraction

Description

This function converts a decimal number into a fraction

Usage

decimal2fraction(decimal, period = 0)

Arguments

decimal

the decimal number to be converted, given without an repeating ending

period

if the decimal places have an repeating ending (period), set the period here. See examples.

Author

Joerg Schlarmann

Examples

Run this code
## converting 23.4323
decimal2fraction(23.4323)

## converting a number with decimal period, e.g. 12.12344444444444444444
decimal2fraction(12.123, 4)

Run the code above in your browser using DataLab