Skip to content

Conversation

@kio-watanabe
Copy link
Contributor

FUNCTION VARIANCE (CobolIntrinsic.java) was modified.
Another issue was that the test case for FUNCTION SQRT was failing.
This was found to be due to the precision of the double type in java.
Therefore, the numerical value of the test case was corrected.

@kio-watanabe
Copy link
Contributor Author

@ytr-sakamoto
不要な修正が多かったため、pull requestを出しなおしました。

CobolNumericField.javaの338行目の修正について:
現状で問題が起きているわけではないですが、以下の理由で修正しています。

} else if (c == (byte) '.') {
          ++count;
          if (count > 0) {
            break outer;
          }

上記のコードについて、opensource COBOLでは以下のようになっています。
(https://github.com/opensourcecobol/opensource-cobol/blob/b0794035c93b25ef069282ca02bb9a4d88bdf930/libcob/move.c#L267C4-L267C22)

} else if (c == cob_current_module->decimal_point) {
	if (count++ > 0) {
		goto error;
	}

現行の4Jではif(count > 0)に入る前にインクリメントされているため、このif文は必ずtrueになりますが、
opensource COBOLではif (count++ > 0)となっているため、初めてこのif文を通るときはtrueになりません。
そのため、以下のように修正しました。

} else if (c == (byte) '.') {
          ++count;
          if (count > 1) {
            break outer;
          }

@yutaro-sakamoto yutaro-sakamoto merged commit b6a1faf into opensourcecobol:develop Dec 25, 2023
@yutaro-sakamoto
Copy link
Contributor

@kio-watanabe
Thank you!

This was referenced Dec 25, 2023
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.

2 participants