Тема: -nan(ind)
#include <stdio.h>
#include <math.h>
double f(double x, double a, double k) {
    double result;
    if (a == 0 || x == 0 || x == a) {
        printf("Cannot compute a function for x = %.2lf\n", x);
        return 0;
    }
    result = pow(cos(a * x), 1. / 3) + (k * log(a - x)) / log(a * x);
    return result;
}
int main() {
    double xmin, xmax, dx;
    double a, k;
    double x, y;
    printf("Enter the value xmin: ");
    scanf_s("%lf", &xmin);
    printf("Enter the value xmax: ");
    scanf_s("%lf", &xmax);
    printf("Enter the value step dx: ");
    scanf_s("%lf", &dx);
    printf("Enter the value a: ");
    scanf_s("%lf", &a);
    printf("Enter the value k: ");
    scanf_s("%lf", &k);
    printf("Tabulation function f(x):\n");
    printf("-----------------------\n");
    printf("   x      |      f(x)   \n");
    printf("-----------------------\n");
    for (x = xmin; x <= xmax; x += dx) {
        y = f(x, a, k);
        printf("%8.2lf | %10.4lf\n", x, y);
    }
    return 0;
}як позбутися nan ind у результатах обчислення ?



