Skip to content

printf %e / %f of NAN and INF prints lowercase nan/inf; php prints NaN and INF. #266

Closed

Description

@blacktrs

Summary

printf %e / %f of NAN and INF prints lowercase nan/inf; php prints NaN and INF.

Repro

<?php
printf("%e %e %e %f %F %g\n", NAN, INF, -INF, NAN, INF, NAN);

Expected (php)

NaN INF -INF NaN INF NaN

Actual (manticore a30f7cf6, Darwin arm64)

nan inf -inf nan INF nan

Tracking

Known-bug repro: tests/aot/repro/wrong/printf_e_nonfinite.php — bash tests/aot/xfail.sh -k printf_e_nonfinite reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Oct 15, 2026
  2. blacktrs commented on Oct 15, 2026

    @blacktrs
    ContributorAuthor

    Runtime-format path (non-literal format, vsprintf, number formatting through __mc_format) now prints NaN / INF / -INF like php (branch bcmath). A literal format string still compiles to an inline C snprintf and prints lowercase nan / inf: routing every float conversion through the runtime engine to cover that rare case would slow the common printf('%.2f', $x) path, so this divergence is accepted by design. Close as won't-fix for the literal case, or reopen if a cheap runtime guard (isfinite branch around the snprintf) is wanted.

  3. added a commit that references this issue on Oct 16, 2026
    5d4eec9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions