Home
Ruby
ActiveRecord
Array
CGI
Class
Collections
Database
Date
Design Patterns
Development
File Directory
GUI
Hash
Language Basics
Method
Network
Number
Rails
Range
Reflection
Statement
String
Threads
Time
Tk
Unit Test
Windows Platform
XML
Rational Numbers « Number « Ruby
Ruby
Number
Rational Numbers
1.
Rational Numbers
2.
how to create a fraction;
3.
Create a rational number
4.
Add two rational number up
5.
Subtract one number from another
6.
Rational number without using Rational class
7.
Multiply two rational numbers
8.
Divide two rational numbers
9.
how to add (+), subtract (-), multiply (*), and divide (/) fractions;
10.
how to perform modulo (%), power (**), and equality (== or <=>);
11.
how to produce a string or a float representation of a fraction (inspect).
12.
Compare two rational numbers
13.
Comparable operator on rational numbers
14.
Inspect a rational number
15.
Power a rational number
16.
Modulo two rational numbers