Skip to content

A Rational Number library for the Gleam programming language

License

Notifications You must be signed in to change notification settings

schurhammer/ratioed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ratioed

Package Version Hex Docs

A Rational Number library for the Gleam programming language.

Quick start

The example below converts the floats 3/4 and 2/3 into rationals and multiplies them, giving a result of 1/2.

import gleam/io
import ratioed as r

pub fn main() {
  let a = r.from_f(3.0 /. 4.0)
  let b = r.from_f(2.0 /. 3.0)
  r.mul(a, b)
  |> r.to_string
  |> io.println
  // prints 1/2
}

Installation

If available on Hex this package can be added to your Gleam project:

gleam add ratioed

and its documentation can be found at https://hexdocs.pm/ratioed.

About

A Rational Number library for the Gleam programming language

Resources

License

Stars

Watchers

Forks

Packages

No packages published