File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1818#define COLVARS_DEBUG false
1919#endif
2020
21+ #if defined(__FAST_MATH__) && defined(__aarch64__)
22+ // NOTE: This is used for fixing https://github.com/Colvars/colvars/issues/767
23+ #define COLVARS_BOUNDED_INV_TRIGONOMETRIC_FUNC
24+ #endif
25+
2126/* ! \mainpage Main page
2227This is the Developer's documentation for the Collective Variables module (Colvars).
2328
@@ -150,13 +155,23 @@ class colvarmodule {
150155 // / Reimplemented to work around MS compiler issues
151156 static inline real asin (real const &x)
152157 {
158+ #ifdef COLVARS_BOUNDED_INV_TRIGONOMETRIC_FUNC
159+ const double tmp = static_cast <double >(x);
160+ return ::asin (tmp > 1.0 ? 1.0 : (tmp < -1.0 ? -1.0 : tmp));
161+ #else
153162 return ::asin (static_cast <double >(x));
163+ #endif
154164 }
155165
156166 // / Reimplemented to work around MS compiler issues
157167 static inline real acos (real const &x)
158168 {
169+ #ifdef COLVARS_BOUNDED_INV_TRIGONOMETRIC_FUNC
170+ const double tmp = static_cast <double >(x);
171+ return ::acos (tmp > 1.0 ? 1.0 : (tmp < -1.0 ? -1.0 : tmp));
172+ #else
159173 return ::acos (static_cast <double >(x));
174+ #endif
160175 }
161176
162177 // / Reimplemented to work around MS compiler issues
Original file line number Diff line number Diff line change @@ -674,7 +674,7 @@ colvarvalue colvarvalue::dist2_grad(colvarvalue const &x2) const
674674 cvm::rvector const &v1 = this ->rvector_value ;
675675 cvm::rvector const &v2 = x2.rvector_value ;
676676 cvm::real const cos_t = v1 * v2;
677- return colvarvalue (2.0 * std ::acos (cos_t ) * -1.0 / cvm::sqrt (1.0 - cos_t * cos_t ) * v2,
677+ return colvarvalue (2.0 * cvm ::acos (cos_t ) * -1.0 / cvm::sqrt (1.0 - cos_t * cos_t ) * v2,
678678 colvarvalue::type_unit3vectorderiv);
679679 }
680680 case colvarvalue::type_quaternion:
You can’t perform that action at this time.
0 commit comments