aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Execution
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-07-07 02:47:35 +0900
committernsfisis <nsfisis@gmail.com>2024-07-07 02:48:56 +0900
commit3d30b262fab3beeee738cc98d8862a012012c2a4 (patch)
tree6071564035e2230462139b8d3a995c0f5d972617 /src/Execution
parente0614a8ba1206e28c78ee6ef587905390ea389de (diff)
downloadphp-waddiwasi-3d30b262fab3beeee738cc98d8862a012012c2a4.tar.gz
php-waddiwasi-3d30b262fab3beeee738cc98d8862a012012c2a4.tar.zst
php-waddiwasi-3d30b262fab3beeee738cc98d8862a012012c2a4.zip
test: F64Test passed
Diffstat (limited to 'src/Execution')
-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