× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Booth Martin
Sent: Friday, December 12, 2008 9:07 AM
To: Midrange Systems Technical Discussion
Subject: storing fractions of inches in a data field

I have an application that goes back to the 1970s which
measures stock
in inches and fractions. It was designed with 2 fields for every
measurement{ a field for whole inches and a field for
sixteenths. 3,
8 would be 3 1/2 inches, 3 9 would be 3, 9/16ths inches.
There is
some talk of modernizing that.

What would be another way of handling it? 3.5 and 3.5625 are
probably
not going to fly as a solution since it is too hard to teach on the
production floor (I am told).

Any ideas? Alternatives that might work? :)

--
---------------------------------
Booth Martin

Why change what "the floor" sees at all? If you want to store the
information in a "integer" type field, why not just say that the field
contains the size of the part in units of 1/16 inch? On input, you still
have the two fields. I don't know the names, so I'll just say that I1 is
the inches and I2 is the 16ths of an inch. Store the variable via

UPDATE table SET column=I1*16+I2;

When you want to display, get the column into a host variable and recalc
I1 and I2.

In C, I would do this as:

I1=column>>4; /* integer divide by 16 */
I2=column&&0x0F /* remainder after divide by 16 */

In COBOL, something like:

DIVIDE column BY 16 GIVING I1 REMAINDER I2.

--
John McKown
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)
Administrative Services Group
9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * (817)-961-6183 cell
john.mckown@xxxxxxxxxxxxxxxxx * www.HealthMarkets.com

Confidentiality Notice: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
confidential or proprietary information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all
copies of the original message.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.