diff --git a/src/c-writer.cc b/src/c-writer.cc index 9dec2148c..96b79554e 100644 --- a/src/c-writer.cc +++ b/src/c-writer.cc @@ -1251,11 +1251,13 @@ void CWriter::Write(const Const& const_) { break; case Type::F32: - Writef("f32_reinterpret_i32(0x%" PRIx32 ")", const_.f32_bits()); + Writef("f32_reinterpret_i32(0x%" PRIx32 " /* %.9g */)", const_.f32_bits(), + Bitcast(const_.f32_bits())); break; case Type::F64: - Writef("f64_reinterpret_i64(0x%" PRIx64 ")", const_.f64_bits()); + Writef("f64_reinterpret_i64(0x%" PRIx64 " /* %.17g */)", + const_.f64_bits(), Bitcast(const_.f64_bits())); break; case Type::V128: { diff --git a/test/wasm2c/tail-calls.txt b/test/wasm2c/tail-calls.txt index e3b51bbe2..22eacd1a4 100644 --- a/test/wasm2c/tail-calls.txt +++ b/test/wasm2c/tail-calls.txt @@ -823,7 +823,7 @@ void w2c_test_tailcaller_0(w2c_test* instance) { u32 var_i0, var_i2; f32 var_f1; var_i0 = 1u; - var_f1 = f32_reinterpret_i32(0x40000000); + var_f1 = f32_reinterpret_i32(0x40000000 /* 2 */); var_i2 = 0u; static_assert(sizeof(struct wasm_multi_if) <= 1024); CHECK_CALL_INDIRECT(instance->w2c_tab, w2c_test_i32_f32, var_i2); @@ -855,7 +855,7 @@ void wasm_tailcall_w2c_test_tailcaller_0(void **instance_ptr, void *tail_call_st u32 var_i0, var_i2; f32 var_f1; var_i0 = 1u; - var_f1 = f32_reinterpret_i32(0x40000000); + var_f1 = f32_reinterpret_i32(0x40000000 /* 2 */); var_i2 = 0u; static_assert(sizeof(struct wasm_multi_if) <= 1024); CHECK_CALL_INDIRECT(instance->w2c_tab, w2c_test_i32_f32, var_i2);