A newer version of this document is available. Customers should click here to go to the newest version.
Basic Arithmetic Operations and Simple Math Functions
The compiler supports the following basic arithmetic operations and simple math functions:
cpolarf
Description: Returns a complex number with a magnitude of rho and a phase angle of theta.
Calling Interface:
float __complex__ cpolarf(float rho, float theta)
cpolar
Description: Returns a complex number with a magnitude of rho and phase angle of theta.
In standard CPU programming, the C99 standard library provides a set of functions supporting complex number arithmetic. You can include <complex.h> to use them. These complex math functions are provided in SYCL device code.
Calling Interface:
double __complex__ __devicelib_cpolar(double rho, double theta)
__divsc3, __divdc3
Description: Returns the quotient of (a + ib) / (c + id). During compilation, the compiler may insert reference to these two functions in your code and the linker resolves the undefined reference later.
Calling Interface:
float __complex__ __divsc3(float __a, float __b, float __c, float __d) double __complex__ __divdc3(double __a, double __b, double __c, double __d)
__mulsc3, __muldc3
Description: Returns the product of a + ib and c + id.
Calling Interface:
float __complex__ __mulsc3(float __a, float __b, float __c, float __d) double __complex__ __muldc3(double __a, double __b, double __c, double __d)
labs, llabs
Description: Computes the absolute value of the integer number x for long and long long types. In normal CPU programming, the C standard library provides functions to return absolute value for integer values, these functions are declared in <stdlib.h>. The compiler supports these functions in SYCL device code.
Calling Interface:
int abs(int x) long labs(long x) long long llabs(long long x)
ldiv, lldiv
Description: Computes both the quotient and the remainder of the division of the numerator x by the denominator y. The returned type has the following definitions:
struct div_t { int quot; int rem; }; struct ldiv_t { long quot; long rem; }; struct lldiv_t { long long quot; long long rem; };
Calling Interface:
div_t div(int x, int y) ldiv_t ldiv(long x, long y) lldiv_t lldiv(long long x, long long y)
- Simple Integer Math Functions
- Basic Integer Arithmetic Operations
- Simple Arithmetic Operations with Rounding Mode
- Type Casting Functions for Floating-Point Numbers
- Type Casting Functions for Half-Precision Types
- Type Casting Functions for bfloat16 Type
- Simple Half-Precision Arithmetic Math Functions
- Half-Precision Comparison Functions