Skip to content

feat(libc): implement _Dtest, _LDtest and double/long-double constants - #1784

Closed
yamalameyooooo wants to merge 1 commit into
boykopovar:mainfrom
yamalameyooooo:feat/libc-dtest-classification
Closed

yamalameyooooo wants to merge 1 commit into
boykopovar:mainfrom
yamalameyooooo:feat/libc-dtest-classification

Conversation

@yamalameyooooo

Copy link
Copy Markdown

What

Implement the double-precision and long-double floating-point classification functions and their constant exports:

  • _Dtest — double-precision IEEE 754 classification (mirrors the existing _FDtest for float)
  • _LDtest — x87 extended-precision classification (80-bit significand in 16-byte storage)
  • _DInf, _DNan — double-precision infinity and quiet NaN constants (mirror _FInf, _FNan)
  • _LInf, _LNan — long-double infinity and quiet NaN constants

All six are in the NID database and are Dinkumware CRT internals used by the guest libc for fpclassify, isnan, isinf and related macros on double and long double values.

The classification functions return the same codes as _FDtest: Zero (0), Denormal (-2), Finite (-1), Infinite (1), NotANumber (2).

Tested

Not tested at runtime. Conventions check passes. Test cases added to GuestMath.cpp covering positive/negative zero, denormals, finite values, signed infinities, quiet NaN, signaling NaN, and the constant exports.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes (Claude)

Add the double-precision and long-double classification functions
(_Dtest, _LDtest) that mirror the existing float _FDtest, and the
corresponding infinity and NaN data exports (_DInf, _DNan, _LInf,
_LNan) that mirror _FInf and _FNan.

Tests cover positive/negative zero, denormals, finite values, signed
infinities, quiet NaN, signaling NaN and the constant exports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the libc label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 9, 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
#1987 core/libs/tests/GuestMath.cpp L21-22

@github-actions github-actions Bot mentioned this pull request Oct 9, 2026
9 tasks done
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is shown to reach _Dtest, _LDtest or the constants on main. Reopen with the title ID and the log line where it stops if you find one.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants