Skip to content

Stdlib: nextafter() IEEE next representable float (#9241) - #15017

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-9241-nextafter
Jul 2, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-9241-nextafter

Conversation

@PurHur

@PurHur PurHur commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add nextafter() to ext/standard for the PHP 8.4+ profile (CompilerVersion::supportsNextafter()), matching php-src ext/standard/math.c.
  • Implement VM logic via VmMath::nextafter() (native nextafter() when available, IEEE polyfill otherwise).
  • JIT lowers through libm nextafter; AOT/VM compliance + phantom-registration guard updated alongside fpow.

php-src reference

  • ext/standard/math.c — PHP_FUNCTION(nextafter)

Verification

vendor/bin/phpunit --filter 'SupportsNextafter|NextafterWithheld'
php -r 'require "vendor/autoload.php"; use PHPCompiler\ext\standard\VmMath; var_export(VmMath::nextafter(1.0,2.0)); echo "\n";'
# 1.0000000000000002

php bin/vm.php test/repro/maintainer_gap_nextafter_basic.php
# skip: nextafter not registered on reference profile (8.4.0-dev gate — expected)

php script/capability-matrix.php

Closes #9241

Made with Cursor

Implement IEEE nextafter in ext/standard with VmMath polyfill, version-gated
registration matching fpow, and VM/JIT/AOT compliance coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 8f6a0d3 into master Jul 2, 2026
@PurHur
PurHur deleted the agent/issue-9241-nextafter branch July 2, 2026 16:25
PurHur added a commit that referenced this pull request Jul 2, 2026
…15024)

After #15017 added ext/standard/nextafter.php to the vm.php inventory,
regenerate docs/bootstrap-inventory.md and append the missing require_once
to compiler_lib_spine_smoke so north-star5-verify-fast passes again.

Closes #15023

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: nextafter() missing — IEEE next representable float (ext/standard/math.c)

1 participant