
(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 9 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}
x_m = (fabs.f64 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x_m y_m z)
:precision binary64
(*
y_s
(if (<= x_m 1e-190)
(* 0.5 (- y_m (* z (/ z y_m))))
(if (<= x_m 2.1e+151)
(* 0.5 (+ y_m (/ (- (pow x_m 2.0) (pow z 2.0)) y_m)))
(pow (* x_m (sqrt (/ 0.5 y_m))) 2.0)))))x_m = fabs(x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if (x_m <= 1e-190) {
tmp = 0.5 * (y_m - (z * (z / y_m)));
} else if (x_m <= 2.1e+151) {
tmp = 0.5 * (y_m + ((pow(x_m, 2.0) - pow(z, 2.0)) / y_m));
} else {
tmp = pow((x_m * sqrt((0.5 / y_m))), 2.0);
}
return y_s * tmp;
}
x_m = abs(x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x_m <= 1d-190) then
tmp = 0.5d0 * (y_m - (z * (z / y_m)))
else if (x_m <= 2.1d+151) then
tmp = 0.5d0 * (y_m + (((x_m ** 2.0d0) - (z ** 2.0d0)) / y_m))
else
tmp = (x_m * sqrt((0.5d0 / y_m))) ** 2.0d0
end if
code = y_s * tmp
end function
x_m = Math.abs(x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if (x_m <= 1e-190) {
tmp = 0.5 * (y_m - (z * (z / y_m)));
} else if (x_m <= 2.1e+151) {
tmp = 0.5 * (y_m + ((Math.pow(x_m, 2.0) - Math.pow(z, 2.0)) / y_m));
} else {
tmp = Math.pow((x_m * Math.sqrt((0.5 / y_m))), 2.0);
}
return y_s * tmp;
}
x_m = math.fabs(x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_m, y_m, z): tmp = 0 if x_m <= 1e-190: tmp = 0.5 * (y_m - (z * (z / y_m))) elif x_m <= 2.1e+151: tmp = 0.5 * (y_m + ((math.pow(x_m, 2.0) - math.pow(z, 2.0)) / y_m)) else: tmp = math.pow((x_m * math.sqrt((0.5 / y_m))), 2.0) return y_s * tmp
x_m = abs(x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_m, y_m, z) tmp = 0.0 if (x_m <= 1e-190) tmp = Float64(0.5 * Float64(y_m - Float64(z * Float64(z / y_m)))); elseif (x_m <= 2.1e+151) tmp = Float64(0.5 * Float64(y_m + Float64(Float64((x_m ^ 2.0) - (z ^ 2.0)) / y_m))); else tmp = Float64(x_m * sqrt(Float64(0.5 / y_m))) ^ 2.0; end return Float64(y_s * tmp) end
x_m = abs(x); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_m, y_m, z) tmp = 0.0; if (x_m <= 1e-190) tmp = 0.5 * (y_m - (z * (z / y_m))); elseif (x_m <= 2.1e+151) tmp = 0.5 * (y_m + (((x_m ^ 2.0) - (z ^ 2.0)) / y_m)); else tmp = (x_m * sqrt((0.5 / y_m))) ^ 2.0; end tmp_2 = y_s * tmp; end
x_m = N[Abs[x], $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$95$m_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x$95$m, 1e-190], N[(0.5 * N[(y$95$m - N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$95$m, 2.1e+151], N[(0.5 * N[(y$95$m + N[(N[(N[Power[x$95$m, 2.0], $MachinePrecision] - N[Power[z, 2.0], $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(x$95$m * N[Sqrt[N[(0.5 / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 10^{-190}:\\
\;\;\;\;0.5 \cdot \left(y\_m - z \cdot \frac{z}{y\_m}\right)\\
\mathbf{elif}\;x\_m \leq 2.1 \cdot 10^{+151}:\\
\;\;\;\;0.5 \cdot \left(y\_m + \frac{{x\_m}^{2} - {z}^{2}}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(x\_m \cdot \sqrt{\frac{0.5}{y\_m}}\right)}^{2}\\
\end{array}
\end{array}
if x < 1e-190Initial 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-define75.2%
Simplified75.2%
Taylor expanded in x around 0 84.2%
associate--l+84.2%
div-sub87.5%
Simplified87.5%
Taylor expanded in x around 0 69.6%
unpow269.6%
*-un-lft-identity69.6%
times-frac74.6%
Applied egg-rr74.6%
if 1e-190 < x < 2.1000000000000001e151Initial program 78.9%
remove-double-neg78.9%
distribute-lft-neg-out78.9%
distribute-frac-neg278.9%
distribute-frac-neg78.9%
neg-mul-178.9%
distribute-lft-neg-out78.9%
*-commutative78.9%
distribute-lft-neg-in78.9%
times-frac78.9%
metadata-eval78.9%
metadata-eval78.9%
associate--l+78.9%
fma-define79.0%
Simplified79.0%
Taylor expanded in x around 0 91.0%
associate--l+91.0%
div-sub95.4%
Simplified95.4%
if 2.1000000000000001e151 < 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-define59.9%
Simplified59.9%
Taylor expanded in x around inf 66.2%
*-commutative66.2%
associate-*l/66.2%
associate-*r/66.2%
Simplified66.2%
add-sqr-sqrt28.6%
pow228.6%
sqrt-prod28.6%
sqrt-pow133.7%
metadata-eval33.7%
pow133.7%
Applied egg-rr33.7%
Final simplification74.8%
x_m = (fabs.f64 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x_m y_m z)
:precision binary64
(*
y_s
(if (<= y_m 2.9e+153)
(* 0.5 (/ (fma x_m x_m (* (- y_m z) (+ y_m z))) y_m))
(* 0.5 (- y_m (pow (/ z (sqrt y_m)) 2.0))))))x_m = fabs(x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 2.9e+153) {
tmp = 0.5 * (fma(x_m, x_m, ((y_m - z) * (y_m + z))) / y_m);
} else {
tmp = 0.5 * (y_m - pow((z / sqrt(y_m)), 2.0));
}
return y_s * tmp;
}
x_m = abs(x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 2.9e+153) tmp = Float64(0.5 * Float64(fma(x_m, x_m, Float64(Float64(y_m - z) * Float64(y_m + z))) / y_m)); else tmp = Float64(0.5 * Float64(y_m - (Float64(z / sqrt(y_m)) ^ 2.0))); end return Float64(y_s * tmp) end
x_m = N[Abs[x], $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$95$m_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 2.9e+153], N[(0.5 * N[(N[(x$95$m * x$95$m + N[(N[(y$95$m - z), $MachinePrecision] * N[(y$95$m + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y$95$m - N[Power[N[(z / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\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.9 \cdot 10^{+153}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x\_m, x\_m, \left(y\_m - z\right) \cdot \left(y\_m + z\right)\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y\_m - {\left(\frac{z}{\sqrt{y\_m}}\right)}^{2}\right)\\
\end{array}
\end{array}
if y < 2.90000000000000002e153Initial program 81.5%
remove-double-neg81.5%
distribute-lft-neg-out81.5%
distribute-frac-neg281.5%
distribute-frac-neg81.5%
neg-mul-181.5%
distribute-lft-neg-out81.5%
*-commutative81.5%
distribute-lft-neg-in81.5%
times-frac81.5%
metadata-eval81.5%
metadata-eval81.5%
associate--l+81.5%
fma-define82.8%
Simplified82.8%
difference-of-squares84.3%
*-commutative84.3%
Applied egg-rr84.3%
if 2.90000000000000002e153 < y Initial program 9.4%
remove-double-neg9.4%
distribute-lft-neg-out9.4%
distribute-frac-neg29.4%
distribute-frac-neg9.4%
neg-mul-19.4%
distribute-lft-neg-out9.4%
*-commutative9.4%
distribute-lft-neg-in9.4%
times-frac9.4%
metadata-eval9.4%
metadata-eval9.4%
associate--l+9.4%
fma-define9.4%
Simplified9.4%
Taylor expanded in x around 0 62.7%
associate--l+62.7%
div-sub62.7%
Simplified62.7%
Taylor expanded in x around 0 80.9%
unpow280.9%
add-sqr-sqrt80.9%
times-frac90.4%
Applied egg-rr90.4%
unpow290.4%
Simplified90.4%
x_m = (fabs.f64 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x_m y_m z)
:precision binary64
(*
y_s
(if (<= y_m 2.3e+153)
(* 0.5 (/ (fma x_m x_m (* (- y_m z) (+ y_m z))) y_m))
(* 0.5 (* (+ y_m z) (/ (- y_m z) y_m))))))x_m = fabs(x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 2.3e+153) {
tmp = 0.5 * (fma(x_m, x_m, ((y_m - z) * (y_m + z))) / y_m);
} else {
tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m));
}
return y_s * tmp;
}
x_m = abs(x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 2.3e+153) tmp = Float64(0.5 * Float64(fma(x_m, x_m, Float64(Float64(y_m - z) * Float64(y_m + z))) / y_m)); else tmp = Float64(0.5 * Float64(Float64(y_m + z) * Float64(Float64(y_m - z) / y_m))); end return Float64(y_s * tmp) end
x_m = N[Abs[x], $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$95$m_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 2.3e+153], N[(0.5 * N[(N[(x$95$m * x$95$m + N[(N[(y$95$m - z), $MachinePrecision] * N[(y$95$m + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m + z), $MachinePrecision] * N[(N[(y$95$m - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\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.3 \cdot 10^{+153}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x\_m, x\_m, \left(y\_m - z\right) \cdot \left(y\_m + z\right)\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + z\right) \cdot \frac{y\_m - z}{y\_m}\right)\\
\end{array}
\end{array}
if y < 2.3000000000000001e153Initial program 81.5%
remove-double-neg81.5%
distribute-lft-neg-out81.5%
distribute-frac-neg281.5%
distribute-frac-neg81.5%
neg-mul-181.5%
distribute-lft-neg-out81.5%
*-commutative81.5%
distribute-lft-neg-in81.5%
times-frac81.5%
metadata-eval81.5%
metadata-eval81.5%
associate--l+81.5%
fma-define82.8%
Simplified82.8%
difference-of-squares84.3%
*-commutative84.3%
Applied egg-rr84.3%
if 2.3000000000000001e153 < y Initial program 9.4%
remove-double-neg9.4%
distribute-lft-neg-out9.4%
distribute-frac-neg29.4%
distribute-frac-neg9.4%
neg-mul-19.4%
distribute-lft-neg-out9.4%
*-commutative9.4%
distribute-lft-neg-in9.4%
times-frac9.4%
metadata-eval9.4%
metadata-eval9.4%
associate--l+9.4%
fma-define9.4%
Simplified9.4%
difference-of-squares10.1%
*-commutative10.1%
Applied egg-rr10.1%
Taylor expanded in x around 0 10.1%
associate-/l*90.4%
+-commutative90.4%
Simplified90.4%
Final simplification85.0%
x_m = (fabs.f64 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x_m y_m z)
:precision binary64
(*
y_s
(if (<= y_m 7.1e+152)
(/ (- (+ (* x_m x_m) (* y_m y_m)) (* z z)) (* y_m 2.0))
(* 0.5 (* (+ y_m z) (/ (- y_m z) y_m))))))x_m = fabs(x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 7.1e+152) {
tmp = (((x_m * x_m) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
} else {
tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m));
}
return y_s * tmp;
}
x_m = abs(x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 7.1d+152) then
tmp = (((x_m * x_m) + (y_m * y_m)) - (z * z)) / (y_m * 2.0d0)
else
tmp = 0.5d0 * ((y_m + z) * ((y_m - z) / y_m))
end if
code = y_s * tmp
end function
x_m = Math.abs(x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 7.1e+152) {
tmp = (((x_m * x_m) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
} else {
tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m));
}
return y_s * tmp;
}
x_m = math.fabs(x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_m, y_m, z): tmp = 0 if y_m <= 7.1e+152: tmp = (((x_m * x_m) + (y_m * y_m)) - (z * z)) / (y_m * 2.0) else: tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m)) return y_s * tmp
x_m = abs(x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 7.1e+152) tmp = Float64(Float64(Float64(Float64(x_m * x_m) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)); else tmp = Float64(0.5 * Float64(Float64(y_m + z) * Float64(Float64(y_m - z) / y_m))); end return Float64(y_s * tmp) end
x_m = abs(x); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_m, y_m, z) tmp = 0.0; if (y_m <= 7.1e+152) tmp = (((x_m * x_m) + (y_m * y_m)) - (z * z)) / (y_m * 2.0); else tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m)); end tmp_2 = y_s * tmp; end
x_m = N[Abs[x], $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$95$m_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 7.1e+152], N[(N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m + z), $MachinePrecision] * N[(N[(y$95$m - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\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 7.1 \cdot 10^{+152}:\\
\;\;\;\;\frac{\left(x\_m \cdot x\_m + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + z\right) \cdot \frac{y\_m - z}{y\_m}\right)\\
\end{array}
\end{array}
if y < 7.10000000000000017e152Initial program 81.5%
if 7.10000000000000017e152 < y Initial program 9.4%
remove-double-neg9.4%
distribute-lft-neg-out9.4%
distribute-frac-neg29.4%
distribute-frac-neg9.4%
neg-mul-19.4%
distribute-lft-neg-out9.4%
*-commutative9.4%
distribute-lft-neg-in9.4%
times-frac9.4%
metadata-eval9.4%
metadata-eval9.4%
associate--l+9.4%
fma-define9.4%
Simplified9.4%
difference-of-squares10.1%
*-commutative10.1%
Applied egg-rr10.1%
Taylor expanded in x around 0 10.1%
associate-/l*90.4%
+-commutative90.4%
Simplified90.4%
Final simplification82.5%
x_m = (fabs.f64 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x_m y_m z)
:precision binary64
(*
y_s
(if (<= (* x_m x_m) 7.5e+118)
(* 0.5 (* (+ y_m z) (/ (- y_m z) y_m)))
(* (/ 0.5 y_m) (* x_m x_m)))))x_m = fabs(x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if ((x_m * x_m) <= 7.5e+118) {
tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m));
} else {
tmp = (0.5 / y_m) * (x_m * x_m);
}
return y_s * tmp;
}
x_m = abs(x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x_m * x_m) <= 7.5d+118) then
tmp = 0.5d0 * ((y_m + z) * ((y_m - z) / y_m))
else
tmp = (0.5d0 / y_m) * (x_m * x_m)
end if
code = y_s * tmp
end function
x_m = Math.abs(x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if ((x_m * x_m) <= 7.5e+118) {
tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m));
} else {
tmp = (0.5 / y_m) * (x_m * x_m);
}
return y_s * tmp;
}
x_m = math.fabs(x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_m, y_m, z): tmp = 0 if (x_m * x_m) <= 7.5e+118: tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m)) else: tmp = (0.5 / y_m) * (x_m * x_m) return y_s * tmp
x_m = abs(x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_m, y_m, z) tmp = 0.0 if (Float64(x_m * x_m) <= 7.5e+118) tmp = Float64(0.5 * Float64(Float64(y_m + z) * Float64(Float64(y_m - z) / y_m))); else tmp = Float64(Float64(0.5 / y_m) * Float64(x_m * x_m)); end return Float64(y_s * tmp) end
x_m = abs(x); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_m, y_m, z) tmp = 0.0; if ((x_m * x_m) <= 7.5e+118) tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m)); else tmp = (0.5 / y_m) * (x_m * x_m); end tmp_2 = y_s * tmp; end
x_m = N[Abs[x], $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$95$m_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(x$95$m * x$95$m), $MachinePrecision], 7.5e+118], N[(0.5 * N[(N[(y$95$m + z), $MachinePrecision] * N[(N[(y$95$m - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot x\_m \leq 7.5 \cdot 10^{+118}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + z\right) \cdot \frac{y\_m - z}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{y\_m} \cdot \left(x\_m \cdot x\_m\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 7.50000000000000003e118Initial program 76.3%
remove-double-neg76.3%
distribute-lft-neg-out76.3%
distribute-frac-neg276.3%
distribute-frac-neg76.3%
neg-mul-176.3%
distribute-lft-neg-out76.3%
*-commutative76.3%
distribute-lft-neg-in76.3%
times-frac76.3%
metadata-eval76.3%
metadata-eval76.3%
associate--l+76.3%
fma-define76.3%
Simplified76.3%
difference-of-squares77.9%
*-commutative77.9%
Applied egg-rr77.9%
Taylor expanded in x around 0 69.8%
associate-/l*91.7%
+-commutative91.7%
Simplified91.7%
if 7.50000000000000003e118 < (*.f64 x x) Initial program 68.1%
remove-double-neg68.1%
distribute-lft-neg-out68.1%
distribute-frac-neg268.1%
distribute-frac-neg68.1%
neg-mul-168.1%
distribute-lft-neg-out68.1%
*-commutative68.1%
distribute-lft-neg-in68.1%
times-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
associate--l+68.1%
fma-define71.1%
Simplified71.1%
Taylor expanded in x around inf 63.4%
*-commutative63.4%
associate-*l/63.4%
associate-*r/63.3%
Simplified63.3%
pow263.3%
Applied egg-rr63.3%
Final simplification80.4%
x_m = (fabs.f64 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x_m y_m z)
:precision binary64
(*
y_s
(if (<= (* x_m x_m) 7.5e+118)
(* 0.5 (- y_m (* z (/ z y_m))))
(* (/ 0.5 y_m) (* x_m x_m)))))x_m = fabs(x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if ((x_m * x_m) <= 7.5e+118) {
tmp = 0.5 * (y_m - (z * (z / y_m)));
} else {
tmp = (0.5 / y_m) * (x_m * x_m);
}
return y_s * tmp;
}
x_m = abs(x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x_m * x_m) <= 7.5d+118) then
tmp = 0.5d0 * (y_m - (z * (z / y_m)))
else
tmp = (0.5d0 / y_m) * (x_m * x_m)
end if
code = y_s * tmp
end function
x_m = Math.abs(x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if ((x_m * x_m) <= 7.5e+118) {
tmp = 0.5 * (y_m - (z * (z / y_m)));
} else {
tmp = (0.5 / y_m) * (x_m * x_m);
}
return y_s * tmp;
}
x_m = math.fabs(x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_m, y_m, z): tmp = 0 if (x_m * x_m) <= 7.5e+118: tmp = 0.5 * (y_m - (z * (z / y_m))) else: tmp = (0.5 / y_m) * (x_m * x_m) return y_s * tmp
x_m = abs(x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_m, y_m, z) tmp = 0.0 if (Float64(x_m * x_m) <= 7.5e+118) tmp = Float64(0.5 * Float64(y_m - Float64(z * Float64(z / y_m)))); else tmp = Float64(Float64(0.5 / y_m) * Float64(x_m * x_m)); end return Float64(y_s * tmp) end
x_m = abs(x); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_m, y_m, z) tmp = 0.0; if ((x_m * x_m) <= 7.5e+118) tmp = 0.5 * (y_m - (z * (z / y_m))); else tmp = (0.5 / y_m) * (x_m * x_m); end tmp_2 = y_s * tmp; end
x_m = N[Abs[x], $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$95$m_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(x$95$m * x$95$m), $MachinePrecision], 7.5e+118], N[(0.5 * N[(y$95$m - N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot x\_m \leq 7.5 \cdot 10^{+118}:\\
\;\;\;\;0.5 \cdot \left(y\_m - z \cdot \frac{z}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{y\_m} \cdot \left(x\_m \cdot x\_m\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 7.50000000000000003e118Initial program 76.3%
remove-double-neg76.3%
distribute-lft-neg-out76.3%
distribute-frac-neg276.3%
distribute-frac-neg76.3%
neg-mul-176.3%
distribute-lft-neg-out76.3%
*-commutative76.3%
distribute-lft-neg-in76.3%
times-frac76.3%
metadata-eval76.3%
metadata-eval76.3%
associate--l+76.3%
fma-define76.3%
Simplified76.3%
Taylor expanded in x around 0 92.9%
associate--l+92.9%
div-sub93.5%
Simplified93.5%
Taylor expanded in x around 0 85.5%
unpow285.5%
*-un-lft-identity85.5%
times-frac91.7%
Applied egg-rr91.7%
if 7.50000000000000003e118 < (*.f64 x x) Initial program 68.1%
remove-double-neg68.1%
distribute-lft-neg-out68.1%
distribute-frac-neg268.1%
distribute-frac-neg68.1%
neg-mul-168.1%
distribute-lft-neg-out68.1%
*-commutative68.1%
distribute-lft-neg-in68.1%
times-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
associate--l+68.1%
fma-define71.1%
Simplified71.1%
Taylor expanded in x around inf 63.4%
*-commutative63.4%
associate-*l/63.4%
associate-*r/63.3%
Simplified63.3%
pow263.3%
Applied egg-rr63.3%
Final simplification80.4%
x_m = (fabs.f64 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x_m y_m z)
:precision binary64
(*
y_s
(if (<= (* x_m x_m) 6e+118)
(* 0.5 (- y_m (/ (* z z) y_m)))
(* (/ 0.5 y_m) (* x_m x_m)))))x_m = fabs(x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if ((x_m * x_m) <= 6e+118) {
tmp = 0.5 * (y_m - ((z * z) / y_m));
} else {
tmp = (0.5 / y_m) * (x_m * x_m);
}
return y_s * tmp;
}
x_m = abs(x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x_m * x_m) <= 6d+118) then
tmp = 0.5d0 * (y_m - ((z * z) / y_m))
else
tmp = (0.5d0 / y_m) * (x_m * x_m)
end if
code = y_s * tmp
end function
x_m = Math.abs(x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if ((x_m * x_m) <= 6e+118) {
tmp = 0.5 * (y_m - ((z * z) / y_m));
} else {
tmp = (0.5 / y_m) * (x_m * x_m);
}
return y_s * tmp;
}
x_m = math.fabs(x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_m, y_m, z): tmp = 0 if (x_m * x_m) <= 6e+118: tmp = 0.5 * (y_m - ((z * z) / y_m)) else: tmp = (0.5 / y_m) * (x_m * x_m) return y_s * tmp
x_m = abs(x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_m, y_m, z) tmp = 0.0 if (Float64(x_m * x_m) <= 6e+118) tmp = Float64(0.5 * Float64(y_m - Float64(Float64(z * z) / y_m))); else tmp = Float64(Float64(0.5 / y_m) * Float64(x_m * x_m)); end return Float64(y_s * tmp) end
x_m = abs(x); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_m, y_m, z) tmp = 0.0; if ((x_m * x_m) <= 6e+118) tmp = 0.5 * (y_m - ((z * z) / y_m)); else tmp = (0.5 / y_m) * (x_m * x_m); end tmp_2 = y_s * tmp; end
x_m = N[Abs[x], $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$95$m_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(x$95$m * x$95$m), $MachinePrecision], 6e+118], N[(0.5 * N[(y$95$m - N[(N[(z * z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot x\_m \leq 6 \cdot 10^{+118}:\\
\;\;\;\;0.5 \cdot \left(y\_m - \frac{z \cdot z}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{y\_m} \cdot \left(x\_m \cdot x\_m\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 6e118Initial program 76.3%
remove-double-neg76.3%
distribute-lft-neg-out76.3%
distribute-frac-neg276.3%
distribute-frac-neg76.3%
neg-mul-176.3%
distribute-lft-neg-out76.3%
*-commutative76.3%
distribute-lft-neg-in76.3%
times-frac76.3%
metadata-eval76.3%
metadata-eval76.3%
associate--l+76.3%
fma-define76.3%
Simplified76.3%
Taylor expanded in x around 0 92.9%
associate--l+92.9%
div-sub93.5%
Simplified93.5%
Taylor expanded in x around 0 85.5%
pow285.5%
Applied egg-rr85.5%
if 6e118 < (*.f64 x x) Initial program 68.1%
remove-double-neg68.1%
distribute-lft-neg-out68.1%
distribute-frac-neg268.1%
distribute-frac-neg68.1%
neg-mul-168.1%
distribute-lft-neg-out68.1%
*-commutative68.1%
distribute-lft-neg-in68.1%
times-frac68.1%
metadata-eval68.1%
metadata-eval68.1%
associate--l+68.1%
fma-define71.1%
Simplified71.1%
Taylor expanded in x around inf 63.4%
*-commutative63.4%
associate-*l/63.4%
associate-*r/63.3%
Simplified63.3%
pow263.3%
Applied egg-rr63.3%
Final simplification76.7%
x_m = (fabs.f64 x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x_m y_m z) :precision binary64 (* y_s (if (<= y_m 2.65e+47) (* (/ 0.5 y_m) (* x_m x_m)) (* 0.5 y_m))))
x_m = fabs(x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 2.65e+47) {
tmp = (0.5 / y_m) * (x_m * x_m);
} else {
tmp = 0.5 * y_m;
}
return y_s * tmp;
}
x_m = abs(x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 2.65d+47) then
tmp = (0.5d0 / y_m) * (x_m * x_m)
else
tmp = 0.5d0 * y_m
end if
code = y_s * tmp
end function
x_m = Math.abs(x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 2.65e+47) {
tmp = (0.5 / y_m) * (x_m * x_m);
} else {
tmp = 0.5 * y_m;
}
return y_s * tmp;
}
x_m = math.fabs(x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_m, y_m, z): tmp = 0 if y_m <= 2.65e+47: tmp = (0.5 / y_m) * (x_m * x_m) else: tmp = 0.5 * y_m return y_s * tmp
x_m = abs(x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 2.65e+47) tmp = Float64(Float64(0.5 / y_m) * Float64(x_m * x_m)); else tmp = Float64(0.5 * y_m); end return Float64(y_s * tmp) end
x_m = abs(x); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_m, y_m, z) tmp = 0.0; if (y_m <= 2.65e+47) tmp = (0.5 / y_m) * (x_m * x_m); else tmp = 0.5 * y_m; end tmp_2 = y_s * tmp; end
x_m = N[Abs[x], $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$95$m_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 2.65e+47], N[(N[(0.5 / y$95$m), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 * y$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\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.65 \cdot 10^{+47}:\\
\;\;\;\;\frac{0.5}{y\_m} \cdot \left(x\_m \cdot x\_m\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\_m\\
\end{array}
\end{array}
if y < 2.65e47Initial program 79.6%
remove-double-neg79.6%
distribute-lft-neg-out79.6%
distribute-frac-neg279.6%
distribute-frac-neg79.6%
neg-mul-179.6%
distribute-lft-neg-out79.6%
*-commutative79.6%
distribute-lft-neg-in79.6%
times-frac79.6%
metadata-eval79.6%
metadata-eval79.6%
associate--l+79.6%
fma-define81.1%
Simplified81.1%
Taylor expanded in x around inf 36.0%
*-commutative36.0%
associate-*l/36.0%
associate-*r/36.0%
Simplified36.0%
pow236.0%
Applied egg-rr36.0%
if 2.65e47 < y Initial program 49.8%
remove-double-neg49.8%
distribute-lft-neg-out49.8%
distribute-frac-neg249.8%
distribute-frac-neg49.8%
neg-mul-149.8%
distribute-lft-neg-out49.8%
*-commutative49.8%
distribute-lft-neg-in49.8%
times-frac49.8%
metadata-eval49.8%
metadata-eval49.8%
associate--l+49.8%
fma-define49.8%
Simplified49.8%
Taylor expanded in y around inf 70.2%
Final simplification43.5%
x_m = (fabs.f64 x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x_m y_m z) :precision binary64 (* y_s (* 0.5 y_m)))
x_m = fabs(x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x_m, double y_m, double z) {
return y_s * (0.5 * y_m);
}
x_m = abs(x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (0.5d0 * y_m)
end function
x_m = Math.abs(x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_m, double y_m, double z) {
return y_s * (0.5 * y_m);
}
x_m = math.fabs(x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x_m, y_m, z): return y_s * (0.5 * y_m)
x_m = abs(x) y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x_m, y_m, z) return Float64(y_s * Float64(0.5 * y_m)) end
x_m = abs(x); y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x_m, y_m, z) tmp = y_s * (0.5 * y_m); end
x_m = N[Abs[x], $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$95$m_, y$95$m_, z_] := N[(y$95$s * N[(0.5 * y$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
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 73.0%
remove-double-neg73.0%
distribute-lft-neg-out73.0%
distribute-frac-neg273.0%
distribute-frac-neg73.0%
neg-mul-173.0%
distribute-lft-neg-out73.0%
*-commutative73.0%
distribute-lft-neg-in73.0%
times-frac73.0%
metadata-eval73.0%
metadata-eval73.0%
associate--l+73.0%
fma-define74.2%
Simplified74.2%
Taylor expanded in y around inf 33.6%
(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 2024185
(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)))