- BT_ASSERT(field);
- BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
- BT_ASSERT(bt_field_get_class_type(field) ==
- BT_FIELD_CLASS_TYPE_REAL);
- bt_field_real_set_value(field, value);
+ bt_field_class_type type = bt_field_get_class_type(field);
+ BT_ASSERT_DBG(field);
+ BT_ASSERT_DBG(bt_field_borrow_class_const(field) == fc->ir_fc);
+ BT_ASSERT_DBG(bt_field_class_type_is(type, BT_FIELD_CLASS_TYPE_REAL));
+
+ if (type == BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL) {
+ bt_field_real_single_precision_set_value(field, (float) value);
+ } else {
+ bt_field_real_double_precision_set_value(field, value);
+ }