返回顶部

收藏

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-03-13 13:55:56Substituting Variables Into Strings by Jamin
  2. 2016-04-24 15:19:49General Predicates by JustForFly
  3. 2016-08-28 18:05:52convert a character code by Loli控
  4. 2016-08-29 09:45:41Basic Math Operations for integer by jeffsui
  5. 2016-08-29 13:18:13Rational Numbers by LeoSun
  6. 2016-09-06 09:14:07Float predicates by 永明
  7. 2016-09-24 09:16:30Absolute value and sign by 胡晋
  8. 2016-10-26 09:21:13Two transformations in one by JustForFly
  9. 2016-11-11 14:37:48Get the ceiling integer from a float by JustForFly
  10. 2015-12-22 09:37:10Divide two rational numbers by digua
  11. 2016-01-13 12:59:50Calculation on BigDecimal in a function by LeoSun

发表评论