mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* struct.c (make_struct): remove redefining constant when
conflict. [ruby-dev:24210] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7cf8256075
commit
880d7af47a
5 changed files with 43 additions and 35 deletions
23
math.c
23
math.c
|
@ -331,6 +331,28 @@ math_log(obj, x)
|
|||
return rb_float_new(d);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* Math.log2(numeric) => float
|
||||
*
|
||||
* Returns the base 2 logarithm of <i>numeric</i>.
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
math_log2(obj, x)
|
||||
VALUE obj, x;
|
||||
{
|
||||
double d;
|
||||
|
||||
Need_Float(x);
|
||||
errno = 0;
|
||||
d = log2(RFLOAT(x)->value);
|
||||
if (errno) {
|
||||
rb_sys_fail("log2");
|
||||
}
|
||||
return rb_float_new(d);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* Math.log10(numeric) => float
|
||||
|
@ -511,6 +533,7 @@ Init_Math()
|
|||
|
||||
rb_define_module_function(rb_mMath, "exp", math_exp, 1);
|
||||
rb_define_module_function(rb_mMath, "log", math_log, 1);
|
||||
rb_define_module_function(rb_mMath, "log2", math_log, 1);
|
||||
rb_define_module_function(rb_mMath, "log10", math_log10, 1);
|
||||
rb_define_module_function(rb_mMath, "sqrt", math_sqrt, 1);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue