XFA Specification
Chapter 23, FormCalc Specification
Grammar and Syntax
807
String Literals
A string literal is a sequence of Unicode characters enclosed within double quote characters, e.g., "the cat
jumped over the fence." The string literal "" defines an empty sequence of text characters called the empty
string.
To embed a double quote within a string literal, specify two double quote characters, as in "He said ""She
said.""". Moreover within string literals, any Unicode character may be expressed as a Unicode escape
sequence of 6 characters consisting of \u followed by four hexadecimal digits, e.g.,
"\u0047\u006f \u0066\u0069\u0073\u0068\u0021"
To embed a control character with a string literal, specify its Unicode escape sequence, e.g., specify \u000d
for a carriage return, and \u000a for a newline character.
6
7
HexDigit ::= ['0'-'9'] | ['m'-'f'] |
EscapedCharacter ::= '"' '"' |
'\' 'U' HexDigit HexDigit HexDigit
'\' 'U' HexDigit HexDigit HexDigit
StringLiteral ::= '"' ( Character \–
['A'-'F']
HexDigit |
HexDigit HexDigit HexDigit HexDigit HexDigit
['"'] | EscapedCharacter )
*
'"'
8
Note:
“Notational Conventions” on page 805
explains the significance of the
*
and
?
symbols.
Number Literals
A number literal is a sequence of mostly digits consisting of an integral part, a decimal point, a fractional
part, an e (or E) and an optionally signed exponent part. Either the integral part or the fractional part may
be missing, but not both. In the fractional part, either the decimal point or the e and exponent part may be
missing, but not both.
9 Integer ::= ['0'-'9']+ ( ['0'-'9'] )
*
10 Exponent ::= ['E' 'e'] ['+' '-']
?
Integer
11 NumberLiteral ::= Integer '.' ['0'-'9']
*
Exponent
?
| '.' Integer Exponent
?
|
Integer Exponent
?
| 'nan' | 'inf'
Note:
“Notational Conventions” on page 805
explains the significance of the
*
and
?
symbols.
Examples of number literals include 12, 1.2345, .12, 1e-2, and 1.2E+3.
All number literals are internally converted to
[IEEE754]
64-bit binary values. However, IEEE 754 values can
only represent a finite quantity of numbers.Just as some numbers, such as 1/3, are not representable
precisely as decimal fractions, other numbers are not precisely representable as binary fractions.
Specifically, but not limited to, number literals having more than 16 significant digits in the non-exponent
part will be the rounded to the nearest representable IEEE 754 64-bit value using a round-to-nearest
mechanism. The following table provides examples of such rounding imprecision, all of which are
conformant to the IEEE 754 standard.
Input number
123456789.012345678
99999999999999999
Is rounded to …
123456789.01234567
100000000000000000
Such rounding behavior behaviour can sometimes lead to surprising results.
FormCalc
provides a
function,
Round()
, which returns a given number rounded to a given number of decimal places. When
Home Index Bookmark Pages
Pages: Home Index All Pages