setdefaultfloatformat
TEMPLATE
The setdefaultfloatformat statement sets the default format for converting floating point values to text (unsupported).
Parameters
This statement has one parameter:
template – IEEE template for converting floating point to text. This is usually in the format %.NNg
, where NN
is the number of digits to be displayed.
Description
This statement changes the template used for converting floating point values to text. Please note that this statement is unsupported – we recommend using the default template. Specifying an invalid template will cause incorrect display of floating point numbers (or even no display at all).
This example tells Panorama to display 16 digits of precision (this was the default for Panorama X 10.1 and earlier, but is no longer recommended because IEEE floating point numbers don’t actually store 16 digits, and this may display numbers that appear to be inexact.)
setdefaultfloatformat "%.16g"
Since IEEE floating point values only contain about 15 1/2 digits, specifying display of 16 digits can result in unexpected output like this:
str(0.07) ☞ 0.07000000000000001
The extra digit in the 16th place is because IEEE floating point cannot accurately store the value 0.07. For detailed technical information about IEEE floating point numbers see double precision floating point.
If you specify an empty format, Panorama will reset to the default template (%.15g
).
setdefaultfloatformat ""
Displaying only 15 digits eliminates possible inaccuracy in the display of the 16th digit.
str(0.07) ☞ 0.07
To find out the current format setting, use the info(“defaultfloatformat”) function.
See Also
- alphabeticnumber( -- converts a number into letters: A, B, C, etc.
- asc( -- converts the first character of a text string into a number from 0 to 65535 based on Unicode encoding.
- bigendianbinaryvalue( -- converts big endian binary data (a byte, word, or longword) into an unsigned number (see Binary Data).
- binarytotext( -- converts binary data into text, optionally using a specified encoding.
- binaryvalue( -- converts binary data (a byte, word, longword, or longlongword) into a number (see Binary Data).
- booleanvalue( -- converts a numeric or text value to Boolean (true/false).
- boolstr( -- converts a Boolean value to text, either `"true"` or `"false"`.
- bytepattern( -- converts a byte count to text: 543 Bytes, 543 Kb, 123 Mb, 3.2 Gb
- chr( -- converts a number into a single character of text, based on Unicode encoding.
- commalist( -- converts a text array (see Text Arrays) into an English list, with items separated by a comma and a space, except for the last two items which are separated by the word *and* and spaces.
- commastr( -- converts a number to text, with a comma every third digit. The number is converted as an integer, with no decimal point.
- completedatestr( -- converts a date to text, spelling out the month and including the day of the week.
- custompluralpattern( -- converts a number to text using a pattern, making customizable adjustments for pluralization.
- datestr( -- converts a date to text using format *mm/dd/yy*.
- daystr( -- converts a date to the day of the week (for example *Sunday*).
- dollarsandcents( -- converts a number to text formatted as dollars and cents.
- emojicheats( -- abbreviates any emojis with "emoji cheat" codes.
- encodeurlfragment( -- encodes text so that it can be used in the fragment portion of a URL (the portion after the # symbol).
- encodeurlhost( -- encodes text so that it can be used in the host portion of a URL (for example www.host.com).
- encodeurlpassword( -- encodes text so that it can be used in the password portion of a URL.
- encodeurlpath( -- encodes text so that it can be used in the path portion of a URL (the portion after the host name, but before any ? symbol).
- encodeurlquery( -- encodes text so that it can be used in the query portion of a URL (the portion after the ? symbol).
- encodeurluser( -- encodes text so that it can be used in the user name portion of a URL.
- eurodatestr( -- converts a date to text in European format.
- expandemojis( -- expands any "emoji cheat" abbreviations into the actual emojis.
- formatphone( -- formats a US phone number using the standard *(aaa) nnn-nnnn* format.
- hex( -- converts a text item containing a hexadecimal number into a standard number (decimal).
- hexbyte( -- converts a limited range of decimal numbers to a two-digit hexadecimal number expressed as a text string.
- hexlong( -- converts a decimal number to an eight-digit hexadecimal number expressed as a text string
- hexstr( -- converts a number to text formatted as a hexadecimal number.
- hextobinary( -- converts a sequence of hexadecimal digits into a raw binary data value.
- hexword( -- converts a decimal number to a four-digit hexadecimal number expressed as a text string.
- importcell( -- returns one cell of imported data.
- info("defaultfloatformat") -- returns the default format for converting floating point numbers to text.
- length( -- counts the number of characters in a text value (also called a string).
- littleendianbinaryvalue( -- converts little endian binary data (a byte, word, longword, or longlongword) into an unsigned number (see Binary Data).
- longdatestr( -- converts a date to text by spelling out the month.
- longtimestr( -- converts a number to text in am/pm time format, including seconds.
- money( -- converts a number to text, formatted as money.
- nth( -- converts a number into an ordinal.
- Numeric Patterns -- control how a number is displayed or converted to text.
- pattern( -- converts a number into text using a pattern.
- places( -- converts a number to text with a specific number of places after the decimal point.
- pluralpattern( -- converts a number to text using a pattern, making adjustments for pluralization.
- pointsval( -- converts a dimension to points (possibly from inches or centimeters).
- radix( -- converts a text item containing a number in a radix between 2 and 36 into a decimal number.
- radixstr( -- converts a number into a text item containing the equivalent number in a radix between 2 and 36.
- scientificnotation( -- converts a number to text, formatted in scientific notation.
- signedbinaryvalue( -- converts binary data (a byte, word, longword, or longlongword) into a signed number (see Binary Data).
- str( -- converts a number into text, with no formatting.
- superdatepattern( -- converts a number containing a superdate to text, allowing you to specify the patterns for both the date and the time conversion to text.
- superdatesecondsstr( -- converts a number containing a superdate to text, including the seconds.
- superdatestr( -- converts a number containing a superdate (date + time) to text.
- texttobinary( -- converts text into binary data, optionally using a specified encoding.
- timestr( -- converts a number to text in am/pm time format.
- val( -- converts text into a number.
- zbpattern( -- converts a number to text using a pattern, but returns empty text if the number is zero.
History
10.2 | New | New in this version. |