Chapter 7. Numbers, Calculations, and Conversions
Overview
The second chapter gives the barest definition of what numbers are and how they are used. Rexx is designed to handle arithmetic in as natural as manner as possible. It conforms to the basic rules of computation that people absorb in high school or college. For most programs, you'll need no special knowledge of how Rexx handles numbers. Rely on its automatic numeric conversions and rounding, and your scripts will work just fine.
Rexx differs from languages that place the burden of cross-system consistency on the developer. Its language definition ensures that calculations provide the same outputs, regardless of language implementation or the platform on which it is run.
Rexx achieves this cross-platform consistency by employing decimal arithmetic internally. This contrasts with the floating-point or binary arithmetic used by most other programming languages, which produce calculation results that can vary by platform. Rexx's natural or human-oriented approach to computation is part of its appeal as an easy-to-use, portable scripting language.
Even with this high level of automation, there will be situations where you require some knowledge of how Rexx handles calculations and how you can affect them. This chapter probes a little more deeply so that you'll be able to handle these situations appropriately. More specifically, we'll look at the ways in which you can express numeric values within scripts. We'll discuss the numeric ...
Get Rexx Programmer's Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.