File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 18
18
#define COLVARS_DEBUG false
19
19
#endif
20
20
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
+
21
26
/* ! \mainpage Main page
22
27
This is the Developer's documentation for the Collective Variables module (Colvars).
23
28
@@ -150,13 +155,23 @@ class colvarmodule {
150
155
// / Reimplemented to work around MS compiler issues
151
156
static inline real asin (real const &x)
152
157
{
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
153
162
return ::asin (static_cast <double >(x));
163
+ #endif
154
164
}
155
165
156
166
// / Reimplemented to work around MS compiler issues
157
167
static inline real acos (real const &x)
158
168
{
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
159
173
return ::acos (static_cast <double >(x));
174
+ #endif
160
175
}
161
176
162
177
// / 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
674
674
cvm::rvector const &v1 = this ->rvector_value ;
675
675
cvm::rvector const &v2 = x2.rvector_value ;
676
676
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,
678
678
colvarvalue::type_unit3vectorderiv);
679
679
}
680
680
case colvarvalue::type_quaternion:
You can’t perform that action at this time.
0 commit comments