Global environment
set numberFormat to "00.##" -- displays 02.21 for 2.21
set numberFormat to "0" -- displays 2 for 2.21
set numberFormat to "0.0" -- displays 2.2 for 2.21
The numberFormat
property determines the format used when integer
s, number
s, and complex
es are converted to string
s. Use zeroes (0
) to represent digits that always appear, a period (.
) to represent the decimal point, and number signs (#
) to represent digits that appear only when they are non-zero. Use E
followed by one or more zeroes to specify scientific notation. If scientific notation is specified, you can use <
followed by an integer to specify scientific notation only for numbers with an exponent less than or equal to that integer, and >
followed by an integer to specify scientific notation only for numbers with an exponent greater than or equal to that integer.
The following table illustrates various number formats:
Format | 0 | 0.00715 | 0.0715 | 0.715 | 7.15 | 71.5 | 715 | 7150 |
---|---|---|---|---|---|---|---|---|
0.###### |
0 |
0.00715 |
0.0715 |
0.715 |
7.15 |
71.5 |
715 |
7150 |
0.## |
0 |
0.01 |
0.07 |
0.72 |
7.15 |
71.5 |
715 |
7150 |
0.# |
0 |
0 |
0.1 |
0.7 |
7.2 |
71.5 |
715 |
7150 |
0.000000 |
0.000000 |
0.007150 |
0.071500 |
0.715000 |
7.150000 |
71.500000 |
715.000000 |
7150.000000 |
0.00 |
0.00 |
0.01 |
0.07 |
0.72 |
7.15 |
71.50 |
715.00 |
7150.00 |
0.0 |
0.0 |
0.0 |
0.1 |
0.7 |
7.2 |
71.5 |
715.0 |
7150.0 |
0.00## |
0.00 |
0.0072 |
0.0715 |
0.715 |
7.15 |
71.50 |
715.00 |
7150.00 |
0.0# |
0.0 |
0.01 |
0.07 |
0.72 |
7.15 |
71.5 |
715.0 |
7150.0 |
0 |
0 |
0 |
0 |
1 |
7 |
72 |
715 |
7150 |
0.###E0 |
0E0 |
7.15E-3 |
7.15E-2 |
7.15E-1 |
7.15E0 |
7.15E1 |
7.15E2 |
7.15E3 |
0.#E0 |
0E0 |
7.2E-3 |
7.2E-2 |
7.2E-1 |
7.2E0 |
7.2E1 |
7.2E2 |
7.2E3 |
0.#E00 |
0E00 |
7.2E-03 |
7.2E-02 |
7.2E-01 |
7.2E00 |
7.2E01 |
7.2E02 |
7.2E03 |
0.000E0 |
0.000E0 |
7.150E-3 |
7.150E-2 |
7.150E-1 |
7.150E0 |
7.150E1 |
7.150E2 |
7.150E3 |
0.##E0<-3>3 |
0 |
7.15E-3 |
0.07 |
0.72 |
7.15 |
71.5 |
715 |
7.15E3 |
0.##E0<-2>2 |
0 |
7.15E-3 |
7.15E-2 |
0.72 |
7.15 |
71.5 |
7.15E2 |
7.15E3 |
0.##E0<-1>1 |
0 |
7.15E-3 |
7.15E-2 |
7.15E-1 |
7.15 |
7.15E1 |
7.15E2 |
7.15E3 |
0.###'0 |
0'0 |
7.15''3 |
7.15''2 |
7.15''1 |
7.15'0 |
7.15'1 |
7.15'2 |
7.15'3 |
0.#'0 |
0'0 |
7.2''3 |
7.2''2 |
7.2''1 |
7.2'0 |
7.2'1 |
7.2'2 |
7.2'3 |
0.#'00 |
0'00 |
7.2''03 |
7.2''02 |
7.2''01 |
7.2'00 |
7.2'01 |
7.2'02 |
7.2'03 |
0.000'0 |
0.000'0 |
7.150''3 |
7.150''2 |
7.150''1 |
7.150'0 |
7.150'1 |
7.150'2 |
7.150'3 |
0.##'0<-3>3 |
0 |
7.15''3 |
0.07 |
0.72 |
7.15 |
71.5 |
715 |
7.15'3 |
0.##'0<-2>2 |
0 |
7.15''3 |
7.15''2 |
0.72 |
7.15 |
71.5 |
7.15'2 |
7.15'3 |
0.##'0<-1>1 |
0 |
7.15''3 |
7.15''2 |
7.15''1 |
7.15 |
7.15'1 |
7.15'2 |
7.15'3 |
The numberFormat
property does not affect the accuracy or precision of mathematical operations, only the presentation of the results. To change the precision of mathematical operations, see precision
.
The default number format in both HyperTalk and XION is 0.######
.
HyperTalk supports only the 0
, .
, and #
characters in its numberFormat
property.