TU-Programmieren_2/exercise2/task3.hpp
2025-04-09 10:22:44 +02:00

21 lines
906 B
C++

/// @file
/// @brief Task3: function declarations
#pragma once
#include <tuple> // std::tuple
/// @brief Calculates the real solutions of the quadratic equation a*x^2 + b*x + c = 0.
/// @param a coefficient; assertion: 'a' is a non-zero value
/// @param b coefficient
/// @param c coefficient
/// @return The two real solutions (order: ascending).
/// If no real solutions exists, the tuple contains two quiet NaNs.
std::tuple<double, double> solve_quadratic_equation(double a, double b, double c);
/// @brief Calculates the real solutions of the quadratic equation a*x^2 + b*x + c = 0.
/// @param abc coefficients; assertion: first coefficient 'a' is a non-zero value
/// @return The two real solutions (order: ascending).
/// If no real solutions exists, the tuple contains two quiet NaNs.
std::tuple<double, double> solve_quadratic_equation(std::tuple<double, double, double> abc);