17#ifndef __AP_FIXED_SPECIAL_H__
18#define __AP_FIXED_SPECIAL_H__
21#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
32template <
typename _Tp>
61template <
int _AP_W,
int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O,
int _AP_N>
65 typedef _Tp value_type;
70 complex() : _M_real(_Tp()), _M_imag(_Tp()) {}
73 complex(
const _Tp &__r,
const _Tp &__i = _Tp(0))
74 : _M_real(__r), _M_imag(__i) {}
77 template <
typename _Up>
80#if __cplusplus >= 201103L
81 const _Tp &real()
const {
return _M_real; }
82 const _Tp &imag()
const {
return _M_imag; }
84 _Tp &real() {
return _M_real; }
85 const _Tp &real()
const {
return _M_real; }
86 _Tp &imag() {
return _M_imag; }
87 const _Tp &imag()
const {
return _M_imag; }
90 void real(_Tp __val) { _M_real = __val; }
92 void imag(_Tp __val) { _M_imag = __val; }
133 template <
typename _Up>
135 _M_real = __z.real();
136 _M_imag = __z.imag();
142 template <
typename _Up>
144 _M_real += __z.real();
145 _M_imag += __z.imag();
151 template <
typename _Up>
153 _M_real -= __z.real();
154 _M_imag -= __z.imag();
160 template <
typename _Up>
162 const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
163 _M_imag = _M_real * __z.imag() + _M_imag * __z.real();
170 template <
typename _Up>
175 _M_real = a.real() / b.real();
176 _M_imag = a.imag() / b.real();
193template <
int _AP_W,
int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O,
int _AP_N>
194inline bool operator==(
197 return __x.real() == __y && __x.imag() == 0;
201template <
int _AP_W,
int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O,
int _AP_N>
202inline bool operator==(
205 return __x == __y.real() && 0 == __y.imag();
209template <
int _AP_W,
int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O,
int _AP_N>
210inline bool operator!=(
213 return __x.real() != __y || __x.imag() != 0;
217template <
int _AP_W,
int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O,
int _AP_N>
218inline bool operator!=(
221 return __x != __y.real() || 0 != __y.imag();
Signed Arbitrary Precision Fixed-Point Type.