Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Currency Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

8.3 Inexact Conditions

Division will use as many digits as necessary for an exact result or all available digits if the exact result requires more digits than are available. For this reason, using the result of a division in a subsequent operation can easily result in a loss of precision exception. This can be avoided by rounding the result to a smaller number of digits using the round function.

Consider the example:

which produces the result

Using this value in calculations will likely result in a number with too many digits and a resulting inexact error. The round function can be used to reduce the number of digits after the decimal place:

The pow operation should be used with particular caution since the call,

where x is an n-digit number, will produce a result that is up to n* p digits long. If the result has too many digits, it will cause an overflow or precision error.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.