Skip to content

testing: Add host fmaf regression program - #3830

Open
anatol wants to merge 1 commit into
apache:masterfrom
anatol:master
Open

anatol wants to merge 1 commit into
apache:masterfrom
anatol:master

Conversation

@anatol

@anatol anatol commented Oct 11, 2026 •

Copy link
Copy Markdown

Summary

  • Add a host-side regression program under testing/fmaf that compares NuttX fmaf() with the host libm.
  • Check result bits and floating-point exception flags in all four rounding modes. The cases include boundary values, halfway cases, double-rounding traps, and one million pseudorandom inputs per rounding mode.
  • This provides a reproducible way to check fmaf() behavior against host libm.
  • Related NuttX or NuttX Apps issue: None.

Impact

  • New feature or changed existing feature? Yes. Adds a host-side fmaf() regression program.
  • Impact on user: No. No application or user-facing behavior changes.
  • Impact on build: No. Does not change the NuttX Apps build.
  • Impact on hardware: No. The program runs on a host and does not change hardware support.
  • Impact on documentation: No. The source file documents how to compile and run the program.
  • Impact on security: No.
  • Impact on compatibility: No.
  • Anything else to consider: The program must be linked with the NuttX lib_fmaf.c implementation and host libm. It is a companion for libs/libm: Add fmaf, using fmadd.s on RISC-V targets with an FPU. nuttx#20553

Testing

  • Build host: Not run.
  • Target: Host-side executable; no NuttX board target.
  • Build and runtime logs: Not run. Add the host, compiler, and output here before submitting.

PR verification Self-Check

☑ This PR introduces only one functional change.
☑ I have updated all required description fields above.
☑ My PR adheres to the Contributing Guidelines and Documentation.
☐ My PR is still work in progress (not ready for review).
☑ My PR is ready for review and can be safely merged into a codebase.

Assisted-by: Claude Code:claude-sonnet-5-5

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @anatol please update PR description according to https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md :-)

@anatol

anatol commented Oct 11, 2026

Copy link
Copy Markdown
Author

@cederom Thank you for the feedback. PTAL.

Comment thread testing/fmaf/test_fmaf.c Outdated
Comment thread testing/libc/fmaf/test_fmaf.c
Comment thread testing/libc/fmaf/Kconfig Outdated
Comment thread testing/libc/fmaf/CMakeLists.txt
Comment thread testing/libc/fmaf/Makefile
Comment thread testing/libc/fmaf/test_fmaf_impl.c Outdated
@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@anatol please fix:

629fb2df2 Merge efb62ee7ec58d0e3d8512776b54ffd7072d8f0f0 into 56c9b325c7e87268a0d7342a348b99dc9b6212c7
efb62ee7e testing: Add host fmaf regression program
../nuttx/tools/checkpatch.sh -c -u -m -g 56c9b325c7e87268a0d7342a348b99dc9b6212c7..HEAD
ERROR __main__.py:618: Check failed: /home/runner/work/nuttx-apps/nuttx-apps/apps/testing/libc/fmaf/CMakeLists.txt

cmake-format check failed, run following command to update the style:
  $ cmake-format <src> -o <dst>

ERROR __main__.py:618: Check failed: /home/runner/work/nuttx-apps/nuttx-apps/apps/testing/libc/fmaf/CMakeLists.txt
Used config files:
    1: .codespellrc

@anatol

anatol commented Oct 19, 2026 •

Copy link
Copy Markdown
Author

@anatol please fix:
cmake-format

done

Add a host-side regression program under testing/libc/fmaf that compiles the
NuttX fmaf implementation and compares results and required exception flags
with host libm across all four rounding modes. Include Make and CMake metadata
for building it as a NuttX test app.

Keep the comparison harness with the apps testing sources rather than the
NuttX tools directory, and document how to invoke it from nuttx-apps.

Tests: host C compiler build and run against system libm; 4,072,672 cases
passed across four rounding modes.

Assisted-by: Claude Code:claude-sonnet-5-5
Signed-off-by: Anatol Pomozov <anatol@google.com>
@cederom

cederom commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

@cederom Thank you for the feedback. PTAL.

Thank you @anatol :-)

  • I have launched the CI.

  • Build and runtime logs (extracts) are required in the PR description to show that code builds and runs. Your description looks like the code was not even built / run? Please provide your build and runtime logs.

    Build host: Not run.
    Target: Host-side executable; no NuttX board target.
    Build and runtime logs: Not run. Add the host, compiler, and output here before submitting.

  • This is new application (apache/nuttx-apps) and new functionality (apache/nuttx) that should be documented - with explanation what is does, how, why, and how to use it, with examples. Could you please provide documentation too for testing: Add host fmaf regression program #3830 and libs/libm: Add fmaf, using fmadd.s on RISC-V targets with an FPU. nuttx#20553 ? Documentation is part of apache/nuttx repo and would require new PR after current ones are merged.

@anatol

anatol commented Oct 20, 2026

Copy link
Copy Markdown
Author

@cederom Thank you for the feedback. PTAL.

Thank you @anatol :-)

  • I have launched the CI.
  • Build and runtime logs (extracts) are required in the PR description to show that code builds and runs. Your description looks like the code was not even built / run? Please provide your build and runtime logs.

    Build host: Not run.
    Target: Host-side executable; no NuttX board target.
    Build and runtime logs: Not run. Add the host, compiler, and output here before submitting.

  • This is new application (apache/nuttx-apps) and new functionality (apache/nuttx) that should be documented - with explanation what is does, how, why, and how to use it, with examples. Could you please provide documentation too for testing: Add host fmaf regression program #3830 and libs/libm: Add fmaf, using fmadd.s on RISC-V targets with an FPU. nuttx#20553 ? Documentation is part of apache/nuttx repo and would require new PR after current ones are merged.

Hello,

thank you for your feedback. This test is a split of apache/nuttx#20553 that adds the missing libm function.

The code above been used as host testcase for the libm code i added and built/ran it about hundred times at this point. See the commit message part Tests: host C compiler build and run against system libm; 4,072,672 cases passed across four rounding modes.

@cederom

cederom commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@cederom Thank you for the feedback. PTAL.

Thank you @anatol :-)

  • I have launched the CI.
  • Build and runtime logs (extracts) are required in the PR description to show that code builds and runs. Your description looks like the code was not even built / run? Please provide your build and runtime logs.

    Build host: Not run.
    Target: Host-side executable; no NuttX board target.
    Build and runtime logs: Not run. Add the host, compiler, and output here before submitting.

  • This is new application (apache/nuttx-apps) and new functionality (apache/nuttx) that should be documented - with explanation what is does, how, why, and how to use it, with examples. Could you please provide documentation too for testing: Add host fmaf regression program #3830 and libs/libm: Add fmaf, using fmadd.s on RISC-V targets with an FPU. nuttx#20553 ? Documentation is part of apache/nuttx repo and would require new PR after current ones are merged.

Hello,

thank you for your feedback. This test is a split of apache/nuttx#20553 that adds the missing libm function.

There is no mention about new functionality in our Documentation (see [1], [2]). Please add some documentation so people interested in libm / fmaf could read how it works and how to use it.

Here is an example PR where author added some code, documentation, and proof of working runtime apache/nuttx#19911 :-)

The code above been used as host testcase for the libm code i added and built/ran it about hundred times at this point. See the commit message part Tests: host C compiler build and run against system libm; 4,072,672 cases passed across four rounding modes.

I could tell you that I ran 1/3 * 4,072,672 cases and you probably would want some logs from me - logs (extracts) really help greatly in the review.

Just copy paste most important build and runtime information form the terminal so we know you did build and test the change yourself and that the PR is not fully and only generated by AI with no author verification.. thanks for understanding :-)

Why I ask for that? Because your current description states clearly the code was not built and did not run either on host or target board, this may be language issue but also ai hallucination, see:

Build host: Not run.
Target: Host-side executable; no NuttX board target.
Build and runtime logs: Not run. Add the host, compiler, and output here before submitting.

[1] https://nuttx.apache.org/docs/latest/index.html
[2] https://nuttx.apache.org/docs/latest/contributing/documentation.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants