Panorama formulas are very adept at performing arithmetic—from simple addition to complex financial calculations. Arithmetic formulas usually work just like the ones you learned about in high school. Panorama has seven arithmetic operators:

The ^ operator (press Shift-6) raises the operand on the left to the power specified on the right. For example the formula:

2^3

means raise 2 to the third power, equivalent to the mathematical formula:

The `` operator truncates both operands to integers and then divides them. The result is also an integer. For example,

19/5 ☞ 3.8
9.89/1.89 ☞ 5.23

but

19\5 ☞ 3
9.89\1.89 ☞ 9

Notice that because this is an integer operation, the result is not rounded.

The mod operator computes the remainder after an integer division. For example:

19 mod 5 ☞ 4
20 mod 5 ☞ 0

The result of the mod operator will always be an integer between zero and one less than the value of the operand on the right (in this case 0, 1, 2, 3, or 4).

If the first operand is negative, the result will be negative. If the second operand is negative, the result will be the same as if it had been positive. If either operand has a fractional component, that component will be removed before making the calculation, so:

21.35 mod 4.89 ☞ 1

Dividing by Zero

If you divide any number by 0, the result is infinity:

3/0 ☞ inf

You’ll often want to test to see if the result of a division is valid, which you can do with the infinity( function.

Q = X/Y
if Q = infinity()
    message "Oops!"
    return /* stop program */
endif
... continue with program ...

Another option is to use the validnumber( function.

Q = X/Y
if validnumber(Q) = false()
    message "Oops!"
    return /* stop program */
endif
... continue with program ...

It’s numerically incorrect, but if you would prefer that the result of dividing by zero be zero then use the divzero( function:

divzero(3,0) ☞ 0.0000

You can also use the divzeroerror( function if you would prefer that an error be generated.

divzeroerror(3,0) ☞ ERROR

Basic Numeric Functions

These functions perform various mathematical operations. Each of these functions takes one or more numeric parameters and returns a numeric result.

Scientific Functions

These functions perform various log, trig, and exponential calculations. Each of these functions takes one or more numeric parameters and returns a numeric result.

All of the trig functions listed in this table either have an angle as their parameter or produce an angle as their result and they expect input angles to be expressed in radians (1 radian = 180/π degrees) and their angle output will be expressed in radians. If you want to express the angle in degrees instead, you can use the degreestoradians( function to convert the angle from degrees to radians. For example, this formula calculates the sine of 45 degrees.

sin(degreestoradians(45)) ☞ 0.7071067811865475

In a procedure the degree statement may be used to temporarily switch Panorama’s trig functions to use degrees instead of radians. The radian statement switches the mode back to radians (Panorama also switches back automatically when the procedure is finished). For example, the procedure below calculates the tangent of 30 degrees, not 30 radians.

degree
height=tan(30)

Calculations performed outside of a procedure always use radians (for example in a Text Display Object).

Financial Functions

These functions calculate financial data, including loan payments, future value, and present value.

They are designed to be compatible with the same functions in Microsoft Excel. The financial functions are based on the following formula.

pv(1+rate)periods+payment(1+rate ×begin)×((1+rate)periods-1)/rate+fv=0

See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.