Method: DataView#get_float32

Defined in:
ext/type_array/data_view.c

#get_float32(2) ⇒ Float

Gets a float32 value from a given offset, using the provided endianness.

Examples

buf = ArrayBuffer.new(100)   =>  ArrayBuffer
view = DataView.new(buf)     =>  DataView
view.set_float32(2, 77.643)  =>  nil
view.get_float32(2)          =>  758

Returns:

  • (Float)


471
472
473
474
475
# File 'ext/type_array/data_view.c', line 471

static VALUE rb_data_view_get_float32(int argc, VALUE *argv, VALUE obj)
{
    DataViewAget(obj);
    return rb_float_new((double)rb_type_array_get_float32(buf->buf, index, little_endian));
}