(someone wrote) > Some years ago this situation changed dramatically. Mike > Cowlishaw---he who designed REXX---devised what is now ANSI decimal > floating point (DFP). DFP behaves consistently in ways that do not > surprise accountants. (All three floating-point formats are supported > by zArchitecture hardware.)
According to D.E.Knuth, there are two things that should not be done in floating point: financial calculations and typesetting. Floating point is great for quantities with a relative error. That is, where the uncertainty in measurement scales with the value. One can measure lengths in nanometers or gigameters to about one part in 100 million or so at best(*) For quantities where the uncertainty does not depend on the magnitude, fixed point is a better choice. I expect my bank to keep my balance to the cent, when I have either $1.00 or (rarely) $1,000,000.00 in my account. Digital typesetting needs to be able to position glyphs on the page consistently. The eye is amazingly sensitive to some types of positioning errors. Knuth has an example of a typesetting machine that was thought to have 5333 dot/inch resolution, but turned out to be 5333 and a third dpi. The difference was visible in printed output. TeX and Metafont use only fixed point arithmetic for any calculation that affects the printed page. Some messages to the user use floating point arithmetic. > Although there has been ample tIme to do so, IBM COBOL does not yet > support DFP. It should. When IBM COBOL does support DFP, it will be > possible to eliminate packed-decimal (except as a transitional data > type in certain conversion operations) from COBOL routines; and doing > so will confer large performance advantages. I suppose if one is careful in how it is used. Still, the 15 decimal digits from S/360 packed decimal should be enough for most uses. (31 digits for add/subtract.) -------------------------------------------------------------- (*) (The lattice constant for crystalline Silicon is 543.102 0504 x 10^-12 m with a relative error of 1.6 in 100,000,000.) The radius of the earth is about 6371km. Because the earth isn't a perfect sphere it is hard to give it much more accurately, though one could measure the distance between two points on the earth more accurately. The semi-major axis of the earth's orbit is 149598261km, so again to about one part in 100,000,000. The period of the earth's orbit is 365.256363004 days, or known to about 1 part in ten to the 11th. Optical spectra lines can also be measured to a similar relative uncertainty. -- glen ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN