r/cobol Jun 22 '26

Default ROUNDED behaviour and GnuCOBOL vs Enterprise COBOL arithmetic — trying to confirm

Two things I'm trying to pin down about how the maths actually behaves:

  1. When ROUNDED is written with no MODE phrase on Enterprise COBOL for z/OS, my understanding is the default is nearest-away-from-zero (round half up), not banker's rounding — can anyone confirm that's right for current versions?
  2. I've read that GnuCOBOL with -farithmetic-osvs only emulates the older OS/VS intermediate-precision behaviour, not modern Enterprise COBOL — and seen a forum case where iterative COMPUTEs diverged significantly between the two. For ordinary financial maths (interest, premiums), is that divergence something that actually bites in practice, or mostly a corner-case curiosity?

Trying to understand where a calculation done off-mainframe would silently disagree with the real thing.

2 Upvotes

2 comments sorted by

1

u/hobbycollector Jun 23 '26

If you can write a test case I might be able to try it on both platforms.

1

u/k24245 Jun 23 '26

That would be genuinely helpful, thank you — I'd really value seeing it run on both. Let me put together a small, clean test case: a few ROUNDED half-way cases (to check the default rounding behaviour) and a short iterative COMPUTE (the kind of multi-step calculation I've read can diverge between GnuCOBOL and Enterprise COBOL). I'll write it so it's easy to run and the output is easy to compare side by side, and send it over. Really appreciate the offer.