Skip to content

Improve RzIL floating-point support#6626

Draft
b1llow wants to merge 5 commits into
devfrom
rzil-float
Draft

Improve RzIL floating-point support#6626
b1llow wants to merge 5 commits into
devfrom
rzil-float

Conversation

@b1llow

@b1llow b1llow commented Jul 18, 2026

Copy link
Copy Markdown
Member

Your checklist for this pull request

Detailed description

This PR improves IEEE-754 edge-case handling in RzFloat and adds reusable floating-point facilities to RzIL.

The RzFloat changes fix:

  • binary80 explicit-integer-bit and NaN handling;
  • binary16 conversions;
  • gradual underflow and directed rounding;
  • overflow and inexact exception reporting;
  • propagation of floating-point exception metadata through nested conversions.

The RzIL changes add scoped binary80 precision support through RzFloatRPrecision and the FWITH_RPREC opcode. Precision scopes restore the previous SoftFloat state after
successful evaluation and after evaluation failures. The new opcode is supported by validation, duplication, destruction, string and JSON exporters, graph output, and VM
evaluation.

This PR also adds runtime rounding-mode constructors for conversion, rounding, square root, addition, subtraction, multiplication, division, and remainder operations. The
rounding mode is represented by a 32-bit IL bitvector whose values correspond to RzFloatRMode. RNE, RNA, RTP, RTN, and RTZ are supported; unknown values fall back to RNE. These
helpers expand to ordinary LET/ITE expressions and do not introduce a dynamic rounding-mode opcode.

Finally, FEXCEPT now emits a VM event only when the queried exception is actually present, while preserving exceptions raised by nested conversions.

No Rizin book update is needed because this PR does not change user-facing commands or workflows.

Test plan

...

Closing issues

...

@github-actions github-actions Bot added rz-test API RzUtil RZIL AI/LLM Partially or fully AI generated. Critical thinking is advised! labels Jul 18, 2026
b1llow added 5 commits July 19, 2026 18:46
Co-authored-by agent: Codex/GPT-5
Co-authored-by agent: Codex/GPT-5
Co-authored-by agent: Codex/GPT-5
Co-authored-by agent: Codex/GPT-5
Co-authored-by agent: Codex/GPT-5
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.39776% with 397 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.01%. Comparing base (12cf18e) to head (7cc8df1).

Files with missing lines Patch % Lines
librz/util/float/float.c 57.14% 61 Missing and 11 partials ⚠️
librz/il/il_export_string.c 19.75% 63 Missing and 2 partials ⚠️
librz/il/il_validate.c 27.38% 52 Missing and 9 partials ⚠️
librz/il/il_graph.c 8.77% 52 Missing ⚠️
librz/il/il_opcodes.c 41.55% 26 Missing and 19 partials ⚠️
librz/il/il_export_json.c 27.11% 43 Missing ⚠️
librz/il/il_export_string_unicode.c 5.12% 36 Missing and 1 partial ⚠️
librz/il/theory_fbasic.c 89.23% 8 Missing and 6 partials ⚠️
librz/il/definitions/float.c 30.00% 6 Missing and 1 partial ⚠️
librz/util/float/float_internal.c 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
librz/il/il_vm_eval.c 60.00% <ø> (+1.42%) ⬆️
librz/include/rz_util/rz_float.h 50.00% <ø> (ø)
librz/util/float/float_internal.c 67.74% <88.88%> (+1.75%) ⬆️
librz/il/definitions/float.c 62.50% <30.00%> (-5.25%) ⬇️
librz/il/theory_fbasic.c 69.16% <89.23%> (+14.14%) ⬆️
librz/il/il_export_string_unicode.c 49.07% <5.12%> (-3.84%) ⬇️
librz/il/il_export_json.c 37.73% <27.11%> (+1.08%) ⬆️
librz/il/il_opcodes.c 56.56% <41.55%> (-1.37%) ⬇️
librz/il/il_graph.c 27.36% <8.77%> (+0.63%) ⬆️
librz/il/il_validate.c 58.02% <27.38%> (-5.01%) ⬇️
... and 2 more

... and 11 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12cf18e...7cc8df1. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

AI/LLM Partially or fully AI generated. Critical thinking is advised! API rz-test RZIL RzUtil

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant