From 3d30b262fab3beeee738cc98d8862a012012c2a4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 7 Jul 2024 02:47:35 +0900 Subject: test: F64Test passed --- src/Execution/Runtime.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Execution/Runtime.php') diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php index a261a3f..10bed7c 100644 --- a/src/Execution/Runtime.php +++ b/src/Execution/Runtime.php @@ -928,7 +928,11 @@ final class Runtime private function execInstrNumericF64Trunc(Instrs\Numeric\F64Trunc $instr): void { $v = $this->stack->popFloat(); - $this->stack->pushValue((float) (int) $v); + if ($v < 0) { + $this->stack->pushValue(ceil($v)); + } else { + $this->stack->pushValue(floor($v)); + } } private function execInstrNumericI32Add(Instrs\Numeric\I32Add $instr): void -- cgit v1.2.3-70-g09d2