Repository navigation
fix: preserve giga/thicc values in float and double conversions - #394
Conversation
|
Hi, I’m considering a Brainrot contribution for the Build 2026 × ByteAsk challenge. I noticed PR #394 is already addressing issue #372 with regression tests, so I won’t duplicate that work. Is there another open starter-to-medium issue you’d recommend that is available for a new contributor? I’ll follow the project’s required testing and disclosure rules, and wait for your guidance before starting. |
Feel free to pick any |
Thanks! I’d like to take issue #379. I’ll trace the shared formatting behavior and keep the fix focused on making %% produce a single % whether or not format arguments remain. I’ll add regression coverage for the no-argument case and for %% after the last argument is consumed, then run the project’s required checks. Please let me know if someone has already started on it. |
Description
Converting a
giga/thiccvalue tochad/gigachadread its low 32 bits. For example, assigning5000000000to a double printed705032704.000000; multiplying it by2.0printed1410065408.000000.Preserve the integer expression's width before floating conversion. The float/double evaluators route wide integer expressions through
evaluate_expression_long, while the integer operand helpers do the same for mixed arithmetic. The type guard keeps mixed floating expressions in floating-point evaluation, and the existing pointer exclusion and unsigned-32 operand behavior remain intact. The float helper converts directly from the wide integer, avoiding an intermediate double and double rounding.Two language-level regression fixtures cover both widths and signs, assignment and literals, mixed operations and both operand orders, 32-bit boundaries, the minimum signed 64-bit value, a float halfway-point case, nested expressions, array/pointer reads, and single evaluation of increment/index/function-call side effects. Both final fixtures fail against a separately rebuilt unchanged upstream
4988c99with normal exits and no parsing errors, and pass with this patch.Validation on Ubuntu 24.04 / WSL2, in an isolated workspace:
make test: 548 passed, 5 skipped (optional raylib integration tests).make format-check,make cppcheckandmake tidy: passed.make valgrind: passed across all 487 fixtures (zero reported errors).AI assistance: implementation and verification were performed with Codex, with additional read-only AI-assisted source analysis. This is disclosed as in the issue discussion; no independent human review is implied.
Related Issue
Fixes #372
Type of Change
Checklist
test_cases/*.brainrotfor language-visible behavior; a host-side C test wired intomake testfor internal APIs Brainrot source cannot reach). Required for every bug fix, feature, refactor, performance change, and breaking change — not optional, not "if applicable". See CONTRIBUTING.md ("TESTS ARE MANDATORY").make format-checklocally (ormake formatto fix)Error/rejection paths are covered by the existing passing suite; the added fixtures focus on the numeric conversion regression. The docs-only checklist item does not apply.