Difference between revisions of "Working With Numeric Data in Recital"

From Recital Documentation Wiki
Jump to: navigation, search
(Numeric Conversion Functions)
(Miscellaneous Financial Functions)
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Working With Numeric Data in Recital==
 
==Working With Numeric Data in Recital==
 +
Certain [[:Category:Set Commands|set commands]] change the display format of numeric data:
 +
 +
* [[SET DECIMALS|set decimals]] - specify the number of decimal places to be displayed
 +
 +
<pre>
 +
set decimals to <places as numeric>
 +
</pre>
 +
 +
* [[SET FIXED|set fixed]] - determine whether the number of decimal places displayed is fixed
 +
 +
<pre>
 +
set fixed on | off
 +
</pre>
 +
 +
* [[SET POINT|set point]] - specify the character to be used as the decimal point
 +
 +
<pre>
 +
set point to [<point as character>]
 +
</pre>
 +
 +
* [[SET SEPARATOR|set separator]] - specify the character to be used to mark thousands
 +
 +
<pre>
 +
set separator to [<separator as character>]
 +
</pre>
 +
 
===Numeric Conversion Functions===
 
===Numeric Conversion Functions===
'''See Also'''
+
* [[ABS()|abs()]] - return the absolute value of a numeric
  
'''Table of Contents'''
+
<pre>
 +
numeric = abs(number as numeric)
 +
</pre>
  
* [[CAST()]] - perform data type conversion
+
* [[CAST()|cast()]] - perform data type conversion
* [[ETOS()]] - perform expression to string conversion
+
 
* [[STR()]] - perform numeric to string conversion  
+
<pre>
* [[STRZERO()]] - perform numeric to zero left-padded string conversion
+
expression = cast(expression as expression AS datatype as character [, width as numeric [, precision as numeric]] [null | not null])
* [[VAL()]] - perform string to numeric conversion
+
</pre>
 +
 
 +
* [[CHR()|chr()]] - perform numeric to ASCII character conversion
 +
 
 +
<pre>
 +
character = chr(number as numeric)
 +
</pre>
 +
 
 +
* [[CTRL()|ctrl()]] - return the numeric value of a control character
 +
 
 +
<pre>
 +
numeric = ctrl(letter as character)
 +
</pre>
 +
 
 +
* [[CURRENCY()|currency()]] - perform numeric to currency string conversion
 +
 
 +
<pre>
 +
character = currency(number as numeric)
 +
</pre>
 +
 
 +
* [[ETOS()|etos()]] - perform expression to string conversion
 +
 
 +
<pre>
 +
character = etos(expression as expression)
 +
</pre>
 +
 
 +
* [[INT()|int()]] - return the integer value of a numeric
 +
 
 +
<pre>
 +
numeric = int(number as numeric)
 +
</pre>
 +
 
 +
* [[STR()|str()]] - perform numeric to string conversion
 +
 
 +
<pre>
 +
character = str(number as numeric [, width as numeric [, decimals as numeric [, base as numeric]]] )
 +
</pre>
 +
 +
* [[STRZERO()|strzero()]] - perform numeric to zero left-padded string conversion
 +
 
 +
<pre>
 +
character = strzero(number as numeric [, width as numeric [, decimals as numeric]])
 +
</pre>
 +
 
 +
* [[TRANSFORM()|transform()]] - perform expression to string conversion based on a picture formatting clause
 +
 
 +
<pre>
 +
character = transform(expression as expression, picture as character)
 +
</pre>
 +
 
 +
* [[VAL()|val()]] - perform string to numeric conversion
 +
 
 +
<pre>
 +
numeric = val(string as character)
 +
</pre>
  
 
===Miscellaneous Numeric Functions===
 
===Miscellaneous Numeric Functions===
 +
* [[ACOS()|acos()]] - calculate the angle size in radians of a cosine
 +
 +
<pre>
 +
numeric = acos(cosine as numeric)
 +
</pre>
 +
 +
* [[ASIN()|asin()]] - calculate the angle size of any given sine value
 +
 +
<pre>
 +
numeric = asin(sine as numeric)
 +
</pre>
 +
 +
* [[ATAN()|atan()]] - calulate the angle size of a given tangent value
 +
 +
<pre>
 +
numeric = atan(tangent as numeric)
 +
</pre>
 +
 +
* [[ATN2()|atn2()]] - calculate the angle size for the specified cosine and sine values of a given point
 +
 +
<pre>
 +
numeric = atn2(cosine as numeric, sine as numeric)
 +
</pre>
 +
 +
* [[BETWEEN()|between()]] - determine whether an expression is between two other specified expressions
 +
 +
<pre>
 +
logical = between(value as expression, minimum as expression, maximum as expression)
 +
</pre>
 +
 +
* [[CEILING()|ceiling()]] - calculate the smallest integer that is greater than or equal to a given value
 +
 +
<pre>
 +
numeric = ceiling(limit as numeric)
 +
</pre>
 +
 +
* [[COS()|cos()]] - calculate the cosine of an angle in radians
 +
 +
<pre>
 +
numeric = cos(radians as numeric)
 +
</pre>
 +
 +
* [[DTOR()|dtor()]] - perform degree to radian conversion
 +
 +
<pre>
 +
numeric = dtor(degrees as numeric)
 +
</pre>
 +
 +
* [[EXP()|exp()]] - calculate exponential value of ''e''
 +
 +
<pre>
 +
numeric = exp(power as numeric)
 +
</pre>
 +
 +
* [[FLOOR()|floor()]] - calculate the largest integer that is less than or equal to a given number
 +
 +
<pre>
 +
numeric = floor(limit as numeric)
 +
</pre>
 +
 +
* [[LENNUM()|lennum()]] - calculate the length of a numeric value
 +
 +
<pre>
 +
numeric = lennum(number as numeric)
 +
</pre>
 +
 +
* [[LOG()|log()]] - calculate natural logarithm value
 +
 +
<pre>
 +
numeric = log(number as numeric)
 +
</pre>
 +
 +
* [[LOG10()|log10()]] - calculate base 10 logarithm value
 +
 +
<pre>
 +
numeric = log10(number as numeric)
 +
</pre>
 +
 +
* [[MAX()|max()]] - calculate the greater of two values
 +
 +
<pre>
 +
numeric = max(value1 as numeric, value2 as numeric)
 +
</pre>
 +
 +
* [[MIN()|min()]] - calculate the lesser of two values
 +
 +
<pre>
 +
numeric = min(value1 as numeric, value2 as numeric)
 +
</pre>
 +
 +
* [[MOD()|mod()]] - calculate the division remainder
 +
 +
<pre>
 +
numeric = mod(dividend as numeric, divisor as numeric)
 +
</pre>
 +
 +
* [[PERCENT()|percent()]] - calculate percentage
 +
 +
<pre>
 +
numeric = percent(part as numeric, whole as numeric)
 +
</pre>
 +
 +
* [[PI()|pi()]] - return the value of pi
 +
 +
<pre>
 +
numeric = pi()
 +
</pre>
 +
 +
* [[RAND()|rand()]] - return a random number
 +
 +
<pre>
 +
numeric = rand([seed as numeric])
 +
</pre>
 +
 +
* [[ROUND()|round()]] - return a rounded numeric
 +
 +
<pre>
 +
numeric = round(number as numeric [, decimals as numeric])
 +
</pre>
 +
 +
* [[RTOD()|rtod()]] - perform radian to degree conversion
 +
 +
<pre>
 +
numeric = rtod(radians as numeric)
 +
</pre>
 +
 +
* [[SIGN()|sign()]] - return the sign of a numeric value
 +
 +
<pre>
 +
numeric = sign(number as numeric)
 +
</pre>
 +
 +
* [[SIN()|sin()]] - calculate the sine of an angle in radians
 +
 +
<pre>
 +
numeric = sin(radians as numeric)
 +
</pre>
 +
 +
* [[SQRT()|sqrt()]] - calculate a square root
 +
 +
<pre>
 +
numeric = sqrt(number as numeric)
 +
</pre>
 +
 +
* [[TAN()|tan()]] - calculate the tangent of an angle in radians
 +
 +
<pre>
 +
numeric = tan(radians as numeric)
 +
</pre>
 +
 
===Miscellaneous Financial Functions===
 
===Miscellaneous Financial Functions===
===Summary===
+
* [[CAGR()|cagr()]] - calculate compound annual growth rate
 +
 
 +
<pre>
 +
numeric = cagr(start as numeric, target as numeric, years as numeric)
 +
</pre>
 +
 
 +
* [[FV()|fv()]] - calculate the future value of a periodic investment
 +
 
 +
<pre>
 +
numeric = fv(premium as numeric, rate as numeric, payments as numeric)
 +
</pre>
 +
 
 +
* [[PAYMENT()|payment()]] - calculate the payment on a loan
 +
 
 +
<pre>
 +
numeric = payment(principal as numeric, rate as numeric, payments as numeric)
 +
</pre>
 +
 
 +
* [[PMT()|pmt()]] - calculate the payment on a loan
 +
 
 +
<pre>
 +
numeric = pmt(principal as numeric, rate as numeric, payments as numeric)
 +
</pre>
 +
 
 +
* [[PV()|pv()]] - calculate the present value of equal regular payments on a loan
 +
 
 +
<pre>
 +
numeric = pv(premium as numeric, rate as numeric, payments as numeric)
 +
</pre>

Latest revision as of 15:22, 22 January 2010

Working With Numeric Data in Recital

Certain set commands change the display format of numeric data:

  • set decimals - specify the number of decimal places to be displayed
set decimals to <places as numeric>
  • set fixed - determine whether the number of decimal places displayed is fixed
set fixed on | off
  • set point - specify the character to be used as the decimal point
set point to [<point as character>]
  • set separator - specify the character to be used to mark thousands
set separator to [<separator as character>]

Numeric Conversion Functions

  • abs() - return the absolute value of a numeric
numeric = abs(number as numeric)
  • cast() - perform data type conversion
expression = cast(expression as expression AS datatype as character [, width as numeric [, precision as numeric]] [null | not null])
  • chr() - perform numeric to ASCII character conversion
character = chr(number as numeric)
  • ctrl() - return the numeric value of a control character
numeric = ctrl(letter as character)
  • currency() - perform numeric to currency string conversion
character = currency(number as numeric)
  • etos() - perform expression to string conversion
character = etos(expression as expression)
  • int() - return the integer value of a numeric
numeric = int(number as numeric)
  • str() - perform numeric to string conversion
character = str(number as numeric [, width as numeric [, decimals as numeric [, base as numeric]]] )
  • strzero() - perform numeric to zero left-padded string conversion
character = strzero(number as numeric [, width as numeric [, decimals as numeric]])
  • transform() - perform expression to string conversion based on a picture formatting clause
character = transform(expression as expression, picture as character)
  • val() - perform string to numeric conversion
numeric = val(string as character)

Miscellaneous Numeric Functions

  • acos() - calculate the angle size in radians of a cosine
numeric = acos(cosine as numeric)
  • asin() - calculate the angle size of any given sine value
numeric = asin(sine as numeric)
  • atan() - calulate the angle size of a given tangent value
numeric = atan(tangent as numeric)
  • atn2() - calculate the angle size for the specified cosine and sine values of a given point
numeric = atn2(cosine as numeric, sine as numeric)
  • between() - determine whether an expression is between two other specified expressions
logical = between(value as expression, minimum as expression, maximum as expression)
  • ceiling() - calculate the smallest integer that is greater than or equal to a given value
numeric = ceiling(limit as numeric)
  • cos() - calculate the cosine of an angle in radians
numeric = cos(radians as numeric)
  • dtor() - perform degree to radian conversion
numeric = dtor(degrees as numeric)
  • exp() - calculate exponential value of e
numeric = exp(power as numeric)
  • floor() - calculate the largest integer that is less than or equal to a given number
numeric = floor(limit as numeric)
  • lennum() - calculate the length of a numeric value
numeric = lennum(number as numeric)
  • log() - calculate natural logarithm value
numeric = log(number as numeric)
  • log10() - calculate base 10 logarithm value
numeric = log10(number as numeric)
  • max() - calculate the greater of two values
numeric = max(value1 as numeric, value2 as numeric)
  • min() - calculate the lesser of two values
numeric = min(value1 as numeric, value2 as numeric)
  • mod() - calculate the division remainder
numeric = mod(dividend as numeric, divisor as numeric)
numeric = percent(part as numeric, whole as numeric)
  • pi() - return the value of pi
numeric = pi()
  • rand() - return a random number
numeric = rand([seed as numeric])
  • round() - return a rounded numeric
numeric = round(number as numeric [, decimals as numeric])
  • rtod() - perform radian to degree conversion
numeric = rtod(radians as numeric)
  • sign() - return the sign of a numeric value
numeric = sign(number as numeric)
  • sin() - calculate the sine of an angle in radians
numeric = sin(radians as numeric)
  • sqrt() - calculate a square root
numeric = sqrt(number as numeric)
  • tan() - calculate the tangent of an angle in radians
numeric = tan(radians as numeric)

Miscellaneous Financial Functions

  • cagr() - calculate compound annual growth rate
numeric = cagr(start as numeric, target as numeric, years as numeric)
  • fv() - calculate the future value of a periodic investment
numeric = fv(premium as numeric, rate as numeric, payments as numeric)
  • payment() - calculate the payment on a loan
numeric = payment(principal as numeric, rate as numeric, payments as numeric)
  • pmt() - calculate the payment on a loan
numeric = pmt(principal as numeric, rate as numeric, payments as numeric)
  • pv() - calculate the present value of equal regular payments on a loan
numeric = pv(premium as numeric, rate as numeric, payments as numeric)