reduce.fraction: Reduce Fractions

Description Usage Arguments Value Author(s) Examples

Description

Reduce fractions to lowest terms using Euclid's Algorithm.

Usage

1
reduce.fraction (ratio)

Arguments

ratio

A vector with two integers. The first element is the numerator of a ratio, and the second element is the denominator.

Value

A vector containing the elements of the reduced fraction. The first element is the numerator of a ratio, and the second element is the denominator.

Author(s)

Santiago Barreda <sbarreda@ucdavis.edu>

Examples

1
2
3
4
5
6
7
8
## an easy one
reduce.fraction (c(100, 200))

## irreducible
reduce.fraction (c(140, 201))

## a hard one
reduce.fraction (c(140, 203))

Example output

[1] 1 2
[1] 140 201
[1] 20 29

phonTools documentation built on May 1, 2019, 6:26 p.m.