(FPCore (x) :precision binary64 (sqrt (* 2.0 (pow x 2.0))))
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (pow 16.0 0.125)))) (fabs (* t_0 (* (pow t_0 2.0) x)))))
double code(double x) {
return sqrt((2.0 * pow(x, 2.0)));
}
double code(double x) {
double t_0 = cbrt(pow(16.0, 0.125));
return fabs((t_0 * (pow(t_0, 2.0) * x)));
}
public static double code(double x) {
return Math.sqrt((2.0 * Math.pow(x, 2.0)));
}
public static double code(double x) {
double t_0 = Math.cbrt(Math.pow(16.0, 0.125));
return Math.abs((t_0 * (Math.pow(t_0, 2.0) * x)));
}
function code(x) return sqrt(Float64(2.0 * (x ^ 2.0))) end
function code(x) t_0 = cbrt((16.0 ^ 0.125)) return abs(Float64(t_0 * Float64((t_0 ^ 2.0) * x))) end
code[x_] := N[Sqrt[N[(2.0 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := Block[{t$95$0 = N[Power[N[Power[16.0, 0.125], $MachinePrecision], 1/3], $MachinePrecision]}, N[Abs[N[(t$95$0 * N[(N[Power[t$95$0, 2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\sqrt{2 \cdot {x}^{2}}
\begin{array}{l}
t_0 := \sqrt[3]{{16}^{0.125}}\\
\left|t_0 \cdot \left({t_0}^{2} \cdot x\right)\right|
\end{array}
Results
Initial program 47.27
Simplified0.69
Applied egg-rr0.68
Taylor expanded in x around 0 0.87
Applied egg-rr0.59
herbie shell --seed 2023136
(FPCore (x)
:name "sqrt D (should all be same)"
:precision binary64
(sqrt (* 2.0 (pow x 2.0))))