
(FPCore (x y z t) :precision binary64 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * x) / (y * y)) + ((z * z) / (t * t))
end function
public static double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
def code(x, y, z, t): return ((x * x) / (y * y)) + ((z * z) / (t * t))
function code(x, y, z, t) return Float64(Float64(Float64(x * x) / Float64(y * y)) + Float64(Float64(z * z) / Float64(t * t))) end
function tmp = code(x, y, z, t) tmp = ((x * x) / (y * y)) + ((z * z) / (t * t)); end
code[x_, y_, z_, t_] := N[(N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * x) / (y * y)) + ((z * z) / (t * t))
end function
public static double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
def code(x, y, z, t): return ((x * x) / (y * y)) + ((z * z) / (t * t))
function code(x, y, z, t) return Float64(Float64(Float64(x * x) / Float64(y * y)) + Float64(Float64(z * z) / Float64(t * t))) end
function tmp = code(x, y, z, t) tmp = ((x * x) / (y * y)) + ((z * z) / (t * t)); end
code[x_, y_, z_, t_] := N[(N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\end{array}
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (/ (* z_m z_m) (* t t)) 1e+292) (+ (* z_m (/ (/ z_m t) t)) (/ (/ x y) (/ y x))) (+ (/ (* x (/ x y)) y) (* (/ z_m t) (* (sqrt z_m) (/ (sqrt z_m) t))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (((z_m * z_m) / (t * t)) <= 1e+292) {
tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
} else {
tmp = ((x * (x / y)) / y) + ((z_m / t) * (sqrt(z_m) * (sqrt(z_m) / t)));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (((z_m * z_m) / (t * t)) <= 1d+292) then
tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
else
tmp = ((x * (x / y)) / y) + ((z_m / t) * (sqrt(z_m) * (sqrt(z_m) / t)))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (((z_m * z_m) / (t * t)) <= 1e+292) {
tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
} else {
tmp = ((x * (x / y)) / y) + ((z_m / t) * (Math.sqrt(z_m) * (Math.sqrt(z_m) / t)));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if ((z_m * z_m) / (t * t)) <= 1e+292: tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x)) else: tmp = ((x * (x / y)) / y) + ((z_m / t) * (math.sqrt(z_m) * (math.sqrt(z_m) / t))) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(Float64(z_m * z_m) / Float64(t * t)) <= 1e+292) tmp = Float64(Float64(z_m * Float64(Float64(z_m / t) / t)) + Float64(Float64(x / y) / Float64(y / x))); else tmp = Float64(Float64(Float64(x * Float64(x / y)) / y) + Float64(Float64(z_m / t) * Float64(sqrt(z_m) * Float64(sqrt(z_m) / t)))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if (((z_m * z_m) / (t * t)) <= 1e+292) tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x)); else tmp = ((x * (x / y)) / y) + ((z_m / t) * (sqrt(z_m) * (sqrt(z_m) / t))); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision], 1e+292], N[(N[(z$95$m * N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(N[(z$95$m / t), $MachinePrecision] * N[(N[Sqrt[z$95$m], $MachinePrecision] * N[(N[Sqrt[z$95$m], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{z\_m \cdot z\_m}{t \cdot t} \leq 10^{+292}:\\
\;\;\;\;z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{x}{y}}{y} + \frac{z\_m}{t} \cdot \left(\sqrt{z\_m} \cdot \frac{\sqrt{z\_m}}{t}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 1e292Initial program 73.5%
associate-/l*79.1%
fma-define79.1%
associate-/l*81.7%
Simplified81.7%
fma-undefine81.7%
associate-/l*75.9%
+-commutative75.9%
associate-/r*77.9%
associate-/l*84.4%
Applied egg-rr84.4%
associate-*r/77.9%
frac-times99.6%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
if 1e292 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 55.3%
add-sqr-sqrt55.3%
associate-*r/55.3%
times-frac69.5%
sqrt-prod36.8%
add-sqr-sqrt39.7%
associate-*r/38.9%
associate-*r/28.9%
times-frac49.9%
sqrt-prod43.5%
add-sqr-sqrt82.0%
Applied egg-rr82.0%
add-sqr-sqrt81.9%
times-frac81.9%
sqrt-prod48.8%
add-sqr-sqrt66.3%
associate-*r/66.3%
times-frac79.8%
sqrt-prod56.2%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
*-commutative97.2%
associate-*r/92.4%
add-sqr-sqrt92.3%
sqrt-prod88.3%
associate-*r*85.8%
*-commutative85.8%
sqrt-prod45.2%
Applied egg-rr48.6%
associate-*l*50.2%
Simplified50.2%
Final simplification77.5%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (/ (* z_m z_m) (* t t)) 5e-22) (+ (* z_m (/ (/ z_m t) t)) (/ (/ x y) (/ y x))) (+ (/ (* x (/ x y)) y) (/ 1.0 (* (/ t z_m) (/ t z_m))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (((z_m * z_m) / (t * t)) <= 5e-22) {
tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
} else {
tmp = ((x * (x / y)) / y) + (1.0 / ((t / z_m) * (t / z_m)));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (((z_m * z_m) / (t * t)) <= 5d-22) then
tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
else
tmp = ((x * (x / y)) / y) + (1.0d0 / ((t / z_m) * (t / 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 t) {
double tmp;
if (((z_m * z_m) / (t * t)) <= 5e-22) {
tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
} else {
tmp = ((x * (x / y)) / y) + (1.0 / ((t / z_m) * (t / z_m)));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if ((z_m * z_m) / (t * t)) <= 5e-22: tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x)) else: tmp = ((x * (x / y)) / y) + (1.0 / ((t / z_m) * (t / z_m))) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(Float64(z_m * z_m) / Float64(t * t)) <= 5e-22) tmp = Float64(Float64(z_m * Float64(Float64(z_m / t) / t)) + Float64(Float64(x / y) / Float64(y / x))); else tmp = Float64(Float64(Float64(x * Float64(x / y)) / y) + Float64(1.0 / Float64(Float64(t / z_m) * Float64(t / z_m)))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if (((z_m * z_m) / (t * t)) <= 5e-22) tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x)); else tmp = ((x * (x / y)) / y) + (1.0 / ((t / z_m) * (t / z_m))); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision], 5e-22], N[(N[(z$95$m * N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(1.0 / N[(N[(t / z$95$m), $MachinePrecision] * N[(t / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{z\_m \cdot z\_m}{t \cdot t} \leq 5 \cdot 10^{-22}:\\
\;\;\;\;z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{x}{y}}{y} + \frac{1}{\frac{t}{z\_m} \cdot \frac{t}{z\_m}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 4.99999999999999954e-22Initial program 74.6%
associate-/l*79.3%
fma-define79.3%
associate-/l*82.4%
Simplified82.4%
fma-undefine82.4%
associate-/l*77.5%
+-commutative77.5%
associate-/r*79.8%
associate-/l*84.9%
Applied egg-rr84.9%
associate-*r/79.8%
frac-times99.6%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
if 4.99999999999999954e-22 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 57.1%
add-sqr-sqrt57.1%
associate-*r/57.1%
times-frac69.1%
sqrt-prod34.1%
add-sqr-sqrt41.0%
associate-*r/40.4%
associate-*r/31.9%
times-frac49.6%
sqrt-prod39.8%
add-sqr-sqrt79.6%
Applied egg-rr79.6%
add-sqr-sqrt79.6%
times-frac79.6%
sqrt-prod46.4%
add-sqr-sqrt64.1%
associate-*r/64.1%
times-frac78.7%
sqrt-prod54.9%
add-sqr-sqrt97.5%
Applied egg-rr97.5%
clear-num97.5%
*-un-lft-identity97.5%
times-frac99.6%
clear-num99.6%
Applied egg-rr99.6%
Final simplification99.7%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= t 2e-199) (+ (* (/ x y) (/ x y)) (/ (* z_m (/ z_m t)) t)) (+ (* z_m (/ (/ z_m t) t)) (/ (/ x y) (/ y x)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (t <= 2e-199) {
tmp = ((x / y) * (x / y)) + ((z_m * (z_m / t)) / t);
} else {
tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 2d-199) then
tmp = ((x / y) * (x / y)) + ((z_m * (z_m / t)) / t)
else
tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (t <= 2e-199) {
tmp = ((x / y) * (x / y)) + ((z_m * (z_m / t)) / t);
} else {
tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if t <= 2e-199: tmp = ((x / y) * (x / y)) + ((z_m * (z_m / t)) / t) else: tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x)) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (t <= 2e-199) tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + Float64(Float64(z_m * Float64(z_m / t)) / t)); else tmp = Float64(Float64(z_m * Float64(Float64(z_m / t) / t)) + Float64(Float64(x / y) / Float64(y / x))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if (t <= 2e-199) tmp = ((x / y) * (x / y)) + ((z_m * (z_m / t)) / t); else tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x)); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[t, 2e-199], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + N[(N[(z$95$m * N[(z$95$m / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z$95$m * N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2 \cdot 10^{-199}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \frac{z\_m \cdot \frac{z\_m}{t}}{t}\\
\mathbf{else}:\\
\;\;\;\;z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < 1.99999999999999996e-199Initial program 61.5%
add-sqr-sqrt61.5%
associate-*r/61.5%
times-frac70.7%
sqrt-prod40.6%
add-sqr-sqrt52.9%
associate-*r/52.3%
associate-*r/46.5%
times-frac60.1%
sqrt-prod45.3%
add-sqr-sqrt76.6%
Applied egg-rr76.6%
times-frac97.3%
Applied egg-rr97.3%
if 1.99999999999999996e-199 < t Initial program 71.9%
associate-/l*76.3%
fma-define76.3%
associate-/l*81.6%
Simplified81.6%
fma-undefine81.6%
associate-/l*77.2%
+-commutative77.2%
associate-/r*84.3%
associate-/l*88.7%
Applied egg-rr88.7%
associate-*r/84.3%
frac-times99.7%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification98.2%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (+ (* z_m (/ (/ z_m t) t)) (/ (/ x y) (/ y x))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
return (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
}
z_m = math.fabs(z) def code(x, y, z_m, t): return (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
z_m = abs(z) function code(x, y, z_m, t) return Float64(Float64(z_m * Float64(Float64(z_m / t) / t)) + Float64(Float64(x / y) / Float64(y / x))) end
z_m = abs(z); function tmp = code(x, y, z_m, t) tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x)); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(N[(z$95$m * N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}}
\end{array}
Initial program 65.3%
associate-/l*72.7%
fma-define72.7%
associate-/l*80.6%
Simplified80.6%
fma-undefine80.6%
associate-/l*73.1%
+-commutative73.1%
associate-/r*78.6%
associate-/l*86.9%
Applied egg-rr86.9%
associate-*r/78.6%
frac-times96.4%
clear-num96.4%
un-div-inv96.5%
Applied egg-rr96.5%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (+ (* z_m (/ (/ z_m t) t)) (* x (/ x (* y y)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return (z_m * ((z_m / t) / t)) + (x * (x / (y * y)));
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = (z_m * ((z_m / t) / t)) + (x * (x / (y * y)))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
return (z_m * ((z_m / t) / t)) + (x * (x / (y * y)));
}
z_m = math.fabs(z) def code(x, y, z_m, t): return (z_m * ((z_m / t) / t)) + (x * (x / (y * y)))
z_m = abs(z) function code(x, y, z_m, t) return Float64(Float64(z_m * Float64(Float64(z_m / t) / t)) + Float64(x * Float64(x / Float64(y * y)))) end
z_m = abs(z); function tmp = code(x, y, z_m, t) tmp = (z_m * ((z_m / t) / t)) + (x * (x / (y * y))); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(N[(z$95$m * N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z\_m \cdot \frac{\frac{z\_m}{t}}{t} + x \cdot \frac{x}{y \cdot y}
\end{array}
Initial program 65.3%
associate-/l*72.7%
fma-define72.7%
associate-/l*80.6%
Simplified80.6%
fma-undefine80.6%
associate-/l*73.1%
+-commutative73.1%
associate-/r*78.6%
associate-/l*86.9%
Applied egg-rr86.9%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (+ (* x (/ x (* y y))) (* z_m (/ z_m (* t t)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return (x * (x / (y * y))) + (z_m * (z_m / (t * t)));
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = (x * (x / (y * y))) + (z_m * (z_m / (t * t)))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
return (x * (x / (y * y))) + (z_m * (z_m / (t * t)));
}
z_m = math.fabs(z) def code(x, y, z_m, t): return (x * (x / (y * y))) + (z_m * (z_m / (t * t)))
z_m = abs(z) function code(x, y, z_m, t) return Float64(Float64(x * Float64(x / Float64(y * y))) + Float64(z_m * Float64(z_m / Float64(t * t)))) end
z_m = abs(z); function tmp = code(x, y, z_m, t) tmp = (x * (x / (y * y))) + (z_m * (z_m / (t * t))); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(N[(x * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z$95$m * N[(z$95$m / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x \cdot \frac{x}{y \cdot y} + z\_m \cdot \frac{z\_m}{t \cdot t}
\end{array}
Initial program 65.3%
associate-/l*72.7%
fma-define72.7%
associate-/l*80.6%
Simplified80.6%
fma-undefine80.6%
associate-/l*73.1%
+-commutative73.1%
associate-/r*78.6%
associate-/l*86.9%
Applied egg-rr86.9%
associate-/l/80.6%
Applied egg-rr80.6%
Final simplification80.6%
(FPCore (x y z t) :precision binary64 (+ (pow (/ x y) 2.0) (pow (/ z t) 2.0)))
double code(double x, double y, double z, double t) {
return pow((x / y), 2.0) + pow((z / t), 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x / y) ** 2.0d0) + ((z / t) ** 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return Math.pow((x / y), 2.0) + Math.pow((z / t), 2.0);
}
def code(x, y, z, t): return math.pow((x / y), 2.0) + math.pow((z / t), 2.0)
function code(x, y, z, t) return Float64((Float64(x / y) ^ 2.0) + (Float64(z / t) ^ 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x / y) ^ 2.0) + ((z / t) ^ 2.0); end
code[x_, y_, z_, t_] := N[(N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(z / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2}
\end{array}
herbie shell --seed 2024097
(FPCore (x y z t)
:name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
:precision binary64
:alt
(+ (pow (/ x y) 2.0) (pow (/ z t) 2.0))
(+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))