(FPCore (x) :precision binary64 (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (exp x)))
(t_1 (+ (pow (exp x) 0.6666666666666666) (- 1.0 t_0))))
(sqrt (+ (* t_1 t_0) (* t_1 1.0)))))double code(double x) {
return sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
}
double code(double x) {
double t_0 = cbrt(exp(x));
double t_1 = pow(exp(x), 0.6666666666666666) + (1.0 - t_0);
return sqrt(((t_1 * t_0) + (t_1 * 1.0)));
}
public static double code(double x) {
return Math.sqrt(((Math.exp((2.0 * x)) - 1.0) / (Math.exp(x) - 1.0)));
}
public static double code(double x) {
double t_0 = Math.cbrt(Math.exp(x));
double t_1 = Math.pow(Math.exp(x), 0.6666666666666666) + (1.0 - t_0);
return Math.sqrt(((t_1 * t_0) + (t_1 * 1.0)));
}
function code(x) return sqrt(Float64(Float64(exp(Float64(2.0 * x)) - 1.0) / Float64(exp(x) - 1.0))) end
function code(x) t_0 = cbrt(exp(x)) t_1 = Float64((exp(x) ^ 0.6666666666666666) + Float64(1.0 - t_0)) return sqrt(Float64(Float64(t_1 * t_0) + Float64(t_1 * 1.0))) end
code[x_] := N[Sqrt[N[(N[(N[Exp[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(N[Exp[x], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := Block[{t$95$0 = N[Power[N[Exp[x], $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[Exp[x], $MachinePrecision], 0.6666666666666666], $MachinePrecision] + N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]}, N[Sqrt[N[(N[(t$95$1 * t$95$0), $MachinePrecision] + N[(t$95$1 * 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\begin{array}{l}
t_0 := \sqrt[3]{e^{x}}\\
t_1 := {\left(e^{x}\right)}^{0.6666666666666666} + \left(1 - t_0\right)\\
\sqrt{t_1 \cdot t_0 + t_1 \cdot 1}
\end{array}
Results
Initial program 36.2%
Simplified100.0%
Applied egg-rr100.0%
herbie shell --seed 2023151
(FPCore (x)
:name "sqrtexp (problem 3.4.4)"
:precision binary64
(sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))