@@ -21,43 +21,47 @@ namespace ql
2121{
2222 // Logarithms
2323 inline double Log (double const & x) { return std::log (x); }
24- #ifdef __x86_64__
24+ #if defined( __x86_64__) || defined(__i386__)
2525 inline qdouble Log (qdouble const & x) { return logq (x); }
2626 inline qcomplex Log (qcomplex const & x) { return clogq (x); }
27- #else
27+ #endif
28+ #if defined(__aarch64__)
2829 inline qdouble Log (qdouble const & x) { return std::log (x); }
2930 inline qcomplex Log (qcomplex const & x) { return clogl (x); }
3031#endif
3132 inline complex Log (complex const & x) { return std::log (x); }
3233
3334 // Power
3435 inline double Pow (double const & x, int const & a) { return std::pow (x, a); }
35- #ifdef __x86_64__
36+ #if defined( __x86_64__) || defined(__i386__)
3637 inline qdouble Pow (qdouble const & x, int const & a) { return powq (x,a); }
3738 inline qcomplex Pow (qcomplex const & x, int const & a){ return cpowq (x,a); }
38- #else
39+ #endif
40+ #if defined(__aarch64__)
3941 inline qdouble Pow (qdouble const & x, int const & a) { return std::pow (x,a); }
4042 inline qcomplex Pow (qcomplex const & x, int const & a){ return cpowl (x,a); }
4143#endif
4244 inline complex Pow (complex const & x, int const & a) { return std::pow (x,a); }
4345
4446 // Root
4547 inline double Sqrt (double const & x) { return std::sqrt (x); }
46- #ifdef __x86_64__
48+ #if defined( __x86_64__) || defined(__i386__)
4749 inline qdouble Sqrt (qdouble const & x) { return sqrtq (x); }
4850 inline qcomplex Sqrt (qcomplex const & x){ return csqrtq (x); }
49- #else
51+ #endif
52+ #if defined(__aarch64__)
5053 inline qdouble Sqrt (qdouble const & x) { return std::sqrt (x); }
5154 inline qcomplex Sqrt (qcomplex const & x){ return csqrtl (x); }
5255#endif
5356 inline complex Sqrt (complex const & x) { return std::sqrt (x); }
5457
5558 // Absolute value
5659 inline double Abs (double const & x) { return std::abs (x); }
57- #ifdef __x86_64__
60+ #if defined( __x86_64__) || defined(__i386__)
5861 inline qdouble Abs (qdouble const & x) { return fabsq (x);}
5962 inline qdouble Abs (qcomplex const & x) { return cabsq (x); }
60- #else
63+ #endif
64+ #if defined(__aarch64__)
6165 inline qdouble Abs (qdouble const & x) { return std::abs (x);}
6266 inline qdouble Abs (qcomplex const & x) { return cabsl (x); }
6367#endif
@@ -67,25 +71,28 @@ namespace ql
6771 inline double Imag (double const & x) { UNUSED (x); return 0 ; }
6872 inline qdouble Imag (qdouble const & x) { UNUSED (x); return qdouble (0 ); }
6973 inline double Imag (complex const & x) { return x.imag (); }
70- #ifdef __x86_64__
74+ #if defined( __x86_64__) || defined(__i386__)
7175 inline qdouble Imag (qcomplex const & x){ return cimagq (x);}
72- #else
76+ #endif
77+ #if defined(__aarch64__)
7378 inline qdouble Imag (qcomplex const & x){ return cimagl (x);}
7479#endif
7580
7681 inline double Real (double const & x) { return x; }
7782 inline qdouble Real (qdouble const & x) { return x; }
7883 inline double Real (complex const & x) { return x.real (); }
79- #ifdef __x86_64__
84+ #if defined( __x86_64__) || defined(__i386__)
8085 inline qdouble Real (qcomplex const & x) { return crealq (x); }
81- #else
86+ #endif
87+ #if defined(__aarch64__)
8288 inline qdouble Real (qcomplex const & x) { return creall (x); }
8389#endif
8490
8591 inline complex Conjg (complex const & x) { return std::conj (x); }
86- #ifdef __x86_64__
92+ #if defined( __x86_64__) || defined(__i386__)
8793 inline qcomplex Conjg (qcomplex const & x){ return conjq (x); }
88- #else
94+ #endif
95+ #if defined(__aarch64__)
8996 inline qcomplex Conjg (qcomplex const & x){ return conjl (x); }
9097#endif
9198
0 commit comments