aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Execution/Runtime.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Execution/Runtime.php')
-rw-r--r--src/Execution/Runtime.php6
1 files changed, 5 insertions, 1 deletions
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