mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 12:46:00 +08:00
protect min/max with parenthesis
This commit is contained in:
parent
b5f70814c1
commit
695a7ab9d7
@ -539,13 +539,13 @@ inline const AutoDiffScalar<DerType>& real(const AutoDiffScalar<DerType>& x) {
|
|||||||
template<typename DerType>
|
template<typename DerType>
|
||||||
inline typename DerType::Scalar imag(const AutoDiffScalar<DerType>&) { return 0.; }
|
inline typename DerType::Scalar imag(const AutoDiffScalar<DerType>&) { return 0.; }
|
||||||
template<typename DerType, typename T>
|
template<typename DerType, typename T>
|
||||||
inline AutoDiffScalar<DerType> min(const AutoDiffScalar<DerType>& x, const T& y) { return (x <= y ? x : y); }
|
inline AutoDiffScalar<DerType> (min)(const AutoDiffScalar<DerType>& x, const T& y) { return (x <= y ? x : y); }
|
||||||
template<typename DerType, typename T>
|
template<typename DerType, typename T>
|
||||||
inline AutoDiffScalar<DerType> max(const AutoDiffScalar<DerType>& x, const T& y) { return (x >= y ? x : y); }
|
inline AutoDiffScalar<DerType> (max)(const AutoDiffScalar<DerType>& x, const T& y) { return (x >= y ? x : y); }
|
||||||
template<typename DerType, typename T>
|
template<typename DerType, typename T>
|
||||||
inline AutoDiffScalar<DerType> min(const T& x, const AutoDiffScalar<DerType>& y) { return (x < y ? x : y); }
|
inline AutoDiffScalar<DerType> (min)(const T& x, const AutoDiffScalar<DerType>& y) { return (x < y ? x : y); }
|
||||||
template<typename DerType, typename T>
|
template<typename DerType, typename T>
|
||||||
inline AutoDiffScalar<DerType> max(const T& x, const AutoDiffScalar<DerType>& y) { return (x > y ? x : y); }
|
inline AutoDiffScalar<DerType> (max)(const T& x, const AutoDiffScalar<DerType>& y) { return (x > y ? x : y); }
|
||||||
|
|
||||||
#define sign(x) x >= 0 ? 1 : -1 // required for abs function below
|
#define sign(x) x >= 0 ? 1 : -1 // required for abs function below
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user