# Declare the
ac_fixed Data Type

ac_fixed

Data TypePerform the following steps to declare the

ac_fixed

data type:
- Include theac_fixed.hppheader file as follows:#include <CL/sycl/INTEL/ac_types/ac_fixed.hpp>
- Declare yourac_fixedvariables as follows:ac_fixed<N, I, true, Q, O> var_name; //Signed fixed-point numberac_fixed<N, I, false, Q, O> var_name; //Unsigned fixed-point numberThe following table describes the template parameters:Template ParameterDescriptionNThe total length of the fixed-point number in bits.IThe number of bits used to represent the integer value of the fixed-point number. The difference ofdetermines how many bits represent the fractional part of the fixed-point number.N−IQThe quantization mode that determines how to handle values where the generated precision (number of decimal places) exceeds the number of bits available in the variable to represent the fractional part of the number.For a list of quantization modes and their descriptions, refer to theQuantization and Overflowsection in the Mentor Graphics Algorithmic C (AC) Datatypes documentation, which is available at https://hlslibs.org/.OThe overflow mode that determines how to handle values where the generated value has more bits than the number of bits available in the variable. For a list of overflow modes and their descriptions, refer to theQuantization and Overflowsection in the Mentor Graphics Algorithmic C (AC) Datatypes documentation, which is available at https://hlslibs.org/.

For a list of supported operators and their return types, refer to the

Arbitrary-Length Bit-Accurate Integer and Fixed-Point Datatypes

chapter in the Mentor Graphics Algorithmic C (AC) Datatypes documentation, which is available at
https://hlslibs.org/.
## Math Functions Provided by the
ac_fixed_math.hpp Header File

ac_fixed_math.hpp

Header FileInclude the header file as follows:

#include <CL/sycl/INTEL/ac_types/ac_fixed_math.hpp>

The

ac_fixed_math.hpp

header file provides support for the following arbitrary precision fixed-point (ac_fixed

) data type functions:
- sqrt_fixed
- reciprocal_fixed
- reciprocal_sqrt_fixed
- sin_fixed
- cos_fixed
- sincos_fixed
- sinpi_fixed
- cospi_fixed
- sincospi_fixed
- log_fixed
- exp_fixed

For details about input type restrictions, input value limits, and output type propagation rules, review the comments in the

ac_fixed_math.hpp

header file.
Due to the differences in the internal math implementations, the results from the

ac_fixed

data type operations might differ between simulation (not supported yet) and emulation. The maximum difference is within a few units in the last place (ULPs).