File indexing completed on 2024-04-06 12:31:29
0001 #ifndef RealQuadEquation_H
0002 #define RealQuadEquation_H
0003
0004 #include <cmath>
0005 #include "FWCore/Utilities/interface/Visibility.h"
0006
0007
0008
0009
0010
0011 struct dso_internal RealQuadEquation {
0012 double first;
0013 double second;
0014 bool hasSolution;
0015
0016 RealQuadEquation(double A, double B, double C) {
0017 double D = B * B - 4 * A * C;
0018 if (D < 0)
0019 hasSolution = false;
0020 else {
0021 hasSolution = true;
0022 auto q = -0.5 * (B + std::copysign(std::sqrt(D), B));
0023 first = q / A;
0024 second = C / q;
0025 }
0026 }
0027 };
0028
0029 #endif