From: nobu.nokada@... Date: 2004-01-28T23:39:13+09:00 Subject: Re: float types Hi, At Wed, 28 Jan 2004 19:00:09 +0900, elathan@phys.uoa.gr wrote: > If this isn't supported by the Ruby API I will write my own C macro that > will return true if TYPE == T_FLOAT || TYPE == T_FIXNUM. One thought: if (!NIL_P(val = rb_check_convert_type(arg1, T_STRING, "String", "to_str"))) { foo(RSTRING(val)->ptr, RFLOAT(rb_Float(arg2))->value, RFLOAT(rb_Float(arg3))->value); } else if (!NIL_P(val = rb_check_convert_type(arg1, T_FLOAT, "Float", "to_float"))) { foo(RFLOAT(val)->value, NUM2INT(arg2), NUM2INT(arg3)); } else { rb_raise(rb_eArgError, "unsupported argument %s", rb_obj_classname(arg1)); } -- Nobu Nakada