
(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 14 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) (FPCore (x y z_m) :precision binary64 (/ 0.5 (/ (/ y (- (hypot y x) z_m)) (+ (hypot y x) z_m))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
return 0.5 / ((y / (hypot(y, x) - z_m)) / (hypot(y, x) + z_m));
}
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
return 0.5 / ((y / (Math.hypot(y, x) - z_m)) / (Math.hypot(y, x) + z_m));
}
z_m = math.fabs(z) def code(x, y, z_m): return 0.5 / ((y / (math.hypot(y, x) - z_m)) / (math.hypot(y, x) + z_m))
z_m = abs(z) function code(x, y, z_m) return Float64(0.5 / Float64(Float64(y / Float64(hypot(y, x) - z_m)) / Float64(hypot(y, x) + z_m))) end
z_m = abs(z); function tmp = code(x, y, z_m) tmp = 0.5 / ((y / (hypot(y, x) - z_m)) / (hypot(y, x) + z_m)); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := N[(0.5 / N[(N[(y / N[(N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] - z$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
\frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right) - z\_m}}{\mathsf{hypot}\left(y, x\right) + z\_m}}
\end{array}
Initial program 71.9%
remove-double-neg71.9%
distribute-lft-neg-out71.9%
distribute-frac-neg271.9%
distribute-frac-neg71.9%
neg-mul-171.9%
distribute-lft-neg-out71.9%
*-commutative71.9%
distribute-lft-neg-in71.9%
times-frac71.5%
metadata-eval71.5%
metadata-eval71.5%
associate--l+71.5%
fma-define74.7%
Simplified74.7%
clear-num74.5%
un-div-inv74.9%
fma-undefine71.7%
associate--l+71.7%
add-sqr-sqrt71.7%
pow271.7%
hypot-define71.7%
pow271.7%
Applied egg-rr71.7%
*-un-lft-identity71.7%
unpow271.7%
unpow271.7%
difference-of-squares79.4%
times-frac99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
hypot-undefine79.2%
unpow279.2%
unpow279.2%
+-commutative79.2%
unpow279.2%
unpow279.2%
hypot-define99.8%
+-commutative99.8%
hypot-undefine78.5%
unpow278.5%
unpow278.5%
+-commutative78.5%
unpow278.5%
unpow278.5%
hypot-define99.8%
Simplified99.8%
Final simplification99.8%
z_m = (fabs.f64 z)
(FPCore (x y z_m)
:precision binary64
(let* ((t_0 (/ (- (+ (* x x) (* y y)) (* z_m z_m)) (* y 2.0))))
(if (<= t_0 1e-24)
(* 0.5 (* (+ y z_m) (/ (- y z_m) y)))
(if (<= t_0 INFINITY)
(/ 0.5 (/ (/ y (hypot y x)) (+ (hypot y x) z_m)))
(* 0.5 (* (+ x z_m) (/ (- x z_m) y)))))))z_m = fabs(z);
double code(double x, double y, double z_m) {
double t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0);
double tmp;
if (t_0 <= 1e-24) {
tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
} else if (t_0 <= ((double) INFINITY)) {
tmp = 0.5 / ((y / hypot(y, x)) / (hypot(y, x) + z_m));
} else {
tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
}
return tmp;
}
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0);
double tmp;
if (t_0 <= 1e-24) {
tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = 0.5 / ((y / Math.hypot(y, x)) / (Math.hypot(y, x) + z_m));
} else {
tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0) tmp = 0 if t_0 <= 1e-24: tmp = 0.5 * ((y + z_m) * ((y - z_m) / y)) elif t_0 <= math.inf: tmp = 0.5 / ((y / math.hypot(y, x)) / (math.hypot(y, x) + z_m)) else: tmp = 0.5 * ((x + z_m) * ((x - z_m) / y)) return tmp
z_m = abs(z) function code(x, y, z_m) t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z_m * z_m)) / Float64(y * 2.0)) tmp = 0.0 if (t_0 <= 1e-24) tmp = Float64(0.5 * Float64(Float64(y + z_m) * Float64(Float64(y - z_m) / y))); elseif (t_0 <= Inf) tmp = Float64(0.5 / Float64(Float64(y / hypot(y, x)) / Float64(hypot(y, x) + z_m))); else tmp = Float64(0.5 * Float64(Float64(x + z_m) * Float64(Float64(x - z_m) / y))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0); tmp = 0.0; if (t_0 <= 1e-24) tmp = 0.5 * ((y + z_m) * ((y - z_m) / y)); elseif (t_0 <= Inf) tmp = 0.5 / ((y / hypot(y, x)) / (hypot(y, x) + z_m)); else tmp = 0.5 * ((x + z_m) * ((x - z_m) / y)); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := Block[{t$95$0 = N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e-24], N[(0.5 * N[(N[(y + z$95$m), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(0.5 / N[(N[(y / N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * N[(N[(x - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y \cdot y\right) - z\_m \cdot z\_m}{y \cdot 2}\\
\mathbf{if}\;t\_0 \leq 10^{-24}:\\
\;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right) + z\_m}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot \frac{x - z\_m}{y}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 9.99999999999999924e-25Initial program 82.2%
remove-double-neg82.2%
distribute-lft-neg-out82.2%
distribute-frac-neg282.2%
distribute-frac-neg82.2%
neg-mul-182.2%
distribute-lft-neg-out82.2%
*-commutative82.2%
distribute-lft-neg-in82.2%
times-frac82.2%
metadata-eval82.2%
metadata-eval82.2%
associate--l+82.2%
fma-define82.2%
Simplified82.2%
fma-undefine82.2%
associate--l+82.2%
add-sqr-sqrt82.2%
difference-of-squares82.2%
hypot-define82.2%
hypot-define82.2%
Applied egg-rr82.2%
Taylor expanded in x around 0 60.2%
associate-/l*73.9%
Simplified73.9%
if 9.99999999999999924e-25 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < +inf.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-frac77.7%
metadata-eval77.7%
metadata-eval77.7%
associate--l+77.7%
fma-define77.7%
Simplified77.7%
clear-num77.6%
un-div-inv78.3%
fma-undefine78.3%
associate--l+78.3%
add-sqr-sqrt78.3%
pow278.3%
hypot-define78.3%
pow278.3%
Applied egg-rr78.3%
*-un-lft-identity78.3%
unpow278.3%
unpow278.3%
difference-of-squares78.3%
times-frac99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
hypot-undefine79.1%
unpow279.1%
unpow279.1%
+-commutative79.1%
unpow279.1%
unpow279.1%
hypot-define99.8%
+-commutative99.8%
hypot-undefine79.1%
unpow279.1%
unpow279.1%
+-commutative79.1%
unpow279.1%
unpow279.1%
hypot-define99.8%
Simplified99.8%
Taylor expanded in z around 0 47.4%
+-commutative47.4%
unpow247.4%
unpow247.4%
hypot-undefine69.2%
Simplified69.2%
if +inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 0.0%
remove-double-neg0.0%
distribute-lft-neg-out0.0%
distribute-frac-neg20.0%
distribute-frac-neg0.0%
neg-mul-10.0%
distribute-lft-neg-out0.0%
*-commutative0.0%
distribute-lft-neg-in0.0%
times-frac0.0%
metadata-eval0.0%
metadata-eval0.0%
associate--l+0.0%
fma-define29.6%
Simplified29.6%
fma-undefine0.0%
associate--l+0.0%
add-sqr-sqrt0.0%
difference-of-squares35.6%
hypot-define57.8%
hypot-define72.6%
Applied egg-rr72.6%
Taylor expanded in y around 0 71.4%
associate-/l*78.1%
+-commutative78.1%
Simplified78.1%
Final simplification72.3%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (if (<= y 3.4e+108) (* 0.5 (/ (* (+ z_m (hypot x y)) (- (hypot x y) z_m)) y)) (/ 0.5 (/ (/ y (hypot y x)) (+ (hypot y x) z_m)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (y <= 3.4e+108) {
tmp = 0.5 * (((z_m + hypot(x, y)) * (hypot(x, y) - z_m)) / y);
} else {
tmp = 0.5 / ((y / hypot(y, x)) / (hypot(y, x) + z_m));
}
return tmp;
}
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if (y <= 3.4e+108) {
tmp = 0.5 * (((z_m + Math.hypot(x, y)) * (Math.hypot(x, y) - z_m)) / y);
} else {
tmp = 0.5 / ((y / Math.hypot(y, x)) / (Math.hypot(y, x) + z_m));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if y <= 3.4e+108: tmp = 0.5 * (((z_m + math.hypot(x, y)) * (math.hypot(x, y) - z_m)) / y) else: tmp = 0.5 / ((y / math.hypot(y, x)) / (math.hypot(y, x) + z_m)) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (y <= 3.4e+108) tmp = Float64(0.5 * Float64(Float64(Float64(z_m + hypot(x, y)) * Float64(hypot(x, y) - z_m)) / y)); else tmp = Float64(0.5 / Float64(Float64(y / hypot(y, x)) / Float64(hypot(y, x) + z_m))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if (y <= 3.4e+108) tmp = 0.5 * (((z_m + hypot(x, y)) * (hypot(x, y) - z_m)) / y); else tmp = 0.5 / ((y / hypot(y, x)) / (hypot(y, x) + z_m)); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[y, 3.4e+108], N[(0.5 * N[(N[(N[(z$95$m + N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] - z$95$m), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(N[(y / N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.4 \cdot 10^{+108}:\\
\;\;\;\;0.5 \cdot \frac{\left(z\_m + \mathsf{hypot}\left(x, y\right)\right) \cdot \left(\mathsf{hypot}\left(x, y\right) - z\_m\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{\frac{y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right) + z\_m}}\\
\end{array}
\end{array}
if y < 3.39999999999999996e108Initial program 81.0%
remove-double-neg81.0%
distribute-lft-neg-out81.0%
distribute-frac-neg281.0%
distribute-frac-neg81.0%
neg-mul-181.0%
distribute-lft-neg-out81.0%
*-commutative81.0%
distribute-lft-neg-in81.0%
times-frac80.6%
metadata-eval80.6%
metadata-eval80.6%
associate--l+80.6%
fma-define84.3%
Simplified84.3%
fma-undefine80.6%
associate--l+80.6%
add-sqr-sqrt80.6%
difference-of-squares84.4%
hypot-define86.8%
hypot-define88.6%
Applied egg-rr88.6%
if 3.39999999999999996e108 < y Initial program 25.4%
remove-double-neg25.4%
distribute-lft-neg-out25.4%
distribute-frac-neg225.4%
distribute-frac-neg25.4%
neg-mul-125.4%
distribute-lft-neg-out25.4%
*-commutative25.4%
distribute-lft-neg-in25.4%
times-frac25.4%
metadata-eval25.4%
metadata-eval25.4%
associate--l+25.4%
fma-define25.4%
Simplified25.4%
clear-num25.3%
un-div-inv25.3%
fma-undefine25.3%
associate--l+25.3%
add-sqr-sqrt25.3%
pow225.3%
hypot-define25.3%
pow225.3%
Applied egg-rr25.3%
*-un-lft-identity25.3%
unpow225.3%
unpow225.3%
difference-of-squares31.0%
times-frac99.9%
Applied egg-rr99.9%
associate-*l/99.9%
*-lft-identity99.9%
hypot-undefine33.3%
unpow233.3%
unpow233.3%
+-commutative33.3%
unpow233.3%
unpow233.3%
hypot-define99.9%
+-commutative99.9%
hypot-undefine30.9%
unpow230.9%
unpow230.9%
+-commutative30.9%
unpow230.9%
unpow230.9%
hypot-define99.9%
Simplified99.9%
Taylor expanded in z around 0 31.1%
+-commutative31.1%
unpow231.1%
unpow231.1%
hypot-undefine94.2%
Simplified94.2%
Final simplification89.5%
z_m = (fabs.f64 z)
(FPCore (x y z_m)
:precision binary64
(if (<= y 1.52e-130)
(/ 0.5 (/ y (* (+ x z_m) (- x z_m))))
(if (<= y 4.2e+131)
(* 0.5 (/ (fma x x (* (+ y z_m) (- y z_m))) y))
(* 0.5 (* (+ y z_m) (/ (- y z_m) y))))))z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (y <= 1.52e-130) {
tmp = 0.5 / (y / ((x + z_m) * (x - z_m)));
} else if (y <= 4.2e+131) {
tmp = 0.5 * (fma(x, x, ((y + z_m) * (y - z_m))) / y);
} else {
tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (y <= 1.52e-130) tmp = Float64(0.5 / Float64(y / Float64(Float64(x + z_m) * Float64(x - z_m)))); elseif (y <= 4.2e+131) tmp = Float64(0.5 * Float64(fma(x, x, Float64(Float64(y + z_m) * Float64(y - z_m))) / y)); else tmp = Float64(0.5 * Float64(Float64(y + z_m) * Float64(Float64(y - z_m) / y))); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[y, 1.52e-130], N[(0.5 / N[(y / N[(N[(x + z$95$m), $MachinePrecision] * N[(x - z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+131], N[(0.5 * N[(N[(x * x + N[(N[(y + z$95$m), $MachinePrecision] * N[(y - z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y + z$95$m), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.52 \cdot 10^{-130}:\\
\;\;\;\;\frac{0.5}{\frac{y}{\left(x + z\_m\right) \cdot \left(x - z\_m\right)}}\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+131}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, \left(y + z\_m\right) \cdot \left(y - z\_m\right)\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\
\end{array}
\end{array}
if y < 1.51999999999999998e-130Initial program 77.4%
remove-double-neg77.4%
distribute-lft-neg-out77.4%
distribute-frac-neg277.4%
distribute-frac-neg77.4%
neg-mul-177.4%
distribute-lft-neg-out77.4%
*-commutative77.4%
distribute-lft-neg-in77.4%
times-frac76.8%
metadata-eval76.8%
metadata-eval76.8%
associate--l+76.8%
fma-define80.7%
Simplified80.7%
clear-num80.6%
un-div-inv81.1%
fma-undefine77.2%
associate--l+77.2%
add-sqr-sqrt77.2%
pow277.2%
hypot-define77.2%
pow277.2%
Applied egg-rr77.2%
*-un-lft-identity77.2%
unpow277.2%
unpow277.2%
difference-of-squares85.8%
times-frac99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
hypot-undefine84.4%
unpow284.4%
unpow284.4%
+-commutative84.4%
unpow284.4%
unpow284.4%
hypot-define99.8%
+-commutative99.8%
hypot-undefine83.8%
unpow283.8%
unpow283.8%
+-commutative83.8%
unpow283.8%
unpow283.8%
hypot-define99.8%
Simplified99.8%
Taylor expanded in y around 0 73.0%
if 1.51999999999999998e-130 < y < 4.19999999999999971e131Initial program 86.7%
remove-double-neg86.7%
distribute-lft-neg-out86.7%
distribute-frac-neg286.7%
distribute-frac-neg86.7%
neg-mul-186.7%
distribute-lft-neg-out86.7%
*-commutative86.7%
distribute-lft-neg-in86.7%
times-frac86.7%
metadata-eval86.7%
metadata-eval86.7%
associate--l+86.7%
fma-define89.8%
Simplified89.8%
difference-of-squares89.8%
*-commutative89.8%
Applied egg-rr89.8%
if 4.19999999999999971e131 < y Initial program 21.0%
remove-double-neg21.0%
distribute-lft-neg-out21.0%
distribute-frac-neg221.0%
distribute-frac-neg21.0%
neg-mul-121.0%
distribute-lft-neg-out21.0%
*-commutative21.0%
distribute-lft-neg-in21.0%
times-frac21.0%
metadata-eval21.0%
metadata-eval21.0%
associate--l+21.0%
fma-define21.0%
Simplified21.0%
fma-undefine21.0%
associate--l+21.0%
add-sqr-sqrt21.0%
difference-of-squares24.7%
hypot-define27.5%
hypot-define27.5%
Applied egg-rr27.5%
Taylor expanded in x around 0 24.7%
associate-/l*81.8%
Simplified81.8%
Final simplification78.6%
z_m = (fabs.f64 z)
(FPCore (x y z_m)
:precision binary64
(if (<= (* x x) 5e-122)
(* 0.5 (* (+ y z_m) (/ (- y z_m) y)))
(if (<= (* x x) 2e+265)
(/ (- (+ (* x x) (* y y)) (* z_m z_m)) (* y 2.0))
(* 0.5 (* (+ x z_m) (/ (- x z_m) y))))))z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if ((x * x) <= 5e-122) {
tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
} else if ((x * x) <= 2e+265) {
tmp = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0);
} else {
tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((x * x) <= 5d-122) then
tmp = 0.5d0 * ((y + z_m) * ((y - z_m) / y))
else if ((x * x) <= 2d+265) then
tmp = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0d0)
else
tmp = 0.5d0 * ((x + z_m) * ((x - z_m) / y))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if ((x * x) <= 5e-122) {
tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
} else if ((x * x) <= 2e+265) {
tmp = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0);
} else {
tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if (x * x) <= 5e-122: tmp = 0.5 * ((y + z_m) * ((y - z_m) / y)) elif (x * x) <= 2e+265: tmp = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0) else: tmp = 0.5 * ((x + z_m) * ((x - z_m) / y)) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (Float64(x * x) <= 5e-122) tmp = Float64(0.5 * Float64(Float64(y + z_m) * Float64(Float64(y - z_m) / y))); elseif (Float64(x * x) <= 2e+265) tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z_m * z_m)) / Float64(y * 2.0)); else tmp = Float64(0.5 * Float64(Float64(x + z_m) * Float64(Float64(x - z_m) / y))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if ((x * x) <= 5e-122) tmp = 0.5 * ((y + z_m) * ((y - z_m) / y)); elseif ((x * x) <= 2e+265) tmp = (((x * x) + (y * y)) - (z_m * z_m)) / (y * 2.0); else tmp = 0.5 * ((x + z_m) * ((x - z_m) / y)); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e-122], N[(0.5 * N[(N[(y + z$95$m), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e+265], N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * N[(N[(x - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-122}:\\
\;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+265}:\\
\;\;\;\;\frac{\left(x \cdot x + y \cdot y\right) - z\_m \cdot z\_m}{y \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot \frac{x - z\_m}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 4.9999999999999999e-122Initial program 76.8%
remove-double-neg76.8%
distribute-lft-neg-out76.8%
distribute-frac-neg276.8%
distribute-frac-neg76.8%
neg-mul-176.8%
distribute-lft-neg-out76.8%
*-commutative76.8%
distribute-lft-neg-in76.8%
times-frac76.8%
metadata-eval76.8%
metadata-eval76.8%
associate--l+76.8%
fma-define76.8%
Simplified76.8%
fma-undefine76.8%
associate--l+76.8%
add-sqr-sqrt76.8%
difference-of-squares77.0%
hypot-define77.0%
hypot-define77.0%
Applied egg-rr77.0%
Taylor expanded in x around 0 74.2%
associate-/l*97.1%
Simplified97.1%
if 4.9999999999999999e-122 < (*.f64 x x) < 2.00000000000000013e265Initial program 82.8%
if 2.00000000000000013e265 < (*.f64 x x) Initial program 52.7%
remove-double-neg52.7%
distribute-lft-neg-out52.7%
distribute-frac-neg252.7%
distribute-frac-neg52.7%
neg-mul-152.7%
distribute-lft-neg-out52.7%
*-commutative52.7%
distribute-lft-neg-in52.7%
times-frac52.7%
metadata-eval52.7%
metadata-eval52.7%
associate--l+52.7%
fma-define63.9%
Simplified63.9%
fma-undefine52.7%
associate--l+52.7%
add-sqr-sqrt52.7%
difference-of-squares65.7%
hypot-define72.7%
hypot-define76.8%
Applied egg-rr76.8%
Taylor expanded in y around 0 76.8%
associate-/l*90.0%
+-commutative90.0%
Simplified90.0%
Final simplification90.7%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (if (<= z_m 2.9e-168) (/ 0.5 (/ (/ y x) (+ x z_m))) (if (<= z_m 2.3e+71) (* 0.5 y) (* 0.5 (* z_m (/ (- y z_m) y))))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 2.9e-168) {
tmp = 0.5 / ((y / x) / (x + z_m));
} else if (z_m <= 2.3e+71) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (z_m * ((y - z_m) / y));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 2.9d-168) then
tmp = 0.5d0 / ((y / x) / (x + z_m))
else if (z_m <= 2.3d+71) then
tmp = 0.5d0 * y
else
tmp = 0.5d0 * (z_m * ((y - z_m) / y))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 2.9e-168) {
tmp = 0.5 / ((y / x) / (x + z_m));
} else if (z_m <= 2.3e+71) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (z_m * ((y - z_m) / y));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if z_m <= 2.9e-168: tmp = 0.5 / ((y / x) / (x + z_m)) elif z_m <= 2.3e+71: tmp = 0.5 * y else: tmp = 0.5 * (z_m * ((y - z_m) / y)) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (z_m <= 2.9e-168) tmp = Float64(0.5 / Float64(Float64(y / x) / Float64(x + z_m))); elseif (z_m <= 2.3e+71) tmp = Float64(0.5 * y); else tmp = Float64(0.5 * Float64(z_m * Float64(Float64(y - z_m) / y))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if (z_m <= 2.9e-168) tmp = 0.5 / ((y / x) / (x + z_m)); elseif (z_m <= 2.3e+71) tmp = 0.5 * y; else tmp = 0.5 * (z_m * ((y - z_m) / y)); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[z$95$m, 2.9e-168], N[(0.5 / N[(N[(y / x), $MachinePrecision] / N[(x + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 2.3e+71], N[(0.5 * y), $MachinePrecision], N[(0.5 * N[(z$95$m * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 2.9 \cdot 10^{-168}:\\
\;\;\;\;\frac{0.5}{\frac{\frac{y}{x}}{x + z\_m}}\\
\mathbf{elif}\;z\_m \leq 2.3 \cdot 10^{+71}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(z\_m \cdot \frac{y - z\_m}{y}\right)\\
\end{array}
\end{array}
if z < 2.8999999999999998e-168Initial program 70.0%
remove-double-neg70.0%
distribute-lft-neg-out70.0%
distribute-frac-neg270.0%
distribute-frac-neg70.0%
neg-mul-170.0%
distribute-lft-neg-out70.0%
*-commutative70.0%
distribute-lft-neg-in70.0%
times-frac69.6%
metadata-eval69.6%
metadata-eval69.6%
associate--l+69.6%
fma-define72.5%
Simplified72.5%
clear-num72.4%
un-div-inv72.8%
fma-undefine69.9%
associate--l+69.9%
add-sqr-sqrt69.9%
pow269.9%
hypot-define69.9%
pow269.9%
Applied egg-rr69.9%
*-un-lft-identity69.9%
unpow269.9%
unpow269.9%
difference-of-squares77.8%
times-frac99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
hypot-undefine79.4%
unpow279.4%
unpow279.4%
+-commutative79.4%
unpow279.4%
unpow279.4%
hypot-define99.8%
+-commutative99.8%
hypot-undefine76.0%
unpow276.0%
unpow276.0%
+-commutative76.0%
unpow276.0%
unpow276.0%
hypot-define99.8%
Simplified99.8%
Taylor expanded in x around inf 25.4%
Taylor expanded in y around 0 38.3%
associate-/r*42.3%
+-commutative42.3%
Simplified42.3%
if 2.8999999999999998e-168 < z < 2.3000000000000002e71Initial program 78.8%
remove-double-neg78.8%
distribute-lft-neg-out78.8%
distribute-frac-neg278.8%
distribute-frac-neg78.8%
neg-mul-178.8%
distribute-lft-neg-out78.8%
*-commutative78.8%
distribute-lft-neg-in78.8%
times-frac78.8%
metadata-eval78.8%
metadata-eval78.8%
associate--l+78.8%
fma-define78.8%
Simplified78.8%
Taylor expanded in y around inf 44.2%
if 2.3000000000000002e71 < z 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-define79.1%
Simplified79.1%
fma-undefine72.5%
associate--l+72.5%
add-sqr-sqrt72.5%
difference-of-squares77.2%
hypot-define77.2%
hypot-define85.9%
Applied egg-rr85.9%
Taylor expanded in x around 0 77.3%
associate-/l*89.2%
Simplified89.2%
Taylor expanded in y around 0 76.9%
Final simplification48.8%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (if (<= z_m 5.6e-163) (* (* x x) (/ 0.5 y)) (if (<= z_m 2.7e+71) (* 0.5 y) (* 0.5 (* z_m (/ (- y z_m) y))))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 5.6e-163) {
tmp = (x * x) * (0.5 / y);
} else if (z_m <= 2.7e+71) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (z_m * ((y - z_m) / y));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 5.6d-163) then
tmp = (x * x) * (0.5d0 / y)
else if (z_m <= 2.7d+71) then
tmp = 0.5d0 * y
else
tmp = 0.5d0 * (z_m * ((y - z_m) / y))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 5.6e-163) {
tmp = (x * x) * (0.5 / y);
} else if (z_m <= 2.7e+71) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (z_m * ((y - z_m) / y));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if z_m <= 5.6e-163: tmp = (x * x) * (0.5 / y) elif z_m <= 2.7e+71: tmp = 0.5 * y else: tmp = 0.5 * (z_m * ((y - z_m) / y)) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (z_m <= 5.6e-163) tmp = Float64(Float64(x * x) * Float64(0.5 / y)); elseif (z_m <= 2.7e+71) tmp = Float64(0.5 * y); else tmp = Float64(0.5 * Float64(z_m * Float64(Float64(y - z_m) / y))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if (z_m <= 5.6e-163) tmp = (x * x) * (0.5 / y); elseif (z_m <= 2.7e+71) tmp = 0.5 * y; else tmp = 0.5 * (z_m * ((y - z_m) / y)); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[z$95$m, 5.6e-163], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 2.7e+71], N[(0.5 * y), $MachinePrecision], N[(0.5 * N[(z$95$m * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 5.6 \cdot 10^{-163}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\
\mathbf{elif}\;z\_m \leq 2.7 \cdot 10^{+71}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(z\_m \cdot \frac{y - z\_m}{y}\right)\\
\end{array}
\end{array}
if z < 5.5999999999999999e-163Initial program 70.0%
remove-double-neg70.0%
distribute-lft-neg-out70.0%
distribute-frac-neg270.0%
distribute-frac-neg70.0%
neg-mul-170.0%
distribute-lft-neg-out70.0%
*-commutative70.0%
distribute-lft-neg-in70.0%
times-frac69.6%
metadata-eval69.6%
metadata-eval69.6%
associate--l+69.6%
fma-define72.5%
Simplified72.5%
Taylor expanded in x around inf 30.2%
*-commutative30.2%
associate-*l/30.7%
associate-*r/30.7%
Simplified30.7%
unpow230.7%
Applied egg-rr30.7%
if 5.5999999999999999e-163 < z < 2.69999999999999997e71Initial program 78.8%
remove-double-neg78.8%
distribute-lft-neg-out78.8%
distribute-frac-neg278.8%
distribute-frac-neg78.8%
neg-mul-178.8%
distribute-lft-neg-out78.8%
*-commutative78.8%
distribute-lft-neg-in78.8%
times-frac78.8%
metadata-eval78.8%
metadata-eval78.8%
associate--l+78.8%
fma-define78.8%
Simplified78.8%
Taylor expanded in y around inf 44.2%
if 2.69999999999999997e71 < z 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-define79.1%
Simplified79.1%
fma-undefine72.5%
associate--l+72.5%
add-sqr-sqrt72.5%
difference-of-squares77.2%
hypot-define77.2%
hypot-define85.9%
Applied egg-rr85.9%
Taylor expanded in x around 0 77.3%
associate-/l*89.2%
Simplified89.2%
Taylor expanded in y around 0 76.9%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (if (<= z_m 5.6e-163) (* (* x x) (/ 0.5 y)) (if (<= z_m 1.8e+70) (* 0.5 y) (* (* z_m (/ z_m y)) (- 0.5)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 5.6e-163) {
tmp = (x * x) * (0.5 / y);
} else if (z_m <= 1.8e+70) {
tmp = 0.5 * y;
} else {
tmp = (z_m * (z_m / y)) * -0.5;
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 5.6d-163) then
tmp = (x * x) * (0.5d0 / y)
else if (z_m <= 1.8d+70) then
tmp = 0.5d0 * y
else
tmp = (z_m * (z_m / y)) * -0.5d0
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 5.6e-163) {
tmp = (x * x) * (0.5 / y);
} else if (z_m <= 1.8e+70) {
tmp = 0.5 * y;
} else {
tmp = (z_m * (z_m / y)) * -0.5;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if z_m <= 5.6e-163: tmp = (x * x) * (0.5 / y) elif z_m <= 1.8e+70: tmp = 0.5 * y else: tmp = (z_m * (z_m / y)) * -0.5 return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (z_m <= 5.6e-163) tmp = Float64(Float64(x * x) * Float64(0.5 / y)); elseif (z_m <= 1.8e+70) tmp = Float64(0.5 * y); else tmp = Float64(Float64(z_m * Float64(z_m / y)) * Float64(-0.5)); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if (z_m <= 5.6e-163) tmp = (x * x) * (0.5 / y); elseif (z_m <= 1.8e+70) tmp = 0.5 * y; else tmp = (z_m * (z_m / y)) * -0.5; end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[z$95$m, 5.6e-163], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 1.8e+70], N[(0.5 * y), $MachinePrecision], N[(N[(z$95$m * N[(z$95$m / y), $MachinePrecision]), $MachinePrecision] * (-0.5)), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 5.6 \cdot 10^{-163}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\
\mathbf{elif}\;z\_m \leq 1.8 \cdot 10^{+70}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(z\_m \cdot \frac{z\_m}{y}\right) \cdot \left(-0.5\right)\\
\end{array}
\end{array}
if z < 5.5999999999999999e-163Initial program 70.0%
remove-double-neg70.0%
distribute-lft-neg-out70.0%
distribute-frac-neg270.0%
distribute-frac-neg70.0%
neg-mul-170.0%
distribute-lft-neg-out70.0%
*-commutative70.0%
distribute-lft-neg-in70.0%
times-frac69.6%
metadata-eval69.6%
metadata-eval69.6%
associate--l+69.6%
fma-define72.5%
Simplified72.5%
Taylor expanded in x around inf 30.2%
*-commutative30.2%
associate-*l/30.7%
associate-*r/30.7%
Simplified30.7%
unpow230.7%
Applied egg-rr30.7%
if 5.5999999999999999e-163 < z < 1.8e70Initial program 78.8%
remove-double-neg78.8%
distribute-lft-neg-out78.8%
distribute-frac-neg278.8%
distribute-frac-neg78.8%
neg-mul-178.8%
distribute-lft-neg-out78.8%
*-commutative78.8%
distribute-lft-neg-in78.8%
times-frac78.8%
metadata-eval78.8%
metadata-eval78.8%
associate--l+78.8%
fma-define78.8%
Simplified78.8%
Taylor expanded in y around inf 44.2%
if 1.8e70 < z 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-define79.1%
Simplified79.1%
fma-undefine72.5%
associate--l+72.5%
add-sqr-sqrt72.5%
difference-of-squares77.2%
hypot-define77.2%
hypot-define85.9%
Applied egg-rr85.9%
Taylor expanded in x around 0 77.3%
associate-/l*89.2%
Simplified89.2%
Taylor expanded in y around 0 76.9%
Taylor expanded in y around 0 76.1%
neg-mul-176.1%
distribute-neg-frac276.1%
Simplified76.1%
Final simplification41.0%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (if (<= (* x x) 5e+151) (* 0.5 (* (+ y z_m) (/ (- y z_m) y))) (* 0.5 (* (+ x z_m) (/ (- x z_m) y)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if ((x * x) <= 5e+151) {
tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
} else {
tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((x * x) <= 5d+151) then
tmp = 0.5d0 * ((y + z_m) * ((y - z_m) / y))
else
tmp = 0.5d0 * ((x + z_m) * ((x - z_m) / y))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if ((x * x) <= 5e+151) {
tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
} else {
tmp = 0.5 * ((x + z_m) * ((x - z_m) / y));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if (x * x) <= 5e+151: tmp = 0.5 * ((y + z_m) * ((y - z_m) / y)) else: tmp = 0.5 * ((x + z_m) * ((x - z_m) / y)) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (Float64(x * x) <= 5e+151) tmp = Float64(0.5 * Float64(Float64(y + z_m) * Float64(Float64(y - z_m) / y))); else tmp = Float64(0.5 * Float64(Float64(x + z_m) * Float64(Float64(x - z_m) / y))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if ((x * x) <= 5e+151) tmp = 0.5 * ((y + z_m) * ((y - z_m) / y)); else tmp = 0.5 * ((x + z_m) * ((x - z_m) / y)); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e+151], N[(0.5 * N[(N[(y + z$95$m), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + z$95$m), $MachinePrecision] * N[(N[(x - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+151}:\\
\;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\_m\right) \cdot \frac{x - z\_m}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 5.0000000000000002e151Initial program 79.4%
remove-double-neg79.4%
distribute-lft-neg-out79.4%
distribute-frac-neg279.4%
distribute-frac-neg79.4%
neg-mul-179.4%
distribute-lft-neg-out79.4%
*-commutative79.4%
distribute-lft-neg-in79.4%
times-frac79.4%
metadata-eval79.4%
metadata-eval79.4%
associate--l+79.4%
fma-define79.4%
Simplified79.4%
fma-undefine79.4%
associate--l+79.4%
add-sqr-sqrt79.4%
difference-of-squares79.6%
hypot-define80.2%
hypot-define80.8%
Applied egg-rr80.8%
Taylor expanded in x around 0 72.1%
associate-/l*91.1%
Simplified91.1%
if 5.0000000000000002e151 < (*.f64 x x) Initial program 59.8%
remove-double-neg59.8%
distribute-lft-neg-out59.8%
distribute-frac-neg259.8%
distribute-frac-neg59.8%
neg-mul-159.8%
distribute-lft-neg-out59.8%
*-commutative59.8%
distribute-lft-neg-in59.8%
times-frac59.0%
metadata-eval59.0%
metadata-eval59.0%
associate--l+59.0%
fma-define67.1%
Simplified67.1%
fma-undefine59.0%
associate--l+59.0%
add-sqr-sqrt59.0%
difference-of-squares68.5%
hypot-define73.6%
hypot-define76.6%
Applied egg-rr76.6%
Taylor expanded in y around 0 75.4%
associate-/l*85.0%
+-commutative85.0%
Simplified85.0%
Final simplification88.8%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (if (<= x 7e+176) (* 0.5 (* (+ y z_m) (/ (- y z_m) y))) (/ 0.5 (/ (/ y x) (+ x z_m)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (x <= 7e+176) {
tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
} else {
tmp = 0.5 / ((y / x) / (x + z_m));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (x <= 7d+176) then
tmp = 0.5d0 * ((y + z_m) * ((y - z_m) / y))
else
tmp = 0.5d0 / ((y / x) / (x + z_m))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if (x <= 7e+176) {
tmp = 0.5 * ((y + z_m) * ((y - z_m) / y));
} else {
tmp = 0.5 / ((y / x) / (x + z_m));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if x <= 7e+176: tmp = 0.5 * ((y + z_m) * ((y - z_m) / y)) else: tmp = 0.5 / ((y / x) / (x + z_m)) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (x <= 7e+176) tmp = Float64(0.5 * Float64(Float64(y + z_m) * Float64(Float64(y - z_m) / y))); else tmp = Float64(0.5 / Float64(Float64(y / x) / Float64(x + z_m))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if (x <= 7e+176) tmp = 0.5 * ((y + z_m) * ((y - z_m) / y)); else tmp = 0.5 / ((y / x) / (x + z_m)); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[x, 7e+176], N[(0.5 * N[(N[(y + z$95$m), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(N[(y / x), $MachinePrecision] / N[(x + z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{+176}:\\
\;\;\;\;0.5 \cdot \left(\left(y + z\_m\right) \cdot \frac{y - z\_m}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{\frac{y}{x}}{x + z\_m}}\\
\end{array}
\end{array}
if x < 7.00000000000000005e176Initial 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-define76.1%
Simplified76.1%
fma-undefine74.3%
associate--l+74.3%
add-sqr-sqrt74.3%
difference-of-squares76.7%
hypot-define78.0%
hypot-define79.3%
Applied egg-rr79.3%
Taylor expanded in x around 0 58.0%
associate-/l*74.6%
Simplified74.6%
if 7.00000000000000005e176 < x Initial program 45.6%
remove-double-neg45.6%
distribute-lft-neg-out45.6%
distribute-frac-neg245.6%
distribute-frac-neg45.6%
neg-mul-145.6%
distribute-lft-neg-out45.6%
*-commutative45.6%
distribute-lft-neg-in45.6%
times-frac45.6%
metadata-eval45.6%
metadata-eval45.6%
associate--l+45.6%
fma-define61.6%
Simplified61.6%
clear-num61.6%
un-div-inv61.6%
fma-undefine45.6%
associate--l+45.6%
add-sqr-sqrt45.6%
pow245.6%
hypot-define45.6%
pow245.6%
Applied egg-rr45.6%
*-un-lft-identity45.6%
unpow245.6%
unpow245.6%
difference-of-squares78.1%
times-frac99.9%
Applied egg-rr99.9%
associate-*l/100.0%
*-lft-identity100.0%
hypot-undefine74.1%
unpow274.1%
unpow274.1%
+-commutative74.1%
unpow274.1%
unpow274.1%
hypot-define100.0%
+-commutative100.0%
hypot-undefine66.1%
unpow266.1%
unpow266.1%
+-commutative66.1%
unpow266.1%
unpow266.1%
hypot-define100.0%
Simplified100.0%
Taylor expanded in x around inf 92.3%
Taylor expanded in y around 0 74.1%
associate-/r*92.2%
+-commutative92.2%
Simplified92.2%
Final simplification76.3%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (if (<= x 6.6e+75) (* 0.5 y) (* (* x x) (/ 0.5 y))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (x <= 6.6e+75) {
tmp = 0.5 * y;
} else {
tmp = (x * x) * (0.5 / y);
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (x <= 6.6d+75) then
tmp = 0.5d0 * y
else
tmp = (x * x) * (0.5d0 / y)
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if (x <= 6.6e+75) {
tmp = 0.5 * y;
} else {
tmp = (x * x) * (0.5 / y);
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if x <= 6.6e+75: tmp = 0.5 * y else: tmp = (x * x) * (0.5 / y) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (x <= 6.6e+75) tmp = Float64(0.5 * y); else tmp = Float64(Float64(x * x) * Float64(0.5 / y)); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if (x <= 6.6e+75) tmp = 0.5 * y; else tmp = (x * x) * (0.5 / y); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[x, 6.6e+75], N[(0.5 * y), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.6 \cdot 10^{+75}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\
\end{array}
\end{array}
if x < 6.59999999999999996e75Initial program 74.1%
remove-double-neg74.1%
distribute-lft-neg-out74.1%
distribute-frac-neg274.1%
distribute-frac-neg74.1%
neg-mul-174.1%
distribute-lft-neg-out74.1%
*-commutative74.1%
distribute-lft-neg-in74.1%
times-frac73.7%
metadata-eval73.7%
metadata-eval73.7%
associate--l+73.7%
fma-define75.2%
Simplified75.2%
Taylor expanded in y around inf 36.4%
if 6.59999999999999996e75 < x Initial program 63.4%
remove-double-neg63.4%
distribute-lft-neg-out63.4%
distribute-frac-neg263.4%
distribute-frac-neg63.4%
neg-mul-163.4%
distribute-lft-neg-out63.4%
*-commutative63.4%
distribute-lft-neg-in63.4%
times-frac63.4%
metadata-eval63.4%
metadata-eval63.4%
associate--l+63.4%
fma-define72.8%
Simplified72.8%
Taylor expanded in x around inf 50.6%
*-commutative50.6%
associate-*l/50.6%
associate-*r/50.7%
Simplified50.7%
unpow250.7%
Applied egg-rr50.7%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (if (<= x 2.35e+207) (* 0.5 y) (* 0.5 (* x (/ z_m y)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (x <= 2.35e+207) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (x * (z_m / y));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (x <= 2.35d+207) then
tmp = 0.5d0 * y
else
tmp = 0.5d0 * (x * (z_m / y))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if (x <= 2.35e+207) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (x * (z_m / y));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if x <= 2.35e+207: tmp = 0.5 * y else: tmp = 0.5 * (x * (z_m / y)) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (x <= 2.35e+207) tmp = Float64(0.5 * y); else tmp = Float64(0.5 * Float64(x * Float64(z_m / y))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if (x <= 2.35e+207) tmp = 0.5 * y; else tmp = 0.5 * (x * (z_m / y)); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[x, 2.35e+207], N[(0.5 * y), $MachinePrecision], N[(0.5 * N[(x * N[(z$95$m / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.35 \cdot 10^{+207}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{z\_m}{y}\right)\\
\end{array}
\end{array}
if x < 2.34999999999999988e207Initial 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-define75.8%
Simplified75.8%
Taylor expanded in y around inf 34.0%
if 2.34999999999999988e207 < x Initial program 51.4%
remove-double-neg51.4%
distribute-lft-neg-out51.4%
distribute-frac-neg251.4%
distribute-frac-neg51.4%
neg-mul-151.4%
distribute-lft-neg-out51.4%
*-commutative51.4%
distribute-lft-neg-in51.4%
times-frac51.4%
metadata-eval51.4%
metadata-eval51.4%
associate--l+51.4%
fma-define61.4%
Simplified61.4%
clear-num61.4%
un-div-inv61.4%
fma-undefine51.4%
associate--l+51.4%
add-sqr-sqrt51.4%
pow251.4%
hypot-define51.4%
pow251.4%
Applied egg-rr51.4%
*-un-lft-identity51.4%
unpow251.4%
unpow251.4%
difference-of-squares82.0%
times-frac99.9%
Applied egg-rr99.9%
associate-*l/100.0%
*-lft-identity100.0%
hypot-undefine82.0%
unpow282.0%
unpow282.0%
+-commutative82.0%
unpow282.0%
unpow282.0%
hypot-define100.0%
+-commutative100.0%
hypot-undefine72.0%
unpow272.0%
unpow272.0%
+-commutative72.0%
unpow272.0%
unpow272.0%
hypot-define100.0%
Simplified100.0%
Taylor expanded in x around inf 95.3%
Taylor expanded in z around inf 25.5%
associate-/l*25.5%
Simplified25.5%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (* 0.5 y))
z_m = fabs(z);
double code(double x, double y, double z_m) {
return 0.5 * y;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = 0.5d0 * y
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
return 0.5 * y;
}
z_m = math.fabs(z) def code(x, y, z_m): return 0.5 * y
z_m = abs(z) function code(x, y, z_m) return Float64(0.5 * y) end
z_m = abs(z); function tmp = code(x, y, z_m) tmp = 0.5 * y; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := N[(0.5 * y), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
0.5 \cdot y
\end{array}
Initial program 71.9%
remove-double-neg71.9%
distribute-lft-neg-out71.9%
distribute-frac-neg271.9%
distribute-frac-neg71.9%
neg-mul-171.9%
distribute-lft-neg-out71.9%
*-commutative71.9%
distribute-lft-neg-in71.9%
times-frac71.5%
metadata-eval71.5%
metadata-eval71.5%
associate--l+71.5%
fma-define74.7%
Simplified74.7%
Taylor expanded in y around inf 31.9%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (* 0.5 x))
z_m = fabs(z);
double code(double x, double y, double z_m) {
return 0.5 * x;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = 0.5d0 * x
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
return 0.5 * x;
}
z_m = math.fabs(z) def code(x, y, z_m): return 0.5 * x
z_m = abs(z) function code(x, y, z_m) return Float64(0.5 * x) end
z_m = abs(z); function tmp = code(x, y, z_m) tmp = 0.5 * x; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := N[(0.5 * x), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
0.5 \cdot x
\end{array}
Initial program 71.9%
remove-double-neg71.9%
distribute-lft-neg-out71.9%
distribute-frac-neg271.9%
distribute-frac-neg71.9%
neg-mul-171.9%
distribute-lft-neg-out71.9%
*-commutative71.9%
distribute-lft-neg-in71.9%
times-frac71.5%
metadata-eval71.5%
metadata-eval71.5%
associate--l+71.5%
fma-define74.7%
Simplified74.7%
clear-num74.5%
un-div-inv74.9%
fma-undefine71.7%
associate--l+71.7%
add-sqr-sqrt71.7%
pow271.7%
hypot-define71.7%
pow271.7%
Applied egg-rr71.7%
*-un-lft-identity71.7%
unpow271.7%
unpow271.7%
difference-of-squares79.4%
times-frac99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
hypot-undefine79.2%
unpow279.2%
unpow279.2%
+-commutative79.2%
unpow279.2%
unpow279.2%
hypot-define99.8%
+-commutative99.8%
hypot-undefine78.5%
unpow278.5%
unpow278.5%
+-commutative78.5%
unpow278.5%
unpow278.5%
hypot-define99.8%
Simplified99.8%
Taylor expanded in x around inf 23.0%
Taylor expanded in y around inf 3.0%
(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 2024133
(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)))