
(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}
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 1500000000000.0)
(* 0.5 (/ (fma x x (- (* y_m y_m) (* z z))) y_m))
(* 0.5 (- (+ y_m (/ x (* y_m (/ 1.0 x)))) (* z (/ 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 tmp;
if (y_m <= 1500000000000.0) {
tmp = 0.5 * (fma(x, x, ((y_m * y_m) - (z * z))) / y_m);
} else {
tmp = 0.5 * ((y_m + (x / (y_m * (1.0 / x)))) - (z * (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) tmp = 0.0 if (y_m <= 1500000000000.0) tmp = Float64(0.5 * Float64(fma(x, x, Float64(Float64(y_m * y_m) - Float64(z * z))) / y_m)); else tmp = Float64(0.5 * Float64(Float64(y_m + Float64(x / Float64(y_m * Float64(1.0 / x)))) - Float64(z * Float64(z / y_m)))); end return Float64(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, 1500000000000.0], N[(0.5 * N[(N[(x * x + N[(N[(y$95$m * y$95$m), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m + N[(x / N[(y$95$m * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z / y$95$m), $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 1500000000000:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, y\_m \cdot y\_m - z \cdot z\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + \frac{x}{y\_m \cdot \frac{1}{x}}\right) - z \cdot \frac{z}{y\_m}\right)\\
\end{array}
\end{array}
if y < 1.5e12Initial program 74.7%
remove-double-neg74.7%
distribute-lft-neg-out74.7%
distribute-frac-neg274.7%
distribute-frac-neg74.7%
neg-mul-174.7%
distribute-lft-neg-out74.7%
*-commutative74.7%
distribute-lft-neg-in74.7%
times-frac74.3%
metadata-eval74.3%
metadata-eval74.3%
associate--l+74.3%
fma-define75.3%
Simplified75.3%
if 1.5e12 < y Initial program 55.2%
remove-double-neg55.2%
distribute-lft-neg-out55.2%
distribute-frac-neg255.2%
distribute-frac-neg55.2%
neg-mul-155.2%
distribute-lft-neg-out55.2%
*-commutative55.2%
distribute-lft-neg-in55.2%
times-frac55.2%
metadata-eval55.2%
metadata-eval55.2%
associate--l+55.2%
fma-define55.2%
Simplified55.2%
Taylor expanded in x around 0 76.1%
pow276.1%
*-un-lft-identity76.1%
times-frac84.5%
Applied egg-rr84.5%
pow284.5%
*-un-lft-identity84.5%
times-frac99.9%
Applied egg-rr99.9%
frac-2neg99.9%
clear-num99.9%
frac-times99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Final simplification81.0%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (* x x) 1e+273)
(* 0.5 (- (+ y_m (* x (/ x y_m))) (* z (/ z y_m))))
(* 0.5 (fma x (/ x y_m) 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 ((x * x) <= 1e+273) {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z * (z / y_m)));
} else {
tmp = 0.5 * fma(x, (x / y_m), 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 (Float64(x * x) <= 1e+273) tmp = Float64(0.5 * Float64(Float64(y_m + Float64(x * Float64(x / y_m))) - Float64(z * Float64(z / y_m)))); else tmp = Float64(0.5 * fma(x, Float64(x / y_m), y_m)); end return Float64(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[N[(x * x), $MachinePrecision], 1e+273], N[(0.5 * N[(N[(y$95$m + N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(x / y$95$m), $MachinePrecision] + y$95$m), $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}\;x \cdot x \leq 10^{+273}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + x \cdot \frac{x}{y\_m}\right) - z \cdot \frac{z}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \mathsf{fma}\left(x, \frac{x}{y\_m}, y\_m\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 9.99999999999999945e272Initial 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.2%
metadata-eval73.2%
metadata-eval73.2%
associate--l+73.2%
fma-define73.2%
Simplified73.2%
Taylor expanded in x around 0 89.0%
pow289.0%
*-un-lft-identity89.0%
times-frac96.2%
Applied egg-rr96.2%
pow296.2%
Applied egg-rr96.2%
associate-*l/96.7%
Applied egg-rr96.7%
if 9.99999999999999945e272 < (*.f64 x x) 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.3%
Simplified64.3%
Taylor expanded in x around 0 55.9%
Taylor expanded in z around 0 71.5%
*-commutative71.5%
+-commutative71.5%
unpow271.5%
associate-*r/94.3%
fma-define94.3%
Simplified94.3%
Final simplification96.1%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= x 3.85e+67)
(* 0.5 (- (+ y_m (/ (* x x) y_m)) (* z (/ z y_m))))
(if (<= x 2.5e+146)
(/ (- (+ (* y_m y_m) (* x x)) (* z z)) (* y_m 2.0))
(if (<= x 1.85e+235)
(* 0.5 (- (+ y_m (/ x (/ y_m x))) (/ (* z z) 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 (x <= 3.85e+67) {
tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m)));
} else if (x <= 2.5e+146) {
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0);
} else if (x <= 1.85e+235) {
tmp = 0.5 * ((y_m + (x / (y_m / x))) - ((z * z) / y_m));
} else {
tmp = (x * x) * (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 (x <= 3.85d+67) then
tmp = 0.5d0 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m)))
else if (x <= 2.5d+146) then
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0d0)
else if (x <= 1.85d+235) then
tmp = 0.5d0 * ((y_m + (x / (y_m / x))) - ((z * z) / y_m))
else
tmp = (x * x) * (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 (x <= 3.85e+67) {
tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m)));
} else if (x <= 2.5e+146) {
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0);
} else if (x <= 1.85e+235) {
tmp = 0.5 * ((y_m + (x / (y_m / x))) - ((z * z) / y_m));
} else {
tmp = (x * x) * (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 x <= 3.85e+67: tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m))) elif x <= 2.5e+146: tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0) elif x <= 1.85e+235: tmp = 0.5 * ((y_m + (x / (y_m / x))) - ((z * z) / y_m)) else: tmp = (x * x) * (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 (x <= 3.85e+67) tmp = Float64(0.5 * Float64(Float64(y_m + Float64(Float64(x * x) / y_m)) - Float64(z * Float64(z / y_m)))); elseif (x <= 2.5e+146) tmp = Float64(Float64(Float64(Float64(y_m * y_m) + Float64(x * x)) - Float64(z * z)) / Float64(y_m * 2.0)); elseif (x <= 1.85e+235) tmp = Float64(0.5 * Float64(Float64(y_m + Float64(x / Float64(y_m / x))) - Float64(Float64(z * z) / y_m))); else tmp = Float64(Float64(x * x) * 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 (x <= 3.85e+67) tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m))); elseif (x <= 2.5e+146) tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0); elseif (x <= 1.85e+235) tmp = 0.5 * ((y_m + (x / (y_m / x))) - ((z * z) / y_m)); else tmp = (x * x) * (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[x, 3.85e+67], N[(0.5 * N[(N[(y$95$m + N[(N[(x * x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.5e+146], N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.85e+235], N[(0.5 * N[(N[(y$95$m + N[(x / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z * z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y$95$m), $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}\;x \leq 3.85 \cdot 10^{+67}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + \frac{x \cdot x}{y\_m}\right) - z \cdot \frac{z}{y\_m}\right)\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+146}:\\
\;\;\;\;\frac{\left(y\_m \cdot y\_m + x \cdot x\right) - z \cdot z}{y\_m \cdot 2}\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+235}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + \frac{x}{\frac{y\_m}{x}}\right) - \frac{z \cdot z}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y\_m}\\
\end{array}
\end{array}
if x < 3.8500000000000001e67Initial program 70.3%
remove-double-neg70.3%
distribute-lft-neg-out70.3%
distribute-frac-neg270.3%
distribute-frac-neg70.3%
neg-mul-170.3%
distribute-lft-neg-out70.3%
*-commutative70.3%
distribute-lft-neg-in70.3%
times-frac69.9%
metadata-eval69.9%
metadata-eval69.9%
associate--l+69.9%
fma-define70.9%
Simplified70.9%
Taylor expanded in x around 0 82.7%
pow282.7%
*-un-lft-identity82.7%
times-frac89.6%
Applied egg-rr89.6%
pow289.6%
Applied egg-rr89.6%
Taylor expanded in z around 0 89.6%
if 3.8500000000000001e67 < x < 2.4999999999999999e146Initial program 91.6%
if 2.4999999999999999e146 < x < 1.8499999999999999e235Initial program 50.3%
remove-double-neg50.3%
distribute-lft-neg-out50.3%
distribute-frac-neg250.3%
distribute-frac-neg50.3%
neg-mul-150.3%
distribute-lft-neg-out50.3%
*-commutative50.3%
distribute-lft-neg-in50.3%
times-frac50.3%
metadata-eval50.3%
metadata-eval50.3%
associate--l+50.3%
fma-define50.3%
Simplified50.3%
Taylor expanded in x around 0 50.3%
+-commutative50.3%
pow250.3%
add-sqr-sqrt14.0%
fma-define14.0%
sqrt-div14.0%
sqrt-prod14.0%
add-sqr-sqrt14.0%
sqrt-div14.0%
sqrt-prod41.2%
add-sqr-sqrt41.1%
Applied egg-rr41.1%
fma-undefine41.1%
unpow241.1%
Simplified41.1%
unpow241.1%
frac-times14.0%
add-sqr-sqrt50.3%
div-inv50.3%
associate-*r*88.7%
div-inv88.7%
clear-num88.7%
un-div-inv88.7%
Applied egg-rr88.7%
unpow288.7%
Applied egg-rr88.7%
if 1.8499999999999999e235 < x Initial program 75.5%
remove-double-neg75.5%
distribute-lft-neg-out75.5%
distribute-frac-neg275.5%
distribute-frac-neg75.5%
neg-mul-175.5%
distribute-lft-neg-out75.5%
*-commutative75.5%
distribute-lft-neg-in75.5%
times-frac75.5%
metadata-eval75.5%
metadata-eval75.5%
associate--l+75.5%
fma-define75.5%
Simplified75.5%
Taylor expanded in x around inf 88.7%
*-commutative88.7%
associate-*l/88.7%
associate-*r/88.7%
Simplified88.7%
pow276.2%
Applied egg-rr88.7%
Final simplification89.5%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= x 2e+137)
(* 0.5 (- (+ y_m (/ (* x x) y_m)) (* z (/ z y_m))))
(if (<= x 3.1e+238)
(* 0.5 (- (+ y_m (/ x (/ y_m x))) (/ (* z z) 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 (x <= 2e+137) {
tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m)));
} else if (x <= 3.1e+238) {
tmp = 0.5 * ((y_m + (x / (y_m / x))) - ((z * z) / y_m));
} else {
tmp = (x * x) * (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 (x <= 2d+137) then
tmp = 0.5d0 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m)))
else if (x <= 3.1d+238) then
tmp = 0.5d0 * ((y_m + (x / (y_m / x))) - ((z * z) / y_m))
else
tmp = (x * x) * (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 (x <= 2e+137) {
tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m)));
} else if (x <= 3.1e+238) {
tmp = 0.5 * ((y_m + (x / (y_m / x))) - ((z * z) / y_m));
} else {
tmp = (x * x) * (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 x <= 2e+137: tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m))) elif x <= 3.1e+238: tmp = 0.5 * ((y_m + (x / (y_m / x))) - ((z * z) / y_m)) else: tmp = (x * x) * (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 (x <= 2e+137) tmp = Float64(0.5 * Float64(Float64(y_m + Float64(Float64(x * x) / y_m)) - Float64(z * Float64(z / y_m)))); elseif (x <= 3.1e+238) tmp = Float64(0.5 * Float64(Float64(y_m + Float64(x / Float64(y_m / x))) - Float64(Float64(z * z) / y_m))); else tmp = Float64(Float64(x * x) * 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 (x <= 2e+137) tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m))); elseif (x <= 3.1e+238) tmp = 0.5 * ((y_m + (x / (y_m / x))) - ((z * z) / y_m)); else tmp = (x * x) * (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[x, 2e+137], N[(0.5 * N[(N[(y$95$m + N[(N[(x * x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.1e+238], N[(0.5 * N[(N[(y$95$m + N[(x / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z * z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y$95$m), $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}\;x \leq 2 \cdot 10^{+137}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + \frac{x \cdot x}{y\_m}\right) - z \cdot \frac{z}{y\_m}\right)\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+238}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + \frac{x}{\frac{y\_m}{x}}\right) - \frac{z \cdot z}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y\_m}\\
\end{array}
\end{array}
if x < 2.0000000000000001e137Initial program 71.1%
remove-double-neg71.1%
distribute-lft-neg-out71.1%
distribute-frac-neg271.1%
distribute-frac-neg71.1%
neg-mul-171.1%
distribute-lft-neg-out71.1%
*-commutative71.1%
distribute-lft-neg-in71.1%
times-frac70.8%
metadata-eval70.8%
metadata-eval70.8%
associate--l+70.8%
fma-define71.7%
Simplified71.7%
Taylor expanded in x around 0 82.7%
pow282.7%
*-un-lft-identity82.7%
times-frac89.4%
Applied egg-rr89.4%
pow289.4%
Applied egg-rr89.4%
Taylor expanded in z around 0 89.4%
if 2.0000000000000001e137 < x < 3.10000000000000012e238Initial program 57.5%
remove-double-neg57.5%
distribute-lft-neg-out57.5%
distribute-frac-neg257.5%
distribute-frac-neg57.5%
neg-mul-157.5%
distribute-lft-neg-out57.5%
*-commutative57.5%
distribute-lft-neg-in57.5%
times-frac57.5%
metadata-eval57.5%
metadata-eval57.5%
associate--l+57.5%
fma-define57.5%
Simplified57.5%
Taylor expanded in x around 0 52.5%
+-commutative52.5%
pow252.5%
add-sqr-sqrt15.4%
fma-define15.4%
sqrt-div15.4%
sqrt-prod15.4%
add-sqr-sqrt15.4%
sqrt-div15.4%
sqrt-prod36.4%
add-sqr-sqrt36.3%
Applied egg-rr36.3%
fma-undefine36.3%
unpow236.3%
Simplified36.3%
unpow236.3%
frac-times15.4%
add-sqr-sqrt52.5%
div-inv52.5%
associate-*r*82.2%
div-inv82.2%
clear-num82.2%
un-div-inv82.2%
Applied egg-rr82.2%
unpow282.2%
Applied egg-rr82.2%
if 3.10000000000000012e238 < x Initial program 75.5%
remove-double-neg75.5%
distribute-lft-neg-out75.5%
distribute-frac-neg275.5%
distribute-frac-neg75.5%
neg-mul-175.5%
distribute-lft-neg-out75.5%
*-commutative75.5%
distribute-lft-neg-in75.5%
times-frac75.5%
metadata-eval75.5%
metadata-eval75.5%
associate--l+75.5%
fma-define75.5%
Simplified75.5%
Taylor expanded in x around inf 88.7%
*-commutative88.7%
associate-*l/88.7%
associate-*r/88.7%
Simplified88.7%
pow276.2%
Applied egg-rr88.7%
Final simplification88.7%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 2e-7)
(/ (- (+ (* y_m y_m) (* x x)) (* z z)) (* y_m 2.0))
(* 0.5 (- (- y_m (/ (/ x y_m) (/ -1.0 x))) (* z (/ 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 tmp;
if (y_m <= 2e-7) {
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0);
} else {
tmp = 0.5 * ((y_m - ((x / y_m) / (-1.0 / x))) - (z * (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) :: tmp
if (y_m <= 2d-7) then
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0d0)
else
tmp = 0.5d0 * ((y_m - ((x / y_m) / ((-1.0d0) / x))) - (z * (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 tmp;
if (y_m <= 2e-7) {
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0);
} else {
tmp = 0.5 * ((y_m - ((x / y_m) / (-1.0 / x))) - (z * (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): tmp = 0 if y_m <= 2e-7: tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0) else: tmp = 0.5 * ((y_m - ((x / y_m) / (-1.0 / x))) - (z * (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) tmp = 0.0 if (y_m <= 2e-7) tmp = Float64(Float64(Float64(Float64(y_m * y_m) + Float64(x * x)) - Float64(z * z)) / Float64(y_m * 2.0)); else tmp = Float64(0.5 * Float64(Float64(y_m - Float64(Float64(x / y_m) / Float64(-1.0 / x))) - Float64(z * 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) tmp = 0.0; if (y_m <= 2e-7) tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0); else tmp = 0.5 * ((y_m - ((x / y_m) / (-1.0 / x))) - (z * (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_] := N[(y$95$s * If[LessEqual[y$95$m, 2e-7], N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m - N[(N[(x / y$95$m), $MachinePrecision] / N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z / y$95$m), $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 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\left(y\_m \cdot y\_m + x \cdot x\right) - z \cdot z}{y\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m - \frac{\frac{x}{y\_m}}{\frac{-1}{x}}\right) - z \cdot \frac{z}{y\_m}\right)\\
\end{array}
\end{array}
if y < 1.9999999999999999e-7Initial program 74.5%
if 1.9999999999999999e-7 < y Initial program 56.7%
remove-double-neg56.7%
distribute-lft-neg-out56.7%
distribute-frac-neg256.7%
distribute-frac-neg56.7%
neg-mul-156.7%
distribute-lft-neg-out56.7%
*-commutative56.7%
distribute-lft-neg-in56.7%
times-frac56.7%
metadata-eval56.7%
metadata-eval56.7%
associate--l+56.7%
fma-define56.7%
Simplified56.7%
Taylor expanded in x around 0 76.9%
pow276.9%
*-un-lft-identity76.9%
times-frac85.0%
Applied egg-rr85.0%
pow285.0%
*-un-lft-identity85.0%
times-frac99.9%
Applied egg-rr99.9%
clear-num99.9%
associate-*l/99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Final simplification80.5%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 7e-11)
(/ (- (+ (* y_m y_m) (* x x)) (* z z)) (* y_m 2.0))
(* 0.5 (- (+ y_m (* x (/ x y_m))) (* z (/ 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 tmp;
if (y_m <= 7e-11) {
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0);
} else {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z * (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) :: tmp
if (y_m <= 7d-11) then
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0d0)
else
tmp = 0.5d0 * ((y_m + (x * (x / y_m))) - (z * (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 tmp;
if (y_m <= 7e-11) {
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0);
} else {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z * (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): tmp = 0 if y_m <= 7e-11: tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0) else: tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z * (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) tmp = 0.0 if (y_m <= 7e-11) tmp = Float64(Float64(Float64(Float64(y_m * y_m) + Float64(x * x)) - Float64(z * z)) / Float64(y_m * 2.0)); else tmp = Float64(0.5 * Float64(Float64(y_m + Float64(x * Float64(x / y_m))) - Float64(z * 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) tmp = 0.0; if (y_m <= 7e-11) tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0); else tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z * (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_] := N[(y$95$s * If[LessEqual[y$95$m, 7e-11], N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m + N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z / y$95$m), $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 7 \cdot 10^{-11}:\\
\;\;\;\;\frac{\left(y\_m \cdot y\_m + x \cdot x\right) - z \cdot z}{y\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + x \cdot \frac{x}{y\_m}\right) - z \cdot \frac{z}{y\_m}\right)\\
\end{array}
\end{array}
if y < 7.00000000000000038e-11Initial program 74.3%
if 7.00000000000000038e-11 < y Initial program 57.4%
remove-double-neg57.4%
distribute-lft-neg-out57.4%
distribute-frac-neg257.4%
distribute-frac-neg57.4%
neg-mul-157.4%
distribute-lft-neg-out57.4%
*-commutative57.4%
distribute-lft-neg-in57.4%
times-frac57.4%
metadata-eval57.4%
metadata-eval57.4%
associate--l+57.4%
fma-define57.4%
Simplified57.4%
Taylor expanded in x around 0 77.3%
pow277.3%
*-un-lft-identity77.3%
times-frac85.2%
Applied egg-rr85.2%
pow285.2%
Applied egg-rr85.2%
associate-*l/99.9%
Applied egg-rr99.9%
Final simplification80.5%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= x 4e+145)
(* 0.5 (- (+ y_m (/ (* x x) y_m)) (* z (/ z 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 (x <= 4e+145) {
tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m)));
} else {
tmp = (x * x) * (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 (x <= 4d+145) then
tmp = 0.5d0 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m)))
else
tmp = (x * x) * (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 (x <= 4e+145) {
tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m)));
} else {
tmp = (x * x) * (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 x <= 4e+145: tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m))) else: tmp = (x * x) * (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 (x <= 4e+145) tmp = Float64(0.5 * Float64(Float64(y_m + Float64(Float64(x * x) / y_m)) - Float64(z * Float64(z / y_m)))); else tmp = Float64(Float64(x * x) * 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 (x <= 4e+145) tmp = 0.5 * ((y_m + ((x * x) / y_m)) - (z * (z / y_m))); else tmp = (x * x) * (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[x, 4e+145], N[(0.5 * N[(N[(y$95$m + N[(N[(x * x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y$95$m), $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}\;x \leq 4 \cdot 10^{+145}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + \frac{x \cdot x}{y\_m}\right) - z \cdot \frac{z}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y\_m}\\
\end{array}
\end{array}
if x < 4e145Initial program 71.1%
remove-double-neg71.1%
distribute-lft-neg-out71.1%
distribute-frac-neg271.1%
distribute-frac-neg71.1%
neg-mul-171.1%
distribute-lft-neg-out71.1%
*-commutative71.1%
distribute-lft-neg-in71.1%
times-frac70.8%
metadata-eval70.8%
metadata-eval70.8%
associate--l+70.8%
fma-define71.7%
Simplified71.7%
Taylor expanded in x around 0 82.5%
pow282.5%
*-un-lft-identity82.5%
times-frac89.1%
Applied egg-rr89.1%
pow289.1%
Applied egg-rr89.1%
Taylor expanded in z around 0 89.1%
if 4e145 < x Initial program 64.7%
remove-double-neg64.7%
distribute-lft-neg-out64.7%
distribute-frac-neg264.7%
distribute-frac-neg64.7%
neg-mul-164.7%
distribute-lft-neg-out64.7%
*-commutative64.7%
distribute-lft-neg-in64.7%
times-frac64.7%
metadata-eval64.7%
metadata-eval64.7%
associate--l+64.7%
fma-define64.7%
Simplified64.7%
Taylor expanded in x around inf 73.5%
*-commutative73.5%
associate-*l/73.5%
associate-*r/73.5%
Simplified73.5%
pow262.1%
Applied egg-rr73.5%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= y_m 1.65e+72) (* (* x x) (/ 0.5 y_m)) (* y_m 0.5))))
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+72) {
tmp = (x * x) * (0.5 / y_m);
} else {
tmp = y_m * 0.5;
}
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+72) then
tmp = (x * x) * (0.5d0 / y_m)
else
tmp = y_m * 0.5d0
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+72) {
tmp = (x * x) * (0.5 / y_m);
} else {
tmp = y_m * 0.5;
}
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+72: tmp = (x * x) * (0.5 / y_m) else: tmp = y_m * 0.5 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+72) tmp = Float64(Float64(x * x) * Float64(0.5 / y_m)); else tmp = Float64(y_m * 0.5); 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+72) tmp = (x * x) * (0.5 / y_m); else tmp = y_m * 0.5; 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+72], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $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^{+72}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 1.65e72Initial program 75.5%
remove-double-neg75.5%
distribute-lft-neg-out75.5%
distribute-frac-neg275.5%
distribute-frac-neg75.5%
neg-mul-175.5%
distribute-lft-neg-out75.5%
*-commutative75.5%
distribute-lft-neg-in75.5%
times-frac75.2%
metadata-eval75.2%
metadata-eval75.2%
associate--l+75.2%
fma-define76.1%
Simplified76.1%
Taylor expanded in x around inf 37.8%
*-commutative37.8%
associate-*l/38.2%
associate-*r/38.2%
Simplified38.2%
pow286.6%
Applied egg-rr38.2%
if 1.65e72 < y Initial program 45.3%
remove-double-neg45.3%
distribute-lft-neg-out45.3%
distribute-frac-neg245.3%
distribute-frac-neg45.3%
neg-mul-145.3%
distribute-lft-neg-out45.3%
*-commutative45.3%
distribute-lft-neg-in45.3%
times-frac45.3%
metadata-eval45.3%
metadata-eval45.3%
associate--l+45.3%
fma-define45.3%
Simplified45.3%
Taylor expanded in y around inf 74.3%
*-commutative74.3%
Simplified74.3%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (* y_m 0.5)))
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 * (y_m * 0.5);
}
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 * (y_m * 0.5d0)
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 * (y_m * 0.5);
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): return y_s * (y_m * 0.5)
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) return Float64(y_s * Float64(y_m * 0.5)) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z) tmp = y_s * (y_m * 0.5); 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[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
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 70.2%
remove-double-neg70.2%
distribute-lft-neg-out70.2%
distribute-frac-neg270.2%
distribute-frac-neg70.2%
neg-mul-170.2%
distribute-lft-neg-out70.2%
*-commutative70.2%
distribute-lft-neg-in70.2%
times-frac69.9%
metadata-eval69.9%
metadata-eval69.9%
associate--l+69.9%
fma-define70.7%
Simplified70.7%
Taylor expanded in y around inf 33.7%
*-commutative33.7%
Simplified33.7%
(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 2024119
(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)))