返回顶部

收藏

Create a rational number

更多
#!/usr/bin/env ruby

require 'rational'
require 'mathn'

rat = Rational(25/100) # => 1/4 -- lowest terms

标签:Ruby,Number

收藏

0人收藏

支持

0

反对

0

»更多 您可能感兴趣的代码
  1. 2016-10-26 09:14:22Is it between a range by LeoSun
  2. 2016-11-16 18:54:42convert string to oct by jeffsui
  3. 2016-11-19 13:07:17Integer is an instance of the Fixnum class, which inherits the Integer class. by Ω油菜
  4. 2016-11-27 15:21:59.to_s("F") by 杨洋
  5. 2016-02-19 09:28:45Simulating a Subclass of Fixnum by jeffsui
  6. 2016-03-05 09:26:04Comparable operator on rational numbers by 永明
  7. 2016-03-21 15:09:13Add double_upto method to Fixnum by 永明
  8. 2016-04-24 15:03:21Number parser by regular expressons by 好好学习啊
  9. 2016-08-28 17:51:55convert a string by 永明
  10. 2016-08-29 09:26:06puts 120.chr by 永明
  11. 2016-08-29 13:00:35Use each method from Prime class by JustForFly
相关聚客文章
  1. Peter Cooper 发表 2012-10-18 04:05:24 The Past 2 Weeks in Ruby: 1.9.3-p286, JRuby 1.7RC2
  2. trevrowe 发表 2013-02-19 15:54:24 AWS SDK for Ruby Release v1.8.3
  3. 博主 发表 2013-02-08 14:34:17 Ruby 2.0.0-rc2 is released
  4. 博主 发表 2013-03-26 10:08:22 Ruby社区应该去Rails化了
  5. zputee 发表 2013-05-04 03:57:43 ruby中的常量
  6. boohee 发表 2013-05-09 08:19:22 【上海】薄荷科技诚招Ruby On Rails工程师
  7. hpviewer 发表 2013-05-17 10:31:59 深圳ruby基友游玩一日团
  8. xiaoxiao 发表 2013-05-26 12:57:12 ruby 操作xls
  9. angryfrog 发表 2013-06-05 21:10:57 请教大家如何转型成为ruby的开发人员?
  10. luikore 发表 2013-06-13 05:59:05 ruby 版科ऌ学上网
  11. ZeroCool 发表 2013-06-17 17:02:05 Ruby on Linux
  12. sundevilyang 发表 2013-06-26 03:52:54 RAILS 4.0.0 RC2 AND RUBY 2.0 DICTIONARIES

发表评论