Subject: | |
From: | |
Reply To: | |
Date: | Sun, 5 Feb 1995 19:14:00 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
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.
When a reading for the particular test is received, the numeric field in the
record corrsponding to the hour of the reading is updated with that value.
When a retrieval process looks at the record, it cannot compare the numeric
fields to -0, because there really is no such value. Instead, it compares
the variable to a field initialized with %100000/%000000 and if equal, the
particular reading is deemed 'missing'. Otherwise the particular occurrance
contains a valid reading from the unit, which indeed might be zero. In this
manner, calculations such as averages, etc. are not skewed just because a
test reading did not exist and true 'zero' readings are used.
Regards -- Jerry Fochtman
|
|
|