Math Functions

Top  Previous  Next

Lighthouse Studio includes a number of math functions that can be used to display information to the screen, within skip logic, within constructed list logic, for use with Hidden Variables, and in other fields within the Lighthouse Studio menu system.

 

The "Sawtooth Script" column below gives the syntax for Math Functions.  

 

Sawtooth Script:

Description:

Abs (*NUMBER)

Returns the absolute value.  

Ceiling (NUMBER)

Rounds the NUMBER up to the closest integer.

Exp (NUMBER)

Returns e (2.71828183) raised to the power of NUMBER

Floor (NUMBER)

Rounds the NUMBER down to the closest integer.

FORMATNUMBER (NUMBER,

 "ThousandsSeparator",

 "DecimalSeparator",

 NumDecimalPlaces)

Formats a number with commas and decimal places. More Information.

Log10 (NUMBER)

Returns the log (base 10) of NUMBER.

Ln (NUMBER)

Returns the natural log of NUMBER.

POWER (NUMBER1, NUMBER2)

Returns NUMBER1 raised to the NUMBER2 power.

ROUND (NUMBER)

ROUND (NUMBER, #DECIMALS)

Rounds NUMBER to the #DECIMALS places.  If no decimal places are specified, rounds to nearest integer.

ROUNDTONUMBER (NUMBER, ROUNDTO)

ROUNDTONUMBER (NUMBER, ROUNDTO,

  #DECIMALS)

 

Rounds NUMBER to the nearest ROUNDTO value, such as to the nearest 10, 25, 50, 100, 250, 500, 1000, 5000, 10000, etc.

Sqrt (NUMBER)

Returns the square root of NUMBER.

*For all math functions, NUMBER can be any QuestionName that contains a numeric value or any numeric expression (including functions and mathematical operators) that returns a numeric value.

 

For additional flexibility in Sawtooth Scripting, see the Unverified Perl documentation.

 

Page link: http://www.sawtoothsoftware.com/help/lighthouse-studio/manual/index.html?mathfunctions.html