                On-line Guides All Guides eBook Store iOS / Android Linux for Beginners Office Productivity Linux Installation Linux Security Linux Utilities Linux Virtualization Linux Kernel System/Network Admin Programming Scripting Languages Development Tools Web Development GUI Toolkits/Desktop Databases Mail Systems openSolaris Eclipse Documentation Techotopia.com Virtuatopia.com How To Guides Virtualization General System Admin Linux Security Linux Filesystems Web Servers Graphics & Desktop PC Hardware Windows Problem Solutions Privacy Policy  Eclipse BIRT Report Developer Guide
Previous Page Home Next Page

## Class BirtMath

The BirtMath class provides functions to manipulate numeric data, for example, to add, subtract, multiple, divide, and round numbers. This class is static. The application cannot create instances of the class.

### BirtMath.ceiling

BirtMath.ceiling( ) is commonly used to round up prices. For example, to avoid dealing with pennies, you can round prices in a Price field up to the nearest nickel with the following expression:

If the Price value is 20.52, the expression returns 20.60. If the Price value is 20.40, the expression returns 20.40. No rounding occurs because 20.40 is a multiple of 0.1.

### BirtMath.divide

The following example returns the result of dividing values in the Total field by values in the Quantity field:

### BirtMath.mod

The following example checks if numbers in the Grade field are odd or even. When the divisor is 2, the function returns 0 for even numbers, and 1 for odd numbers.

### BirtMath.multiply

The following example returns the result of multiplying values in the QuantityOrdered and PriceEach fields:

### BirtMath.roundDown

The number of digits to round number down to. If you omit this argument, the function assumes 0.

### BirtMath.roundUp

The number of digits to round number up to. If you omit this argument, the function assumes 0.

### BirtMath.safeDivide

This function returns the result of dividing one number by another, preventing a division by zero condition.

The following example returns the result of dividing values in the Revenue field by values in the Volume field. If the Volume value is 0, the function returns 0.

### BirtMath.subtract

The following example returns the result of subtracting values in the Discount field from values in the Total field: Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire