Skip to content

feat(libc): implement _Divide, _FDivide, _Recip and _FRecip - #10787

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
00xDisaster:feat/libc-dinkumware-divide
Oct 25, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
00xDisaster:feat/libc-dinkumware-divide

Conversation

@00xDisaster

@00xDisaster 00xDisaster commented Oct 25, 2026 •

Copy link
Copy Markdown

What

Add _Divide, _FDivide, _Recip and _FRecip, the double and float Dinkumware division and reciprocal helpers. They use IEEE division and reciprocal semantics; tests cover quotients, signed zero, signed infinity, NaN and infinity operands. Exact console results, signaling-NaN handling and floating-point exception behavior remain unverified and are recorded in the libc debt entry.

The declarations live in Api.hpp; no other open PR implements these four exports.

Tested

Linux CachyOS 7.3.0-2-cachyos, GCC 16.2.1. Base upstream/main bd8e13428a; head 72583a0b20.

The approved commit 5ae2d41c23 differs from the pre-rebase head c777042410 only by the removal of two trailing blank lines at the ends of the source and test files. Rebased after main advanced: the only conflict was the adjacent _FSinh/_FCosh debt entry; main's measured version and this PR's division entry are both preserved, and no code or test statements changed.

  • cmake --build build --target guest_dinkumware_internals_tests guest_math_tests guest_math_exact_tests libs --parallel 8: passed.
  • ctest --test-dir build -R '^(guest_dinkumware_internals|guest_math|guest_math_exact)$' --output-on-failure: 3/3 passed.
  • guest_dinkumware_internals covers double and float division and reciprocal results, signed zero, signed infinity, NaN and infinity operands.
  • guest_math and guest_math_exact are the neighboring libm suites and pass unchanged.
  • tools/check_conventions.py --base upstream/main --head HEAD and git diff --check: clean.
  • GPUs tested: n/a.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: no

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Progress report (50a4f82 → 72583a0)

📈 System libraries: 48.87% (+0.01%, +4 implemented functions)

✅ 4 implemented
Library Name
libc _Divide_nid_postfix
libc _FDivide_nid_postfix
libc _FRecip_nid_postfix
libc _Recip_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libc 1337/1348 (99.18%) 1341/1352 (99.19%) +0.00 pp

@MarcZX10 MarcZX10 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.

Reviewed exact head 5ae2d41. The four helpers are narrowly scoped IEEE division/reciprocal wrappers, declarations are in the canonical API header, and the console-specific floating-point gaps are recorded in libc debt. Locally, both changed C++ translation units compile with GCC 12.2 using -Wall -Wextra -Werror; a focused harness linked to the exact implementation and passed quotient, signed-zero, infinity, and NaN cases. diff --check and the current-main conventions check pass. I could not configure the integrated libc test target locally because this environment lacks SDL2/XRandR development support; the PR reports its focused CTest run, and the hosted conventions/intake checks pass. The remaining console-specific behavior is explicitly unverified in the debt entry.

@00xDisaster
00xDisaster force-pushed the feat/libc-dinkumware-divide branch from 5ae2d41 to c777042 Compare October 25, 2026 00:51
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 10345 docs/dev/debt/libc.md L70-71

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 3965 docs/dev/debt/libc.md
PR 5021 docs/dev/debt/libc.md
PR 5303 docs/dev/debt/libc.md
PR 6713 docs/dev/debt/libc.md
PR 7081 docs/dev/debt/libc.md
PR 7386 docs/dev/debt/libc.md
PR 7447 docs/dev/debt/libc.md
PR 7544 docs/dev/debt/libc.md
PR 7648 docs/dev/debt/libc.md
PR 7715 docs/dev/debt/libc.md
PR 8150 docs/dev/debt/libc.md
PR 8417 docs/dev/debt/libc.md
PR 9087 docs/dev/debt/libc.md
PR 9269 docs/dev/debt/libc.md
PR 9340 docs/dev/debt/libc.md
PR 9371 docs/dev/debt/libc.md
PR 9408 docs/dev/debt/libc.md
PR 9447 docs/dev/debt/libc.md
PR 9499 docs/dev/debt/libc.md
PR 9526 docs/dev/debt/libc.md
PR 9527 docs/dev/debt/libc.md
PR 9552 docs/dev/debt/libc.md
PR 9648 docs/dev/debt/libc.md
PR 9669 docs/dev/debt/libc.md
PR 9784 docs/dev/debt/libc.md
PR 9863 docs/dev/debt/libc.md
PR 9873 docs/dev/debt/libc.md
PR 9929 docs/dev/debt/libc.md
PR 9973 docs/dev/debt/libc.md
PR 10007 docs/dev/debt/libc.md
PR 10234 docs/dev/debt/libc.md
PR 10245 docs/dev/debt/libc.md
PR 10316 docs/dev/debt/libc.md
PR 10317 docs/dev/debt/libc.md
PR 10321 docs/dev/debt/libc.md
PR 10325 docs/dev/debt/libc.md
PR 10328 docs/dev/debt/libc.md
PR 10354 docs/dev/debt/libc.md
PR 10405 docs/dev/debt/libc.md
PR 10460 docs/dev/debt/libc.md
PR 10468 docs/dev/debt/libc.md
PR 10506 docs/dev/debt/libc.md
PR 10510 docs/dev/debt/libc.md

@MarcZX10 MarcZX10 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.

The new head differs from the previously reviewed commit only by removing trailing blank lines in the implementation and test files; no executable code or test assertions changed. I rechecked the exact head, git diff --check, and the conventions checker (all pass). The prior GCC 12.2 -Wall -Wextra -Werror compile and focused exact-source harness remain applicable to the unchanged code. Hosted eligibility, conventions, labels, report, Ubuntu/Windows relinker, ASAN, Ubuntu register-context and macOS write-watch checks pass; macOS relinker and Intel register-context checks are still queued, and product jobs are path-skipped.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 25, 2026
@00xDisaster
00xDisaster force-pushed the feat/libc-dinkumware-divide branch from c777042 to 72583a0 Compare October 25, 2026 01:22
@00xDisaster

Copy link
Copy Markdown
Author

@MarcZX10 I rebased this onto current main bd8e13428a. The only conflict was the adjacent measured _FSinh/_FCosh debt entry; I preserved both entries, and no code or tests changed. The pre-rebase head differed from your approved 5ae2d41c23 only by two trailing blank lines. At 72583a0b20, guest_dinkumware_internals, guest_math and guest_math_exact pass 3/3, and conventions plus git diff --check are clean. Could you re-approve this head? Checks are running.

@github-actions github-actions Bot added libc docs and removed needs rebase Conflicts with main, rebase needed labels Oct 25, 2026

@MarcZX10 MarcZX10 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.

Reviewed the rebased head 72583a0b20ceb65ebaf630775ce9c0e42137a625. The four wrappers use native IEEE division/reciprocal operations, and the tests cover finite values, signed zero, infinities and NaNs; the remaining console/FENV uncertainty is recorded in debt. The PR reports 3/3 focused Linux tests on this head. Current hosted relinker, ASAN, register-context and write-watch jobs pass; platform product jobs are skipped. git diff --check against current main is clean, and the hosted conventions check passes. I also manually checked the #10345 overlap: it changes the fmod/fmodf debt entry, with no implementation/export duplication; preserve both debt entries if the adjacent documentation hunk conflicts during merge.

@oneandonlydean oneandonlydean self-assigned this Oct 25, 2026
@oneandonlydean
oneandonlydean merged commit cdcbd55 into boykopovar:main Oct 25, 2026
18 of 19 checks passed
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