Numbers are integers or floating point numbers. In Panorama X, both are 64 bit. Integers are the number zero and the positive and negative whole numbers, that is, they are not expressed as a fraction or decimal number. Floating point numbers are all non-whole real numbers. They can be expressed as a set of digits and an exponent. You can learn more technical details about floating point numbers at Floating Point Numbers.

Combining Numbers

When you combine numeric types in Panorama, here is what happens to the result:

Operator Operand 1 Operand 2 Result
+, -, * Integer Integer Integer
+, -, * Integer Float Float
+, -, * Float Integer Float
+, -, * Float Float Float
/ Any Any Float
  Any Any Integer

Converting numbers to text

You may convert numbers to text by concatenating a number with a non-number, or by applying a variety of functions. If no pattern is specified, a floating point number will round to six significant digits. For example, if the result of a function is 12345.6789, it will be displayed, in a text display object, for example, as 12345.7 if no pattern is applied. If you need to display more decimal places, then use a pattern, such as

pattern(12345.6789,”$#,.##”) ☞ $12,345.68

Six functions convert numbers to text:

Str( function: The string function will convert an integer—as text—exactly as the integer appears, from str(-9223372036854775807) to str(9223372036854775807). Integers greater or less than those numbers are not correct. Floating point numbers in Panorama will be handled exactly correctly up to 15 digits.

pattern( function: The pattern function converts numbers to text in a wide variety of ways of your creation. See the Numeric Patterns for more details. The pattern function can output up to 15 significant digits. Patterns now include an option for engineering notation, e.g. pattern(number,”###.###e”), where e is always a multiple of 3.

zbPattern( function: This is the same as the pattern function except that zero value output will be left blank. For example, the formula zbpattern(number,”$#,.##”) will return blank if 0 is the original number, $1.00 if 1 is entered, and $7,542.00 if 7542 is entered.

pluralPattern( function: See zbpattern( for using correct English syntax, by adding an “s”, or not, and using “is” or “are” as appropriate and changing nouns to the correct form, within limits, of course.

radixstr( converts a number into a text string expressed in a different number base, from 2 to 32, or to binary. You may enter binary, octal, or hex for bases 2, 8, and 16. like this:

radixstr("hex",1234) ☞ 00000000000004D2

radixstr(17,1234) ☞ 44A

hexstr( is merely a subset of the radixstr( function – it converts to a text string of the base 16 number.

Converting anything to a floating point number.

float(: This function will convert any type of value to a floating point value, including text, integers, or fixed point numbers. For example,

float(3) ☞  3.0000
float(“3”)  ☞  3.0000 
float(“anytext”) ☞  0 and
float(3.5) ☞ 3.5000

In most situations Panorama converts integers to floating point automatically when necessary and you don’t need the float( function. For example, division automatically converts to floating point.

3/4 ☞ 0.75

####Converting a floating point number to an integer.####

You may also convert floating point numbers to integers with three functions.

int( which truncates toward -infinity. So

int (4.5) ☞ 4


int(-4.5) ☞ -5

ceil( truncates toward positive infinity. So

ceil(4.5) ☞ 5


ceil(-4.5) ☞ -4

fix( truncates toward 0. So

fix(4.5) ☞ 4


fix(-4.5) ☞ -4

Rounding Floating Point Numbers

Rounding works like traditional rounding with one wrinkle:

round(4.5,1) ☞ 5

but use round(-4.5,-1) if you want to round to -5. Query, if you have a variable of unknown sign (“+” or “-“?), how do you handle that? This oddity may be changed in a later release of Panorama so the second operand is always positive.

HexStr( Panorama X supports the use of hexadecimal (base 16) numbers. To express a hexadecimal constant, begin the string with 0x.

####Converting base-10 numbers to base-16, i.e. hexadecimal####

Several functions can convert base-10 numbers to hexadecimal numbers: hexbyte, hexword, hexlong, and hexstr. See the details in the Panorama X Help pages: hexbyte(, hexword(, hexlong(, and hexstr(.

####Special Floating Point Values####

There are two special floating point values: INF (infinity) and NAN (not a number). For example, dividing by zero returns inf, so

1/0 ☞ inf

The result is treated as a valid result (but not a valid number), not an error. The function infinity() is equivalent to dividing by zero. So

2/0=infinity() ☞ true

Since Panorama does not accommodate imaginary numbers, the nan has been created to handle operations that return imaginary numbers. So the function

sqr(-2) ☞ nan

You may test a result to see if it is a valid number with the function validnumber(, which returns true or false. For example,

validnumber(-2) ☞ -1, i.e. true


validnumber(sqr(-2)) ☞ 0, i.e. false

In spite of the existence of the infinity( function, infinity is still not a valid number, i.e.,

validnumber(2/0) ☞ 0

You can test to see if a numeric value is valid with the nan( function, which is true if the value tested is invalid. For example,

nan(5/2) ☞ 0, i.e., false


nan(5/0) ☞ -1, i.e. true
nan(sqr(-1) ☞ -1, i.e. true

You may also use the divzero( function to return zero instead of nan if you divide a number be zero, or you may use the divzeroerror( function to return an error if you divide a number by zero or the actual result if the denominator is not zero.

The mod function

The mod function returns the remainder when operand 1 is divided by operand 2. It can help when working with numbers in some clever ways. You can check if numbers are even or odd with the mod function.

x mod 2 ☞  1,which is true

if x is odd. (Note that any floating point operand will be converted to an integer before the calculation is made.) You may find numbers divisible by any integer, so (x mod y)=0 will return true whenever x is evenly divisible by y. You could also select every x number of records by using (seq() mod x)=0, which will be true for every x records beginning with record number x.

While you are working with true/false formulas, remember that false is 0 and that every other number is true. One true value does not necessarily equal another true value, but every false value will equal every other false value.

The mod function will truncate floating point operands back to the decimal, so, for example,

6.8 mod 2.2 ☞ 0

Mod may also return a negative number.

-7 mod 2 ☞ -1  

Random numbers

Panorama has two functions for generating random numbers, the randominteger( and rnd( functions. Randominteger(x,y) will generate a random integer between x and y. rnd( will generate a random number between 0 and 1.

For other topics regarding numbers, see the help pages for the trig functions, time, various date and superdate functions (which are stored as integers), statistical functions, zip codes, irrational numbers, pi, and Euler’s number, logarithmic functions, nth function to convert numbers into ordinals, leading zeros, financial functions, and scientific notation.

See Also


10.0No ChangeCarried over from Panorama.