[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNU-COBOL] math library questions



>Matthew Fischer wrote :>
>
>> This is directed to Chad, but the rest of you may have some input.
>
>> In the math library:
>
>> --Do we need to be able to init using a u.long, long, or double???
>
If the math library design is dependent on data types like u.long, long, and
double, it is not a Cobol math library.  Cobol does character math (where
the number is stored as ascii in contigious memory of variable size),
integer math against variable sized integers, and BCD math.  A call to the
math library should specify the address of the variables, their type, their
size, and their precision (where the implied decimal is).

Trying to implement 'C' datatypes has been the shortfall of all of the
previous failed attempts to write Cobol to C compilers that I have seen to
date.  This bad casting results in incorrect results (overflow actions,
truncation errors etc.).

Cobol was written and is used to mantain accounting ledgers, inventories,
equipment maintenance schedules and other business functions.  How numbers
round or truncate when added, subtracted, divided or multiplied was
determined by business use ot the data.

Those people working on math library functions who are failing back on C
data types need to carefully consider if their initial design concepts are
correct.  I would propose that only char types be used in the libraries -
even for the COMP variables that look and act like INTs, but aren't because
of their variable length.  Granted, it is a mind bender to do bit level
math, but failing to do so will result in something that does not perform as
expected.

Glen


--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to gnu-cobol@acm.cs.umr.edu with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@acm.cs.umr.edu.