FPBench is a standard benchmark suite for the floatingpoint community. The benchmark suite contains a common format for floatingpoint computation and metadata and a common set of accuracy measures:
 The FPCore input format
 FPCore example inputs
 Metadata for FPCore benchmarks
 Standard measures of error
FPCore benchmark format
FPCore is the format used for FPBench benchmarks. It is a simple functional programming language with conditionals and loops. The syntax is an easytoparse Sexpression syntax.
Syntax
Benchmarks use a simple Sexpression syntax with the following grammar.
In this grammar, an FPCore term describes
a single benchmark, with a set of free variables, a collection of
metadata properties, and the
floatingpoint expression defining the benchmark. Whitespace is
ignored, and lines starting with the semicolon (;
)
are treated as comments and ignored. The basic tokens are defined
as expected:
 rational
 An optional plus (
+
) or minus (
) sign, followed by a sequence of decimal digits that form the numerator, followed by a slash (/
), followed by a nonzero sequence of decimal digits that form the denominator. This definition is implemented for ASCII by the regular expression:
Every other kind of numeric literal only expresses rational numbers, so every other type of numeric literal can be considered syntax sugar for rational numbers.[+]?[09]+/[09]*[19][09]*
 decnum
 An optional plus (
+
) or minus (
) sign followed by either a sequence of decimal digits which may optionally be followed by a period (.
) and another sequence of digits, or by a period and a sequence of digits. This may be followed by ane
, an optional plus or minus sign, and a final sequence of digits. This definition is implemented for ASCII by the regular expression:[+]?([09]+(\.[09]+)?\.[09]+)(e[+]?[09]+)?
 hexnum
 An optional plus (
+
) or minus (
) sign, followed by the hexadecimal literal identifier0x
, all followed by either a sequence of hexadecimal digits ([09af]
) which may optionally be followed by a period (.
) and another sequence of hex digits, or by a period and a sequence of hex digits. This may be followed by ap
, an optional plus or minus sign, and a sequence of decimal digits. This definition is implemented for ASCII by the following regular expression, which is caseinsensitive:[+]?0x([09af]+(\.[09af]+)?\.[09af]+)(p[+]?[09]+)?
 symbol
 Any sequence of letters, digits, or characters from the
set
~!@$%^&*_+=<>.?/:
not starting with a digit and not matching any other basic token. In ASCII, all symbols match by this regular expression:[azAZ~!@$%^&*_\+=<>.?/:][azAZ09~!@$%^&*_\+=<>.?/:]*
 string
 Any sequence of printable characters, spaces, tabs, or
carriage returns, delimited by double quotes
(
"
). Within the double quotes, backslashes (\
) have special meaning. A backslash followed by a double quote represents a double quote and does not terminate the string; a backslash followed by a backslash represents a backslash; other escapes may also be supported by implementations, but their meaning is not defined in this standard. We recommend that implementations only use escapes defined in the C or Matlab standard libraries. This definition is implemented for ASCII by the regular expression:"([\x20\x21\x23\x5b\x5d\x7e]\\["\\])*"
Supported operations
The following operations are supported:
Supported Mathematical Operations  

+    *  /  fabs 
fma  exp  exp2  expm1  log 
log10  log2  log1p  pow  sqrt 
cbrt  hypot  sin  cos  tan 
asin  acos  atan  atan2  sinh 
cosh  tanh  asinh  acosh  atanh 
erf  erfc  tgamma  lgamma  ceil 
floor  fmod  remainder  fmax  fmin 
fdim  copysign  trunc  round  nearbyint 
Supported Testing Operations  
<  >  <=  >=  == 
!=  and  or  not  isfinite 
isinf  isnan  isnormal  signbit 
All operations have the same signature as the equivalent operations
in C11.
The arithmetic functions are all binary operators,
except that unary 
represents negation.
The comparison operators and boolean and
and or
allow an arbitrary number of arguments.
A comparison operator with more than two operators is interpreted
as the conjuction of all ordered pairs of arguments. In other
words, ==
tests that all
its arguments are equal; !=
tests that all its
arguments are distinct;
and <
, >
, <=
,
and >=
test that their arguments are sorted (in
the appropriate order), with equal elements allowed
for <=
and >=
, and disallowed
for <
and >
.
Supported constants
The following constants are supported:
Supported Mathematical Constants  

E  LOG2E  LOG10E  LN2  LN10 
PI  PI_2  PI_4  M_1_PI  M_2_PI 
M_2_SQRTPI  SQRT2  SQRT1_2  INFINITY  NAN 
Supported Boolean Constants  
TRUE  FALSE 
The floatingpoint constants are defined just like their analogs in GNU libc. All constants must evaluate to a value as close as possible to their mathematicallyaccurate real value, according to the rounding context.
Semantics
FPCore expressions can describe concrete floatingpoint computations, abstract specifications of those computations, or intermediates between the two. The semantics of FPCore are correspondingly flexible, and are made explicit by the rounding context.
Values in FPCore expressions are either boolean values or extended real numbers, which can be actual real numbers (usually rounded to some finite precision) or special floatingpoint values such as infinities and NaN. Numerical operations take extended real values as input and return the corresponding extended real result, rounded according to a rounding context. The behavior of rounding and the rounding context is described in detail under Rounding.
Operations that receive values of mixed or incorrect types, such
as (+ 1 TRUE)
, are illegal and the results of
evaluating them undefined.
 Function application
 The semantics of function application are standard.
if
expressions
An
if
expression evaluates the conditional to a boolean and then returns the result of the first branch if the conditional is true or the second branch if the conditional is false. let
expressions
Bindings in a
let
expression are evaluated simultaneously, as in a simultaneous substitution. Thus,(let ([a b] [b a]) ( a b))
is the same as( b a)
and(let ([a 1] [b a]) b)
is illegal unlessa
is available in the context. For sequentially binding variables, nestlet
s. while
expressions
A
while
loop contains a conditional, a list of bound variables, and a return expression. Both the conditional and the return expression may refer to the bound variables. While loops are evaluated according the equality:(while cond ([x init update] ...) retexpr)
(let ([x init] ...) (if cond (while cond ([x update update] ...) retexpr) retexpr)In other words, the list of bound variables gives the variable's name, its initial value, and the expression by which it is updated to after each iteration. The loop initializes all bound variables; evaluates the condition; if true, simultaneously updates the variables with the update expression and repeats; if false, the return expression is evaluated and its value is returned.
cast
expressions
A
cast
performs explicit rounding according to the rounding context. If the context specifies real precision, it is guaranteed to be a noop. !
annotations
A
!
annotation updates the rounding context for a subexpression. Properties specified in the annotation are set to the provided values, and all other properties are inherited from the parent context. See Rounding. digits

The
digits
constructor allows exact numbers to be specified in any floatingpoint radix as a triple of significand (or mantissa), exponent, and base.(digits m e b)
represents exactly the value m ✕ b^{e}. m, e, and b are integers, with b ≥ 2. The sign of the value is determined by the sign of m. let*
andwhile*

let*
andwhile*
expressions are sequentially binding variants oflet
andwhile
, familiar from most lisp dialects. Rather than being evaluated simultaneously, the bindings are evaluated in order, so that(let* ([a b] [b a]) ( a b))
is the same as( b b)
and(let* ([a 1] [b a])b)
is the same as1
. The initializations and updates in the body of awhile*
loop are performed sequentially in an analogous way.let*
expressions can be desugared into nestedlet
expressions by the following rule:(let* ([var value] rest ...) body)
(let ([var value]) (let* (rest ...) body))Similarly,
while*
loops can be desugared into regular, simultaneouslybindingwhile
andlet*
expressions (which can be further desugared intolet
s):(while* cond ([x xinit xupdate] [y yinit yupdate] ...) retexpr)
(while cond ([x (let* ([x xinit] [y yinit] ...) x)) (let* ([x xupdate] [y yupdate] ...) x))] [y (let* ([x xinit] [y yinit] ...) y)) (let* ([x xupdate] [y yupdate] ...) y))] ...) retexpr)Alternatively, a
while*
loop can be given semantics directly in terms oflet*
, according to the equality:(while* cond ([x init update] ...) retexpr)
(let* ([x init] ...) (if cond (while* cond ([x update update] ...) retexpr) retexpr)
Rounding
FPCore allows the precision of program inputs, constants, and operations to be controlled via a rounding context. The context consists of a set of metadata properties, which affect how function application, casts, and constants are rounded.
Number literals, mathematical constants, and program inputs are rounded according to the rounding context. Variables, however, are not rounded where they appear as values (since they hold rounded values, either from the expressions where they are bound or from rounded program inputs).
Function applications round their results using the rounding context.
More precisely, a function application
(f e_{1} ...)
in a
rounding context ρ must evaluate to the same value as
if f
were evaluated in exact real
arithmetic, and then rounded according to the rounding context.
Formally:
v_{i} = ⟦e_{i}⟧_{ρ}
⟦(f e_{i} ...)
⟧_{ρ} = round( ρ, ⟦f⟧(v_{i} , ... ) )
Casts behave identically to applying the identity function (and then rounding the result).
FPCore does not restrict the behavior of the rounding function or the set
of metadata properties that its behavior depends on. Some common precision
and rounding direction properties are described for the metadata properties
:precision
and :round
.
Tools are not required to support all of these rounding behaviors,
and are allowed to introduce new ones and new metadata properties
to control them.
Rounding contexts are initialized with the properties of the
overall FPCore benchmark and are updated with
!
annotations. Program inputs can also be annotated
to describe the precision of the input.
!
annotations use lexical scoping. For example, in the expression
the subtraction will take place in a context
with binary32
precision, but the addition will take
place in a context that has inherited binary64
precision from the annotation enclosing the
entire let
. Both operations will take place in a
context that has inherited nearestEven
rounding
behavior. The examples
contain more details.
If tools do not support the rounding context specified for a computation, the result is undefined, and the tool should give some indication of the reason for the failure. FPCore does not restrict the representation used internally by a tool to store values. Numeric values can be floatingpoint values of various precisions, fixedpoint values, intervals, or any sort of symbolic representations of mathematical real numbers. Though FPCore can represent exact real computations, tools are not required to be able to represent arbitrary real numbers exactly.