Making a WebAssembly interpreter in Ruby, part 7: floating-point encoding

Опубликовано: 09 Июнь 2026
на канале: Tom Stuart
167
6

https://github.com/tomstuart/wasminna...

00:00:00 — Waiting to start
00:00:46 — Hello
00:01:50 — Retro
00:04:46 — Switch away from POSIX bracket expressions for decimal and hex digits
00:13:49 — Start implementing float encoding in Wasminna::Float
01:27:05 — Add test for encoding 0x7fffff4000000001 as a float
01:41:14 — Use Wasminna::Float.encode in `convert_i32_s` and `convert_i64_s` implementation
01:52:46 — Support zero numerators correctly in Wasminna::Float.encode
01:54:02 — Extract #scale_significand method for reuse after rounding
02:19:16 — Reuse #scale_significand method after rounding
02:19:37 — Add test for encoding 0x7fffffff as a float
02:22:27 — Add 64-bit support to Wasminna::Float.encode
02:29:18 — Support `f64.convert_i32_s` and `f64.convert_i64_s` instructions
02:29:48 — Implement the `f*.convert_i32_u` and `f*.convert_i64_u` instructions
02:33:04 — Begin implementing Wasminna::Float.decode and test decoding zero
03:14:50 — Support subnormals in Wasminna::Float.decode
03:18:49 — Implement the `f64.promote_f32` instruction
03:20:45 — Extract a Wasminna::Float::Finite class and move #encode onto it
03:36:36 — Introduce Wasminna::Float.from_integer factory
03:41:36 — Support infinities in Wasminna::Float.decode
03:48:19 — Support `nan:canonical` and `nan:arithmetic` in `assert_return` command
04:00:44 — Support NaNs in Wasminna::Float.decode
04:01:03 — Implement the `f32.demote_f64` instruction
04:03:33 — Limit float exponent during significand scaling
04:16:12 — Set float significand and exponent correctly for subnormal numbers
04:23:59 — Set float significand and exponent correctly for infinities
04:29:06 — Always set at least one bit of a NaN when encoding it
04:36:06 — Implement the `f32.reinterpret_i32` and `f64.reinterpret_i64` instructions
04:38:35 — Add conversions.wast to the test script
04:39:44 — Add float_test.rb to the test script
04:40:25 — Wrapping up
04:42:10 — Bye