Commit 64dfb0b4 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][interpreter] Print float in hex representation

The interpreter is used for testing (including fuzzing) only, and in
these cases it's often important to see the exact value of a float. Both
decimal and scientific notation does not show the full value though, and
decimal representation can also be really long for large values, making
it hard to compare values.
This CL switches this debug output to hexadecimal float values, which
always shows the float value in full precision and is also much shorter
than decimal notation in many cases.

R=ahaas@chromium.org

Bug: chromium:1112099
Change-Id: Ia84824227fcd2f1e763ab89280a202ed44930a71
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2346646Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69323}
parent 3bd6d141
...@@ -3720,10 +3720,10 @@ class WasmInterpreterInternals { ...@@ -3720,10 +3720,10 @@ class WasmInterpreterInternals {
PrintF("i64:%" PRId64 "", val.to<int64_t>()); PrintF("i64:%" PRId64 "", val.to<int64_t>());
break; break;
case ValueType::kF32: case ValueType::kF32:
PrintF("f32:%f", val.to<float>()); PrintF("f32:%a", val.to<float>());
break; break;
case ValueType::kF64: case ValueType::kF64:
PrintF("f64:%lf", val.to<double>()); PrintF("f64:%la", val.to<double>());
break; break;
case ValueType::kS128: { case ValueType::kS128: {
// This defaults to tracing all S128 values as i32x4 values for now, // This defaults to tracing all S128 values as i32x4 values for now,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment