Performing arithmetic
You can use any of several COBOL language features (including COMPUTE
,
arithmetic expressions, numeric intrinsic functions, and math and
date callable services) to perform arithmetic. Your choice depends
on whether a feature meets your particular needs.
About this task
For most common arithmetic evaluations, the COMPUTE
statement
is appropriate. If you need to use numeric literals, numeric data,
or arithmetic operators, you might want to use arithmetic expressions.
In places where numeric expressions are allowed, you can save time
by using numeric intrinsic functions. Language Environment® callable services for mathematical
functions and for date and time operations also provide a means of
assigning arithmetic results to data items.