#include
#include
#include
double ctg(const double x) {
return cos(x) / sin(x);
}
double double_parse(const char* prompt) {
std::cout << prompt;
double value;
std::cin >> value;
std::cin.ignore(0x1000, '\n');
return value;
}
double f(double x) {
x /= 4.0;
if (fabs(sin(x)) < 1e-15) {
return std::numeric_limits::infinity();
}
return ctg(x / 4.0) / 2.0 + 4.0;
}
int main() {
const auto x = double_parse("x: ");
const auto y = f(x);
std::cout << "y(x): ";
if (isinf(y)) {
puts("infinity");
}
else {
std::cout.setf(std::ios::fixed);
std::cout.precision(15);
std::cout << y << '\n';
}
}