
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 3.15e-109)
(* (+ x z) (* (/ 0.5 y_m) (- x z)))
(if (<= y_m 2.4e+23)
(* y_m (+ 0.5 (* 0.5 (/ (* (+ x z) (- x z)) (pow y_m 2.0)))))
(* 0.5 (- (+ y_m (* x (/ x y_m))) (/ z (/ y_m z))))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 3.15e-109) {
tmp = (x + z) * ((0.5 / y_m) * (x - z));
} else if (y_m <= 2.4e+23) {
tmp = y_m * (0.5 + (0.5 * (((x + z) * (x - z)) / pow(y_m, 2.0))));
} else {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z)));
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 3.15d-109) then
tmp = (x + z) * ((0.5d0 / y_m) * (x - z))
else if (y_m <= 2.4d+23) then
tmp = y_m * (0.5d0 + (0.5d0 * (((x + z) * (x - z)) / (y_m ** 2.0d0))))
else
tmp = 0.5d0 * ((y_m + (x * (x / y_m))) - (z / (y_m / z)))
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 3.15e-109) {
tmp = (x + z) * ((0.5 / y_m) * (x - z));
} else if (y_m <= 2.4e+23) {
tmp = y_m * (0.5 + (0.5 * (((x + z) * (x - z)) / Math.pow(y_m, 2.0))));
} else {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z)));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 3.15e-109: tmp = (x + z) * ((0.5 / y_m) * (x - z)) elif y_m <= 2.4e+23: tmp = y_m * (0.5 + (0.5 * (((x + z) * (x - z)) / math.pow(y_m, 2.0)))) else: tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z))) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 3.15e-109) tmp = Float64(Float64(x + z) * Float64(Float64(0.5 / y_m) * Float64(x - z))); elseif (y_m <= 2.4e+23) tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(x + z) * Float64(x - z)) / (y_m ^ 2.0))))); else tmp = Float64(0.5 * Float64(Float64(y_m + Float64(x * Float64(x / y_m))) - Float64(z / Float64(y_m / z)))); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 3.15e-109) tmp = (x + z) * ((0.5 / y_m) * (x - z)); elseif (y_m <= 2.4e+23) tmp = y_m * (0.5 + (0.5 * (((x + z) * (x - z)) / (y_m ^ 2.0)))); else tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z))); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 3.15e-109], N[(N[(x + z), $MachinePrecision] * N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 2.4e+23], N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(x + z), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision] / N[Power[y$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m + N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 3.15 \cdot 10^{-109}:\\
\;\;\;\;\left(x + z\right) \cdot \left(\frac{0.5}{y\_m} \cdot \left(x - z\right)\right)\\
\mathbf{elif}\;y\_m \leq 2.4 \cdot 10^{+23}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \frac{\left(x + z\right) \cdot \left(x - z\right)}{{y\_m}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + x \cdot \frac{x}{y\_m}\right) - \frac{z}{\frac{y\_m}{z}}\right)\\
\end{array}
\end{array}
if y < 3.1500000000000001e-109Initial program 69.8%
Taylor expanded in y around 0 65.2%
associate-*r/65.2%
*-commutative65.2%
associate-/l*65.3%
Simplified65.3%
unpow265.3%
unpow265.3%
difference-of-squares73.5%
Applied egg-rr73.5%
Taylor expanded in y around 0 73.5%
associate-*r/73.5%
*-commutative73.5%
associate-/l*73.5%
associate-*r*77.7%
+-commutative77.7%
metadata-eval77.7%
associate-*r/77.7%
*-commutative77.7%
associate-*r/77.7%
metadata-eval77.7%
Simplified77.7%
if 3.1500000000000001e-109 < y < 2.4e23Initial program 85.8%
Taylor expanded in y around inf 85.9%
*-commutative85.9%
Simplified85.9%
unpow265.9%
unpow265.9%
difference-of-squares79.7%
Applied egg-rr99.7%
if 2.4e23 < y Initial program 50.6%
remove-double-neg50.6%
distribute-lft-neg-out50.6%
distribute-frac-neg250.6%
distribute-frac-neg50.6%
neg-mul-150.6%
distribute-lft-neg-out50.6%
*-commutative50.6%
distribute-lft-neg-in50.6%
times-frac50.6%
metadata-eval50.6%
metadata-eval50.6%
associate--l+50.6%
fma-define50.6%
Simplified50.6%
Taylor expanded in x around 0 78.9%
div-inv79.0%
unpow279.0%
associate-*l*88.9%
Applied egg-rr88.9%
unpow288.9%
associate-/l*99.8%
Applied egg-rr99.8%
add-sqr-sqrt99.8%
pow299.8%
associate-*r*88.5%
unpow288.5%
sqrt-prod88.5%
sqrt-pow199.8%
metadata-eval99.8%
pow199.8%
sqrt-div99.7%
metadata-eval99.7%
div-inv99.8%
pow299.8%
clear-num99.8%
frac-times99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
associate-*l/99.8%
rem-square-sqrt99.8%
Simplified99.8%
Final simplification86.0%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (let* ((t_0 (hypot (/ x (sqrt y_m)) (sqrt y_m))) (t_1 (/ z (sqrt y_m)))) (* y_s (* 0.5 (* (+ t_0 t_1) (- t_0 t_1))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = hypot((x / sqrt(y_m)), sqrt(y_m));
double t_1 = z / sqrt(y_m);
return y_s * (0.5 * ((t_0 + t_1) * (t_0 - t_1)));
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = Math.hypot((x / Math.sqrt(y_m)), Math.sqrt(y_m));
double t_1 = z / Math.sqrt(y_m);
return y_s * (0.5 * ((t_0 + t_1) * (t_0 - t_1)));
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = math.hypot((x / math.sqrt(y_m)), math.sqrt(y_m)) t_1 = z / math.sqrt(y_m) return y_s * (0.5 * ((t_0 + t_1) * (t_0 - t_1)))
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = hypot(Float64(x / sqrt(y_m)), sqrt(y_m)) t_1 = Float64(z / sqrt(y_m)) return Float64(y_s * Float64(0.5 * Float64(Float64(t_0 + t_1) * Float64(t_0 - t_1)))) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z) t_0 = hypot((x / sqrt(y_m)), sqrt(y_m)); t_1 = z / sqrt(y_m); tmp = y_s * (0.5 * ((t_0 + t_1) * (t_0 - t_1))); end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[Sqrt[N[(x / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision] ^ 2 + N[Sqrt[y$95$m], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[(z / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(0.5 * N[(N[(t$95$0 + t$95$1), $MachinePrecision] * N[(t$95$0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(\frac{x}{\sqrt{y\_m}}, \sqrt{y\_m}\right)\\
t_1 := \frac{z}{\sqrt{y\_m}}\\
y\_s \cdot \left(0.5 \cdot \left(\left(t\_0 + t\_1\right) \cdot \left(t\_0 - t\_1\right)\right)\right)
\end{array}
\end{array}
Initial program 66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-frac-neg266.6%
distribute-frac-neg66.6%
neg-mul-166.6%
distribute-lft-neg-out66.6%
*-commutative66.6%
distribute-lft-neg-in66.6%
times-frac66.6%
metadata-eval66.6%
metadata-eval66.6%
associate--l+66.6%
fma-define70.5%
Simplified70.5%
Taylor expanded in x around 0 77.9%
add-sqr-sqrt39.2%
add-sqr-sqrt39.2%
difference-of-squares39.2%
Applied egg-rr49.3%
Final simplification49.3%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (* (+ x z) (* 0.5 (/ x y_m)))))
(*
y_s
(if (<= z 3.05e-265)
(* 0.5 y_m)
(if (<= z 3.3e-152)
t_0
(if (<= z 8.6e-57)
(* 0.5 y_m)
(if (<= z 5.6e+64)
t_0
(if (<= z 4e+90)
(* 0.5 y_m)
(if (<= z 1.7e+92)
(* (/ 0.5 y_m) (* x x))
(* (+ x z) (* -0.5 (/ z y_m))))))))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = (x + z) * (0.5 * (x / y_m));
double tmp;
if (z <= 3.05e-265) {
tmp = 0.5 * y_m;
} else if (z <= 3.3e-152) {
tmp = t_0;
} else if (z <= 8.6e-57) {
tmp = 0.5 * y_m;
} else if (z <= 5.6e+64) {
tmp = t_0;
} else if (z <= 4e+90) {
tmp = 0.5 * y_m;
} else if (z <= 1.7e+92) {
tmp = (0.5 / y_m) * (x * x);
} else {
tmp = (x + z) * (-0.5 * (z / y_m));
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + z) * (0.5d0 * (x / y_m))
if (z <= 3.05d-265) then
tmp = 0.5d0 * y_m
else if (z <= 3.3d-152) then
tmp = t_0
else if (z <= 8.6d-57) then
tmp = 0.5d0 * y_m
else if (z <= 5.6d+64) then
tmp = t_0
else if (z <= 4d+90) then
tmp = 0.5d0 * y_m
else if (z <= 1.7d+92) then
tmp = (0.5d0 / y_m) * (x * x)
else
tmp = (x + z) * ((-0.5d0) * (z / y_m))
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = (x + z) * (0.5 * (x / y_m));
double tmp;
if (z <= 3.05e-265) {
tmp = 0.5 * y_m;
} else if (z <= 3.3e-152) {
tmp = t_0;
} else if (z <= 8.6e-57) {
tmp = 0.5 * y_m;
} else if (z <= 5.6e+64) {
tmp = t_0;
} else if (z <= 4e+90) {
tmp = 0.5 * y_m;
} else if (z <= 1.7e+92) {
tmp = (0.5 / y_m) * (x * x);
} else {
tmp = (x + z) * (-0.5 * (z / y_m));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = (x + z) * (0.5 * (x / y_m)) tmp = 0 if z <= 3.05e-265: tmp = 0.5 * y_m elif z <= 3.3e-152: tmp = t_0 elif z <= 8.6e-57: tmp = 0.5 * y_m elif z <= 5.6e+64: tmp = t_0 elif z <= 4e+90: tmp = 0.5 * y_m elif z <= 1.7e+92: tmp = (0.5 / y_m) * (x * x) else: tmp = (x + z) * (-0.5 * (z / y_m)) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(Float64(x + z) * Float64(0.5 * Float64(x / y_m))) tmp = 0.0 if (z <= 3.05e-265) tmp = Float64(0.5 * y_m); elseif (z <= 3.3e-152) tmp = t_0; elseif (z <= 8.6e-57) tmp = Float64(0.5 * y_m); elseif (z <= 5.6e+64) tmp = t_0; elseif (z <= 4e+90) tmp = Float64(0.5 * y_m); elseif (z <= 1.7e+92) tmp = Float64(Float64(0.5 / y_m) * Float64(x * x)); else tmp = Float64(Float64(x + z) * Float64(-0.5 * Float64(z / y_m))); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = (x + z) * (0.5 * (x / y_m)); tmp = 0.0; if (z <= 3.05e-265) tmp = 0.5 * y_m; elseif (z <= 3.3e-152) tmp = t_0; elseif (z <= 8.6e-57) tmp = 0.5 * y_m; elseif (z <= 5.6e+64) tmp = t_0; elseif (z <= 4e+90) tmp = 0.5 * y_m; elseif (z <= 1.7e+92) tmp = (0.5 / y_m) * (x * x); else tmp = (x + z) * (-0.5 * (z / y_m)); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(x + z), $MachinePrecision] * N[(0.5 * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[z, 3.05e-265], N[(0.5 * y$95$m), $MachinePrecision], If[LessEqual[z, 3.3e-152], t$95$0, If[LessEqual[z, 8.6e-57], N[(0.5 * y$95$m), $MachinePrecision], If[LessEqual[z, 5.6e+64], t$95$0, If[LessEqual[z, 4e+90], N[(0.5 * y$95$m), $MachinePrecision], If[LessEqual[z, 1.7e+92], N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x + z), $MachinePrecision] * N[(-0.5 * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \left(x + z\right) \cdot \left(0.5 \cdot \frac{x}{y\_m}\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 3.05 \cdot 10^{-265}:\\
\;\;\;\;0.5 \cdot y\_m\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-152}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{-57}:\\
\;\;\;\;0.5 \cdot y\_m\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+90}:\\
\;\;\;\;0.5 \cdot y\_m\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+92}:\\
\;\;\;\;\frac{0.5}{y\_m} \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) \cdot \left(-0.5 \cdot \frac{z}{y\_m}\right)\\
\end{array}
\end{array}
\end{array}
if z < 3.0500000000000001e-265 or 3.29999999999999998e-152 < z < 8.60000000000000043e-57 or 5.60000000000000047e64 < z < 3.99999999999999987e90Initial program 64.8%
Taylor expanded in y around inf 40.4%
*-commutative40.4%
Simplified40.4%
if 3.0500000000000001e-265 < z < 3.29999999999999998e-152 or 8.60000000000000043e-57 < z < 5.60000000000000047e64Initial program 90.1%
Taylor expanded in y around 0 70.0%
associate-*r/70.0%
*-commutative70.0%
associate-/l*70.1%
Simplified70.1%
unpow270.1%
unpow270.1%
difference-of-squares70.1%
Applied egg-rr70.1%
Taylor expanded in y around 0 70.0%
associate-*r/70.0%
*-commutative70.0%
associate-/l*70.1%
associate-*r*70.1%
+-commutative70.1%
metadata-eval70.1%
associate-*r/70.1%
*-commutative70.1%
associate-*r/70.1%
metadata-eval70.1%
Simplified70.1%
Taylor expanded in x around inf 55.6%
if 3.99999999999999987e90 < z < 1.6999999999999999e92Initial program 99.5%
Taylor expanded in y around 0 67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*67.0%
Simplified67.0%
add-cbrt-cube66.8%
pow366.8%
Applied egg-rr66.8%
Taylor expanded in x around inf 67.4%
pow1/367.4%
pow-pow67.4%
metadata-eval67.4%
unpow267.4%
Applied egg-rr67.4%
if 1.6999999999999999e92 < z Initial program 51.7%
Taylor expanded in y around 0 51.7%
associate-*r/51.7%
*-commutative51.7%
associate-/l*51.7%
Simplified51.7%
unpow251.7%
unpow251.7%
difference-of-squares78.6%
Applied egg-rr78.6%
Taylor expanded in y around 0 78.6%
associate-*r/78.6%
*-commutative78.6%
associate-/l*78.6%
associate-*r*84.9%
+-commutative84.9%
metadata-eval84.9%
associate-*r/84.9%
*-commutative84.9%
associate-*r/84.9%
metadata-eval84.9%
Simplified84.9%
Taylor expanded in x around 0 74.9%
Final simplification49.6%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (* (+ x z) (* x (/ 0.5 y_m)))))
(*
y_s
(if (<= z 9e-266)
(* 0.5 y_m)
(if (<= z 1.4e-155)
t_0
(if (<= z 8.5e-57)
(* 0.5 y_m)
(if (<= z 8.5e+64)
t_0
(if (<= z 2.9e+89)
(* 0.5 y_m)
(if (<= z 1.7e+92)
(* (/ 0.5 y_m) (* x x))
(* (+ x z) (* -0.5 (/ z y_m))))))))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = (x + z) * (x * (0.5 / y_m));
double tmp;
if (z <= 9e-266) {
tmp = 0.5 * y_m;
} else if (z <= 1.4e-155) {
tmp = t_0;
} else if (z <= 8.5e-57) {
tmp = 0.5 * y_m;
} else if (z <= 8.5e+64) {
tmp = t_0;
} else if (z <= 2.9e+89) {
tmp = 0.5 * y_m;
} else if (z <= 1.7e+92) {
tmp = (0.5 / y_m) * (x * x);
} else {
tmp = (x + z) * (-0.5 * (z / y_m));
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + z) * (x * (0.5d0 / y_m))
if (z <= 9d-266) then
tmp = 0.5d0 * y_m
else if (z <= 1.4d-155) then
tmp = t_0
else if (z <= 8.5d-57) then
tmp = 0.5d0 * y_m
else if (z <= 8.5d+64) then
tmp = t_0
else if (z <= 2.9d+89) then
tmp = 0.5d0 * y_m
else if (z <= 1.7d+92) then
tmp = (0.5d0 / y_m) * (x * x)
else
tmp = (x + z) * ((-0.5d0) * (z / y_m))
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = (x + z) * (x * (0.5 / y_m));
double tmp;
if (z <= 9e-266) {
tmp = 0.5 * y_m;
} else if (z <= 1.4e-155) {
tmp = t_0;
} else if (z <= 8.5e-57) {
tmp = 0.5 * y_m;
} else if (z <= 8.5e+64) {
tmp = t_0;
} else if (z <= 2.9e+89) {
tmp = 0.5 * y_m;
} else if (z <= 1.7e+92) {
tmp = (0.5 / y_m) * (x * x);
} else {
tmp = (x + z) * (-0.5 * (z / y_m));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = (x + z) * (x * (0.5 / y_m)) tmp = 0 if z <= 9e-266: tmp = 0.5 * y_m elif z <= 1.4e-155: tmp = t_0 elif z <= 8.5e-57: tmp = 0.5 * y_m elif z <= 8.5e+64: tmp = t_0 elif z <= 2.9e+89: tmp = 0.5 * y_m elif z <= 1.7e+92: tmp = (0.5 / y_m) * (x * x) else: tmp = (x + z) * (-0.5 * (z / y_m)) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(Float64(x + z) * Float64(x * Float64(0.5 / y_m))) tmp = 0.0 if (z <= 9e-266) tmp = Float64(0.5 * y_m); elseif (z <= 1.4e-155) tmp = t_0; elseif (z <= 8.5e-57) tmp = Float64(0.5 * y_m); elseif (z <= 8.5e+64) tmp = t_0; elseif (z <= 2.9e+89) tmp = Float64(0.5 * y_m); elseif (z <= 1.7e+92) tmp = Float64(Float64(0.5 / y_m) * Float64(x * x)); else tmp = Float64(Float64(x + z) * Float64(-0.5 * Float64(z / y_m))); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = (x + z) * (x * (0.5 / y_m)); tmp = 0.0; if (z <= 9e-266) tmp = 0.5 * y_m; elseif (z <= 1.4e-155) tmp = t_0; elseif (z <= 8.5e-57) tmp = 0.5 * y_m; elseif (z <= 8.5e+64) tmp = t_0; elseif (z <= 2.9e+89) tmp = 0.5 * y_m; elseif (z <= 1.7e+92) tmp = (0.5 / y_m) * (x * x); else tmp = (x + z) * (-0.5 * (z / y_m)); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(x + z), $MachinePrecision] * N[(x * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[z, 9e-266], N[(0.5 * y$95$m), $MachinePrecision], If[LessEqual[z, 1.4e-155], t$95$0, If[LessEqual[z, 8.5e-57], N[(0.5 * y$95$m), $MachinePrecision], If[LessEqual[z, 8.5e+64], t$95$0, If[LessEqual[z, 2.9e+89], N[(0.5 * y$95$m), $MachinePrecision], If[LessEqual[z, 1.7e+92], N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x + z), $MachinePrecision] * N[(-0.5 * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \left(x + z\right) \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 9 \cdot 10^{-266}:\\
\;\;\;\;0.5 \cdot y\_m\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-155}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-57}:\\
\;\;\;\;0.5 \cdot y\_m\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+89}:\\
\;\;\;\;0.5 \cdot y\_m\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+92}:\\
\;\;\;\;\frac{0.5}{y\_m} \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) \cdot \left(-0.5 \cdot \frac{z}{y\_m}\right)\\
\end{array}
\end{array}
\end{array}
if z < 9.0000000000000006e-266 or 1.4e-155 < z < 8.49999999999999955e-57 or 8.4999999999999998e64 < z < 2.90000000000000025e89Initial program 64.8%
Taylor expanded in y around inf 40.4%
*-commutative40.4%
Simplified40.4%
if 9.0000000000000006e-266 < z < 1.4e-155 or 8.49999999999999955e-57 < z < 8.4999999999999998e64Initial program 90.1%
Taylor expanded in y around 0 70.0%
associate-*r/70.0%
*-commutative70.0%
associate-/l*70.1%
Simplified70.1%
unpow270.1%
unpow270.1%
difference-of-squares70.1%
Applied egg-rr70.1%
Taylor expanded in y around 0 70.0%
associate-*r/70.0%
*-commutative70.0%
associate-/l*70.1%
associate-*r*70.1%
+-commutative70.1%
metadata-eval70.1%
associate-*r/70.1%
*-commutative70.1%
associate-*r/70.1%
metadata-eval70.1%
Simplified70.1%
Taylor expanded in x around inf 55.6%
*-commutative55.6%
associate-*l/55.6%
associate-*r/55.6%
Simplified55.6%
if 2.90000000000000025e89 < z < 1.6999999999999999e92Initial program 99.5%
Taylor expanded in y around 0 67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*67.0%
Simplified67.0%
add-cbrt-cube66.8%
pow366.8%
Applied egg-rr66.8%
Taylor expanded in x around inf 67.4%
pow1/367.4%
pow-pow67.4%
metadata-eval67.4%
unpow267.4%
Applied egg-rr67.4%
if 1.6999999999999999e92 < z Initial program 51.7%
Taylor expanded in y around 0 51.7%
associate-*r/51.7%
*-commutative51.7%
associate-/l*51.7%
Simplified51.7%
unpow251.7%
unpow251.7%
difference-of-squares78.6%
Applied egg-rr78.6%
Taylor expanded in y around 0 78.6%
associate-*r/78.6%
*-commutative78.6%
associate-/l*78.6%
associate-*r*84.9%
+-commutative84.9%
metadata-eval84.9%
associate-*r/84.9%
*-commutative84.9%
associate-*r/84.9%
metadata-eval84.9%
Simplified84.9%
Taylor expanded in x around 0 74.9%
Final simplification49.6%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (* (/ 0.5 y_m) (* x x))))
(*
y_s
(if (<= z 5.9e-265)
(* 0.5 y_m)
(if (<= z 2.1e-153)
t_0
(if (<= z 8e-57)
(* 0.5 y_m)
(if (<= z 9.2e+64)
t_0
(if (<= z 7.9e+93)
(* 0.5 y_m)
(* (+ x z) (* -0.5 (/ z y_m)))))))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = (0.5 / y_m) * (x * x);
double tmp;
if (z <= 5.9e-265) {
tmp = 0.5 * y_m;
} else if (z <= 2.1e-153) {
tmp = t_0;
} else if (z <= 8e-57) {
tmp = 0.5 * y_m;
} else if (z <= 9.2e+64) {
tmp = t_0;
} else if (z <= 7.9e+93) {
tmp = 0.5 * y_m;
} else {
tmp = (x + z) * (-0.5 * (z / y_m));
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (0.5d0 / y_m) * (x * x)
if (z <= 5.9d-265) then
tmp = 0.5d0 * y_m
else if (z <= 2.1d-153) then
tmp = t_0
else if (z <= 8d-57) then
tmp = 0.5d0 * y_m
else if (z <= 9.2d+64) then
tmp = t_0
else if (z <= 7.9d+93) then
tmp = 0.5d0 * y_m
else
tmp = (x + z) * ((-0.5d0) * (z / y_m))
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = (0.5 / y_m) * (x * x);
double tmp;
if (z <= 5.9e-265) {
tmp = 0.5 * y_m;
} else if (z <= 2.1e-153) {
tmp = t_0;
} else if (z <= 8e-57) {
tmp = 0.5 * y_m;
} else if (z <= 9.2e+64) {
tmp = t_0;
} else if (z <= 7.9e+93) {
tmp = 0.5 * y_m;
} else {
tmp = (x + z) * (-0.5 * (z / y_m));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = (0.5 / y_m) * (x * x) tmp = 0 if z <= 5.9e-265: tmp = 0.5 * y_m elif z <= 2.1e-153: tmp = t_0 elif z <= 8e-57: tmp = 0.5 * y_m elif z <= 9.2e+64: tmp = t_0 elif z <= 7.9e+93: tmp = 0.5 * y_m else: tmp = (x + z) * (-0.5 * (z / y_m)) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(Float64(0.5 / y_m) * Float64(x * x)) tmp = 0.0 if (z <= 5.9e-265) tmp = Float64(0.5 * y_m); elseif (z <= 2.1e-153) tmp = t_0; elseif (z <= 8e-57) tmp = Float64(0.5 * y_m); elseif (z <= 9.2e+64) tmp = t_0; elseif (z <= 7.9e+93) tmp = Float64(0.5 * y_m); else tmp = Float64(Float64(x + z) * Float64(-0.5 * Float64(z / y_m))); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = (0.5 / y_m) * (x * x); tmp = 0.0; if (z <= 5.9e-265) tmp = 0.5 * y_m; elseif (z <= 2.1e-153) tmp = t_0; elseif (z <= 8e-57) tmp = 0.5 * y_m; elseif (z <= 9.2e+64) tmp = t_0; elseif (z <= 7.9e+93) tmp = 0.5 * y_m; else tmp = (x + z) * (-0.5 * (z / y_m)); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[z, 5.9e-265], N[(0.5 * y$95$m), $MachinePrecision], If[LessEqual[z, 2.1e-153], t$95$0, If[LessEqual[z, 8e-57], N[(0.5 * y$95$m), $MachinePrecision], If[LessEqual[z, 9.2e+64], t$95$0, If[LessEqual[z, 7.9e+93], N[(0.5 * y$95$m), $MachinePrecision], N[(N[(x + z), $MachinePrecision] * N[(-0.5 * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{0.5}{y\_m} \cdot \left(x \cdot x\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 5.9 \cdot 10^{-265}:\\
\;\;\;\;0.5 \cdot y\_m\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-153}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-57}:\\
\;\;\;\;0.5 \cdot y\_m\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 7.9 \cdot 10^{+93}:\\
\;\;\;\;0.5 \cdot y\_m\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) \cdot \left(-0.5 \cdot \frac{z}{y\_m}\right)\\
\end{array}
\end{array}
\end{array}
if z < 5.90000000000000012e-265 or 2.10000000000000004e-153 < z < 7.99999999999999964e-57 or 9.2e64 < z < 7.8999999999999999e93Initial program 65.7%
Taylor expanded in y around inf 40.1%
*-commutative40.1%
Simplified40.1%
if 5.90000000000000012e-265 < z < 2.10000000000000004e-153 or 7.99999999999999964e-57 < z < 9.2e64Initial program 90.1%
Taylor expanded in y around 0 70.0%
associate-*r/70.0%
*-commutative70.0%
associate-/l*70.1%
Simplified70.1%
add-cbrt-cube50.7%
pow350.8%
Applied egg-rr50.8%
Taylor expanded in x around inf 40.7%
pow1/340.2%
pow-pow55.1%
metadata-eval55.1%
unpow255.1%
Applied egg-rr55.1%
if 7.8999999999999999e93 < z Initial program 50.7%
Taylor expanded in y around 0 50.7%
associate-*r/50.7%
*-commutative50.7%
associate-/l*50.7%
Simplified50.7%
unpow250.7%
unpow250.7%
difference-of-squares78.1%
Applied egg-rr78.1%
Taylor expanded in y around 0 78.1%
associate-*r/78.1%
*-commutative78.1%
associate-/l*78.1%
associate-*r*84.6%
+-commutative84.6%
metadata-eval84.6%
associate-*r/84.6%
*-commutative84.6%
associate-*r/84.6%
metadata-eval84.6%
Simplified84.6%
Taylor expanded in x around 0 74.3%
Final simplification48.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 1.65e-118)
(* (+ x z) (* (/ 0.5 y_m) (- x z)))
(* 0.5 (- (+ y_m (* x (/ x y_m))) (/ z (/ y_m z)))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.65e-118) {
tmp = (x + z) * ((0.5 / y_m) * (x - z));
} else {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z)));
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1.65d-118) then
tmp = (x + z) * ((0.5d0 / y_m) * (x - z))
else
tmp = 0.5d0 * ((y_m + (x * (x / y_m))) - (z / (y_m / z)))
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.65e-118) {
tmp = (x + z) * ((0.5 / y_m) * (x - z));
} else {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z)));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1.65e-118: tmp = (x + z) * ((0.5 / y_m) * (x - z)) else: tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z))) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1.65e-118) tmp = Float64(Float64(x + z) * Float64(Float64(0.5 / y_m) * Float64(x - z))); else tmp = Float64(0.5 * Float64(Float64(y_m + Float64(x * Float64(x / y_m))) - Float64(z / Float64(y_m / z)))); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1.65e-118) tmp = (x + z) * ((0.5 / y_m) * (x - z)); else tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z))); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.65e-118], N[(N[(x + z), $MachinePrecision] * N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m + N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.65 \cdot 10^{-118}:\\
\;\;\;\;\left(x + z\right) \cdot \left(\frac{0.5}{y\_m} \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + x \cdot \frac{x}{y\_m}\right) - \frac{z}{\frac{y\_m}{z}}\right)\\
\end{array}
\end{array}
if y < 1.65e-118Initial program 69.6%
Taylor expanded in y around 0 65.0%
associate-*r/65.0%
*-commutative65.0%
associate-/l*65.1%
Simplified65.1%
unpow265.1%
unpow265.1%
difference-of-squares73.3%
Applied egg-rr73.3%
Taylor expanded in y around 0 73.3%
associate-*r/73.3%
*-commutative73.3%
associate-/l*73.3%
associate-*r*77.5%
+-commutative77.5%
metadata-eval77.5%
associate-*r/77.5%
*-commutative77.5%
associate-*r/77.5%
metadata-eval77.5%
Simplified77.5%
if 1.65e-118 < y Initial program 61.6%
remove-double-neg61.6%
distribute-lft-neg-out61.6%
distribute-frac-neg261.6%
distribute-frac-neg61.6%
neg-mul-161.6%
distribute-lft-neg-out61.6%
*-commutative61.6%
distribute-lft-neg-in61.6%
times-frac61.6%
metadata-eval61.6%
metadata-eval61.6%
associate--l+61.6%
fma-define64.7%
Simplified64.7%
Taylor expanded in x around 0 81.2%
div-inv81.3%
unpow281.3%
associate-*l*88.1%
Applied egg-rr88.1%
unpow288.1%
associate-/l*95.7%
Applied egg-rr95.7%
add-sqr-sqrt95.7%
pow295.7%
associate-*r*87.9%
unpow287.9%
sqrt-prod87.8%
sqrt-pow195.7%
metadata-eval95.7%
pow195.7%
sqrt-div95.6%
metadata-eval95.6%
div-inv95.7%
pow295.7%
clear-num95.7%
frac-times95.7%
*-un-lft-identity95.7%
Applied egg-rr95.7%
associate-*l/95.7%
rem-square-sqrt95.7%
Simplified95.7%
Final simplification84.4%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= y_m 5.4e+120) (* (/ 0.5 y_m) (* (+ x z) (- x z))) (* 0.5 y_m))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 5.4e+120) {
tmp = (0.5 / y_m) * ((x + z) * (x - z));
} else {
tmp = 0.5 * y_m;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 5.4d+120) then
tmp = (0.5d0 / y_m) * ((x + z) * (x - z))
else
tmp = 0.5d0 * y_m
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 5.4e+120) {
tmp = (0.5 / y_m) * ((x + z) * (x - z));
} else {
tmp = 0.5 * y_m;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 5.4e+120: tmp = (0.5 / y_m) * ((x + z) * (x - z)) else: tmp = 0.5 * y_m return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 5.4e+120) tmp = Float64(Float64(0.5 / y_m) * Float64(Float64(x + z) * Float64(x - z))); else tmp = Float64(0.5 * y_m); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 5.4e+120) tmp = (0.5 / y_m) * ((x + z) * (x - z)); else tmp = 0.5 * y_m; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 5.4e+120], N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(N[(x + z), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * y$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 5.4 \cdot 10^{+120}:\\
\;\;\;\;\frac{0.5}{y\_m} \cdot \left(\left(x + z\right) \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\_m\\
\end{array}
\end{array}
if y < 5.3999999999999999e120Initial program 73.5%
Taylor expanded in y around 0 63.0%
associate-*r/63.0%
*-commutative63.0%
associate-/l*63.0%
Simplified63.0%
unpow263.0%
unpow263.0%
difference-of-squares71.1%
Applied egg-rr71.1%
if 5.3999999999999999e120 < y Initial program 33.1%
Taylor expanded in y around inf 79.5%
*-commutative79.5%
Simplified79.5%
Final simplification72.5%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= y_m 8.5e+122) (* (+ x z) (* (/ 0.5 y_m) (- x z))) (* 0.5 y_m))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 8.5e+122) {
tmp = (x + z) * ((0.5 / y_m) * (x - z));
} else {
tmp = 0.5 * y_m;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 8.5d+122) then
tmp = (x + z) * ((0.5d0 / y_m) * (x - z))
else
tmp = 0.5d0 * y_m
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 8.5e+122) {
tmp = (x + z) * ((0.5 / y_m) * (x - z));
} else {
tmp = 0.5 * y_m;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 8.5e+122: tmp = (x + z) * ((0.5 / y_m) * (x - z)) else: tmp = 0.5 * y_m return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 8.5e+122) tmp = Float64(Float64(x + z) * Float64(Float64(0.5 / y_m) * Float64(x - z))); else tmp = Float64(0.5 * y_m); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 8.5e+122) tmp = (x + z) * ((0.5 / y_m) * (x - z)); else tmp = 0.5 * y_m; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 8.5e+122], N[(N[(x + z), $MachinePrecision] * N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * y$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 8.5 \cdot 10^{+122}:\\
\;\;\;\;\left(x + z\right) \cdot \left(\frac{0.5}{y\_m} \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\_m\\
\end{array}
\end{array}
if y < 8.50000000000000003e122Initial program 73.5%
Taylor expanded in y around 0 63.0%
associate-*r/63.0%
*-commutative63.0%
associate-/l*63.0%
Simplified63.0%
unpow263.0%
unpow263.0%
difference-of-squares71.1%
Applied egg-rr71.1%
Taylor expanded in y around 0 71.1%
associate-*r/71.1%
*-commutative71.1%
associate-/l*71.1%
associate-*r*75.9%
+-commutative75.9%
metadata-eval75.9%
associate-*r/75.9%
*-commutative75.9%
associate-*r/75.9%
metadata-eval75.9%
Simplified75.9%
if 8.50000000000000003e122 < y Initial program 33.1%
Taylor expanded in y around inf 79.5%
*-commutative79.5%
Simplified79.5%
Final simplification76.6%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= y_m 1.2e+121) (* (+ x z) (/ (* 0.5 (- x z)) y_m)) (* 0.5 y_m))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.2e+121) {
tmp = (x + z) * ((0.5 * (x - z)) / y_m);
} else {
tmp = 0.5 * y_m;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1.2d+121) then
tmp = (x + z) * ((0.5d0 * (x - z)) / y_m)
else
tmp = 0.5d0 * y_m
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.2e+121) {
tmp = (x + z) * ((0.5 * (x - z)) / y_m);
} else {
tmp = 0.5 * y_m;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1.2e+121: tmp = (x + z) * ((0.5 * (x - z)) / y_m) else: tmp = 0.5 * y_m return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1.2e+121) tmp = Float64(Float64(x + z) * Float64(Float64(0.5 * Float64(x - z)) / y_m)); else tmp = Float64(0.5 * y_m); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1.2e+121) tmp = (x + z) * ((0.5 * (x - z)) / y_m); else tmp = 0.5 * y_m; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.2e+121], N[(N[(x + z), $MachinePrecision] * N[(N[(0.5 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 * y$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.2 \cdot 10^{+121}:\\
\;\;\;\;\left(x + z\right) \cdot \frac{0.5 \cdot \left(x - z\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\_m\\
\end{array}
\end{array}
if y < 1.2e121Initial program 73.5%
Taylor expanded in y around 0 63.0%
associate-*r/63.0%
*-commutative63.0%
associate-/l*63.0%
Simplified63.0%
unpow263.0%
unpow263.0%
difference-of-squares71.1%
Applied egg-rr71.1%
Taylor expanded in y around 0 71.1%
associate-*r/71.1%
*-commutative71.1%
associate-/l*71.1%
associate-*r*75.9%
+-commutative75.9%
metadata-eval75.9%
associate-*r/75.9%
*-commutative75.9%
associate-*r/75.9%
metadata-eval75.9%
Simplified75.9%
associate-*l/76.0%
Applied egg-rr76.0%
if 1.2e121 < y Initial program 33.1%
Taylor expanded in y around inf 79.5%
*-commutative79.5%
Simplified79.5%
Final simplification76.6%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= y_m 4.7e+27) (* (/ 0.5 y_m) (* x x)) (* 0.5 y_m))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 4.7e+27) {
tmp = (0.5 / y_m) * (x * x);
} else {
tmp = 0.5 * y_m;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 4.7d+27) then
tmp = (0.5d0 / y_m) * (x * x)
else
tmp = 0.5d0 * y_m
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 4.7e+27) {
tmp = (0.5 / y_m) * (x * x);
} else {
tmp = 0.5 * y_m;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 4.7e+27: tmp = (0.5 / y_m) * (x * x) else: tmp = 0.5 * y_m return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 4.7e+27) tmp = Float64(Float64(0.5 / y_m) * Float64(x * x)); else tmp = Float64(0.5 * y_m); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 4.7e+27) tmp = (0.5 / y_m) * (x * x); else tmp = 0.5 * y_m; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 4.7e+27], N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(0.5 * y$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 4.7 \cdot 10^{+27}:\\
\;\;\;\;\frac{0.5}{y\_m} \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\_m\\
\end{array}
\end{array}
if y < 4.69999999999999976e27Initial program 72.2%
Taylor expanded in y around 0 65.3%
associate-*r/65.3%
*-commutative65.3%
associate-/l*65.4%
Simplified65.4%
add-cbrt-cube53.5%
pow353.5%
Applied egg-rr53.5%
Taylor expanded in x around inf 29.0%
pow1/328.9%
pow-pow36.2%
metadata-eval36.2%
unpow236.2%
Applied egg-rr36.2%
if 4.69999999999999976e27 < y Initial program 50.6%
Taylor expanded in y around inf 66.3%
*-commutative66.3%
Simplified66.3%
Final simplification44.1%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (* 0.5 y_m)))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
return y_s * (0.5 * y_m);
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (0.5d0 * y_m)
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
return y_s * (0.5 * y_m);
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): return y_s * (0.5 * y_m)
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) return Float64(y_s * Float64(0.5 * y_m)) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z) tmp = y_s * (0.5 * y_m); end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(0.5 * y$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(0.5 \cdot y\_m\right)
\end{array}
Initial program 66.6%
Taylor expanded in y around inf 34.3%
*-commutative34.3%
Simplified34.3%
Final simplification34.3%
(FPCore (x y z) :precision binary64 (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x))))
double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y * 0.5d0) - (((0.5d0 / y) * (z + x)) * (z - x))
end function
public static double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
def code(x, y, z): return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x))
function code(x, y, z) return Float64(Float64(y * 0.5) - Float64(Float64(Float64(0.5 / y) * Float64(z + x)) * Float64(z - x))) end
function tmp = code(x, y, z) tmp = (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x)); end
code[x_, y_, z_] := N[(N[(y * 0.5), $MachinePrecision] - N[(N[(N[(0.5 / y), $MachinePrecision] * N[(z + x), $MachinePrecision]), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 0.5 - \left(\frac{0.5}{y} \cdot \left(z + x\right)\right) \cdot \left(z - x\right)
\end{array}
herbie shell --seed 2024080
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:alt
(- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))