Skip to content
This repository has been archived by the owner on Feb 19, 2019. It is now read-only.

harold-s/numeral_system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

numeral_system

This library implements a conversion from integer to a string numeral system. It implements two numeral systems :

Just require attic_numeral or roman_numeral and methods to_attic_numeral or to_roman_numeral are added to Fixnum :

6.to_roman_numeral #returns "VI"
287.to_roman_numeral #returns "CCLXXXVII" 
287.to_attic_numeral #returns "ΗΗΔΔΔΔΔΔΔΔΠΙΙ"

Both method can take a overflow: true argument which will attempt to construct the number

9999.to_roman_numeral #returns "MMMMMMMMMCMXCIX
10000.to_roman_numeral #raise  exception : ArgumentError: Overflow error, no symbols available for numbers with 10^4 magnitude. (Biggest symbol available : M (1000)), try with overflow=true
10000.to_roman_numeral(overflow: true) #returns "MMMMMMMMMM"

Tests can be launched with rspec

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages