Repository navigation
Convert numbers assigned to FS, OFS, SUBSEP and others with CONVFMT - #674
Conversation
The setters of FS, RS, OFS, ORS, SUBSEP, CONVFMT and OFMT stored value.toString(), so a Double such as 0.1 + 0.2 or the result of OFS++ got Java's formatting (0.30000000000000004, 4.0). They now convert the value with toAwkString(), which applies CONVFMT and prints an integral value as an integer, as gawk does. Fixes #672 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 259d41382e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A special variable stored as text now keeps the value assigned to it, so FS = 3.6 still reads as 3.6 after a lossy CONVFMT, as in gawk, while the separator and format operations use the text converted when it was assigned. Settings apply CONVFMT before the other special variables, so a numeric RS or SUBSEP given next to a custom CONVFMT uses that format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex please review again |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c1f4eead5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- The JRT constructor sets the values of FS, OFS and the other text specials to their defaults, so they read as before execution starts. - assignInitialVariables() goes through applySpecialVariables(), so CONVFMT is applied first there too. - Settings and per-run overrides of special variables are normalized like other variables, so a BigDecimal or BigInteger keeps its text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex please review again |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5a850f08a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The setters of FS, OFS and the other text specials turn a BigDecimal or BigInteger into a numeric string that keeps its digits, as the AVM does for any host variable, instead of converting it through a double. This covers direct calls and assignInitialVariables(), so the separate normalization of the special-variable maps in the AVM is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex please review again |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c31b9e99b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The special-variable setters now use StrNum.ofJavaNumber() for a BigDecimal or BigInteger, so its period stays a decimal point in a locale with a decimal comma, and turn a Boolean into AWK's 1 or 0, as applySpecialVariable() and the AVM already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex please review again |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #672
Summary
JRT.setFS(),setRS(),setOFS(),setORS(),setSUBSEP(),setCONVFMT()andsetOFMT()storedvalue.toString(), so aDoubleassigned to these variables got Java's formatting. They now usetoAwkString(), the sameCONVFMTconversion used for concatenation, which prints an integral value as an integer. All assignment paths (ASSIGN_*opcodes,-v, Java settings) go through these setters.The variables still hold the value assigned to them (so
FS = 3.6reads back as3.6even with a lossyCONVFMT, as in gawk), and settings applyCONVFMTbefore the other special variables.a0.30000000000000004b/a4.0b/11.02a0.3b/a4b/112Tests
SpecialVariableConversionTest(viaAwkTestSupport) covers all seven variables; expected outputs checked against gawk.mvn verify: unit tests pass, checkstyle/PMD/SpotBugs clean; the compatibility IT failures are identical tomain.Unreleasedinbehavior-changes.md.🤖 Generated with Claude Code