Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 1.51 KB

README.md

File metadata and controls

64 lines (47 loc) · 1.51 KB

rationals

Build Status Erlang Versions Tag

Project Logo

Rational numbers in Erlang

Build & Test

$ rebar3 compile
$ rebar3 check

Usage

1> Third = rationals:new(1, 3).
{fraction,1,3}
2> Quarter = rationals:new(1, 4).
{fraction,1,4}
3> rationals:numerator(Quarter).
1
4> rationals:denominator(Quarter).
4
5> rationals:add(Quarter, Third).
{fraction,7,12}
6> rationals:multiply(Quarter, Third).
{fraction,1,12}
7> rationals:gcd(64, 72).
8

See more examples in test/rationals_SUITE.erl; see rationals.erl for implementation details.

License

Copyright © 2021, Erlang-Aided Enrichment Center

Copyright © 2014 Peter Morgan [email protected]