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

Closed
yamalameyooooo wants to merge 1 commit from upstream-pr/1784 into main
yamalameyooooo commented 2026-10-08 19:08:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by yamalameyooooo on 2026-10-08T19:08:58Z.


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)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4791575089 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1784). Originally posted by [yamalameyooooo](https://github.com/yamalameyooooo) on 2026-10-08T19:08:58Z. --- ### 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 - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (Claude)
github-actions[bot] commented 2026-10-09 04:35:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T04:35:27Z.


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
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6074341059 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1784#issuecomment-6074341059). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T04:35:27Z. --- <!-- pr-overlap --> 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](https://github.com/boykopovar/AnyPS5/blob/f145139676a48306681d3a4d5fabf83938759daf/core/libs/tests/GuestMath.cpp#L21-L22) | | |
oneandonlydean commented 2026-10-09 08:55:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T08:55:29Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077716119 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1784#issuecomment-6077716119). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T08:55:29Z. --- 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.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1784
No description provided.