XFA Specification
Chapter 23, FormCalc Specification
Grammar and Syntax
808
the given number is exactly halfway between two representable numbers, it is rounded away from zero;
up if positive, and down if negative. So, e.g.,
round(.124, 2)
returns 0.12, and
round(.125, 2)
returns 0.13. Given this convention, one might expect then that
round(0.045, 2)
returns 0.05. It doesn't. IEEE 754 dictates that the number literal
0.045
be approximated to
0.0449999999999999
This approximation is closer to 0.04 than to 0.05, so
Round(0.045, 2)
returns 0.04. This too is conformant to the IEEE 754 standard.
IEEE 754 64-bit values also support representations like NaN (not a number), +Inf (positive infinity), and -Inf
(negative infinity).
FormCalc
does not support these; currently, any intermediate expression that
evaluates to NaN, +Inf, or -Inf results in an error exception which is propagated in the remainder of the
expression. This behaviour is expected to change soon.
Literals (General)
12 NullLiteral ::= 'null'
13 Literal ::= StringLiteral | NumberLiteral| NullLiteral
The NullLiteral equates to the null value
Identifiers
An identifier is a sequence of characters of unlimited length but always beginning with an alphabetic
character, or an underscore (_) character, or a dollar sign ($) character, or an exclamation mark (!) character.
FormCalc
identifiers are case sensitive, i.e., identifiers whose characters only differ in case, are considered
distinct. Case sensitivity is mandated by
FormCalc's
hosting environments.
14 Identifier ::= ( AlphabeticCharacter | '_' | '$' | '!' ) (
AlphaNumericCharacter
1
| '_' | '$' )
Keywords
Keywords in
FormCalc
are reserved words and are case insensitive. Of these, the 'if', 'then', 'elseif', 'else',
'endif' keywords delimit the parts of an
If Expressions.The
'nan' and 'inf' keywords denote special number
literals, whereas the 'null' keyword denotes the null literal. The 'this' keyword denotes a specific
accessor.The remaining keywords are keyword operators.
1. An alphabetic character is any Unicode character classified as a letter in the Basic Multilingual Plane (BMP). An
alphanumeric character is any Unicode character classified as either a letter or digit in the BMP.