Math


Math functions allow you to perform a variety of calculations, from rounding numbers to finding the percentage of group averages within your report.

Table C-2: Math functions

Function

Description

Arguments

Abs (x)

Returns the absolute value of a number. The absolute value of a number is the number without its sign.

x is the real number for which you want the absolute value.

Sgn (number)

Determines the sign of a number. Returns 1 if the number is positive, 0 if the number is 0, and -1 if the number is negative.

number is any real number.

Int (number)

Rounds a number down to the nearest integer.

number is the real number you want to round down to an integer.

Round (x, #places)

Rounds a number to a specified number of digits.

x is the number you want to round.

#places specifies the number of digits to which you want to round number.

1. If #places is greater than 0, number is rounded to the specified number of decimal places.

2. If #places is 0, number is rounded to the nearest integer.

3. If #places is less than 0, number is rounded to the left of the decimal point.

Truncate (x, #places)

Truncates a number to an integer by removing the fractional part of the number.

x is the number you want to truncate.

#places is a number specifying the precision of the truncation. The default value for #places is 0.

Fix (number, #places)

Truncates a number to the specified number of decimal places and returns it. If #places is omitted, 0 is assumed.

number is the Number value to be truncated; it can be positive, 0, or negative.

#places is an optional Number indicating the number of decimal places to be truncated to. If omitted, 0 is assumed.

Remainder (num, denom)

Returns the remainder after the numerator (dividend) has been divided by the denominator (divisor).

num is a fractional value (and stands for the numerator).

denom is a fractional value (and stands for the denominator).

Sin (number)

Returns the sine of the given angle.

number is the angle in radians for which you want the sine. If your argument is in degrees, multiply it by Pi()/180 to convert it to radians.

Cos (number)

Returns the cosine of the given angle.

number is the angle in radians for which you want the cosine. If the angle is in degrees, multiply it by Pi()/180 to convert it to radians.

Tan (number)

Returns the tangent of the given angle.

number is the angle in radians for which you want the tangent. If your argument is in degrees, multiply it by Pi()/180 to convert it to radians.

Atn (number)

Returns the arctangent of a number. The arctangent is the angle whose tangent is number. The returned angle is given in radians in the range -pi/2 to pi/2.

number is the tangent of the angle you want.

Pi

Returns the number 3.14159265358979, the mathematical constant pi, accurate to 15 digits.

(no arguments)

Sqr (number)

Returns a positive square root.

number is the number for which you want the square root.

Exp (number)

Returns e raised to the power of number. The constant e equals 2.71828182845904, the base of the natural logarithm.

number is the exponent applied to the base e.

Log (number)

Returns the logarithm of a number to the base you specify.

number is the positive real number for which you want the logarithm.

Rnd (seed)

Returns an evenly distributed random number greater than or equal to 0 and less than 1. A new random number is returned every time the report is refreshed.

seed is the optional Number value argument.




Mastering Business Analysis with Crystal Reports 9
Mastering Business Analysis with Crystal Reports 9 (Wordware Applications Library)
ISBN: 1556222939
EAN: 2147483647
Year: 2004
Pages: 177
Authors: Chris Tull

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net