
(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 12 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
(let* ((t_0 (* (+ x z_m) (/ (- x z_m) y_m))))
(*
y_s
(if (<= y_m 6.4e-96)
(* 0.5 t_0)
(* y_m (+ 0.5 (* 0.5 (/ 1.0 (/ y_m t_0)))))))))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 + z_m) * ((x - z_m) / y_m);
double tmp;
if (y_m <= 6.4e-96) {
tmp = 0.5 * t_0;
} else {
tmp = y_m * (0.5 + (0.5 * (1.0 / (y_m / t_0))));
}
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 + z_m) * ((x - z_m) / y_m)
if (y_m <= 6.4d-96) then
tmp = 0.5d0 * t_0
else
tmp = y_m * (0.5d0 + (0.5d0 * (1.0d0 / (y_m / t_0))))
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 + z_m) * ((x - z_m) / y_m);
double tmp;
if (y_m <= 6.4e-96) {
tmp = 0.5 * t_0;
} else {
tmp = y_m * (0.5 + (0.5 * (1.0 / (y_m / t_0))));
}
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 + z_m) * ((x - z_m) / y_m) tmp = 0 if y_m <= 6.4e-96: tmp = 0.5 * t_0 else: tmp = y_m * (0.5 + (0.5 * (1.0 / (y_m / t_0)))) 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 + z_m) * Float64(Float64(x - z_m) / y_m)) tmp = 0.0 if (y_m <= 6.4e-96) tmp = Float64(0.5 * t_0); else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(1.0 / Float64(y_m / t_0))))); 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 + z_m) * ((x - z_m) / y_m); tmp = 0.0; if (y_m <= 6.4e-96) tmp = 0.5 * t_0; else tmp = y_m * (0.5 + (0.5 * (1.0 / (y_m / t_0)))); 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 + z$95$m), $MachinePrecision] * N[(N[(x - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 6.4e-96], N[(0.5 * t$95$0), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(1.0 / N[(y$95$m / t$95$0), $MachinePrecision]), $MachinePrecision]), $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)
\\
\begin{array}{l}
t_0 := \left(x + z\_m\right) \cdot \frac{x - z\_m}{y\_m}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 6.4 \cdot 10^{-96}:\\
\;\;\;\;0.5 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \frac{1}{\frac{y\_m}{t\_0}}\right)\\
\end{array}
\end{array}
\end{array}
if y < 6.40000000000000023e-96Initial program 78.0%
remove-double-neg78.0%
distribute-lft-neg-out78.0%
distribute-frac-neg278.0%
distribute-frac-neg78.0%
neg-mul-178.0%
distribute-lft-neg-out78.0%
*-commutative78.0%
distribute-lft-neg-in78.0%
times-frac78.0%
metadata-eval78.0%
metadata-eval78.0%
associate--l+78.0%
fma-define78.0%
Simplified78.0%
Taylor expanded in y around inf 75.2%
unpow275.2%
unpow275.2%
difference-of-squares76.3%
Applied egg-rr76.3%
Taylor expanded in y around 0 63.0%
associate-/l*68.2%
Simplified68.2%
if 6.40000000000000023e-96 < y Initial program 60.2%
remove-double-neg60.2%
distribute-lft-neg-out60.2%
distribute-frac-neg260.2%
distribute-frac-neg60.2%
neg-mul-160.2%
distribute-lft-neg-out60.2%
*-commutative60.2%
distribute-lft-neg-in60.2%
times-frac60.2%
metadata-eval60.2%
metadata-eval60.2%
associate--l+60.2%
fma-define61.5%
Simplified61.5%
Taylor expanded in y around inf 81.3%
unpow281.3%
unpow281.3%
difference-of-squares85.1%
Applied egg-rr85.1%
*-commutative85.1%
unpow285.1%
times-frac98.7%
Applied egg-rr98.7%
associate-*r/98.8%
clear-num98.7%
Applied egg-rr98.7%
Final simplification77.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) (* y_m y_m)) (* z_m z_m)) (* y_m 2.0))))
(*
y_s
(if (<= t_0 0.0)
(* 0.5 (* (+ x z_m) (/ (- x z_m) y_m)))
(if (<= t_0 5e+302)
t_0
(* y_m (+ 0.5 (* 0.5 (* (/ (+ x z_m) y_m) (/ x 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 t_0 = (((x * x) + (y_m * y_m)) - (z_m * z_m)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = 0.5 * ((x + z_m) * ((x - z_m) / y_m));
} else if (t_0 <= 5e+302) {
tmp = t_0;
} else {
tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / 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) :: t_0
real(8) :: tmp
t_0 = (((x * x) + (y_m * y_m)) - (z_m * z_m)) / (y_m * 2.0d0)
if (t_0 <= 0.0d0) then
tmp = 0.5d0 * ((x + z_m) * ((x - z_m) / y_m))
else if (t_0 <= 5d+302) then
tmp = t_0
else
tmp = y_m * (0.5d0 + (0.5d0 * (((x + z_m) / y_m) * (x / 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 t_0 = (((x * x) + (y_m * y_m)) - (z_m * z_m)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = 0.5 * ((x + z_m) * ((x - z_m) / y_m));
} else if (t_0 <= 5e+302) {
tmp = t_0;
} else {
tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / 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): t_0 = (((x * x) + (y_m * y_m)) - (z_m * z_m)) / (y_m * 2.0) tmp = 0 if t_0 <= 0.0: tmp = 0.5 * ((x + z_m) * ((x - z_m) / y_m)) elif t_0 <= 5e+302: tmp = t_0 else: tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / 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) t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z_m * z_m)) / Float64(y_m * 2.0)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(0.5 * Float64(Float64(x + z_m) * Float64(Float64(x - z_m) / y_m))); elseif (t_0 <= 5e+302) tmp = t_0; else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(x + z_m) / y_m) * Float64(x / 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) t_0 = (((x * x) + (y_m * y_m)) - (z_m * z_m)) / (y_m * 2.0); tmp = 0.0; if (t_0 <= 0.0) tmp = 0.5 * ((x + z_m) * ((x - z_m) / y_m)); elseif (t_0 <= 5e+302) tmp = t_0; else tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / 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_] := Block[{t$95$0 = 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[(y$95$s * If[LessEqual[t$95$0, 0.0], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * N[(N[(x - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+302], t$95$0, N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(x + z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $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)
\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z\_m \cdot z\_m}{y\_m \cdot 2}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot \frac{x - z\_m}{y\_m}\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+302}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{x + z\_m}{y\_m} \cdot \frac{x}{y\_m}\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 0.0Initial program 78.4%
remove-double-neg78.4%
distribute-lft-neg-out78.4%
distribute-frac-neg278.4%
distribute-frac-neg78.4%
neg-mul-178.4%
distribute-lft-neg-out78.4%
*-commutative78.4%
distribute-lft-neg-in78.4%
times-frac78.4%
metadata-eval78.4%
metadata-eval78.4%
associate--l+78.4%
fma-define78.4%
Simplified78.4%
Taylor expanded in y around inf 82.7%
unpow282.7%
unpow282.7%
difference-of-squares82.7%
Applied egg-rr82.7%
Taylor expanded in y around 0 53.7%
associate-/l*58.4%
Simplified58.4%
if 0.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 5e302Initial program 99.8%
if 5e302 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 53.5%
remove-double-neg53.5%
distribute-lft-neg-out53.5%
distribute-frac-neg253.5%
distribute-frac-neg53.5%
neg-mul-153.5%
distribute-lft-neg-out53.5%
*-commutative53.5%
distribute-lft-neg-in53.5%
times-frac53.5%
metadata-eval53.5%
metadata-eval53.5%
associate--l+53.5%
fma-define54.6%
Simplified54.6%
Taylor expanded in y around inf 71.1%
unpow271.1%
unpow271.1%
difference-of-squares76.4%
Applied egg-rr76.4%
*-commutative76.4%
unpow276.4%
times-frac99.0%
Applied egg-rr99.0%
Taylor expanded in x around inf 78.7%
Final simplification72.4%
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 (<= (* z_m z_m) 5e-289)
(* y_m 0.5)
(if (<= (* z_m z_m) 2e-187)
(* 0.5 (/ (* x (+ x z_m)) y_m))
(if (<= (* z_m z_m) 2e+277)
(* y_m 0.5)
(/ 0.5 (* (/ -1.0 z_m) (/ y_m z_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 ((z_m * z_m) <= 5e-289) {
tmp = y_m * 0.5;
} else if ((z_m * z_m) <= 2e-187) {
tmp = 0.5 * ((x * (x + z_m)) / y_m);
} else if ((z_m * z_m) <= 2e+277) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 / ((-1.0 / z_m) * (y_m / z_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 ((z_m * z_m) <= 5d-289) then
tmp = y_m * 0.5d0
else if ((z_m * z_m) <= 2d-187) then
tmp = 0.5d0 * ((x * (x + z_m)) / y_m)
else if ((z_m * z_m) <= 2d+277) then
tmp = y_m * 0.5d0
else
tmp = 0.5d0 / (((-1.0d0) / z_m) * (y_m / z_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 ((z_m * z_m) <= 5e-289) {
tmp = y_m * 0.5;
} else if ((z_m * z_m) <= 2e-187) {
tmp = 0.5 * ((x * (x + z_m)) / y_m);
} else if ((z_m * z_m) <= 2e+277) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 / ((-1.0 / z_m) * (y_m / z_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 (z_m * z_m) <= 5e-289: tmp = y_m * 0.5 elif (z_m * z_m) <= 2e-187: tmp = 0.5 * ((x * (x + z_m)) / y_m) elif (z_m * z_m) <= 2e+277: tmp = y_m * 0.5 else: tmp = 0.5 / ((-1.0 / z_m) * (y_m / z_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(z_m * z_m) <= 5e-289) tmp = Float64(y_m * 0.5); elseif (Float64(z_m * z_m) <= 2e-187) tmp = Float64(0.5 * Float64(Float64(x * Float64(x + z_m)) / y_m)); elseif (Float64(z_m * z_m) <= 2e+277) tmp = Float64(y_m * 0.5); else tmp = Float64(0.5 / Float64(Float64(-1.0 / z_m) * Float64(y_m / z_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 ((z_m * z_m) <= 5e-289) tmp = y_m * 0.5; elseif ((z_m * z_m) <= 2e-187) tmp = 0.5 * ((x * (x + z_m)) / y_m); elseif ((z_m * z_m) <= 2e+277) tmp = y_m * 0.5; else tmp = 0.5 / ((-1.0 / z_m) * (y_m / z_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[(z$95$m * z$95$m), $MachinePrecision], 5e-289], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 2e-187], N[(0.5 * N[(N[(x * N[(x + z$95$m), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 2e+277], N[(y$95$m * 0.5), $MachinePrecision], N[(0.5 / N[(N[(-1.0 / z$95$m), $MachinePrecision] * N[(y$95$m / z$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}\;z\_m \cdot z\_m \leq 5 \cdot 10^{-289}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;z\_m \cdot z\_m \leq 2 \cdot 10^{-187}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot \left(x + z\_m\right)}{y\_m}\\
\mathbf{elif}\;z\_m \cdot z\_m \leq 2 \cdot 10^{+277}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{-1}{z\_m} \cdot \frac{y\_m}{z\_m}}\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000029e-289 or 2e-187 < (*.f64 z z) < 2.00000000000000001e277Initial program 70.8%
remove-double-neg70.8%
distribute-lft-neg-out70.8%
distribute-frac-neg270.8%
distribute-frac-neg70.8%
neg-mul-170.8%
distribute-lft-neg-out70.8%
*-commutative70.8%
distribute-lft-neg-in70.8%
times-frac70.8%
metadata-eval70.8%
metadata-eval70.8%
associate--l+70.8%
fma-define70.8%
Simplified70.8%
Taylor expanded in y around inf 48.4%
if 5.00000000000000029e-289 < (*.f64 z z) < 2e-187Initial program 96.0%
remove-double-neg96.0%
distribute-lft-neg-out96.0%
distribute-frac-neg296.0%
distribute-frac-neg96.0%
neg-mul-196.0%
distribute-lft-neg-out96.0%
*-commutative96.0%
distribute-lft-neg-in96.0%
times-frac96.0%
metadata-eval96.0%
metadata-eval96.0%
associate--l+96.0%
fma-define96.0%
Simplified96.0%
Taylor expanded in y around inf 87.6%
unpow287.6%
unpow287.6%
difference-of-squares87.6%
Applied egg-rr87.6%
Taylor expanded in y around 0 74.6%
Taylor expanded in x around inf 70.4%
if 2.00000000000000001e277 < (*.f64 z z) Initial program 68.9%
remove-double-neg68.9%
distribute-lft-neg-out68.9%
distribute-frac-neg268.9%
distribute-frac-neg68.9%
neg-mul-168.9%
distribute-lft-neg-out68.9%
*-commutative68.9%
distribute-lft-neg-in68.9%
times-frac68.9%
metadata-eval68.9%
metadata-eval68.9%
associate--l+68.9%
fma-define70.3%
Simplified70.3%
clear-num70.3%
un-div-inv70.3%
fma-undefine68.9%
associate--l+68.9%
add-sqr-sqrt68.9%
pow268.9%
hypot-define68.9%
pow268.9%
Applied egg-rr68.9%
Taylor expanded in z around inf 74.6%
associate-*r/74.6%
neg-mul-174.6%
Simplified74.6%
neg-mul-174.6%
unpow274.6%
times-frac78.6%
Applied egg-rr78.6%
Final simplification58.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 z_m) y_m)))
(*
y_s
(if (<= (* z_m z_m) 5e-66)
(* y_m (+ 0.5 (* 0.5 (* (/ (+ x z_m) y_m) (/ x y_m)))))
(if (<= (* z_m z_m) 1e+138)
(* 0.5 (* (+ x z_m) t_0))
(* y_m (+ 0.5 (* 0.5 (* t_0 (/ 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 t_0 = (x - z_m) / y_m;
double tmp;
if ((z_m * z_m) <= 5e-66) {
tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / y_m))));
} else if ((z_m * z_m) <= 1e+138) {
tmp = 0.5 * ((x + z_m) * t_0);
} else {
tmp = y_m * (0.5 + (0.5 * (t_0 * (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) :: t_0
real(8) :: tmp
t_0 = (x - z_m) / y_m
if ((z_m * z_m) <= 5d-66) then
tmp = y_m * (0.5d0 + (0.5d0 * (((x + z_m) / y_m) * (x / y_m))))
else if ((z_m * z_m) <= 1d+138) then
tmp = 0.5d0 * ((x + z_m) * t_0)
else
tmp = y_m * (0.5d0 + (0.5d0 * (t_0 * (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 t_0 = (x - z_m) / y_m;
double tmp;
if ((z_m * z_m) <= 5e-66) {
tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / y_m))));
} else if ((z_m * z_m) <= 1e+138) {
tmp = 0.5 * ((x + z_m) * t_0);
} else {
tmp = y_m * (0.5 + (0.5 * (t_0 * (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): t_0 = (x - z_m) / y_m tmp = 0 if (z_m * z_m) <= 5e-66: tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / y_m)))) elif (z_m * z_m) <= 1e+138: tmp = 0.5 * ((x + z_m) * t_0) else: tmp = y_m * (0.5 + (0.5 * (t_0 * (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) t_0 = Float64(Float64(x - z_m) / y_m) tmp = 0.0 if (Float64(z_m * z_m) <= 5e-66) tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(x + z_m) / y_m) * Float64(x / y_m))))); elseif (Float64(z_m * z_m) <= 1e+138) tmp = Float64(0.5 * Float64(Float64(x + z_m) * t_0)); else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(t_0 * Float64(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) t_0 = (x - z_m) / y_m; tmp = 0.0; if ((z_m * z_m) <= 5e-66) tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / y_m)))); elseif ((z_m * z_m) <= 1e+138) tmp = 0.5 * ((x + z_m) * t_0); else tmp = y_m * (0.5 + (0.5 * (t_0 * (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_] := Block[{t$95$0 = N[(N[(x - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]}, N[(y$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 5e-66], N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(x + z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1e+138], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(t$95$0 * N[(z$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]), $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)
\\
\begin{array}{l}
t_0 := \frac{x - z\_m}{y\_m}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 5 \cdot 10^{-66}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{x + z\_m}{y\_m} \cdot \frac{x}{y\_m}\right)\right)\\
\mathbf{elif}\;z\_m \cdot z\_m \leq 10^{+138}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(t\_0 \cdot \frac{z\_m}{y\_m}\right)\right)\\
\end{array}
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999962e-66Initial program 72.5%
remove-double-neg72.5%
distribute-lft-neg-out72.5%
distribute-frac-neg272.5%
distribute-frac-neg72.5%
neg-mul-172.5%
distribute-lft-neg-out72.5%
*-commutative72.5%
distribute-lft-neg-in72.5%
times-frac72.5%
metadata-eval72.5%
metadata-eval72.5%
associate--l+72.5%
fma-define72.5%
Simplified72.5%
Taylor expanded in y around inf 81.7%
unpow281.7%
unpow281.7%
difference-of-squares81.7%
Applied egg-rr81.7%
*-commutative81.7%
unpow281.7%
times-frac96.5%
Applied egg-rr96.5%
Taylor expanded in x around inf 93.3%
if 4.99999999999999962e-66 < (*.f64 z z) < 1e138Initial program 84.9%
remove-double-neg84.9%
distribute-lft-neg-out84.9%
distribute-frac-neg284.9%
distribute-frac-neg84.9%
neg-mul-184.9%
distribute-lft-neg-out84.9%
*-commutative84.9%
distribute-lft-neg-in84.9%
times-frac84.9%
metadata-eval84.9%
metadata-eval84.9%
associate--l+84.9%
fma-define84.9%
Simplified84.9%
Taylor expanded in y around inf 72.5%
unpow272.5%
unpow272.5%
difference-of-squares72.5%
Applied egg-rr72.5%
Taylor expanded in y around 0 75.2%
associate-/l*75.2%
Simplified75.2%
if 1e138 < (*.f64 z z) Initial program 67.0%
remove-double-neg67.0%
distribute-lft-neg-out67.0%
distribute-frac-neg267.0%
distribute-frac-neg67.0%
neg-mul-167.0%
distribute-lft-neg-out67.0%
*-commutative67.0%
distribute-lft-neg-in67.0%
times-frac67.0%
metadata-eval67.0%
metadata-eval67.0%
associate--l+67.0%
fma-define68.0%
Simplified68.0%
Taylor expanded in y around inf 73.6%
unpow273.6%
unpow273.6%
difference-of-squares78.8%
Applied egg-rr78.8%
*-commutative78.8%
unpow278.8%
times-frac98.0%
Applied egg-rr98.0%
Taylor expanded in x around 0 86.8%
Final simplification87.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
(*
y_s
(if (<= (* z_m z_m) 5e-289)
(* y_m 0.5)
(if (<= (* z_m z_m) 2e-187)
(* 0.5 (/ (* x (+ x z_m)) y_m))
(if (<= (* z_m z_m) 2e+277) (* y_m 0.5) (/ (* (* z_m z_m) -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 ((z_m * z_m) <= 5e-289) {
tmp = y_m * 0.5;
} else if ((z_m * z_m) <= 2e-187) {
tmp = 0.5 * ((x * (x + z_m)) / y_m);
} else if ((z_m * z_m) <= 2e+277) {
tmp = y_m * 0.5;
} else {
tmp = ((z_m * z_m) * -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 ((z_m * z_m) <= 5d-289) then
tmp = y_m * 0.5d0
else if ((z_m * z_m) <= 2d-187) then
tmp = 0.5d0 * ((x * (x + z_m)) / y_m)
else if ((z_m * z_m) <= 2d+277) then
tmp = y_m * 0.5d0
else
tmp = ((z_m * z_m) * (-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 ((z_m * z_m) <= 5e-289) {
tmp = y_m * 0.5;
} else if ((z_m * z_m) <= 2e-187) {
tmp = 0.5 * ((x * (x + z_m)) / y_m);
} else if ((z_m * z_m) <= 2e+277) {
tmp = y_m * 0.5;
} else {
tmp = ((z_m * z_m) * -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 (z_m * z_m) <= 5e-289: tmp = y_m * 0.5 elif (z_m * z_m) <= 2e-187: tmp = 0.5 * ((x * (x + z_m)) / y_m) elif (z_m * z_m) <= 2e+277: tmp = y_m * 0.5 else: tmp = ((z_m * z_m) * -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(z_m * z_m) <= 5e-289) tmp = Float64(y_m * 0.5); elseif (Float64(z_m * z_m) <= 2e-187) tmp = Float64(0.5 * Float64(Float64(x * Float64(x + z_m)) / y_m)); elseif (Float64(z_m * z_m) <= 2e+277) tmp = Float64(y_m * 0.5); else tmp = Float64(Float64(Float64(z_m * z_m) * -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 ((z_m * z_m) <= 5e-289) tmp = y_m * 0.5; elseif ((z_m * z_m) <= 2e-187) tmp = 0.5 * ((x * (x + z_m)) / y_m); elseif ((z_m * z_m) <= 2e+277) tmp = y_m * 0.5; else tmp = ((z_m * z_m) * -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[(z$95$m * z$95$m), $MachinePrecision], 5e-289], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 2e-187], N[(0.5 * N[(N[(x * N[(x + z$95$m), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 2e+277], N[(y$95$m * 0.5), $MachinePrecision], N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] * -0.5), $MachinePrecision] / y$95$m), $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}\;z\_m \cdot z\_m \leq 5 \cdot 10^{-289}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;z\_m \cdot z\_m \leq 2 \cdot 10^{-187}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot \left(x + z\_m\right)}{y\_m}\\
\mathbf{elif}\;z\_m \cdot z\_m \leq 2 \cdot 10^{+277}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(z\_m \cdot z\_m\right) \cdot -0.5}{y\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000029e-289 or 2e-187 < (*.f64 z z) < 2.00000000000000001e277Initial program 70.8%
remove-double-neg70.8%
distribute-lft-neg-out70.8%
distribute-frac-neg270.8%
distribute-frac-neg70.8%
neg-mul-170.8%
distribute-lft-neg-out70.8%
*-commutative70.8%
distribute-lft-neg-in70.8%
times-frac70.8%
metadata-eval70.8%
metadata-eval70.8%
associate--l+70.8%
fma-define70.8%
Simplified70.8%
Taylor expanded in y around inf 48.4%
if 5.00000000000000029e-289 < (*.f64 z z) < 2e-187Initial program 96.0%
remove-double-neg96.0%
distribute-lft-neg-out96.0%
distribute-frac-neg296.0%
distribute-frac-neg96.0%
neg-mul-196.0%
distribute-lft-neg-out96.0%
*-commutative96.0%
distribute-lft-neg-in96.0%
times-frac96.0%
metadata-eval96.0%
metadata-eval96.0%
associate--l+96.0%
fma-define96.0%
Simplified96.0%
Taylor expanded in y around inf 87.6%
unpow287.6%
unpow287.6%
difference-of-squares87.6%
Applied egg-rr87.6%
Taylor expanded in y around 0 74.6%
Taylor expanded in x around inf 70.4%
if 2.00000000000000001e277 < (*.f64 z z) Initial program 68.9%
remove-double-neg68.9%
distribute-lft-neg-out68.9%
distribute-frac-neg268.9%
distribute-frac-neg68.9%
neg-mul-168.9%
distribute-lft-neg-out68.9%
*-commutative68.9%
distribute-lft-neg-in68.9%
times-frac68.9%
metadata-eval68.9%
metadata-eval68.9%
associate--l+68.9%
fma-define70.3%
Simplified70.3%
Taylor expanded in z around inf 74.6%
*-commutative74.6%
associate-*l/74.6%
Simplified74.6%
unpow274.6%
Applied egg-rr74.6%
Final simplification57.6%
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 z_m) y_m)))
(*
y_s
(if (<= y_m 4.2e-96)
(* 0.5 (* (+ x z_m) t_0))
(* y_m (+ 0.5 (/ (* 0.5 t_0) (/ y_m (+ x z_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 t_0 = (x - z_m) / y_m;
double tmp;
if (y_m <= 4.2e-96) {
tmp = 0.5 * ((x + z_m) * t_0);
} else {
tmp = y_m * (0.5 + ((0.5 * t_0) / (y_m / (x + z_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) :: t_0
real(8) :: tmp
t_0 = (x - z_m) / y_m
if (y_m <= 4.2d-96) then
tmp = 0.5d0 * ((x + z_m) * t_0)
else
tmp = y_m * (0.5d0 + ((0.5d0 * t_0) / (y_m / (x + z_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 t_0 = (x - z_m) / y_m;
double tmp;
if (y_m <= 4.2e-96) {
tmp = 0.5 * ((x + z_m) * t_0);
} else {
tmp = y_m * (0.5 + ((0.5 * t_0) / (y_m / (x + z_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): t_0 = (x - z_m) / y_m tmp = 0 if y_m <= 4.2e-96: tmp = 0.5 * ((x + z_m) * t_0) else: tmp = y_m * (0.5 + ((0.5 * t_0) / (y_m / (x + z_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) t_0 = Float64(Float64(x - z_m) / y_m) tmp = 0.0 if (y_m <= 4.2e-96) tmp = Float64(0.5 * Float64(Float64(x + z_m) * t_0)); else tmp = Float64(y_m * Float64(0.5 + Float64(Float64(0.5 * t_0) / Float64(y_m / Float64(x + z_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) t_0 = (x - z_m) / y_m; tmp = 0.0; if (y_m <= 4.2e-96) tmp = 0.5 * ((x + z_m) * t_0); else tmp = y_m * (0.5 + ((0.5 * t_0) / (y_m / (x + z_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_] := Block[{t$95$0 = N[(N[(x - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 4.2e-96], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(N[(0.5 * t$95$0), $MachinePrecision] / N[(y$95$m / N[(x + z$95$m), $MachinePrecision]), $MachinePrecision]), $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)
\\
\begin{array}{l}
t_0 := \frac{x - z\_m}{y\_m}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 4.2 \cdot 10^{-96}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + \frac{0.5 \cdot t\_0}{\frac{y\_m}{x + z\_m}}\right)\\
\end{array}
\end{array}
\end{array}
if y < 4.20000000000000002e-96Initial program 78.0%
remove-double-neg78.0%
distribute-lft-neg-out78.0%
distribute-frac-neg278.0%
distribute-frac-neg78.0%
neg-mul-178.0%
distribute-lft-neg-out78.0%
*-commutative78.0%
distribute-lft-neg-in78.0%
times-frac78.0%
metadata-eval78.0%
metadata-eval78.0%
associate--l+78.0%
fma-define78.0%
Simplified78.0%
Taylor expanded in y around inf 75.2%
unpow275.2%
unpow275.2%
difference-of-squares76.3%
Applied egg-rr76.3%
Taylor expanded in y around 0 63.0%
associate-/l*68.2%
Simplified68.2%
if 4.20000000000000002e-96 < y Initial program 60.2%
remove-double-neg60.2%
distribute-lft-neg-out60.2%
distribute-frac-neg260.2%
distribute-frac-neg60.2%
neg-mul-160.2%
distribute-lft-neg-out60.2%
*-commutative60.2%
distribute-lft-neg-in60.2%
times-frac60.2%
metadata-eval60.2%
metadata-eval60.2%
associate--l+60.2%
fma-define61.5%
Simplified61.5%
Taylor expanded in y around inf 81.3%
unpow281.3%
unpow281.3%
difference-of-squares85.1%
Applied egg-rr85.1%
*-commutative85.1%
unpow285.1%
times-frac98.7%
Applied egg-rr98.7%
associate-*r*98.7%
clear-num98.7%
un-div-inv98.8%
Applied egg-rr98.8%
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 z_m) y_m)))
(*
y_s
(if (<= y_m 5e-102)
(* 0.5 (* (+ x z_m) t_0))
(* y_m (+ 0.5 (* 0.5 (* t_0 (/ (+ x 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 t_0 = (x - z_m) / y_m;
double tmp;
if (y_m <= 5e-102) {
tmp = 0.5 * ((x + z_m) * t_0);
} else {
tmp = y_m * (0.5 + (0.5 * (t_0 * ((x + 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) :: t_0
real(8) :: tmp
t_0 = (x - z_m) / y_m
if (y_m <= 5d-102) then
tmp = 0.5d0 * ((x + z_m) * t_0)
else
tmp = y_m * (0.5d0 + (0.5d0 * (t_0 * ((x + 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 t_0 = (x - z_m) / y_m;
double tmp;
if (y_m <= 5e-102) {
tmp = 0.5 * ((x + z_m) * t_0);
} else {
tmp = y_m * (0.5 + (0.5 * (t_0 * ((x + 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): t_0 = (x - z_m) / y_m tmp = 0 if y_m <= 5e-102: tmp = 0.5 * ((x + z_m) * t_0) else: tmp = y_m * (0.5 + (0.5 * (t_0 * ((x + 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) t_0 = Float64(Float64(x - z_m) / y_m) tmp = 0.0 if (y_m <= 5e-102) tmp = Float64(0.5 * Float64(Float64(x + z_m) * t_0)); else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(t_0 * Float64(Float64(x + 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) t_0 = (x - z_m) / y_m; tmp = 0.0; if (y_m <= 5e-102) tmp = 0.5 * ((x + z_m) * t_0); else tmp = y_m * (0.5 + (0.5 * (t_0 * ((x + 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_] := Block[{t$95$0 = N[(N[(x - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 5e-102], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(t$95$0 * N[(N[(x + z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $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)
\\
\begin{array}{l}
t_0 := \frac{x - z\_m}{y\_m}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 5 \cdot 10^{-102}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(t\_0 \cdot \frac{x + z\_m}{y\_m}\right)\right)\\
\end{array}
\end{array}
\end{array}
if y < 5.00000000000000026e-102Initial program 77.6%
remove-double-neg77.6%
distribute-lft-neg-out77.6%
distribute-frac-neg277.6%
distribute-frac-neg77.6%
neg-mul-177.6%
distribute-lft-neg-out77.6%
*-commutative77.6%
distribute-lft-neg-in77.6%
times-frac77.6%
metadata-eval77.6%
metadata-eval77.6%
associate--l+77.6%
fma-define77.6%
Simplified77.6%
Taylor expanded in y around inf 74.7%
unpow274.7%
unpow274.7%
difference-of-squares75.9%
Applied egg-rr75.9%
Taylor expanded in y around 0 62.3%
associate-/l*67.7%
Simplified67.7%
if 5.00000000000000026e-102 < y Initial program 61.7%
remove-double-neg61.7%
distribute-lft-neg-out61.7%
distribute-frac-neg261.7%
distribute-frac-neg61.7%
neg-mul-161.7%
distribute-lft-neg-out61.7%
*-commutative61.7%
distribute-lft-neg-in61.7%
times-frac61.7%
metadata-eval61.7%
metadata-eval61.7%
associate--l+61.7%
fma-define62.9%
Simplified62.9%
Taylor expanded in y around inf 81.9%
unpow281.9%
unpow281.9%
difference-of-squares85.6%
Applied egg-rr85.6%
*-commutative85.6%
unpow285.6%
times-frac98.8%
Applied egg-rr98.8%
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 7.2e+28)
(* 0.5 (* (+ x z_m) (/ (- x z_m) y_m)))
(* y_m (+ 0.5 (* 0.5 (* (/ (+ x z_m) y_m) (/ x 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 <= 7.2e+28) {
tmp = 0.5 * ((x + z_m) * ((x - z_m) / y_m));
} else {
tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / 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 <= 7.2d+28) then
tmp = 0.5d0 * ((x + z_m) * ((x - z_m) / y_m))
else
tmp = y_m * (0.5d0 + (0.5d0 * (((x + z_m) / y_m) * (x / 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 <= 7.2e+28) {
tmp = 0.5 * ((x + z_m) * ((x - z_m) / y_m));
} else {
tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / 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 <= 7.2e+28: tmp = 0.5 * ((x + z_m) * ((x - z_m) / y_m)) else: tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / 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 <= 7.2e+28) tmp = Float64(0.5 * Float64(Float64(x + z_m) * Float64(Float64(x - z_m) / y_m))); else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(x + z_m) / y_m) * Float64(x / 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 <= 7.2e+28) tmp = 0.5 * ((x + z_m) * ((x - z_m) / y_m)); else tmp = y_m * (0.5 + (0.5 * (((x + z_m) / y_m) * (x / 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, 7.2e+28], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * N[(N[(x - z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(x + z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $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 7.2 \cdot 10^{+28}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot \frac{x - z\_m}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{x + z\_m}{y\_m} \cdot \frac{x}{y\_m}\right)\right)\\
\end{array}
\end{array}
if y < 7.1999999999999999e28Initial program 80.0%
remove-double-neg80.0%
distribute-lft-neg-out80.0%
distribute-frac-neg280.0%
distribute-frac-neg80.0%
neg-mul-180.0%
distribute-lft-neg-out80.0%
*-commutative80.0%
distribute-lft-neg-in80.0%
times-frac80.0%
metadata-eval80.0%
metadata-eval80.0%
associate--l+80.0%
fma-define80.5%
Simplified80.5%
Taylor expanded in y around inf 77.1%
unpow277.1%
unpow277.1%
difference-of-squares78.6%
Applied egg-rr78.6%
Taylor expanded in y around 0 65.8%
associate-/l*70.5%
Simplified70.5%
if 7.1999999999999999e28 < y Initial program 45.8%
remove-double-neg45.8%
distribute-lft-neg-out45.8%
distribute-frac-neg245.8%
distribute-frac-neg45.8%
neg-mul-145.8%
distribute-lft-neg-out45.8%
*-commutative45.8%
distribute-lft-neg-in45.8%
times-frac45.8%
metadata-eval45.8%
metadata-eval45.8%
associate--l+45.8%
fma-define45.8%
Simplified45.8%
Taylor expanded in y around inf 77.0%
unpow277.0%
unpow277.0%
difference-of-squares80.5%
Applied egg-rr80.5%
*-commutative80.5%
unpow280.5%
times-frac99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 78.3%
Final simplification72.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 3.1e+134) (* 0.5 (* (+ x z_m) (/ (- x 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 tmp;
if (y_m <= 3.1e+134) {
tmp = 0.5 * ((x + z_m) * ((x - 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) :: tmp
if (y_m <= 3.1d+134) then
tmp = 0.5d0 * ((x + z_m) * ((x - 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 tmp;
if (y_m <= 3.1e+134) {
tmp = 0.5 * ((x + z_m) * ((x - 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): tmp = 0 if y_m <= 3.1e+134: tmp = 0.5 * ((x + z_m) * ((x - 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) tmp = 0.0 if (y_m <= 3.1e+134) tmp = Float64(0.5 * Float64(Float64(x + z_m) * Float64(Float64(x - 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) tmp = 0.0; if (y_m <= 3.1e+134) tmp = 0.5 * ((x + z_m) * ((x - 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_] := N[(y$95$s * If[LessEqual[y$95$m, 3.1e+134], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * N[(N[(x - 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)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 3.1 \cdot 10^{+134}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot \frac{x - z\_m}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 3.09999999999999982e134Initial program 80.6%
remove-double-neg80.6%
distribute-lft-neg-out80.6%
distribute-frac-neg280.6%
distribute-frac-neg80.6%
neg-mul-180.6%
distribute-lft-neg-out80.6%
*-commutative80.6%
distribute-lft-neg-in80.6%
times-frac80.6%
metadata-eval80.6%
metadata-eval80.6%
associate--l+80.6%
fma-define81.0%
Simplified81.0%
Taylor expanded in y around inf 78.0%
unpow278.0%
unpow278.0%
difference-of-squares80.2%
Applied egg-rr80.2%
Taylor expanded in y around 0 65.9%
associate-/l*70.8%
Simplified70.8%
if 3.09999999999999982e134 < y Initial program 11.7%
remove-double-neg11.7%
distribute-lft-neg-out11.7%
distribute-frac-neg211.7%
distribute-frac-neg11.7%
neg-mul-111.7%
distribute-lft-neg-out11.7%
*-commutative11.7%
distribute-lft-neg-in11.7%
times-frac11.7%
metadata-eval11.7%
metadata-eval11.7%
associate--l+11.7%
fma-define11.7%
Simplified11.7%
Taylor expanded in y around inf 87.9%
Final simplification72.8%
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 7.2e+27) (/ (* (* z_m z_m) -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 <= 7.2e+27) {
tmp = ((z_m * z_m) * -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 <= 7.2d+27) then
tmp = ((z_m * z_m) * (-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 <= 7.2e+27) {
tmp = ((z_m * z_m) * -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 <= 7.2e+27: tmp = ((z_m * z_m) * -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 <= 7.2e+27) tmp = Float64(Float64(Float64(z_m * z_m) * -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 <= 7.2e+27) tmp = ((z_m * z_m) * -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, 7.2e+27], N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] * -0.5), $MachinePrecision] / y$95$m), $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 7.2 \cdot 10^{+27}:\\
\;\;\;\;\frac{\left(z\_m \cdot z\_m\right) \cdot -0.5}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 7.19999999999999966e27Initial program 80.0%
remove-double-neg80.0%
distribute-lft-neg-out80.0%
distribute-frac-neg280.0%
distribute-frac-neg80.0%
neg-mul-180.0%
distribute-lft-neg-out80.0%
*-commutative80.0%
distribute-lft-neg-in80.0%
times-frac80.0%
metadata-eval80.0%
metadata-eval80.0%
associate--l+80.0%
fma-define80.5%
Simplified80.5%
Taylor expanded in z around inf 34.7%
*-commutative34.7%
associate-*l/34.7%
Simplified34.7%
unpow234.7%
Applied egg-rr34.7%
if 7.19999999999999966e27 < y Initial program 45.8%
remove-double-neg45.8%
distribute-lft-neg-out45.8%
distribute-frac-neg245.8%
distribute-frac-neg45.8%
neg-mul-145.8%
distribute-lft-neg-out45.8%
*-commutative45.8%
distribute-lft-neg-in45.8%
times-frac45.8%
metadata-eval45.8%
metadata-eval45.8%
associate--l+45.8%
fma-define45.8%
Simplified45.8%
Taylor expanded in y around inf 57.6%
Final simplification39.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 (* y_s (if (<= x 5.8e+219) (* y_m 0.5) (* z_m (* z_m (/ 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 <= 5.8e+219) {
tmp = y_m * 0.5;
} else {
tmp = z_m * (z_m * (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 <= 5.8d+219) then
tmp = y_m * 0.5d0
else
tmp = z_m * (z_m * (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 <= 5.8e+219) {
tmp = y_m * 0.5;
} else {
tmp = z_m * (z_m * (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 <= 5.8e+219: tmp = y_m * 0.5 else: tmp = z_m * (z_m * (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 <= 5.8e+219) tmp = Float64(y_m * 0.5); else tmp = Float64(z_m * Float64(z_m * 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 <= 5.8e+219) tmp = y_m * 0.5; else tmp = z_m * (z_m * (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, 5.8e+219], N[(y$95$m * 0.5), $MachinePrecision], N[(z$95$m * N[(z$95$m * N[(0.5 / 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}\;x \leq 5.8 \cdot 10^{+219}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;z\_m \cdot \left(z\_m \cdot \frac{0.5}{y\_m}\right)\\
\end{array}
\end{array}
if x < 5.79999999999999958e219Initial program 73.5%
remove-double-neg73.5%
distribute-lft-neg-out73.5%
distribute-frac-neg273.5%
distribute-frac-neg73.5%
neg-mul-173.5%
distribute-lft-neg-out73.5%
*-commutative73.5%
distribute-lft-neg-in73.5%
times-frac73.5%
metadata-eval73.5%
metadata-eval73.5%
associate--l+73.5%
fma-define73.9%
Simplified73.9%
Taylor expanded in y around inf 37.9%
if 5.79999999999999958e219 < x Initial program 54.5%
remove-double-neg54.5%
distribute-lft-neg-out54.5%
distribute-frac-neg254.5%
distribute-frac-neg54.5%
neg-mul-154.5%
distribute-lft-neg-out54.5%
*-commutative54.5%
distribute-lft-neg-in54.5%
times-frac54.5%
metadata-eval54.5%
metadata-eval54.5%
associate--l+54.5%
fma-define54.5%
Simplified54.5%
clear-num54.5%
un-div-inv54.5%
fma-undefine54.5%
associate--l+54.5%
add-sqr-sqrt54.5%
pow254.5%
hypot-define54.5%
pow254.5%
Applied egg-rr54.5%
Taylor expanded in z around inf 0.4%
associate-*r/0.4%
neg-mul-10.4%
Simplified0.4%
associate-/r/0.4%
unpow20.4%
associate-*r*0.4%
add-sqr-sqrt0.2%
sqrt-unprod24.4%
sqr-neg24.4%
sqrt-prod16.9%
add-sqr-sqrt33.8%
Applied egg-rr33.8%
Final simplification37.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 (* 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 72.5%
remove-double-neg72.5%
distribute-lft-neg-out72.5%
distribute-frac-neg272.5%
distribute-frac-neg72.5%
neg-mul-172.5%
distribute-lft-neg-out72.5%
*-commutative72.5%
distribute-lft-neg-in72.5%
times-frac72.5%
metadata-eval72.5%
metadata-eval72.5%
associate--l+72.5%
fma-define72.9%
Simplified72.9%
Taylor expanded in y around inf 36.6%
Final simplification36.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 2024170
(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)))