CompuServe Messages

#BEGENNER HELP" again!

    18-Oct-95 12:58:14
Fm: Jim Butterfield 73624,14
To: Douglas Hornal 72637,2714
>> CAN the Amiga do perfect addition, subtraction … with decimal .. ? It's a matter of definition. Can any entity in the finite universe divide 10 by 3, in decimal, perfectly? Even with 24 megabytes of memory, the "3" digits would march on and there would be a loss of "perfection" somewhere. If you want "usual" decimal accuracy, you can indeed carry your numbers in decimal, although the C language won't be too helpful in the advanced arithemetic area .. likely the best approach would be to keep the value as an integer, and the power-of-10 as a separate related value. In many practical cases, you can just do LONG computations, on the assumption that you will have a large number of significant figures and can trim out any error. In assembler, you can do virtually what you want. Want to calculate in decimal mode to about 500 significant digits? Go for it; just allocated the appropriate space for each value and write the special-purpose arithmetic operations. And you can do this in C, too, of course: no reason why a number can't be an array of however many digits you wish to define. It's a major breakthrough to realize that computers, despite their popular reputation, are not always exact in the way they handle numbers. A good book on numeric methods will emphasize how the programmer needs to take accuracy (and inaccuracy) into account during calculations. –Jim