FPBench is a standard benchmark suite for the floating point community. The benchmark suite contains a common format for floating-point computation and metadata and a common set of accuracy measures:

## FPCore benchmark format

FPCore is the format used for FPBench benchmarks. It is a simple functional programming language with conditionals and simple loops. The syntax is an easy-to-parse S-expression syntax.

### Syntax

The syntax is a simple S-expression 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
floating-point expression defining the benchmark. White-space is
ignored, and lines starting with the semicolon (`;`

)
are treated as comments and ignored. The basic tokens are defined
as expected:

- symbol
- Any sequence of letters, digits, or characters from the
set
`~!@$%^&*_-+=<>.?/:`

not starting with a digit, implemented for ASCII by the regular expression:`[a-zA-Z~!@$%^&*_\-+=<>.?/:][a-zA-Z0-9~!@$%^&*_\-+=<>.?/:]*`

- number
- An optional plus (
`+`

) or minus (`-`

) sign followed by any sequence of digits. These may be optionally followed by a period (`.`

) and another sequence of digits, which themselves may be optionally followed by an`e`

, optional plus or minus sign, and a sequence of digits, implemented for ASCII by the regular expression:`[-+]?[0-9]+(\.[0-9]+)?(e[-+]?[0-9]+)?`

- 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-\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 `>`

.

Following IEEE-754 and common C and Fortran implementations,
FPCore does not prescribe an accuracy to any mathematical
functions except the arithmetic operators, `sqrt`

,
and `fma`

. If the exact accuracy is important, we
recommend that benchmark users declare the implementation used
with the `:math-library`

property.

### Supported constants

The following constants are supported:

Supported Mathematical Constants | ||||
---|---|---|---|---|

E | LOG2E | LOG10E | LN2 | LN10 |

PI | PI_2 | PI_4 | 1_PI | 2_PI |

2_SQRTPI | SQRT2 | SQRT1_2 | INFINITY | NAN |

Supported Boolean Constants | ||||

TRUE | FALSE |

The floating-point constants defined just like their analogs in GNU libc. All constants must evaluate to a value as close as possible to their mathematically-accurate real value.

### Semantics

FPCore expressions can describe concrete floating-point computations, abstract specifications of those computations, or intermediates between the two. The semantics of FPCore are correspondingly flexible.

FPCore does not restrict the representation used to represent
values when evaluating FPCore expressions. Numeric values can be
floating point values of various precision, fixed point values, or
(for abstract uses) mathematical reals, though individual FPCore
expressions can use
the `:precision`

property to clarify what representation is expected. Evaluation
nonetheless proceeds by fixed rules.

Expressions return either numeric values or boolean values.
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 unless`a`

is available in the context. For sequentially binding variables, use nested`let`

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`] ...)`body`)

(let ([`x``init`] ...) (if`cond`) (while`cond`([`x``update``update`] ...)`body`) body)In other words, the list of bound variables gives the variable's name, its initial value, and the value it is updated to after each iteration. The loop is executed by initializing all bound variables and then evaluating the condition and simultaneously updating the variables until the condition returns false. Once the condition returns false, the return expression is evaluated and its value is returned.