| 1 |
#include "ruby.h" |
| 2 |
|
| 3 |
static VALUE |
| 4 |
system_nextafter_m(VALUE klass, VALUE vx, VALUE vy) |
| 5 |
{ |
| 6 |
double x, y, z; |
| 7 |
|
| 8 |
x = NUM2DBL(vx); |
| 9 |
y = NUM2DBL(vy); |
| 10 |
z = nextafter(x, y); |
| 11 |
|
| 12 |
return DBL2NUM(z); |
| 13 |
} |
| 14 |
|
| 15 |
#define nextafter missing_nextafter |
| 16 |
#include "../../../missing/nextafter.c" |
| 17 |
#undef nextafter |
| 18 |
|
| 19 |
static VALUE |
| 20 |
missing_nextafter_m(VALUE klass, VALUE vx, VALUE vy) |
| 21 |
{ |
| 22 |
double x, y, z; |
| 23 |
|
| 24 |
x = NUM2DBL(vx); |
| 25 |
y = NUM2DBL(vy); |
| 26 |
z = missing_nextafter(x, y); |
| 27 |
|
| 28 |
return DBL2NUM(z); |
| 29 |
} |
| 30 |
|
| 31 |
void |
| 32 |
Init_nextafter(VALUE klass) |
| 33 |
{ |
| 34 |
rb_define_singleton_method(klass, "system_nextafter", system_nextafter_m, 2); |
| 35 |
rb_define_singleton_method(klass, "missing_nextafter", missing_nextafter_m, 2); |
| 36 |
} |