Skip to content

Bugfix/%DEC bif with italian decimal separator#798

Merged
lanarimarco merged 4 commits intodevelopfrom
bugfix/bif-with-italian-decimal-separator
Mar 26, 2026
Merged

Bugfix/%DEC bif with italian decimal separator#798
lanarimarco merged 4 commits intodevelopfrom
bugfix/bif-with-italian-decimal-separator

Conversation

@lanarimarco
Copy link
Copy Markdown
Collaborator

Description

The problem occurred in this case:

      * %DEC with italian decimal separator (comma) ************************
     C                   EVAL      STR='1,30'
     C                   EVAL      DECIMAL=%DEC(STR:9:2)
      * Expected:
      *  DECIMAL = 1.30
     C     DECIMAL       DSPLY
      ***********************************************************************

This pull request introduces improved support for parsing decimal numbers with both dot and comma as decimal separators, adds a new test case to verify this behavior, and makes a few minor code and test improvements. The most important changes are grouped below:

Decimal parsing improvements:

  • Updated the asBigDecimal utility function in misc.kt to replace commas with dots before parsing, ensuring that strings with either decimal separator are handled correctly. Now, an error is thrown if parsing fails, improving error visibility.

Testing enhancements:

  • Added a new RPGLE test program (BIFDEC01.rpgle) that checks %DEC behavior with both dot and comma decimal separators, ensuring correct parsing in both cases.
  • Added a corresponding test (executeBIFDEC01) in InterpreterTest.kt to verify the output of the new BIFDEC01 program.

Minor improvements:

  • Standardized line endings in RpgParserFacade.kt by changing joinToString(System.lineSeparator()) to joinToString("\n") for consistency across platforms.
  • Fixed test method naming in InterpreterTest.kt for consistency (EVALwithTypeErrorevalWithTypeError).
  • Removed the .claude/settings.local.json file, likely as cleanup.

Related to # (issue)

Checklist:

  • If this feature involves RPGLE fixes or improvements, they are well-described in the summary.
  • There are tests for this feature.
  • RPGLE code used for tests is easily understandable and includes comments that clarify the purpose of this feature.
  • The code follows Kotlin conventions (run ./gradlew ktlintCheck).
  • The code passes all tests (run ./gradlew check).
  • Relevant documentation is included in the docs directory.

lanarimarco and others added 4 commits March 25, 2026 17:34
Handle comma as decimal separator in asBigDecimal() so that %DEC
correctly parses strings like '1,30' as 1.30. Also normalize line
endings to \n in RpgParserFacade to ensure cross-platform consistency.
Add BIFDEC01 test to cover both dot and comma decimal separators.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lanarimarco lanarimarco merged commit fdae19c into develop Mar 26, 2026
1 check passed
@lanarimarco lanarimarco changed the title Bugfix/DEC with italian decimal separator Bugfix/%DEC bif with italian decimal separator Mar 26, 2026
@lanarimarco lanarimarco deleted the bugfix/bif-with-italian-decimal-separator branch March 26, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant