Or, more formally, addition is commutative but subtraction is not.

A + B always* equals B + A, but A - B generally does not equal B - A.

*Is that true for computer languages (as opposed to being true only for pure 
math)? In modern C++ if I say

auto x = y + z;

If y and z are of different types (float and integer; 64-bit and 32-bit) does x 
take the type of the first operand, and thus y + z yields a different result 
than z + y?

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Bernd Oppolzer
Sent: Saturday, July 18, 2020 2:25 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: OOBOL and English was Re: Still COBOL After All These Years?

This reminds me of a very old story (begin of 1990s).

I once had to write a translator for a report generator language (not 
RPG, but similar),
which was in use on Polish ODRA computers (ICL clone). The target 
language was COBOL.
After some weeks of work, I delivered the first version. The "customers" 
(a team of programmers
of another company) tested it and after some days responded like this: 
"very fine, very fine.
BTW: is it possible that the subtractions all show the wrong sign?"

It turned out that I generated

SUBTRACT A FROM B GIVING C

for

C := A - B

much the same way as

ADD A TO B GIVING C

for

C := A + B

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to