HP3000-L Archives

February 1995, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Tony B. Shepherd" <[log in to unmask]>
Reply To:
Tony B. Shepherd
Date:
Tue, 7 Feb 1995 17:30:41 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (36 lines)
In article <[log in to unmask]>,
Jerry Fochtman <[log in to unmask]> wrote:
> Subject:      A use of Negative Zero
> As an interesting side note, the discussion on zoned-decimal fields touched
> on the area of negative zero values.  As it turns-out, this attribute of
> computing which doesn't really exist in number theory has value.
>>
> In processing manufacturing, as in other areas I'm sure, there is a need to
> differentiate zero from 'missing' in terms of a numeric value.  Without the
> benefit of additional flags (as provided in the SQL standard or even before
> this standard existed) we've used a negative zero as a means to denote the
> value is missing.
>
> As an example, a numeric field is initialized to negative zero by equating
> it to %100000, %000000 (2-word REAL).  This variable is then used to
> initialize a record of numeric values which is then written to a DBMS.  In
> my example, this record will be for a specific process test point with
> individual readings once every hour for 24 hours.  Each 24-hour period this
> record is built and written to a DBMS.
 
I don't believe 'negative zero' values were discussed - but indicating the
sign of a field by 'overpunching' the units position was.  And of course one
possible digit for the units position is zero.
 
Not sure about real, but (hex equivalent) x'80000000' is _not_ a negative
zero in integer form - rather the maximum negative value: -2,147,483,648.
 
To illustrate, a one byte binary field has a range of -128 .. +127 (a total
of 256 different values).  x'80' represents -128 in this case.
 
IMHO it would not be wise to count on this implementation quirk in production
systems - if I remember correctly, the Basic interpreter uses this value to
detect references to uninitialized variables.
 
Regards  --  Tony B. Shepherd  --  [log in to unmask]

ATOM RSS1 RSS2