
(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 8 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}
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z_m)
:precision binary64
(*
y_s
(if (<= y_m 9.6e+89)
(* 0.5 (/ (fma x x (* (- y_m z_m) (+ y_m z_m))) y_m))
(* 0.5 (* (+ y_m z_m) (/ (- y_m z_m) y_m))))))z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (y_m <= 9.6e+89) {
tmp = 0.5 * (fma(x, x, ((y_m - z_m) * (y_m + z_m))) / y_m);
} else {
tmp = 0.5 * ((y_m + z_m) * ((y_m - z_m) / y_m));
}
return y_s * tmp;
}
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) tmp = 0.0 if (y_m <= 9.6e+89) tmp = Float64(0.5 * Float64(fma(x, x, Float64(Float64(y_m - z_m) * Float64(y_m + z_m))) / y_m)); else tmp = Float64(0.5 * Float64(Float64(y_m + z_m) * Float64(Float64(y_m - z_m) / y_m))); end return Float64(y_s * tmp) end
z_m = N[Abs[z], $MachinePrecision]
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$95$m_] := N[(y$95$s * If[LessEqual[y$95$m, 9.6e+89], N[(0.5 * N[(N[(x * x + N[(N[(y$95$m - z$95$m), $MachinePrecision] * N[(y$95$m + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m + z$95$m), $MachinePrecision] * N[(N[(y$95$m - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 9.6 \cdot 10^{+89}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, \left(y\_m - z\_m\right) \cdot \left(y\_m + z\_m\right)\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + z\_m\right) \cdot \frac{y\_m - z\_m}{y\_m}\right)\\
\end{array}
\end{array}
if y < 9.60000000000000018e89Initial program 73.9%
remove-double-neg73.9%
distribute-lft-neg-out73.9%
distribute-frac-neg273.9%
distribute-frac-neg73.9%
neg-mul-173.9%
distribute-lft-neg-out73.9%
*-commutative73.9%
distribute-lft-neg-in73.9%
times-frac73.9%
metadata-eval73.9%
metadata-eval73.9%
associate--l+73.9%
fma-define77.3%
Simplified77.3%
difference-of-squares78.6%
*-commutative78.6%
Applied egg-rr78.6%
if 9.60000000000000018e89 < y Initial program 29.0%
remove-double-neg29.0%
distribute-lft-neg-out29.0%
distribute-frac-neg229.0%
distribute-frac-neg29.0%
neg-mul-129.0%
distribute-lft-neg-out29.0%
*-commutative29.0%
distribute-lft-neg-in29.0%
times-frac29.0%
metadata-eval29.0%
metadata-eval29.0%
associate--l+29.0%
fma-define30.9%
Simplified30.9%
difference-of-squares33.7%
*-commutative33.7%
Applied egg-rr33.7%
Taylor expanded in x around 0 33.7%
associate-/l*88.9%
+-commutative88.9%
Simplified88.9%
Final simplification80.7%
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z_m)
:precision binary64
(let* ((t_0 (* (* x x) (/ 0.5 y_m))))
(*
y_s
(if (<= y_m 1.35e-268)
t_0
(if (<= y_m 4.7e-206)
(/ (* 0.5 z_m) (/ y_m (- y_m z_m)))
(if (<= y_m 4.3e-125)
t_0
(if (<= y_m 6.8e-5)
(* 0.5 (* z_m (/ (- y_m z_m) y_m)))
(* y_m 0.5))))))))z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double t_0 = (x * x) * (0.5 / y_m);
double tmp;
if (y_m <= 1.35e-268) {
tmp = t_0;
} else if (y_m <= 4.7e-206) {
tmp = (0.5 * z_m) / (y_m / (y_m - z_m));
} else if (y_m <= 4.3e-125) {
tmp = t_0;
} else if (y_m <= 6.8e-5) {
tmp = 0.5 * (z_m * ((y_m - z_m) / y_m));
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8) :: t_0
real(8) :: tmp
t_0 = (x * x) * (0.5d0 / y_m)
if (y_m <= 1.35d-268) then
tmp = t_0
else if (y_m <= 4.7d-206) then
tmp = (0.5d0 * z_m) / (y_m / (y_m - z_m))
else if (y_m <= 4.3d-125) then
tmp = t_0
else if (y_m <= 6.8d-5) then
tmp = 0.5d0 * (z_m * ((y_m - z_m) / y_m))
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
z_m = Math.abs(z);
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_m) {
double t_0 = (x * x) * (0.5 / y_m);
double tmp;
if (y_m <= 1.35e-268) {
tmp = t_0;
} else if (y_m <= 4.7e-206) {
tmp = (0.5 * z_m) / (y_m / (y_m - z_m));
} else if (y_m <= 4.3e-125) {
tmp = t_0;
} else if (y_m <= 6.8e-5) {
tmp = 0.5 * (z_m * ((y_m - z_m) / y_m));
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
z_m = math.fabs(z) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): t_0 = (x * x) * (0.5 / y_m) tmp = 0 if y_m <= 1.35e-268: tmp = t_0 elif y_m <= 4.7e-206: tmp = (0.5 * z_m) / (y_m / (y_m - z_m)) elif y_m <= 4.3e-125: tmp = t_0 elif y_m <= 6.8e-5: tmp = 0.5 * (z_m * ((y_m - z_m) / y_m)) else: tmp = y_m * 0.5 return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) t_0 = Float64(Float64(x * x) * Float64(0.5 / y_m)) tmp = 0.0 if (y_m <= 1.35e-268) tmp = t_0; elseif (y_m <= 4.7e-206) tmp = Float64(Float64(0.5 * z_m) / Float64(y_m / Float64(y_m - z_m))); elseif (y_m <= 4.3e-125) tmp = t_0; elseif (y_m <= 6.8e-5) tmp = Float64(0.5 * Float64(z_m * Float64(Float64(y_m - z_m) / y_m))); else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
z_m = abs(z); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) t_0 = (x * x) * (0.5 / y_m); tmp = 0.0; if (y_m <= 1.35e-268) tmp = t_0; elseif (y_m <= 4.7e-206) tmp = (0.5 * z_m) / (y_m / (y_m - z_m)); elseif (y_m <= 4.3e-125) tmp = t_0; elseif (y_m <= 6.8e-5) tmp = 0.5 * (z_m * ((y_m - z_m) / y_m)); else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
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$95$m_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 1.35e-268], t$95$0, If[LessEqual[y$95$m, 4.7e-206], N[(N[(0.5 * z$95$m), $MachinePrecision] / N[(y$95$m / N[(y$95$m - z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 4.3e-125], t$95$0, If[LessEqual[y$95$m, 6.8e-5], N[(0.5 * N[(z$95$m * N[(N[(y$95$m - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]]]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \frac{0.5}{y\_m}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.35 \cdot 10^{-268}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y\_m \leq 4.7 \cdot 10^{-206}:\\
\;\;\;\;\frac{0.5 \cdot z\_m}{\frac{y\_m}{y\_m - z\_m}}\\
\mathbf{elif}\;y\_m \leq 4.3 \cdot 10^{-125}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y\_m \leq 6.8 \cdot 10^{-5}:\\
\;\;\;\;0.5 \cdot \left(z\_m \cdot \frac{y\_m - z\_m}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
\end{array}
if y < 1.35e-268 or 4.6999999999999999e-206 < y < 4.3000000000000002e-125Initial program 69.1%
remove-double-neg69.1%
distribute-lft-neg-out69.1%
distribute-frac-neg269.1%
distribute-frac-neg69.1%
neg-mul-169.1%
distribute-lft-neg-out69.1%
*-commutative69.1%
distribute-lft-neg-in69.1%
times-frac69.1%
metadata-eval69.1%
metadata-eval69.1%
associate--l+69.1%
fma-define71.7%
Simplified71.7%
Taylor expanded in x around inf 37.7%
*-commutative37.7%
associate-*l/37.7%
associate-*r/37.7%
Simplified37.7%
unpow237.7%
Applied egg-rr37.7%
if 1.35e-268 < y < 4.6999999999999999e-206Initial program 98.6%
remove-double-neg98.6%
distribute-lft-neg-out98.6%
distribute-frac-neg298.6%
distribute-frac-neg98.6%
neg-mul-198.6%
distribute-lft-neg-out98.6%
*-commutative98.6%
distribute-lft-neg-in98.6%
times-frac98.6%
metadata-eval98.6%
metadata-eval98.6%
associate--l+98.6%
fma-define98.6%
Simplified98.6%
difference-of-squares98.6%
*-commutative98.6%
Applied egg-rr98.6%
Taylor expanded in x around 0 67.5%
associate-/l*68.7%
+-commutative68.7%
Simplified68.7%
associate-*r*68.7%
clear-num68.8%
un-div-inv68.8%
+-commutative68.8%
Applied egg-rr68.8%
Taylor expanded in y around 0 68.8%
if 4.3000000000000002e-125 < y < 6.7999999999999999e-5Initial program 83.1%
remove-double-neg83.1%
distribute-lft-neg-out83.1%
distribute-frac-neg283.1%
distribute-frac-neg83.1%
neg-mul-183.1%
distribute-lft-neg-out83.1%
*-commutative83.1%
distribute-lft-neg-in83.1%
times-frac83.1%
metadata-eval83.1%
metadata-eval83.1%
associate--l+83.1%
fma-define91.5%
Simplified91.5%
difference-of-squares91.5%
*-commutative91.5%
Applied egg-rr91.5%
Taylor expanded in x around 0 63.0%
associate-/l*63.0%
+-commutative63.0%
Simplified63.0%
Taylor expanded in z around inf 59.1%
if 6.7999999999999999e-5 < y Initial program 39.1%
remove-double-neg39.1%
distribute-lft-neg-out39.1%
distribute-frac-neg239.1%
distribute-frac-neg39.1%
neg-mul-139.1%
distribute-lft-neg-out39.1%
*-commutative39.1%
distribute-lft-neg-in39.1%
times-frac39.1%
metadata-eval39.1%
metadata-eval39.1%
associate--l+39.1%
fma-define42.3%
Simplified42.3%
Taylor expanded in y around inf 68.0%
Final simplification49.2%
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z_m)
:precision binary64
(let* ((t_0 (* 0.5 (* z_m (/ (- y_m z_m) y_m))))
(t_1 (* (* x x) (/ 0.5 y_m))))
(*
y_s
(if (<= y_m 5.4e-271)
t_1
(if (<= y_m 8.5e-203)
t_0
(if (<= y_m 2.25e-125) t_1 (if (<= y_m 6.8e-5) t_0 (* y_m 0.5))))))))z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double t_0 = 0.5 * (z_m * ((y_m - z_m) / y_m));
double t_1 = (x * x) * (0.5 / y_m);
double tmp;
if (y_m <= 5.4e-271) {
tmp = t_1;
} else if (y_m <= 8.5e-203) {
tmp = t_0;
} else if (y_m <= 2.25e-125) {
tmp = t_1;
} else if (y_m <= 6.8e-5) {
tmp = t_0;
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (z_m * ((y_m - z_m) / y_m))
t_1 = (x * x) * (0.5d0 / y_m)
if (y_m <= 5.4d-271) then
tmp = t_1
else if (y_m <= 8.5d-203) then
tmp = t_0
else if (y_m <= 2.25d-125) then
tmp = t_1
else if (y_m <= 6.8d-5) then
tmp = t_0
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
z_m = Math.abs(z);
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_m) {
double t_0 = 0.5 * (z_m * ((y_m - z_m) / y_m));
double t_1 = (x * x) * (0.5 / y_m);
double tmp;
if (y_m <= 5.4e-271) {
tmp = t_1;
} else if (y_m <= 8.5e-203) {
tmp = t_0;
} else if (y_m <= 2.25e-125) {
tmp = t_1;
} else if (y_m <= 6.8e-5) {
tmp = t_0;
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
z_m = math.fabs(z) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): t_0 = 0.5 * (z_m * ((y_m - z_m) / y_m)) t_1 = (x * x) * (0.5 / y_m) tmp = 0 if y_m <= 5.4e-271: tmp = t_1 elif y_m <= 8.5e-203: tmp = t_0 elif y_m <= 2.25e-125: tmp = t_1 elif y_m <= 6.8e-5: tmp = t_0 else: tmp = y_m * 0.5 return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) t_0 = Float64(0.5 * Float64(z_m * Float64(Float64(y_m - z_m) / y_m))) t_1 = Float64(Float64(x * x) * Float64(0.5 / y_m)) tmp = 0.0 if (y_m <= 5.4e-271) tmp = t_1; elseif (y_m <= 8.5e-203) tmp = t_0; elseif (y_m <= 2.25e-125) tmp = t_1; elseif (y_m <= 6.8e-5) tmp = t_0; else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
z_m = abs(z); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) t_0 = 0.5 * (z_m * ((y_m - z_m) / y_m)); t_1 = (x * x) * (0.5 / y_m); tmp = 0.0; if (y_m <= 5.4e-271) tmp = t_1; elseif (y_m <= 8.5e-203) tmp = t_0; elseif (y_m <= 2.25e-125) tmp = t_1; elseif (y_m <= 6.8e-5) tmp = t_0; else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
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$95$m_] := Block[{t$95$0 = N[(0.5 * N[(z$95$m * N[(N[(y$95$m - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 5.4e-271], t$95$1, If[LessEqual[y$95$m, 8.5e-203], t$95$0, If[LessEqual[y$95$m, 2.25e-125], t$95$1, If[LessEqual[y$95$m, 6.8e-5], t$95$0, N[(y$95$m * 0.5), $MachinePrecision]]]]]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(z\_m \cdot \frac{y\_m - z\_m}{y\_m}\right)\\
t_1 := \left(x \cdot x\right) \cdot \frac{0.5}{y\_m}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 5.4 \cdot 10^{-271}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y\_m \leq 8.5 \cdot 10^{-203}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y\_m \leq 2.25 \cdot 10^{-125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y\_m \leq 6.8 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
\end{array}
if y < 5.3999999999999997e-271 or 8.50000000000000031e-203 < y < 2.25000000000000006e-125Initial program 69.1%
remove-double-neg69.1%
distribute-lft-neg-out69.1%
distribute-frac-neg269.1%
distribute-frac-neg69.1%
neg-mul-169.1%
distribute-lft-neg-out69.1%
*-commutative69.1%
distribute-lft-neg-in69.1%
times-frac69.1%
metadata-eval69.1%
metadata-eval69.1%
associate--l+69.1%
fma-define71.7%
Simplified71.7%
Taylor expanded in x around inf 37.7%
*-commutative37.7%
associate-*l/37.7%
associate-*r/37.7%
Simplified37.7%
unpow237.7%
Applied egg-rr37.7%
if 5.3999999999999997e-271 < y < 8.50000000000000031e-203 or 2.25000000000000006e-125 < y < 6.7999999999999999e-5Initial program 89.3%
remove-double-neg89.3%
distribute-lft-neg-out89.3%
distribute-frac-neg289.3%
distribute-frac-neg89.3%
neg-mul-189.3%
distribute-lft-neg-out89.3%
*-commutative89.3%
distribute-lft-neg-in89.3%
times-frac89.3%
metadata-eval89.3%
metadata-eval89.3%
associate--l+89.3%
fma-define94.3%
Simplified94.3%
difference-of-squares94.3%
*-commutative94.3%
Applied egg-rr94.3%
Taylor expanded in x around 0 64.8%
associate-/l*65.3%
+-commutative65.3%
Simplified65.3%
Taylor expanded in z around inf 63.0%
if 6.7999999999999999e-5 < y Initial program 39.1%
remove-double-neg39.1%
distribute-lft-neg-out39.1%
distribute-frac-neg239.1%
distribute-frac-neg39.1%
neg-mul-139.1%
distribute-lft-neg-out39.1%
*-commutative39.1%
distribute-lft-neg-in39.1%
times-frac39.1%
metadata-eval39.1%
metadata-eval39.1%
associate--l+39.1%
fma-define42.3%
Simplified42.3%
Taylor expanded in y around inf 68.0%
Final simplification49.2%
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z_m)
:precision binary64
(*
y_s
(if (<= y_m 2.1e+90)
(/ (- (+ (* x x) (* y_m y_m)) (* z_m z_m)) (* y_m 2.0))
(* 0.5 (* (+ y_m z_m) (/ (- y_m z_m) y_m))))))z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (y_m <= 2.1e+90) {
tmp = (((x * x) + (y_m * y_m)) - (z_m * z_m)) / (y_m * 2.0);
} else {
tmp = 0.5 * ((y_m + z_m) * ((y_m - z_m) / y_m));
}
return y_s * tmp;
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8) :: tmp
if (y_m <= 2.1d+90) then
tmp = (((x * x) + (y_m * y_m)) - (z_m * z_m)) / (y_m * 2.0d0)
else
tmp = 0.5d0 * ((y_m + z_m) * ((y_m - z_m) / y_m))
end if
code = y_s * tmp
end function
z_m = Math.abs(z);
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_m) {
double tmp;
if (y_m <= 2.1e+90) {
tmp = (((x * x) + (y_m * y_m)) - (z_m * z_m)) / (y_m * 2.0);
} else {
tmp = 0.5 * ((y_m + z_m) * ((y_m - z_m) / y_m));
}
return y_s * tmp;
}
z_m = math.fabs(z) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): tmp = 0 if y_m <= 2.1e+90: tmp = (((x * x) + (y_m * y_m)) - (z_m * z_m)) / (y_m * 2.0) else: tmp = 0.5 * ((y_m + z_m) * ((y_m - z_m) / y_m)) return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) tmp = 0.0 if (y_m <= 2.1e+90) tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z_m * z_m)) / Float64(y_m * 2.0)); else tmp = Float64(0.5 * Float64(Float64(y_m + z_m) * Float64(Float64(y_m - z_m) / y_m))); end return Float64(y_s * tmp) end
z_m = abs(z); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) tmp = 0.0; if (y_m <= 2.1e+90) tmp = (((x * x) + (y_m * y_m)) - (z_m * z_m)) / (y_m * 2.0); else tmp = 0.5 * ((y_m + z_m) * ((y_m - z_m) / y_m)); end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
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$95$m_] := N[(y$95$s * If[LessEqual[y$95$m, 2.1e+90], N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m + z$95$m), $MachinePrecision] * N[(N[(y$95$m - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 2.1 \cdot 10^{+90}:\\
\;\;\;\;\frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z\_m \cdot z\_m}{y\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + z\_m\right) \cdot \frac{y\_m - z\_m}{y\_m}\right)\\
\end{array}
\end{array}
if y < 2.09999999999999981e90Initial program 73.9%
if 2.09999999999999981e90 < y Initial program 29.0%
remove-double-neg29.0%
distribute-lft-neg-out29.0%
distribute-frac-neg229.0%
distribute-frac-neg29.0%
neg-mul-129.0%
distribute-lft-neg-out29.0%
*-commutative29.0%
distribute-lft-neg-in29.0%
times-frac29.0%
metadata-eval29.0%
metadata-eval29.0%
associate--l+29.0%
fma-define30.9%
Simplified30.9%
difference-of-squares33.7%
*-commutative33.7%
Applied egg-rr33.7%
Taylor expanded in x around 0 33.7%
associate-/l*88.9%
+-commutative88.9%
Simplified88.9%
Final simplification76.9%
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z_m)
:precision binary64
(*
y_s
(if (<= (* x x) 8.2e+152)
(* 0.5 (* (+ y_m z_m) (/ (- y_m z_m) y_m)))
(* (* x x) (/ 0.5 y_m)))))z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if ((x * x) <= 8.2e+152) {
tmp = 0.5 * ((y_m + z_m) * ((y_m - z_m) / y_m));
} else {
tmp = (x * x) * (0.5 / y_m);
}
return y_s * tmp;
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8) :: tmp
if ((x * x) <= 8.2d+152) then
tmp = 0.5d0 * ((y_m + z_m) * ((y_m - z_m) / y_m))
else
tmp = (x * x) * (0.5d0 / y_m)
end if
code = y_s * tmp
end function
z_m = Math.abs(z);
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_m) {
double tmp;
if ((x * x) <= 8.2e+152) {
tmp = 0.5 * ((y_m + z_m) * ((y_m - z_m) / y_m));
} else {
tmp = (x * x) * (0.5 / y_m);
}
return y_s * tmp;
}
z_m = math.fabs(z) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): tmp = 0 if (x * x) <= 8.2e+152: tmp = 0.5 * ((y_m + z_m) * ((y_m - z_m) / y_m)) else: tmp = (x * x) * (0.5 / y_m) return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) tmp = 0.0 if (Float64(x * x) <= 8.2e+152) tmp = Float64(0.5 * Float64(Float64(y_m + z_m) * Float64(Float64(y_m - z_m) / y_m))); else tmp = Float64(Float64(x * x) * Float64(0.5 / y_m)); end return Float64(y_s * tmp) end
z_m = abs(z); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) tmp = 0.0; if ((x * x) <= 8.2e+152) tmp = 0.5 * ((y_m + z_m) * ((y_m - z_m) / y_m)); else tmp = (x * x) * (0.5 / y_m); end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
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$95$m_] := N[(y$95$s * If[LessEqual[N[(x * x), $MachinePrecision], 8.2e+152], N[(0.5 * N[(N[(y$95$m + z$95$m), $MachinePrecision] * N[(N[(y$95$m - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot x \leq 8.2 \cdot 10^{+152}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + z\_m\right) \cdot \frac{y\_m - z\_m}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y\_m}\\
\end{array}
\end{array}
if (*.f64 x x) < 8.1999999999999996e152Initial program 69.3%
remove-double-neg69.3%
distribute-lft-neg-out69.3%
distribute-frac-neg269.3%
distribute-frac-neg69.3%
neg-mul-169.3%
distribute-lft-neg-out69.3%
*-commutative69.3%
distribute-lft-neg-in69.3%
times-frac69.3%
metadata-eval69.3%
metadata-eval69.3%
associate--l+69.3%
fma-define69.3%
Simplified69.3%
difference-of-squares70.9%
*-commutative70.9%
Applied egg-rr70.9%
Taylor expanded in x around 0 60.8%
associate-/l*89.1%
+-commutative89.1%
Simplified89.1%
if 8.1999999999999996e152 < (*.f64 x x) Initial program 58.1%
remove-double-neg58.1%
distribute-lft-neg-out58.1%
distribute-frac-neg258.1%
distribute-frac-neg58.1%
neg-mul-158.1%
distribute-lft-neg-out58.1%
*-commutative58.1%
distribute-lft-neg-in58.1%
times-frac58.1%
metadata-eval58.1%
metadata-eval58.1%
associate--l+58.1%
fma-define65.8%
Simplified65.8%
Taylor expanded in x around inf 59.5%
*-commutative59.5%
associate-*l/59.5%
associate-*r/59.5%
Simplified59.5%
unpow259.5%
Applied egg-rr59.5%
Final simplification77.1%
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z_m)
:precision binary64
(*
y_s
(if (<= x 3.7e+76)
(/ (* 0.5 (+ y_m z_m)) (/ y_m (- y_m z_m)))
(* (* x x) (/ 0.5 y_m)))))z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (x <= 3.7e+76) {
tmp = (0.5 * (y_m + z_m)) / (y_m / (y_m - z_m));
} else {
tmp = (x * x) * (0.5 / y_m);
}
return y_s * tmp;
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8) :: tmp
if (x <= 3.7d+76) then
tmp = (0.5d0 * (y_m + z_m)) / (y_m / (y_m - z_m))
else
tmp = (x * x) * (0.5d0 / y_m)
end if
code = y_s * tmp
end function
z_m = Math.abs(z);
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_m) {
double tmp;
if (x <= 3.7e+76) {
tmp = (0.5 * (y_m + z_m)) / (y_m / (y_m - z_m));
} else {
tmp = (x * x) * (0.5 / y_m);
}
return y_s * tmp;
}
z_m = math.fabs(z) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): tmp = 0 if x <= 3.7e+76: tmp = (0.5 * (y_m + z_m)) / (y_m / (y_m - z_m)) else: tmp = (x * x) * (0.5 / y_m) return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) tmp = 0.0 if (x <= 3.7e+76) tmp = Float64(Float64(0.5 * Float64(y_m + z_m)) / Float64(y_m / Float64(y_m - z_m))); else tmp = Float64(Float64(x * x) * Float64(0.5 / y_m)); end return Float64(y_s * tmp) end
z_m = abs(z); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) tmp = 0.0; if (x <= 3.7e+76) tmp = (0.5 * (y_m + z_m)) / (y_m / (y_m - z_m)); else tmp = (x * x) * (0.5 / y_m); end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
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$95$m_] := N[(y$95$s * If[LessEqual[x, 3.7e+76], N[(N[(0.5 * N[(y$95$m + z$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$95$m / N[(y$95$m - z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 3.7 \cdot 10^{+76}:\\
\;\;\;\;\frac{0.5 \cdot \left(y\_m + z\_m\right)}{\frac{y\_m}{y\_m - z\_m}}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y\_m}\\
\end{array}
\end{array}
if x < 3.6999999999999999e76Initial program 66.9%
remove-double-neg66.9%
distribute-lft-neg-out66.9%
distribute-frac-neg266.9%
distribute-frac-neg66.9%
neg-mul-166.9%
distribute-lft-neg-out66.9%
*-commutative66.9%
distribute-lft-neg-in66.9%
times-frac66.9%
metadata-eval66.9%
metadata-eval66.9%
associate--l+66.9%
fma-define69.3%
Simplified69.3%
difference-of-squares71.2%
*-commutative71.2%
Applied egg-rr71.2%
Taylor expanded in x around 0 50.4%
associate-/l*74.6%
+-commutative74.6%
Simplified74.6%
associate-*r*74.6%
clear-num74.6%
un-div-inv74.6%
+-commutative74.6%
Applied egg-rr74.6%
if 3.6999999999999999e76 < x Initial program 56.9%
remove-double-neg56.9%
distribute-lft-neg-out56.9%
distribute-frac-neg256.9%
distribute-frac-neg56.9%
neg-mul-156.9%
distribute-lft-neg-out56.9%
*-commutative56.9%
distribute-lft-neg-in56.9%
times-frac56.9%
metadata-eval56.9%
metadata-eval56.9%
associate--l+56.9%
fma-define62.5%
Simplified62.5%
Taylor expanded in x around inf 58.9%
*-commutative58.9%
associate-*l/58.9%
associate-*r/58.9%
Simplified58.9%
unpow258.9%
Applied egg-rr58.9%
z_m = (fabs.f64 z) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z_m) :precision binary64 (* y_s (if (<= y_m 5e+59) (* (* x x) (/ 0.5 y_m)) (* y_m 0.5))))
z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (y_m <= 5e+59) {
tmp = (x * x) * (0.5 / y_m);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8) :: tmp
if (y_m <= 5d+59) then
tmp = (x * x) * (0.5d0 / y_m)
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
z_m = Math.abs(z);
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_m) {
double tmp;
if (y_m <= 5e+59) {
tmp = (x * x) * (0.5 / y_m);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
z_m = math.fabs(z) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): tmp = 0 if y_m <= 5e+59: tmp = (x * x) * (0.5 / y_m) else: tmp = y_m * 0.5 return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) tmp = 0.0 if (y_m <= 5e+59) tmp = Float64(Float64(x * x) * Float64(0.5 / y_m)); else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
z_m = abs(z); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) tmp = 0.0; if (y_m <= 5e+59) tmp = (x * x) * (0.5 / y_m); else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $MachinePrecision]
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$95$m_] := N[(y$95$s * If[LessEqual[y$95$m, 5e+59], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
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 \cdot 10^{+59}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 4.9999999999999997e59Initial program 73.6%
remove-double-neg73.6%
distribute-lft-neg-out73.6%
distribute-frac-neg273.6%
distribute-frac-neg73.6%
neg-mul-173.6%
distribute-lft-neg-out73.6%
*-commutative73.6%
distribute-lft-neg-in73.6%
times-frac73.6%
metadata-eval73.6%
metadata-eval73.6%
associate--l+73.6%
fma-define76.6%
Simplified76.6%
Taylor expanded in x around inf 37.2%
*-commutative37.2%
associate-*l/37.2%
associate-*r/37.2%
Simplified37.2%
unpow237.2%
Applied egg-rr37.2%
if 4.9999999999999997e59 < y Initial program 34.6%
remove-double-neg34.6%
distribute-lft-neg-out34.6%
distribute-frac-neg234.6%
distribute-frac-neg34.6%
neg-mul-134.6%
distribute-lft-neg-out34.6%
*-commutative34.6%
distribute-lft-neg-in34.6%
times-frac34.6%
metadata-eval34.6%
metadata-eval34.6%
associate--l+34.6%
fma-define38.0%
Simplified38.0%
Taylor expanded in y around inf 71.4%
Final simplification45.0%
z_m = (fabs.f64 z) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z_m) :precision binary64 (* y_s (* y_m 0.5)))
z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
return y_s * (y_m * 0.5);
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
code = y_s * (y_m * 0.5d0)
end function
z_m = Math.abs(z);
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_m) {
return y_s * (y_m * 0.5);
}
z_m = math.fabs(z) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): return y_s * (y_m * 0.5)
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) return Float64(y_s * Float64(y_m * 0.5)) end
z_m = abs(z); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z_m) tmp = y_s * (y_m * 0.5); end
z_m = N[Abs[z], $MachinePrecision]
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$95$m_] := N[(y$95$s * N[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(y\_m \cdot 0.5\right)
\end{array}
Initial program 64.8%
remove-double-neg64.8%
distribute-lft-neg-out64.8%
distribute-frac-neg264.8%
distribute-frac-neg64.8%
neg-mul-164.8%
distribute-lft-neg-out64.8%
*-commutative64.8%
distribute-lft-neg-in64.8%
times-frac64.8%
metadata-eval64.8%
metadata-eval64.8%
associate--l+64.8%
fma-define67.9%
Simplified67.9%
Taylor expanded in y around inf 34.2%
Final simplification34.2%
(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 2024172
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:alt
(! :herbie-platform default (- (* y 1/2) (* (* (/ 1/2 y) (+ z x)) (- z x))))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))