#include <math.h>
#include <stdio.h>
double versiera(double x) {
return 1.0 / (1.0 + x * x);
}
double lemniscate_value(double x) {
return sqrt(sqrt(1.0 + 4.0 * x * x) - x * x - 1.0);
}
int lemniscate_exists(double x) {
int res = 1;
double value = sqrt(1.0 + 4.0 * x * x) - x * x - 1.0;
if (value < 0.0) {
res = 0;
}
return res;
}
double hyperbola(double x) {
return 1.0 / (x * x);
}
int hyperbola_exists(double x) {
int res = 1;
if (x == 0.0) {
res = 0;
}
return res;
}
int main(void) {
const double pi = 3.14159265358979323846;
const int count = 42;
double x;
double step;
int i = 0;
step = 2.0 * pi / (count - 1);
while (i < count) {
x = -pi + step * i;
printf("%.7lf | %.7lf | ", x, versiera(x));
if (lemniscate_exists(x)) {
printf("%.7lf", lemniscate_value(x));
} else {
printf("-");
}
printf(" | ");
if (hyperbola_exists(x)) {
printf("%.7lf", hyperbola(x));
} else {
printf("-");
}
if (i != count - 1) {
printf("\n");
}
i++;
}
return 0;
}