コード例 #1
0
ファイル: rational.c プロジェクト: alloy/mr-experimental
/*
 * call-seq:
 *    int.gcdlcm(int2)  ->  array
 *
 * Returns an array; [int.gcd(int2), int.lcm(int2)].
 *
 * For example:
 *
 *    2.gcdlcm(2)                    #=> [2, 2]
 *    3.gcdlcm(-7)                   #=> [1, 21]
 *    ((1<<31)-1).gcdlcm((1<<61)-1)  #=> [1, 4951760154835678088235319297]
 */
VALUE
rb_gcdlcm(VALUE self, SEL sel, VALUE other)
{
    other = nurat_int_value(other);
    return rb_assoc_new(f_gcd(self, other), f_lcm(self, other));
}
コード例 #2
0
ファイル: rational.c プロジェクト: Sophrinix/iphone-macruby
VALUE
rb_gcdlcm(VALUE self, VALUE other)
{
    nurat_int_check(other);
    return rb_assoc_new(f_gcd(self, other), f_lcm(self, other));
}
コード例 #3
0
ファイル: rational.c プロジェクト: alloy/mr-experimental
/*
 * call-seq:
 *    int.lcm(int2)  ->  integer
 *
 * Returns the least common multiple (always positive).  0.lcm(x) and
 * x.lcm(0) return zero.
 *
 * For example:
 *
 *    2.lcm(2)                    #=> 2
 *    3.lcm(-7)                   #=> 21
 *    ((1<<31)-1).lcm((1<<61)-1)  #=> 4951760154835678088235319297
 */
VALUE
rb_lcm(VALUE self, SEL sel, VALUE other)
{
    other = nurat_int_value(other);
    return f_lcm(self, other);
}
コード例 #4
0
ファイル: rational.c プロジェクト: Sophrinix/iphone-macruby
VALUE
rb_lcm(VALUE self, VALUE other)
{
    nurat_int_check(other);
    return f_lcm(self, other);
}