Discussion:
"-0" (was: Someone just too smart ...?)
Add Reply
Paul Gilmartin
2017-08-04 15:52:34 UTC
Reply
Permalink
Raw Message
IMO, the case for the RFE could be
that programs that rely on the initialization of
DCL SUM DEC FIXED (7) INIT (-0.1);
with negative zero (X'0000000d')
should be flagged; this is bad practice, and I would like
such initializations to be flagged as ERROR (not only warning)
and to be told by the error message, that the initialization will be
POSITIVE zero from now on. (Losing decimal digits to the right of
the decimal point should only be a warning, IMO).
The designers of S/360 wisely avoided the "-0" silliness for fixed
binary by choosing 2's complement ratner than the sign-magnitude
used by the 7090. This also avoids the need for a recomplement
cycle dependent on the sign of the result.

It would have been wiser to make the packed representation 10's
complement rather than sign-magnitude for similar reasons:
o No "-0".
o Five times the range in the same storage.
o Never a need for a recomplement cycle.

I am not much swayed by the opposing arguments:
o FORTRAN II relied on "-0" to indicate a blank input field.
o Sign-magnitude is more legible than complement in a dump.
o Some theorems in numerical analysis depend on symmetric range.
o Possible overflow complementing a numbe is harmful.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Charles Mills
2017-08-04 17:21:25 UTC
Reply
Permalink
Raw Message
Hollerith card compatibility.

A negative number on a punch card is indicated with a "11-row" overpunch.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On Behalf Of Paul Gilmartin
Sent: Friday, August 4, 2017 8:54 AM
To: IBM-***@LISTSERV.UA.EDU
Subject: "-0" (was: Someone just too smart ...?)
IMO, the case for the RFE could be
that programs that rely on the initialization of
DCL SUM DEC FIXED (7) INIT (-0.1);
with negative zero (X'0000000d')
should be flagged; this is bad practice, and I would like such
initializations to be flagged as ERROR (not only warning) and to be
told by the error message, that the initialization will be POSITIVE
zero from now on. (Losing decimal digits to the right of the decimal
point should only be a warning, IMO).
The designers of S/360 wisely avoided the "-0" silliness for fixed binary by choosing 2's complement ratner than the sign-magnitude used by the 7090. This also avoids the need for a recomplement cycle dependent on the sign of the result.

It would have been wiser to make the packed representation 10's complement rather than sign-magnitude for similar reasons:
o No "-0".
o Five times the range in the same storage.
o Never a need for a recomplement cycle.

I am not much swayed by the opposing arguments:
o FORTRAN II relied on "-0" to indicate a blank input field.
o Sign-magnitude is more legible than complement in a dump.
o Some theorems in numerical analysis depend on symmetric range.
o Possible overflow complementing a numbe is harmful.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Steve Smith
2017-08-04 17:23:01 UTC
Reply
Permalink
Raw Message
OK, I think I may have finally "got" it... if PL/I actually causes that
declaration to come out as x'0000000D', then I'd consider that a minor
internal bug. In any case it is an internal implementation detail, and
anybody that depends on it gets what they deserve (horrible surprise) when
IBM changes how it's implemented.

Still can't see an RFE... One of the things you give up in an HLL is
control over the binary stuff that comes out of it. Mind your own
business, and let the compiler do its thing.

To radically generalize: the fact that something is bad, or is just stupid,
is not sufficient reason to enact a law against it.

sas

On Fri, Aug 4, 2017 at 11:53 AM, Paul Gilmartin <
Post by Paul Gilmartin
IMO, the case for the RFE could be
that programs that rely on the initialization of
DCL SUM DEC FIXED (7) INIT (-0.1);
with negative zero (X'0000000d')
should be flagged; this is bad practice, and I would like
such initializations to be flagged as ERROR (not only warning)
and to be told by the error message, that the initialization will be
POSITIVE zero from now on. (Losing decimal digits to the right of
the decimal point should only be a warning, IMO).
The designers of S/360 wisely avoided the "-0" silliness for fixed
binary by choosing 2's complement ratner than the sign-magnitude
used by the 7090. This also avoids the need for a recomplement
cycle dependent on the sign of the result.
It would have been wiser to make the packed representation 10's
o No "-0".
o Five times the range in the same storage.
o Never a need for a recomplement cycle.
o FORTRAN II relied on "-0" to indicate a blank input field.
o Sign-magnitude is more legible than complement in a dump.
o Some theorems in numerical analysis depend on symmetric range.
o Possible overflow complementing a numbe is harmful.
-- gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
--
sas

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Charles Mills
2017-08-04 17:35:31 UTC
Reply
Permalink
Raw Message
I tend to agree. If someone wants to make a "PL/I-checker" that detects general bad coding practices I would favor that.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On Behalf Of Steve Smith
Sent: Friday, August 4, 2017 10:24 AM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: "-0" (was: Someone just too smart ...?)

OK, I think I may have finally "got" it... if PL/I actually causes that declaration to come out as x'0000000D', then I'd consider that a minor internal bug. In any case it is an internal implementation detail, and anybody that depends on it gets what they deserve (horrible surprise) when IBM changes how it's implemented.

Still can't see an RFE... One of the things you give up in an HLL is control over the binary stuff that comes out of it. Mind your own business, and let the compiler do its thing.

To radically generalize: the fact that something is bad, or is just stupid, is not sufficient reason to enact a law against it.

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