
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x / (x + 1.0d0)) - ((x + 1.0d0) / (x - 1.0d0))
end function
public static double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
def code(x): return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0))
function code(x) return Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x - 1.0))) end
function tmp = code(x) tmp = (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0)); end
code[x_] := N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x / (x + 1.0d0)) - ((x + 1.0d0) / (x - 1.0d0))
end function
public static double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
def code(x): return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0))
function code(x) return Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x - 1.0))) end
function tmp = code(x) tmp = (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0)); end
code[x_] := N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0)))
(t_1 (/ (+ x 1.0) (+ x -1.0)))
(t_2 (- t_0 t_1))
(t_3 (pow t_0 2.0)))
(if (<= t_2 5e-12)
(-
(/ -3.0 (pow x 3.0))
(+ (/ 3.0 x) (+ (/ 1.0 (pow x 2.0)) (/ 1.0 (pow x 4.0)))))
(/
(- t_3 (/ t_1 (/ (+ x -1.0) (+ x 1.0))))
(/ (/ (- (pow t_0 4.0) (pow t_1 4.0)) t_2) (+ t_3 (pow t_1 2.0)))))))
double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double t_2 = t_0 - t_1;
double t_3 = pow(t_0, 2.0);
double tmp;
if (t_2 <= 5e-12) {
tmp = (-3.0 / pow(x, 3.0)) - ((3.0 / x) + ((1.0 / pow(x, 2.0)) + (1.0 / pow(x, 4.0))));
} else {
tmp = (t_3 - (t_1 / ((x + -1.0) / (x + 1.0)))) / (((pow(t_0, 4.0) - pow(t_1, 4.0)) / t_2) / (t_3 + pow(t_1, 2.0)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = x / (x + 1.0d0)
t_1 = (x + 1.0d0) / (x + (-1.0d0))
t_2 = t_0 - t_1
t_3 = t_0 ** 2.0d0
if (t_2 <= 5d-12) then
tmp = ((-3.0d0) / (x ** 3.0d0)) - ((3.0d0 / x) + ((1.0d0 / (x ** 2.0d0)) + (1.0d0 / (x ** 4.0d0))))
else
tmp = (t_3 - (t_1 / ((x + (-1.0d0)) / (x + 1.0d0)))) / ((((t_0 ** 4.0d0) - (t_1 ** 4.0d0)) / t_2) / (t_3 + (t_1 ** 2.0d0)))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double t_2 = t_0 - t_1;
double t_3 = Math.pow(t_0, 2.0);
double tmp;
if (t_2 <= 5e-12) {
tmp = (-3.0 / Math.pow(x, 3.0)) - ((3.0 / x) + ((1.0 / Math.pow(x, 2.0)) + (1.0 / Math.pow(x, 4.0))));
} else {
tmp = (t_3 - (t_1 / ((x + -1.0) / (x + 1.0)))) / (((Math.pow(t_0, 4.0) - Math.pow(t_1, 4.0)) / t_2) / (t_3 + Math.pow(t_1, 2.0)));
}
return tmp;
}
def code(x): t_0 = x / (x + 1.0) t_1 = (x + 1.0) / (x + -1.0) t_2 = t_0 - t_1 t_3 = math.pow(t_0, 2.0) tmp = 0 if t_2 <= 5e-12: tmp = (-3.0 / math.pow(x, 3.0)) - ((3.0 / x) + ((1.0 / math.pow(x, 2.0)) + (1.0 / math.pow(x, 4.0)))) else: tmp = (t_3 - (t_1 / ((x + -1.0) / (x + 1.0)))) / (((math.pow(t_0, 4.0) - math.pow(t_1, 4.0)) / t_2) / (t_3 + math.pow(t_1, 2.0))) return tmp
function code(x) t_0 = Float64(x / Float64(x + 1.0)) t_1 = Float64(Float64(x + 1.0) / Float64(x + -1.0)) t_2 = Float64(t_0 - t_1) t_3 = t_0 ^ 2.0 tmp = 0.0 if (t_2 <= 5e-12) tmp = Float64(Float64(-3.0 / (x ^ 3.0)) - Float64(Float64(3.0 / x) + Float64(Float64(1.0 / (x ^ 2.0)) + Float64(1.0 / (x ^ 4.0))))); else tmp = Float64(Float64(t_3 - Float64(t_1 / Float64(Float64(x + -1.0) / Float64(x + 1.0)))) / Float64(Float64(Float64((t_0 ^ 4.0) - (t_1 ^ 4.0)) / t_2) / Float64(t_3 + (t_1 ^ 2.0)))); end return tmp end
function tmp_2 = code(x) t_0 = x / (x + 1.0); t_1 = (x + 1.0) / (x + -1.0); t_2 = t_0 - t_1; t_3 = t_0 ^ 2.0; tmp = 0.0; if (t_2 <= 5e-12) tmp = (-3.0 / (x ^ 3.0)) - ((3.0 / x) + ((1.0 / (x ^ 2.0)) + (1.0 / (x ^ 4.0)))); else tmp = (t_3 - (t_1 / ((x + -1.0) / (x + 1.0)))) / ((((t_0 ^ 4.0) - (t_1 ^ 4.0)) / t_2) / (t_3 + (t_1 ^ 2.0))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$0, 2.0], $MachinePrecision]}, If[LessEqual[t$95$2, 5e-12], N[(N[(-3.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] - N[(N[(3.0 / x), $MachinePrecision] + N[(N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$3 - N[(t$95$1 / N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[Power[t$95$0, 4.0], $MachinePrecision] - N[Power[t$95$1, 4.0], $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] / N[(t$95$3 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \frac{x + 1}{x + -1}\\
t_2 := t_0 - t_1\\
t_3 := {t_0}^{2}\\
\mathbf{if}\;t_2 \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-3}{{x}^{3}} - \left(\frac{3}{x} + \left(\frac{1}{{x}^{2}} + \frac{1}{{x}^{4}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_3 - \frac{t_1}{\frac{x + -1}{x + 1}}}{\frac{\frac{{t_0}^{4} - {t_1}^{4}}{t_2}}{t_3 + {t_1}^{2}}}\\
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 0.001)
(-
(/ -3.0 (pow x 3.0))
(+ (/ 3.0 x) (+ (/ 1.0 (pow x 2.0)) (/ 1.0 (pow x 4.0)))))
(+ 1.0 (* x (+ x 3.0)))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 0.001) {
tmp = (-3.0 / pow(x, 3.0)) - ((3.0 / x) + ((1.0 / pow(x, 2.0)) + (1.0 / pow(x, 4.0))));
} else {
tmp = 1.0 + (x * (x + 3.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((x / (x + 1.0d0)) - ((x + 1.0d0) / (x + (-1.0d0)))) <= 0.001d0) then
tmp = ((-3.0d0) / (x ** 3.0d0)) - ((3.0d0 / x) + ((1.0d0 / (x ** 2.0d0)) + (1.0d0 / (x ** 4.0d0))))
else
tmp = 1.0d0 + (x * (x + 3.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 0.001) {
tmp = (-3.0 / Math.pow(x, 3.0)) - ((3.0 / x) + ((1.0 / Math.pow(x, 2.0)) + (1.0 / Math.pow(x, 4.0))));
} else {
tmp = 1.0 + (x * (x + 3.0));
}
return tmp;
}
def code(x): tmp = 0 if ((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 0.001: tmp = (-3.0 / math.pow(x, 3.0)) - ((3.0 / x) + ((1.0 / math.pow(x, 2.0)) + (1.0 / math.pow(x, 4.0)))) else: tmp = 1.0 + (x * (x + 3.0)) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 0.001) tmp = Float64(Float64(-3.0 / (x ^ 3.0)) - Float64(Float64(3.0 / x) + Float64(Float64(1.0 / (x ^ 2.0)) + Float64(1.0 / (x ^ 4.0))))); else tmp = Float64(1.0 + Float64(x * Float64(x + 3.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 0.001) tmp = (-3.0 / (x ^ 3.0)) - ((3.0 / x) + ((1.0 / (x ^ 2.0)) + (1.0 / (x ^ 4.0)))); else tmp = 1.0 + (x * (x + 3.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.001], N[(N[(-3.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] - N[(N[(3.0 / x), $MachinePrecision] + N[(N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(x + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 0.001:\\
\;\;\;\;\frac{-3}{{x}^{3}} - \left(\frac{3}{x} + \left(\frac{1}{{x}^{2}} + \frac{1}{{x}^{4}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x + 3\right)\\
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))) (t_1 (/ (+ x 1.0) (+ x -1.0))))
(if (<= (- t_0 t_1) 5e-12)
(+ (/ -3.0 (pow x 3.0)) (- (/ -3.0 x) (pow x -2.0)))
(* (- (pow t_0 2.0) (pow t_1 2.0)) (/ 1.0 (+ t_0 t_1))))))
double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if ((t_0 - t_1) <= 5e-12) {
tmp = (-3.0 / pow(x, 3.0)) + ((-3.0 / x) - pow(x, -2.0));
} else {
tmp = (pow(t_0, 2.0) - pow(t_1, 2.0)) * (1.0 / (t_0 + t_1));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (x + 1.0d0)
t_1 = (x + 1.0d0) / (x + (-1.0d0))
if ((t_0 - t_1) <= 5d-12) then
tmp = ((-3.0d0) / (x ** 3.0d0)) + (((-3.0d0) / x) - (x ** (-2.0d0)))
else
tmp = ((t_0 ** 2.0d0) - (t_1 ** 2.0d0)) * (1.0d0 / (t_0 + t_1))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if ((t_0 - t_1) <= 5e-12) {
tmp = (-3.0 / Math.pow(x, 3.0)) + ((-3.0 / x) - Math.pow(x, -2.0));
} else {
tmp = (Math.pow(t_0, 2.0) - Math.pow(t_1, 2.0)) * (1.0 / (t_0 + t_1));
}
return tmp;
}
def code(x): t_0 = x / (x + 1.0) t_1 = (x + 1.0) / (x + -1.0) tmp = 0 if (t_0 - t_1) <= 5e-12: tmp = (-3.0 / math.pow(x, 3.0)) + ((-3.0 / x) - math.pow(x, -2.0)) else: tmp = (math.pow(t_0, 2.0) - math.pow(t_1, 2.0)) * (1.0 / (t_0 + t_1)) return tmp
function code(x) t_0 = Float64(x / Float64(x + 1.0)) t_1 = Float64(Float64(x + 1.0) / Float64(x + -1.0)) tmp = 0.0 if (Float64(t_0 - t_1) <= 5e-12) tmp = Float64(Float64(-3.0 / (x ^ 3.0)) + Float64(Float64(-3.0 / x) - (x ^ -2.0))); else tmp = Float64(Float64((t_0 ^ 2.0) - (t_1 ^ 2.0)) * Float64(1.0 / Float64(t_0 + t_1))); end return tmp end
function tmp_2 = code(x) t_0 = x / (x + 1.0); t_1 = (x + 1.0) / (x + -1.0); tmp = 0.0; if ((t_0 - t_1) <= 5e-12) tmp = (-3.0 / (x ^ 3.0)) + ((-3.0 / x) - (x ^ -2.0)); else tmp = ((t_0 ^ 2.0) - (t_1 ^ 2.0)) * (1.0 / (t_0 + t_1)); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - t$95$1), $MachinePrecision], 5e-12], N[(N[(-3.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(-3.0 / x), $MachinePrecision] - N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] - N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \frac{x + 1}{x + -1}\\
\mathbf{if}\;t_0 - t_1 \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-3}{{x}^{3}} + \left(\frac{-3}{x} - {x}^{-2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left({t_0}^{2} - {t_1}^{2}\right) \cdot \frac{1}{t_0 + t_1}\\
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))) (t_1 (/ (+ x 1.0) (+ x -1.0))))
(if (<= (- t_0 t_1) 5e-12)
(+ (/ -3.0 (pow x 3.0)) (- (/ -3.0 x) (pow x -2.0)))
(/
(- (/ t_0 (/ (+ x 1.0) x)) (/ t_1 (/ (+ x -1.0) (+ x 1.0))))
(+ t_0 t_1)))))
double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if ((t_0 - t_1) <= 5e-12) {
tmp = (-3.0 / pow(x, 3.0)) + ((-3.0 / x) - pow(x, -2.0));
} else {
tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (x + 1.0d0)
t_1 = (x + 1.0d0) / (x + (-1.0d0))
if ((t_0 - t_1) <= 5d-12) then
tmp = ((-3.0d0) / (x ** 3.0d0)) + (((-3.0d0) / x) - (x ** (-2.0d0)))
else
tmp = ((t_0 / ((x + 1.0d0) / x)) - (t_1 / ((x + (-1.0d0)) / (x + 1.0d0)))) / (t_0 + t_1)
end if
code = tmp
end function
public static double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if ((t_0 - t_1) <= 5e-12) {
tmp = (-3.0 / Math.pow(x, 3.0)) + ((-3.0 / x) - Math.pow(x, -2.0));
} else {
tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1);
}
return tmp;
}
def code(x): t_0 = x / (x + 1.0) t_1 = (x + 1.0) / (x + -1.0) tmp = 0 if (t_0 - t_1) <= 5e-12: tmp = (-3.0 / math.pow(x, 3.0)) + ((-3.0 / x) - math.pow(x, -2.0)) else: tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1) return tmp
function code(x) t_0 = Float64(x / Float64(x + 1.0)) t_1 = Float64(Float64(x + 1.0) / Float64(x + -1.0)) tmp = 0.0 if (Float64(t_0 - t_1) <= 5e-12) tmp = Float64(Float64(-3.0 / (x ^ 3.0)) + Float64(Float64(-3.0 / x) - (x ^ -2.0))); else tmp = Float64(Float64(Float64(t_0 / Float64(Float64(x + 1.0) / x)) - Float64(t_1 / Float64(Float64(x + -1.0) / Float64(x + 1.0)))) / Float64(t_0 + t_1)); end return tmp end
function tmp_2 = code(x) t_0 = x / (x + 1.0); t_1 = (x + 1.0) / (x + -1.0); tmp = 0.0; if ((t_0 - t_1) <= 5e-12) tmp = (-3.0 / (x ^ 3.0)) + ((-3.0 / x) - (x ^ -2.0)); else tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - t$95$1), $MachinePrecision], 5e-12], N[(N[(-3.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(-3.0 / x), $MachinePrecision] - N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 / N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 / N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \frac{x + 1}{x + -1}\\
\mathbf{if}\;t_0 - t_1 \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-3}{{x}^{3}} + \left(\frac{-3}{x} - {x}^{-2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{\frac{x + 1}{x}} - \frac{t_1}{\frac{x + -1}{x + 1}}}{t_0 + t_1}\\
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))) (t_1 (/ (+ x 1.0) (+ x -1.0))))
(if (<= (- t_0 t_1) 5e-12)
(/ (- (/ 2.0 x) (+ 3.0 (/ 2.0 (pow x 2.0)))) (+ x -1.0))
(/
(- (/ t_0 (/ (+ x 1.0) x)) (/ t_1 (/ (+ x -1.0) (+ x 1.0))))
(+ t_0 t_1)))))
double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if ((t_0 - t_1) <= 5e-12) {
tmp = ((2.0 / x) - (3.0 + (2.0 / pow(x, 2.0)))) / (x + -1.0);
} else {
tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (x + 1.0d0)
t_1 = (x + 1.0d0) / (x + (-1.0d0))
if ((t_0 - t_1) <= 5d-12) then
tmp = ((2.0d0 / x) - (3.0d0 + (2.0d0 / (x ** 2.0d0)))) / (x + (-1.0d0))
else
tmp = ((t_0 / ((x + 1.0d0) / x)) - (t_1 / ((x + (-1.0d0)) / (x + 1.0d0)))) / (t_0 + t_1)
end if
code = tmp
end function
public static double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if ((t_0 - t_1) <= 5e-12) {
tmp = ((2.0 / x) - (3.0 + (2.0 / Math.pow(x, 2.0)))) / (x + -1.0);
} else {
tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1);
}
return tmp;
}
def code(x): t_0 = x / (x + 1.0) t_1 = (x + 1.0) / (x + -1.0) tmp = 0 if (t_0 - t_1) <= 5e-12: tmp = ((2.0 / x) - (3.0 + (2.0 / math.pow(x, 2.0)))) / (x + -1.0) else: tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1) return tmp
function code(x) t_0 = Float64(x / Float64(x + 1.0)) t_1 = Float64(Float64(x + 1.0) / Float64(x + -1.0)) tmp = 0.0 if (Float64(t_0 - t_1) <= 5e-12) tmp = Float64(Float64(Float64(2.0 / x) - Float64(3.0 + Float64(2.0 / (x ^ 2.0)))) / Float64(x + -1.0)); else tmp = Float64(Float64(Float64(t_0 / Float64(Float64(x + 1.0) / x)) - Float64(t_1 / Float64(Float64(x + -1.0) / Float64(x + 1.0)))) / Float64(t_0 + t_1)); end return tmp end
function tmp_2 = code(x) t_0 = x / (x + 1.0); t_1 = (x + 1.0) / (x + -1.0); tmp = 0.0; if ((t_0 - t_1) <= 5e-12) tmp = ((2.0 / x) - (3.0 + (2.0 / (x ^ 2.0)))) / (x + -1.0); else tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - t$95$1), $MachinePrecision], 5e-12], N[(N[(N[(2.0 / x), $MachinePrecision] - N[(3.0 + N[(2.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 / N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 / N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \frac{x + 1}{x + -1}\\
\mathbf{if}\;t_0 - t_1 \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{\frac{2}{x} - \left(3 + \frac{2}{{x}^{2}}\right)}{x + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{\frac{x + 1}{x}} - \frac{t_1}{\frac{x + -1}{x + 1}}}{t_0 + t_1}\\
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))) (t_1 (/ (+ x 1.0) (+ x -1.0))))
(if (<= (- t_0 t_1) 5e-12)
(- (/ -3.0 x) (pow x -2.0))
(/
(- (/ t_0 (/ (+ x 1.0) x)) (/ t_1 (/ (+ x -1.0) (+ x 1.0))))
(+ t_0 t_1)))))
double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if ((t_0 - t_1) <= 5e-12) {
tmp = (-3.0 / x) - pow(x, -2.0);
} else {
tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (x + 1.0d0)
t_1 = (x + 1.0d0) / (x + (-1.0d0))
if ((t_0 - t_1) <= 5d-12) then
tmp = ((-3.0d0) / x) - (x ** (-2.0d0))
else
tmp = ((t_0 / ((x + 1.0d0) / x)) - (t_1 / ((x + (-1.0d0)) / (x + 1.0d0)))) / (t_0 + t_1)
end if
code = tmp
end function
public static double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if ((t_0 - t_1) <= 5e-12) {
tmp = (-3.0 / x) - Math.pow(x, -2.0);
} else {
tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1);
}
return tmp;
}
def code(x): t_0 = x / (x + 1.0) t_1 = (x + 1.0) / (x + -1.0) tmp = 0 if (t_0 - t_1) <= 5e-12: tmp = (-3.0 / x) - math.pow(x, -2.0) else: tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1) return tmp
function code(x) t_0 = Float64(x / Float64(x + 1.0)) t_1 = Float64(Float64(x + 1.0) / Float64(x + -1.0)) tmp = 0.0 if (Float64(t_0 - t_1) <= 5e-12) tmp = Float64(Float64(-3.0 / x) - (x ^ -2.0)); else tmp = Float64(Float64(Float64(t_0 / Float64(Float64(x + 1.0) / x)) - Float64(t_1 / Float64(Float64(x + -1.0) / Float64(x + 1.0)))) / Float64(t_0 + t_1)); end return tmp end
function tmp_2 = code(x) t_0 = x / (x + 1.0); t_1 = (x + 1.0) / (x + -1.0); tmp = 0.0; if ((t_0 - t_1) <= 5e-12) tmp = (-3.0 / x) - (x ^ -2.0); else tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - t$95$1), $MachinePrecision], 5e-12], N[(N[(-3.0 / x), $MachinePrecision] - N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 / N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 / N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \frac{x + 1}{x + -1}\\
\mathbf{if}\;t_0 - t_1 \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-3}{x} - {x}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{\frac{x + 1}{x}} - \frac{t_1}{\frac{x + -1}{x + 1}}}{t_0 + t_1}\\
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))) (t_1 (/ (+ x 1.0) (+ x -1.0))))
(if (<= (- t_0 t_1) 5e-12)
(/ -3.0 x)
(/
(- (/ t_0 (/ (+ x 1.0) x)) (/ t_1 (/ (+ x -1.0) (+ x 1.0))))
(+ t_0 t_1)))))
double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if ((t_0 - t_1) <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (x + 1.0d0)
t_1 = (x + 1.0d0) / (x + (-1.0d0))
if ((t_0 - t_1) <= 5d-12) then
tmp = (-3.0d0) / x
else
tmp = ((t_0 / ((x + 1.0d0) / x)) - (t_1 / ((x + (-1.0d0)) / (x + 1.0d0)))) / (t_0 + t_1)
end if
code = tmp
end function
public static double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if ((t_0 - t_1) <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1);
}
return tmp;
}
def code(x): t_0 = x / (x + 1.0) t_1 = (x + 1.0) / (x + -1.0) tmp = 0 if (t_0 - t_1) <= 5e-12: tmp = -3.0 / x else: tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1) return tmp
function code(x) t_0 = Float64(x / Float64(x + 1.0)) t_1 = Float64(Float64(x + 1.0) / Float64(x + -1.0)) tmp = 0.0 if (Float64(t_0 - t_1) <= 5e-12) tmp = Float64(-3.0 / x); else tmp = Float64(Float64(Float64(t_0 / Float64(Float64(x + 1.0) / x)) - Float64(t_1 / Float64(Float64(x + -1.0) / Float64(x + 1.0)))) / Float64(t_0 + t_1)); end return tmp end
function tmp_2 = code(x) t_0 = x / (x + 1.0); t_1 = (x + 1.0) / (x + -1.0); tmp = 0.0; if ((t_0 - t_1) <= 5e-12) tmp = -3.0 / x; else tmp = ((t_0 / ((x + 1.0) / x)) - (t_1 / ((x + -1.0) / (x + 1.0)))) / (t_0 + t_1); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - t$95$1), $MachinePrecision], 5e-12], N[(-3.0 / x), $MachinePrecision], N[(N[(N[(t$95$0 / N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 / N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \frac{x + 1}{x + -1}\\
\mathbf{if}\;t_0 - t_1 \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{\frac{x + 1}{x}} - \frac{t_1}{\frac{x + -1}{x + 1}}}{t_0 + t_1}\\
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 5e-12)
(/ -3.0 x)
(/
(+ (+ x -1.0) (* (+ x 1.0) (/ (- -1.0 x) x)))
(* (+ x -1.0) (/ (+ x 1.0) x)))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = ((x + -1.0) + ((x + 1.0) * ((-1.0 - x) / x))) / ((x + -1.0) * ((x + 1.0) / x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((x / (x + 1.0d0)) - ((x + 1.0d0) / (x + (-1.0d0)))) <= 5d-12) then
tmp = (-3.0d0) / x
else
tmp = ((x + (-1.0d0)) + ((x + 1.0d0) * (((-1.0d0) - x) / x))) / ((x + (-1.0d0)) * ((x + 1.0d0) / x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = ((x + -1.0) + ((x + 1.0) * ((-1.0 - x) / x))) / ((x + -1.0) * ((x + 1.0) / x));
}
return tmp;
}
def code(x): tmp = 0 if ((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12: tmp = -3.0 / x else: tmp = ((x + -1.0) + ((x + 1.0) * ((-1.0 - x) / x))) / ((x + -1.0) * ((x + 1.0) / x)) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-12) tmp = Float64(-3.0 / x); else tmp = Float64(Float64(Float64(x + -1.0) + Float64(Float64(x + 1.0) * Float64(Float64(-1.0 - x) / x))) / Float64(Float64(x + -1.0) * Float64(Float64(x + 1.0) / x))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) tmp = -3.0 / x; else tmp = ((x + -1.0) + ((x + 1.0) * ((-1.0 - x) / x))) / ((x + -1.0) * ((x + 1.0) / x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-12], N[(-3.0 / x), $MachinePrecision], N[(N[(N[(x + -1.0), $MachinePrecision] + N[(N[(x + 1.0), $MachinePrecision] * N[(N[(-1.0 - x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(x + -1.0), $MachinePrecision] * N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + -1\right) + \left(x + 1\right) \cdot \frac{-1 - x}{x}}{\left(x + -1\right) \cdot \frac{x + 1}{x}}\\
\end{array}
\end{array}
(FPCore (x) :precision binary64 (if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 5e-12) (/ -3.0 x) (/ (+ (* x (- 1.0 x)) (* (+ x 1.0) (+ x 1.0))) (* (+ x 1.0) (- 1.0 x)))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = ((x * (1.0 - x)) + ((x + 1.0) * (x + 1.0))) / ((x + 1.0) * (1.0 - x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((x / (x + 1.0d0)) - ((x + 1.0d0) / (x + (-1.0d0)))) <= 5d-12) then
tmp = (-3.0d0) / x
else
tmp = ((x * (1.0d0 - x)) + ((x + 1.0d0) * (x + 1.0d0))) / ((x + 1.0d0) * (1.0d0 - x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = ((x * (1.0 - x)) + ((x + 1.0) * (x + 1.0))) / ((x + 1.0) * (1.0 - x));
}
return tmp;
}
def code(x): tmp = 0 if ((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12: tmp = -3.0 / x else: tmp = ((x * (1.0 - x)) + ((x + 1.0) * (x + 1.0))) / ((x + 1.0) * (1.0 - x)) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-12) tmp = Float64(-3.0 / x); else tmp = Float64(Float64(Float64(x * Float64(1.0 - x)) + Float64(Float64(x + 1.0) * Float64(x + 1.0))) / Float64(Float64(x + 1.0) * Float64(1.0 - x))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) tmp = -3.0 / x; else tmp = ((x * (1.0 - x)) + ((x + 1.0) * (x + 1.0))) / ((x + 1.0) * (1.0 - x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-12], N[(-3.0 / x), $MachinePrecision], N[(N[(N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] + N[(N[(x + 1.0), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(1 - x\right) + \left(x + 1\right) \cdot \left(x + 1\right)}{\left(x + 1\right) \cdot \left(1 - x\right)}\\
\end{array}
\end{array}
(FPCore (x) :precision binary64 (if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 5e-12) (/ -3.0 x) (/ (+ (/ (+ x -1.0) (+ x 1.0)) (/ (- -1.0 x) x)) (/ (+ x -1.0) x))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / ((x + -1.0) / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((x / (x + 1.0d0)) - ((x + 1.0d0) / (x + (-1.0d0)))) <= 5d-12) then
tmp = (-3.0d0) / x
else
tmp = (((x + (-1.0d0)) / (x + 1.0d0)) + (((-1.0d0) - x) / x)) / ((x + (-1.0d0)) / x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / ((x + -1.0) / x);
}
return tmp;
}
def code(x): tmp = 0 if ((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12: tmp = -3.0 / x else: tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / ((x + -1.0) / x) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-12) tmp = Float64(-3.0 / x); else tmp = Float64(Float64(Float64(Float64(x + -1.0) / Float64(x + 1.0)) + Float64(Float64(-1.0 - x) / x)) / Float64(Float64(x + -1.0) / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) tmp = -3.0 / x; else tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / ((x + -1.0) / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-12], N[(-3.0 / x), $MachinePrecision], N[(N[(N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 - x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(N[(x + -1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + -1}{x + 1} + \frac{-1 - x}{x}}{\frac{x + -1}{x}}\\
\end{array}
\end{array}
(FPCore (x) :precision binary64 (if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 5e-12) (/ -3.0 x) (/ (+ (* x (/ (+ x -1.0) (+ x 1.0))) (- -1.0 x)) (+ x -1.0))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = ((x * ((x + -1.0) / (x + 1.0))) + (-1.0 - x)) / (x + -1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((x / (x + 1.0d0)) - ((x + 1.0d0) / (x + (-1.0d0)))) <= 5d-12) then
tmp = (-3.0d0) / x
else
tmp = ((x * ((x + (-1.0d0)) / (x + 1.0d0))) + ((-1.0d0) - x)) / (x + (-1.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = ((x * ((x + -1.0) / (x + 1.0))) + (-1.0 - x)) / (x + -1.0);
}
return tmp;
}
def code(x): tmp = 0 if ((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12: tmp = -3.0 / x else: tmp = ((x * ((x + -1.0) / (x + 1.0))) + (-1.0 - x)) / (x + -1.0) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-12) tmp = Float64(-3.0 / x); else tmp = Float64(Float64(Float64(x * Float64(Float64(x + -1.0) / Float64(x + 1.0))) + Float64(-1.0 - x)) / Float64(x + -1.0)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-12) tmp = -3.0 / x; else tmp = ((x * ((x + -1.0) / (x + 1.0))) + (-1.0 - x)) / (x + -1.0); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-12], N[(-3.0 / x), $MachinePrecision], N[(N[(N[(x * N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{x + -1}{x + 1} + \left(-1 - x\right)}{x + -1}\\
\end{array}
\end{array}
(FPCore (x) :precision binary64 (let* ((t_0 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))))) (if (<= t_0 5e-12) (/ -3.0 x) t_0)))
double code(double x) {
double t_0 = (x / (x + 1.0)) - ((x + 1.0) / (x + -1.0));
double tmp;
if (t_0 <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = (x / (x + 1.0d0)) - ((x + 1.0d0) / (x + (-1.0d0)))
if (t_0 <= 5d-12) then
tmp = (-3.0d0) / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x) {
double t_0 = (x / (x + 1.0)) - ((x + 1.0) / (x + -1.0));
double tmp;
if (t_0 <= 5e-12) {
tmp = -3.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x): t_0 = (x / (x + 1.0)) - ((x + 1.0) / (x + -1.0)) tmp = 0 if t_0 <= 5e-12: tmp = -3.0 / x else: tmp = t_0 return tmp
function code(x) t_0 = Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) tmp = 0.0 if (t_0 <= 5e-12) tmp = Float64(-3.0 / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x) t_0 = (x / (x + 1.0)) - ((x + 1.0) / (x + -1.0)); tmp = 0.0; if (t_0 <= 5e-12) tmp = -3.0 / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-12], N[(-3.0 / x), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1} - \frac{x + 1}{x + -1}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (/ -3.0 x) (+ 1.0 (* x (+ x 3.0)))))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = -3.0 / x;
} else {
tmp = 1.0 + (x * (x + 3.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (-3.0d0) / x
else
tmp = 1.0d0 + (x * (x + 3.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = -3.0 / x;
} else {
tmp = 1.0 + (x * (x + 3.0));
}
return tmp;
}
def code(x): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = -3.0 / x else: tmp = 1.0 + (x * (x + 3.0)) return tmp
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(-3.0 / x); else tmp = Float64(1.0 + Float64(x * Float64(x + 3.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = -3.0 / x; else tmp = 1.0 + (x * (x + 3.0)); end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(-3.0 / x), $MachinePrecision], N[(1.0 + N[(x * N[(x + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x + 3\right)\\
\end{array}
\end{array}
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (/ -3.0 x) (+ 1.0 (* x 3.0))))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = -3.0 / x;
} else {
tmp = 1.0 + (x * 3.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (-3.0d0) / x
else
tmp = 1.0d0 + (x * 3.0d0)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = -3.0 / x;
} else {
tmp = 1.0 + (x * 3.0);
}
return tmp;
}
def code(x): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = -3.0 / x else: tmp = 1.0 + (x * 3.0) return tmp
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(-3.0 / x); else tmp = Float64(1.0 + Float64(x * 3.0)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = -3.0 / x; else tmp = 1.0 + (x * 3.0); end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(-3.0 / x), $MachinePrecision], N[(1.0 + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot 3\\
\end{array}
\end{array}
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (/ -3.0 x) 1.0))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = -3.0 / x;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (-3.0d0) / x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = -3.0 / x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = -3.0 / x else: tmp = 1.0 return tmp
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(-3.0 / x); else tmp = 1.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = -3.0 / x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(-3.0 / x), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x) :precision binary64 1.0)
double code(double x) {
return 1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0
end function
public static double code(double x) {
return 1.0;
}
def code(x): return 1.0
function code(x) return 1.0 end
function tmp = code(x) tmp = 1.0; end
code[x_] := 1.0
\begin{array}{l}
\\
1
\end{array}
herbie shell --seed 2023348
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))