Skip to content
master
Switch branches/tags
Go to file
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.md

mruby-rational

Rational class for mruby.

This library does not support build rational instance by string value yet.

Example

> a = Rational(1, 4)
 => (1/4)

> b = Rational(2, 3)
 => (2/3)

> a + b
 => (11/12)

> (a + b).to_f
 => 0.91666666666667

> x = Rational(1, 3) * 2
 => (2/3)

> y = Rational(1, 2)
 => (1/2)

> x * y
 => (1/3)

Implemented methods

Rational class

method impl. note
Rational#* o
Rational#** o
Rational#+ o
Rational#- o
Rational#/ o
Rational#quo o
Rational#<=> o
Rational#== o
Rational#coerce o
Rational#denominator o
Rational#fdiv o
Rational#floor o
Rational#inspect o
Rational#marshal_dump o
Rational#marshal_load o
Rational#numerator o
Rational#rationalize
Rational#round o
Rational#to_f o
Rational#to_i o
Rational#truncate o
Rational#to_r o
Rational#to_s o
  • Non regular methods
method impl. note
Rational.new o
Rational.convert o

Kernel class

method impl. note
Kernel.#Rational o

Numeric class

method impl. note
Numeric#quo o

License

MIT License

https://github.com/dyama/mruby-rational/blob/master/LICENSE

Author

dyama dyama@member.fsf.org

About

Rational class for mruby.

Resources

License

Releases

No releases published

Packages

No packages published

Languages