Category
stdlib | php-in-PHP
Problem
#4605 was filed when fpow() was entirely missing. Audit (2026-06-06): VM now registers fpow() (function_exists('fpow') → true, fpow(2,3) → 8) while the open issue still describes undefined-function failure.
Remaining gaps vs php-src ext/standard/math.c PHP_FUNCTION(fpow):
- Version gate — exposed on
CompilerVersion 8.3.0-dev before PHP 8.4 target alignment
- IEEE edge cases —
fpow(-1, 0.5) → NAN, fpow(0, -1) → INF, signed-zero exponent rules
- TypeError paths — non-numeric operands (
Z_PARAM_DOUBLE), enum case operands (php-src-strict)
- JIT/AOT — may still defer; capability matrix must reflect reality
- Implementation location — ensure logic lives in
ext/standard/VmMath.php / fpow.php, not ad-hoc C
php-src reference
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(function_exists(\"fpow\")); echo PHP_EOL; var_export(fpow(2,3)); echo PHP_EOL; var_export(fpow(-1,0.5)); echo PHP_EOL;"
php -r "var_export(function_exists(\"fpow\")); echo PHP_EOL;" 2>/dev/null || echo zend_pre_84
'
| Check |
Expected (Zend 8.4+) |
VM today |
function_exists('fpow') |
true (8.4+) |
true (early) |
fpow(2,3) |
8.0 |
8 ✅ |
fpow(-1,0.5) |
NAN |
verify ❓ |
| Enum case arg |
TypeError |
verify ❓ |
Scope
| Path |
Work |
ext/standard/fpow.php / VmMath.php |
centralize libc pow() + edge cases |
lib/CompilerVersion.php |
supportsFpow() ≥ 8.4 |
lib/JIT/ |
native double pow lowering (phase 2) |
| #4605 |
close or rewrite when this lands |
| Tests |
test/compliance/cases/stdlib/fpow*.phpt |
No new runtime/*.c math helpers.
Done when
Related
Category
stdlib|php-in-PHPProblem
#4605 was filed when
fpow()was entirely missing. Audit (2026-06-06): VM now registersfpow()(function_exists('fpow')→ true,fpow(2,3)→8) while the open issue still describes undefined-function failure.Remaining gaps vs php-src ext/standard/math.c
PHP_FUNCTION(fpow):CompilerVersion8.3.0-dev before PHP 8.4 target alignmentfpow(-1, 0.5)→NAN,fpow(0, -1)→INF, signed-zero exponent rulesZ_PARAM_DOUBLE), enum case operands (php-src-strict)ext/standard/VmMath.php/fpow.php, not ad-hoc Cphp-src reference
ext/standard/math.c—PHP_FUNCTION(fpow)ext/standard/basic_functions.c— PHP 8.4+ registrationRepro
function_exists('fpow')fpow(2,3)8.08✅fpow(-1,0.5)NANTypeErrorScope
ext/standard/fpow.php/VmMath.phppow()+ edge caseslib/CompilerVersion.phpsupportsFpow()≥ 8.4lib/JIT/test/compliance/cases/stdlib/fpow*.phptNo new
runtime/*.cmath helpers.Done when
CompilerVersiongate preventsfpowon pre-8.4 target if required by project policy./script/ci-fast.sh --filter fpowgreenRelated
fdiv()pattern · Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492