Developer Guide

Intel oneAPI FPGA Handbook

ID 785441
Date 2/07/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Modify the Rounding Mode of Floating-point Operations (-Xsrounding=<rounding_type>)

To modify the rounding mode of floating-point elementary operations in your design, use the -Xsrounding=<rounding_type> option in your icpx command. You can set the -Xsrounding option to one of the following values:

  • ieee: All elementary operations (+, -, *, /) of both single-precision and double-precision floating-point use IEEE-754 round nearest ties to even (RNE) mode, which has a 0.5 unit of least precision (ULP) error at most.
  • faithful: All elementary operations of double-precision floating-point and multiplication and division of single-precision floating-point use faithful rounding mode, which has a 1 ULP error at most. This rounding mode leads to more efficient hardware at the expense of numerical variation in results. Addition and subtraction of single-precision floating-point still have to use IEEE-754 RNE rounding mode.

The following tables summarize the rounding modes:

Single-precision Floating-point

 

Addition

Subtraction

Multiplication

Division

Default

IEEE-754 RNE

IEEE-754 RNE

IEEE-754 RNE

Faithful

-Xsrounding=ieee

IEEE-754 RNE

IEEE-754 RNE

IEEE-754 RNE

IEEE-754 RNE

-Xsrounding=faithful

IEEE-754 RNE

IEEE-754 RNE

Faithful

Faithful

Double-precision Floating-point

  Addition Subtraction Multiplication Division

Default

IEEE-754 RNE

IEEE-754 RNE

IEEE-754 RNE

IEEE-754 RNE

-Xsrounding=ieee

IEEE-754 RNE

IEEE-754 RNE

IEEE-754 RNE

IEEE-754 RNE

-Xsrounding=faithful

Faithful Faithful Faithful Faithful

Examples

icpx -fsycl -fintelfpga -Xshardware -Xsrounding=ieee <source_file>.cpp
icpx -fsycl -fintelfpga -Xshardware -Xsrounding=faithful <source_file>.cpp