Method: MessagePack::Packer#write_float32

Defined in:
ext/msgpack/packer_class.c

#write_float32(numeric) ⇒ Object



273
274
275
276
277
278
279
280
281
282
# File 'ext/msgpack/packer_class.c', line 273

static VALUE Packer_write_float32(VALUE self, VALUE numeric)
{
    if(!rb_obj_is_kind_of(numeric, rb_cNumeric)) {
      rb_raise(rb_eArgError, "Expected numeric");
    }

    msgpack_packer_t *pk = MessagePack_Packer_get(self);
    msgpack_packer_write_float(pk, (float)rb_num2dbl(numeric));
    return self;
}