Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 660 lines (562 sloc) 13.204 kb
9c1d230 committing experimental branch content
Laurent Sansonetti authored
1 /**********************************************************************
2
3 math.c -
4
5 $Author: nobu $
6 created at: Tue Jan 25 14:12:56 JST 1994
7
8 Copyright (C) 1993-2007 Yukihiro Matsumoto
9
10 **********************************************************************/
11
12 #include "ruby/ruby.h"
13 #include <math.h>
14 #include <errno.h>
15
16 VALUE rb_mMath;
17
18 static VALUE
19 to_flo(VALUE x)
20 {
8397cfb a quick optimization
Laurent Sansonetti authored
21 if (CLASS_OF(x) == rb_cFloat) {
22 return x;
23 }
9c1d230 committing experimental branch content
Laurent Sansonetti authored
24 if (!rb_obj_is_kind_of(x, rb_cNumeric)) {
25 rb_raise(rb_eTypeError, "can't convert %s into Float",
26 NIL_P(x) ? "nil" :
27 x == Qtrue ? "true" :
28 x == Qfalse ? "false" :
29 rb_obj_classname(x));
30 }
31 return rb_convert_type(x, T_FLOAT, "Float", "to_f");
32 }
33
34 #define Need_Float(x) (x) = to_flo(x)
35 #define Need_Float2(x,y) do {\
36 Need_Float(x);\
37 Need_Float(y);\
38 } while (0)
39
40 static void
41 domain_check(double x, const char *msg)
42 {
43 while(1) {
44 if (errno) {
45 rb_sys_fail(msg);
46 }
47 if (isnan(x)) {
48 #if defined(EDOM)
49 errno = EDOM;
50 #elif defined(ERANGE)
51 errno = ERANGE;
52 #endif
53 continue;
54 }
55 break;
56 }
57 }
58
59
60 /*
61 * call-seq:
62 * Math.atan2(y, x) => float
63 *
64 * Computes the arc tangent given <i>y</i> and <i>x</i>. Returns
65 * -PI..PI.
66 *
67 */
68
69 VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
70 math_atan2(VALUE obj, SEL sel, VALUE y, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
71 {
72 Need_Float2(y, x);
73 return DOUBLE2NUM(atan2(RFLOAT_VALUE(y), RFLOAT_VALUE(x)));
74 }
75
76
77 /*
78 * call-seq:
79 * Math.cos(x) => float
80 *
81 * Computes the cosine of <i>x</i> (expressed in radians). Returns
82 * -1..1.
83 */
84
85 VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
86 math_cos(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
87 {
88 Need_Float(x);
89 return DOUBLE2NUM(cos(RFLOAT_VALUE(x)));
90 }
91
92 /*
93 * call-seq:
94 * Math.sin(x) => float
95 *
96 * Computes the sine of <i>x</i> (expressed in radians). Returns
97 * -1..1.
98 */
99
100 VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
101 math_sin(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
102 {
103 Need_Float(x);
104
105 return DOUBLE2NUM(sin(RFLOAT_VALUE(x)));
106 }
107
108
109 /*
110 * call-seq:
111 * Math.tan(x) => float
112 *
113 * Returns the tangent of <i>x</i> (expressed in radians).
114 */
115
116 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
117 math_tan(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
118 {
119 Need_Float(x);
120
121 return DOUBLE2NUM(tan(RFLOAT_VALUE(x)));
122 }
123
124 /*
125 * call-seq:
126 * Math.acos(x) => float
127 *
128 * Computes the arc cosine of <i>x</i>. Returns 0..PI.
129 */
130
131 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
132 math_acos(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
133 {
134 double d;
135
136 Need_Float(x);
137 errno = 0;
138 d = acos(RFLOAT_VALUE(x));
139 domain_check(d, "acos");
140 return DOUBLE2NUM(d);
141 }
142
143 /*
144 * call-seq:
145 * Math.asin(x) => float
146 *
147 * Computes the arc sine of <i>x</i>. Returns -{PI/2} .. {PI/2}.
148 */
149
150 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
151 math_asin(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
152 {
153 double d;
154
155 Need_Float(x);
156 errno = 0;
157 d = asin(RFLOAT_VALUE(x));
158 domain_check(d, "asin");
159 return DOUBLE2NUM(d);
160 }
161
162 /*
163 * call-seq:
164 * Math.atan(x) => float
165 *
166 * Computes the arc tangent of <i>x</i>. Returns -{PI/2} .. {PI/2}.
167 */
168
169 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
170 math_atan(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
171 {
172 Need_Float(x);
173 return DOUBLE2NUM(atan(RFLOAT_VALUE(x)));
174 }
175
176 #ifndef HAVE_COSH
177 double
178 cosh(double x)
179 {
180 return (exp(x) + exp(-x)) / 2;
181 }
182 #endif
183
184 /*
185 * call-seq:
186 * Math.cosh(x) => float
187 *
188 * Computes the hyperbolic cosine of <i>x</i> (expressed in radians).
189 */
190
191 VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
192 math_cosh(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
193 {
194 Need_Float(x);
195
196 return DOUBLE2NUM(cosh(RFLOAT_VALUE(x)));
197 }
198
199 #ifndef HAVE_SINH
200 double
201 sinh(double x)
202 {
203 return (exp(x) - exp(-x)) / 2;
204 }
205 #endif
206
207 /*
208 * call-seq:
209 * Math.sinh(x) => float
210 *
211 * Computes the hyperbolic sine of <i>x</i> (expressed in
212 * radians).
213 */
214
215 VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
216 math_sinh(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
217 {
218 Need_Float(x);
219 return DOUBLE2NUM(sinh(RFLOAT_VALUE(x)));
220 }
221
222 #ifndef HAVE_TANH
223 double
224 tanh(double x)
225 {
226 return sinh(x) / cosh(x);
227 }
228 #endif
229
230 /*
231 * call-seq:
232 * Math.tanh() => float
233 *
234 * Computes the hyperbolic tangent of <i>x</i> (expressed in
235 * radians).
236 */
237
238 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
239 math_tanh(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
240 {
241 Need_Float(x);
242 return DOUBLE2NUM(tanh(RFLOAT_VALUE(x)));
243 }
244
245 /*
246 * call-seq:
247 * Math.acosh(x) => float
248 *
249 * Computes the inverse hyperbolic cosine of <i>x</i>.
250 */
251
252 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
253 math_acosh(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
254 {
255 double d;
256
257 Need_Float(x);
258 errno = 0;
259 d = acosh(RFLOAT_VALUE(x));
260 domain_check(d, "acosh");
261 return DOUBLE2NUM(d);
262 }
263
264 /*
265 * call-seq:
266 * Math.asinh(x) => float
267 *
268 * Computes the inverse hyperbolic sine of <i>x</i>.
269 */
270
271 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
272 math_asinh(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
273 {
274 Need_Float(x);
275 return DOUBLE2NUM(asinh(RFLOAT_VALUE(x)));
276 }
277
278 /*
279 * call-seq:
280 * Math.atanh(x) => float
281 *
282 * Computes the inverse hyperbolic tangent of <i>x</i>.
283 */
284
285 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
286 math_atanh(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
287 {
288 double d;
289
290 Need_Float(x);
291 errno = 0;
292 d = atanh(RFLOAT_VALUE(x));
293 domain_check(d, "atanh");
294 return DOUBLE2NUM(d);
295 }
296
297 /*
298 * call-seq:
299 * Math.exp(x) => float
300 *
301 * Returns e**x.
302 */
303
304 VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
305 math_exp(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
306 {
307 Need_Float(x);
308 return DOUBLE2NUM(exp(RFLOAT_VALUE(x)));
309 }
310
311 #if defined __CYGWIN__
312 # include <cygwin/version.h>
313 # if CYGWIN_VERSION_DLL_MAJOR < 1005
314 # define nan(x) nan()
315 # endif
316 # define log(x) ((x) < 0.0 ? nan("") : log(x))
317 # define log10(x) ((x) < 0.0 ? nan("") : log10(x))
318 #endif
319
320 /*
321 * call-seq:
322 * Math.log(numeric) => float
323 * Math.log(num,base) => float
324 *
325 * Returns the natural logarithm of <i>numeric</i>.
326 * If additional second argument is given, it will be the base
327 * of logarithm.
328 */
329
330 VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
331 math_log(VALUE rcv, SEL sel, int argc, VALUE *argv)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
332 {
333 VALUE x, base;
334 double d;
335
336 rb_scan_args(argc, argv, "11", &x, &base);
337 Need_Float(x);
338 errno = 0;
339 d = log(RFLOAT_VALUE(x));
340 if (!NIL_P(base)) {
341 Need_Float(base);
342 d /= log(RFLOAT_VALUE(base));
343 }
344 domain_check(d, "log");
345 return DOUBLE2NUM(d);
346 }
347
348 #ifndef log2
349 #ifndef HAVE_LOG2
350 double
351 log2(double x)
352 {
353 return log10(x)/log10(2.0);
354 }
355 #else
356 extern double log2(double);
357 #endif
358 #endif
359
360 /*
361 * call-seq:
362 * Math.log2(numeric) => float
363 *
364 * Returns the base 2 logarithm of <i>numeric</i>.
365 */
366
367 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
368 math_log2(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
369 {
370 double d;
371
372 Need_Float(x);
373 errno = 0;
374 d = log2(RFLOAT_VALUE(x));
375 if (errno) {
376 rb_sys_fail("log2");
377 }
378 return DOUBLE2NUM(d);
379 }
380
381 /*
382 * call-seq:
383 * Math.log10(numeric) => float
384 *
385 * Returns the base 10 logarithm of <i>numeric</i>.
386 */
387
388 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
389 math_log10(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
390 {
391 double d;
392
393 Need_Float(x);
394 errno = 0;
395 d = log10(RFLOAT_VALUE(x));
396 domain_check(d, "log10");
397 return DOUBLE2NUM(d);
398 }
399
400 /*
401 * call-seq:
402 * Math.sqrt(numeric) => float
403 *
404 * Returns the non-negative square root of <i>numeric</i>.
405 */
406
407 VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
408 math_sqrt(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
409 {
410 double d;
411
412 Need_Float(x);
413 errno = 0;
414 d = sqrt(RFLOAT_VALUE(x));
415 domain_check(d, "sqrt");
416 return DOUBLE2NUM(d);
417 }
418
419 /*
420 * call-seq:
421 * Math.cbrt(numeric) => float
422 *
423 * Returns the cube root of <i>numeric</i>.
424 */
425
426 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
427 math_cbrt(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
428 {
429 Need_Float(x);
430 return DOUBLE2NUM(cbrt(RFLOAT_VALUE(x)));
431 }
432
433 /*
434 * call-seq:
435 * Math.frexp(numeric) => [ fraction, exponent ]
436 *
437 * Returns a two-element array containing the normalized fraction (a
438 * <code>Float</code>) and exponent (a <code>Fixnum</code>) of
439 * <i>numeric</i>.
440 *
441 * fraction, exponent = Math.frexp(1234) #=> [0.6025390625, 11]
442 * fraction * 2**exponent #=> 1234.0
443 */
444
445 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
446 math_frexp(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
447 {
448 double d;
449 int exp;
450
451 Need_Float(x);
452
453 d = frexp(RFLOAT_VALUE(x), &exp);
454 return rb_assoc_new(DOUBLE2NUM(d), INT2NUM(exp));
455 }
456
457 /*
458 * call-seq:
459 * Math.ldexp(flt, int) -> float
460 *
461 * Returns the value of <i>flt</i>*(2**<i>int</i>).
462 *
463 * fraction, exponent = Math.frexp(1234)
464 * Math.ldexp(fraction, exponent) #=> 1234.0
465 */
466
467 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
468 math_ldexp(VALUE obj, SEL sel, VALUE x, VALUE n)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
469 {
470 Need_Float(x);
471 return DOUBLE2NUM(ldexp(RFLOAT_VALUE(x), NUM2INT(n)));
472 }
473
474 /*
475 * call-seq:
476 * Math.hypot(x, y) => float
477 *
478 * Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle
479 * with sides <i>x</i> and <i>y</i>.
480 *
481 * Math.hypot(3, 4) #=> 5.0
482 */
483
484 VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
485 math_hypot(VALUE obj, SEL sel, VALUE x, VALUE y)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
486 {
487 Need_Float2(x, y);
488 return DOUBLE2NUM(hypot(RFLOAT_VALUE(x), RFLOAT_VALUE(y)));
489 }
490
491 /*
492 * call-seq:
493 * Math.erf(x) => float
494 *
495 * Calculates the error function of x.
496 */
497
498 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
499 math_erf(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
500 {
501 Need_Float(x);
502 return DOUBLE2NUM(erf(RFLOAT_VALUE(x)));
503 }
504
505 /*
506 * call-seq:
507 * Math.erfc(x) => float
508 *
509 * Calculates the complementary error function of x.
510 */
511
512 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
513 math_erfc(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
514 {
515 Need_Float(x);
516 return DOUBLE2NUM(erfc(RFLOAT_VALUE(x)));
517 }
518
519 /*
520 * call-seq:
521 * Math.gamma(x) => float
522 *
523 * Calculates the gamma function of x.
524 *
525 * Note that gamma(n) is same as fact(n-1) for integer n >= 0.
526 * However gamma(n) returns float and possibly has error in calculation.
527 *
528 * def fact(n) (1..n).inject(1) {|r,i| r*i } end
529 * 0.upto(25) {|i| p [i, Math.gamma(i+1), fact(i)] }
530 * =>
531 * [0, 1.0, 1]
532 * [1, 1.0, 1]
533 * [2, 2.0, 2]
534 * [3, 6.0, 6]
535 * [4, 24.0, 24]
536 * [5, 120.0, 120]
537 * [6, 720.0, 720]
538 * [7, 5040.0, 5040]
539 * [8, 40320.0, 40320]
540 * [9, 362880.0, 362880]
541 * [10, 3628800.0, 3628800]
542 * [11, 39916800.0, 39916800]
543 * [12, 479001599.999999, 479001600]
544 * [13, 6227020800.00001, 6227020800]
545 * [14, 87178291199.9998, 87178291200]
546 * [15, 1307674368000.0, 1307674368000]
547 * [16, 20922789888000.0, 20922789888000]
548 * [17, 3.55687428096001e+14, 355687428096000]
549 * [18, 6.40237370572799e+15, 6402373705728000]
550 * [19, 1.21645100408832e+17, 121645100408832000]
551 * [20, 2.43290200817664e+18, 2432902008176640000]
552 * [21, 5.10909421717094e+19, 51090942171709440000]
553 * [22, 1.12400072777761e+21, 1124000727777607680000]
554 * [23, 2.58520167388851e+22, 25852016738884976640000]
555 * [24, 6.20448401733239e+23, 620448401733239439360000]
556 * [25, 1.5511210043331e+25, 15511210043330985984000000]
557 *
558 */
559
560 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
561 math_gamma(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
562 {
563 double d;
564 Need_Float(x);
565 errno = 0;
566 d = tgamma(RFLOAT_VALUE(x));
567 domain_check(d, "gamma");
568 return DOUBLE2NUM(d);
569 }
570
571 /*
572 * call-seq:
573 * Math.lgamma(x) => [float, -1 or 1]
574 *
575 * Calculates the logarithmic gamma of x and
576 * the sign of gamma of x.
577 *
578 * Math.lgamma(x) is same as
579 * [Math.log(Math.gamma(x).abs), Math.gamma(x) < 0 ? -1 : 1]
580 * but avoid overflow by Math.gamma(x) for large x.
581 */
582
583 #include "lgamma_r.c"
584
585 static VALUE
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
586 math_lgamma(VALUE obj, SEL sel, VALUE x)
9c1d230 committing experimental branch content
Laurent Sansonetti authored
587 {
588 double d;
589 int sign;
590 VALUE v;
591 Need_Float(x);
592 errno = 0;
593 d = lgamma_r(RFLOAT_VALUE(x), &sign);
594 domain_check(d, "lgamma");
595 v = DOUBLE2NUM(d);
596 return rb_assoc_new(v, INT2FIX(sign));
597 }
598
599 /*
600 * The <code>Math</code> module contains module functions for basic
601 * trigonometric and transcendental functions. See class
602 * <code>Float</code> for a list of constants that
603 * define Ruby's floating point accuracy.
604 */
605
606
607 void
608 Init_Math(void)
609 {
610 rb_mMath = rb_define_module("Math");
611
612 #ifdef M_PI
613 rb_define_const(rb_mMath, "PI", DOUBLE2NUM(M_PI));
614 #else
615 rb_define_const(rb_mMath, "PI", DOUBLE2NUM(atan(1.0)*4.0));
616 #endif
617
618 #ifdef M_E
619 rb_define_const(rb_mMath, "E", DOUBLE2NUM(M_E));
620 #else
621 rb_define_const(rb_mMath, "E", DOUBLE2NUM(exp(1.0)));
622 #endif
623
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
624 VALUE rb_cmMath = *(VALUE *)rb_mMath;
625 rb_objc_define_method(rb_cmMath, "atan2", math_atan2, 2);
626 rb_objc_define_method(rb_cmMath, "cos", math_cos, 1);
627 rb_objc_define_method(rb_cmMath, "sin", math_sin, 1);
628 rb_objc_define_method(rb_cmMath, "tan", math_tan, 1);
9c1d230 committing experimental branch content
Laurent Sansonetti authored
629
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
630 rb_objc_define_method(rb_cmMath, "acos", math_acos, 1);
631 rb_objc_define_method(rb_cmMath, "asin", math_asin, 1);
632 rb_objc_define_method(rb_cmMath, "atan", math_atan, 1);
9c1d230 committing experimental branch content
Laurent Sansonetti authored
633
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
634 rb_objc_define_method(rb_cmMath, "cosh", math_cosh, 1);
635 rb_objc_define_method(rb_cmMath, "sinh", math_sinh, 1);
636 rb_objc_define_method(rb_cmMath, "tanh", math_tanh, 1);
9c1d230 committing experimental branch content
Laurent Sansonetti authored
637
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
638 rb_objc_define_method(rb_cmMath, "acosh", math_acosh, 1);
639 rb_objc_define_method(rb_cmMath, "asinh", math_asinh, 1);
640 rb_objc_define_method(rb_cmMath, "atanh", math_atanh, 1);
9c1d230 committing experimental branch content
Laurent Sansonetti authored
641
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
642 rb_objc_define_method(rb_cmMath, "exp", math_exp, 1);
643 rb_objc_define_method(rb_cmMath, "log", math_log, -1);
644 rb_objc_define_method(rb_cmMath, "log2", math_log2, 1);
645 rb_objc_define_method(rb_cmMath, "log10", math_log10, 1);
646 rb_objc_define_method(rb_cmMath, "sqrt", math_sqrt, 1);
647 rb_objc_define_method(rb_cmMath, "cbrt", math_cbrt, 1);
9c1d230 committing experimental branch content
Laurent Sansonetti authored
648
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
649 rb_objc_define_method(rb_cmMath, "frexp", math_frexp, 1);
650 rb_objc_define_method(rb_cmMath, "ldexp", math_ldexp, 2);
9c1d230 committing experimental branch content
Laurent Sansonetti authored
651
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
652 rb_objc_define_method(rb_cmMath, "hypot", math_hypot, 2);
9c1d230 committing experimental branch content
Laurent Sansonetti authored
653
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
654 rb_objc_define_method(rb_cmMath, "erf", math_erf, 1);
655 rb_objc_define_method(rb_cmMath, "erfc", math_erfc, 1);
9c1d230 committing experimental branch content
Laurent Sansonetti authored
656
38078c0 ported the math.c apis to the new runtime
Laurent Sansonetti authored
657 rb_objc_define_method(rb_cmMath, "gamma", math_gamma, 1);
658 rb_objc_define_method(rb_cmMath, "lgamma", math_lgamma, 1);
9c1d230 committing experimental branch content
Laurent Sansonetti authored
659 }
Something went wrong with that request. Please try again.