|
Not wanting to be the only member that didn't post on this one so here goes.... > These two types of problems differ in your ability to know quantities > with absolute exactness. It is easy to know how many fingers I have > (an exact > entity) but it is very hard to know precisely how much they weigh (an > inexact entity). Decimal expressions are used for problems that match the > first type (most iSeries software falls into this category). Floating > point expressions are used for problems of the second type. Do not use > the wrong type of expressions for the wrong problem. There are two metrics of a measurement to consider when solving a problem. Accuracy and precision. Accuracy is how close my answer is to the correct answer. If I added 1 + 1 and got 1.6, 2.4, 1.7, 2.3, 2.0 and 1.9, my answer is relatively accurate--they all average to 2, but they lack precision. If I get 1.5002, 1.4997, 1.5001, 1.5000 my answers are very precise, but they lack accuracy. To get a true correct answer I need both accuracy and precision. The problem lies in the fact that nobody wants to spend $1000 to get a ruler accurate to 10 decimal places, so we sacrifice one or the other. The place that nature and business applications really cross is in the quality control department. Consider the engineer that specifies a piece of aluminum that is one inch square to hang 1000 pounds off of. The aluminum holds 1100 pounds per square inch. If I hang 1000 pounds from it does it break? No - at least not on the drawing board. Consider reality. My aluminum was made by a tired factory worker on a Monday morning. It is really only .99 x .98 (which is within my quality control specification). Consider that 1100 pound figure, can it really hold 1100 pounds per square inch or just somewhere between 1050 and 1150, depending on the batch of aluminum? Lastly, does that weight really weigh 1000 pounds or did they think that somewhere between 980 and 1020 was good enough? So now if I hang the weight, does it break? It broke 1 time out of 25 --- whoops. So, if I wrote a procedure in RPG that would do all that statistical math and you just passed it parameters, I would have two choices, declare all my variables really big (19,9P in RPG III) and pray for no overflow or use a float data type. In areas where absolute precision is required (aka General Ledger), float data types are not a very good answer, but within other areas they are exactly what the doctor ordered. IMHO one of the tricks to programming is knowing which time is which. Andy
As an Amazon Associate we earn from qualifying purchases.
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.