
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 2700000.0) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (fabs (fma x (/ z y_m) (/ (- -4.0 x) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 2700000.0) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = fabs(fma(x, (z / y_m), ((-4.0 - x) / y_m)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 2700000.0) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); else tmp = abs(fma(x, Float64(z / y_m), Float64(Float64(-4.0 - x) / y_m))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 2700000.0], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 2700000:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y\_m}, \frac{-4 - x}{y\_m}\right)\right|\\
\end{array}
\end{array}
if y < 2.7e6Initial program 89.3%
associate-*l/93.1%
sub-div99.0%
Applied egg-rr99.0%
if 2.7e6 < y Initial program 96.2%
fabs-sub96.2%
associate-*l/90.7%
associate-*r/99.8%
fma-neg99.8%
distribute-neg-frac99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.1%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ x y_m))) (t_1 (fabs (* z (/ x y_m)))))
(if (<= x -2.45e+82)
t_0
(if (<= x -1.06e-42)
t_1
(if (<= x 1e-112) (fabs (/ 4.0 y_m)) (if (<= x 2.95e+54) t_1 t_0))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((x / y_m));
double t_1 = fabs((z * (x / y_m)));
double tmp;
if (x <= -2.45e+82) {
tmp = t_0;
} else if (x <= -1.06e-42) {
tmp = t_1;
} else if (x <= 1e-112) {
tmp = fabs((4.0 / y_m));
} else if (x <= 2.95e+54) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((x / y_m))
t_1 = abs((z * (x / y_m)))
if (x <= (-2.45d+82)) then
tmp = t_0
else if (x <= (-1.06d-42)) then
tmp = t_1
else if (x <= 1d-112) then
tmp = abs((4.0d0 / y_m))
else if (x <= 2.95d+54) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs((x / y_m));
double t_1 = Math.abs((z * (x / y_m)));
double tmp;
if (x <= -2.45e+82) {
tmp = t_0;
} else if (x <= -1.06e-42) {
tmp = t_1;
} else if (x <= 1e-112) {
tmp = Math.abs((4.0 / y_m));
} else if (x <= 2.95e+54) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((x / y_m)) t_1 = math.fabs((z * (x / y_m))) tmp = 0 if x <= -2.45e+82: tmp = t_0 elif x <= -1.06e-42: tmp = t_1 elif x <= 1e-112: tmp = math.fabs((4.0 / y_m)) elif x <= 2.95e+54: tmp = t_1 else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(x / y_m)) t_1 = abs(Float64(z * Float64(x / y_m))) tmp = 0.0 if (x <= -2.45e+82) tmp = t_0; elseif (x <= -1.06e-42) tmp = t_1; elseif (x <= 1e-112) tmp = abs(Float64(4.0 / y_m)); elseif (x <= 2.95e+54) tmp = t_1; else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((x / y_m)); t_1 = abs((z * (x / y_m))); tmp = 0.0; if (x <= -2.45e+82) tmp = t_0; elseif (x <= -1.06e-42) tmp = t_1; elseif (x <= 1e-112) tmp = abs((4.0 / y_m)); elseif (x <= 2.95e+54) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.45e+82], t$95$0, If[LessEqual[x, -1.06e-42], t$95$1, If[LessEqual[x, 1e-112], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2.95e+54], t$95$1, t$95$0]]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y\_m}\right|\\
t_1 := \left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{if}\;x \leq -2.45 \cdot 10^{+82}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.06 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 10^{-112}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{elif}\;x \leq 2.95 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.45e82 or 2.9499999999999999e54 < x Initial program 79.9%
*-commutative79.9%
clear-num79.9%
un-div-inv79.9%
Applied egg-rr79.9%
frac-sub75.4%
associate-/r*85.1%
*-commutative85.1%
Applied egg-rr85.1%
Taylor expanded in z around 0 77.8%
Taylor expanded in x around inf 77.9%
if -2.45e82 < x < -1.0600000000000001e-42 or 9.9999999999999995e-113 < x < 2.9499999999999999e54Initial program 99.9%
Simplified99.6%
Taylor expanded in z around inf 61.8%
associate-*r/61.8%
neg-mul-161.8%
distribute-lft-neg-in61.8%
*-commutative61.8%
associate-*r/61.9%
Simplified61.9%
clear-num61.8%
un-div-inv61.7%
add-sqr-sqrt22.3%
sqrt-unprod61.7%
sqr-neg61.7%
sqrt-unprod39.3%
add-sqr-sqrt61.7%
Applied egg-rr61.7%
associate-/r/57.3%
associate-*l/61.8%
associate-/l*61.9%
Simplified61.9%
if -1.0600000000000001e-42 < x < 9.9999999999999995e-113Initial program 96.1%
Simplified99.8%
Taylor expanded in x around 0 78.1%
Final simplification74.2%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= z -1.3e+93)
(fabs (/ x (/ y_m z)))
(if (<= z 9.5e+21)
(fabs (/ (- x -4.0) y_m))
(fabs (* (- 1.0 z) (/ x y_m))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -1.3e+93) {
tmp = fabs((x / (y_m / z)));
} else if (z <= 9.5e+21) {
tmp = fabs(((x - -4.0) / y_m));
} else {
tmp = fabs(((1.0 - z) * (x / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.3d+93)) then
tmp = abs((x / (y_m / z)))
else if (z <= 9.5d+21) then
tmp = abs(((x - (-4.0d0)) / y_m))
else
tmp = abs(((1.0d0 - z) * (x / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (z <= -1.3e+93) {
tmp = Math.abs((x / (y_m / z)));
} else if (z <= 9.5e+21) {
tmp = Math.abs(((x - -4.0) / y_m));
} else {
tmp = Math.abs(((1.0 - z) * (x / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -1.3e+93: tmp = math.fabs((x / (y_m / z))) elif z <= 9.5e+21: tmp = math.fabs(((x - -4.0) / y_m)) else: tmp = math.fabs(((1.0 - z) * (x / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -1.3e+93) tmp = abs(Float64(x / Float64(y_m / z))); elseif (z <= 9.5e+21) tmp = abs(Float64(Float64(x - -4.0) / y_m)); else tmp = abs(Float64(Float64(1.0 - z) * Float64(x / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -1.3e+93) tmp = abs((x / (y_m / z))); elseif (z <= 9.5e+21) tmp = abs(((x - -4.0) / y_m)); else tmp = abs(((1.0 - z) * (x / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -1.3e+93], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 9.5e+21], N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(1.0 - z), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+93}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+21}:\\
\;\;\;\;\left|\frac{x - -4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if z < -1.3e93Initial program 93.0%
Simplified92.7%
Taylor expanded in z around inf 82.8%
mul-1-neg82.8%
associate-*r/83.0%
Simplified83.0%
clear-num82.9%
un-div-inv83.1%
Applied egg-rr83.1%
if -1.3e93 < z < 9.500000000000001e21Initial program 92.9%
fabs-sub92.9%
associate-*l/98.0%
associate-*r/98.1%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 95.5%
associate-*r/95.5%
distribute-lft-in95.5%
metadata-eval95.5%
neg-mul-195.5%
sub-neg95.5%
Simplified95.5%
if 9.500000000000001e21 < z Initial program 85.0%
Simplified93.3%
Taylor expanded in x around -inf 78.9%
*-commutative78.9%
associate-/l*83.7%
neg-mul-183.7%
unsub-neg83.7%
Simplified83.7%
Final simplification90.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -7.5e+94) (fabs (/ (* x z) y_m)) (if (<= z 1.8e+15) (fabs (/ (- x -4.0) y_m)) (fabs (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -7.5e+94) {
tmp = fabs(((x * z) / y_m));
} else if (z <= 1.8e+15) {
tmp = fabs(((x - -4.0) / y_m));
} else {
tmp = fabs((z * (x / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-7.5d+94)) then
tmp = abs(((x * z) / y_m))
else if (z <= 1.8d+15) then
tmp = abs(((x - (-4.0d0)) / y_m))
else
tmp = abs((z * (x / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (z <= -7.5e+94) {
tmp = Math.abs(((x * z) / y_m));
} else if (z <= 1.8e+15) {
tmp = Math.abs(((x - -4.0) / y_m));
} else {
tmp = Math.abs((z * (x / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -7.5e+94: tmp = math.fabs(((x * z) / y_m)) elif z <= 1.8e+15: tmp = math.fabs(((x - -4.0) / y_m)) else: tmp = math.fabs((z * (x / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -7.5e+94) tmp = abs(Float64(Float64(x * z) / y_m)); elseif (z <= 1.8e+15) tmp = abs(Float64(Float64(x - -4.0) / y_m)); else tmp = abs(Float64(z * Float64(x / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -7.5e+94) tmp = abs(((x * z) / y_m)); elseif (z <= 1.8e+15) tmp = abs(((x - -4.0) / y_m)); else tmp = abs((z * (x / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -7.5e+94], N[Abs[N[(N[(x * z), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1.8e+15], N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+94}:\\
\;\;\;\;\left|\frac{x \cdot z}{y\_m}\right|\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+15}:\\
\;\;\;\;\left|\frac{x - -4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if z < -7.49999999999999978e94Initial program 93.0%
Simplified92.7%
Taylor expanded in z around inf 82.8%
associate-*r/82.8%
neg-mul-182.8%
distribute-lft-neg-in82.8%
*-commutative82.8%
associate-*r/82.5%
Simplified82.5%
add-sqr-sqrt33.9%
sqrt-unprod71.8%
sqr-neg71.8%
sqrt-unprod48.5%
add-sqr-sqrt82.5%
associate-/l*82.8%
*-commutative82.8%
Applied egg-rr82.8%
if -7.49999999999999978e94 < z < 1.8e15Initial program 92.9%
fabs-sub92.9%
associate-*l/98.0%
associate-*r/98.1%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 95.5%
associate-*r/95.5%
distribute-lft-in95.5%
metadata-eval95.5%
neg-mul-195.5%
sub-neg95.5%
Simplified95.5%
if 1.8e15 < z Initial program 85.0%
Simplified93.3%
Taylor expanded in z around inf 78.9%
associate-*r/78.9%
neg-mul-178.9%
distribute-lft-neg-in78.9%
*-commutative78.9%
associate-*r/83.7%
Simplified83.7%
clear-num83.4%
un-div-inv83.5%
add-sqr-sqrt33.2%
sqrt-unprod64.2%
sqr-neg64.2%
sqrt-unprod50.0%
add-sqr-sqrt83.5%
Applied egg-rr83.5%
associate-/r/76.2%
associate-*l/78.9%
associate-/l*83.7%
Simplified83.7%
Final simplification90.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -3.45e+93) (fabs (* x (/ z y_m))) (if (<= z 1.6e+25) (fabs (/ (- x -4.0) y_m)) (fabs (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -3.45e+93) {
tmp = fabs((x * (z / y_m)));
} else if (z <= 1.6e+25) {
tmp = fabs(((x - -4.0) / y_m));
} else {
tmp = fabs((z * (x / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-3.45d+93)) then
tmp = abs((x * (z / y_m)))
else if (z <= 1.6d+25) then
tmp = abs(((x - (-4.0d0)) / y_m))
else
tmp = abs((z * (x / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (z <= -3.45e+93) {
tmp = Math.abs((x * (z / y_m)));
} else if (z <= 1.6e+25) {
tmp = Math.abs(((x - -4.0) / y_m));
} else {
tmp = Math.abs((z * (x / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -3.45e+93: tmp = math.fabs((x * (z / y_m))) elif z <= 1.6e+25: tmp = math.fabs(((x - -4.0) / y_m)) else: tmp = math.fabs((z * (x / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -3.45e+93) tmp = abs(Float64(x * Float64(z / y_m))); elseif (z <= 1.6e+25) tmp = abs(Float64(Float64(x - -4.0) / y_m)); else tmp = abs(Float64(z * Float64(x / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -3.45e+93) tmp = abs((x * (z / y_m))); elseif (z <= 1.6e+25) tmp = abs(((x - -4.0) / y_m)); else tmp = abs((z * (x / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -3.45e+93], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1.6e+25], N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.45 \cdot 10^{+93}:\\
\;\;\;\;\left|x \cdot \frac{z}{y\_m}\right|\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+25}:\\
\;\;\;\;\left|\frac{x - -4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if z < -3.4499999999999998e93Initial program 93.0%
Simplified92.7%
Taylor expanded in z around inf 82.8%
mul-1-neg82.8%
associate-*r/83.0%
Simplified83.0%
if -3.4499999999999998e93 < z < 1.6e25Initial program 92.9%
fabs-sub92.9%
associate-*l/98.0%
associate-*r/98.1%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 95.5%
associate-*r/95.5%
distribute-lft-in95.5%
metadata-eval95.5%
neg-mul-195.5%
sub-neg95.5%
Simplified95.5%
if 1.6e25 < z Initial program 85.0%
Simplified93.3%
Taylor expanded in z around inf 78.9%
associate-*r/78.9%
neg-mul-178.9%
distribute-lft-neg-in78.9%
*-commutative78.9%
associate-*r/83.7%
Simplified83.7%
clear-num83.4%
un-div-inv83.5%
add-sqr-sqrt33.2%
sqrt-unprod64.2%
sqr-neg64.2%
sqrt-unprod50.0%
add-sqr-sqrt83.5%
Applied egg-rr83.5%
associate-/r/76.2%
associate-*l/78.9%
associate-/l*83.7%
Simplified83.7%
Final simplification90.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -1.95e+92) (fabs (/ x (/ y_m z))) (if (<= z 1.85e+25) (fabs (/ (- x -4.0) y_m)) (fabs (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -1.95e+92) {
tmp = fabs((x / (y_m / z)));
} else if (z <= 1.85e+25) {
tmp = fabs(((x - -4.0) / y_m));
} else {
tmp = fabs((z * (x / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.95d+92)) then
tmp = abs((x / (y_m / z)))
else if (z <= 1.85d+25) then
tmp = abs(((x - (-4.0d0)) / y_m))
else
tmp = abs((z * (x / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (z <= -1.95e+92) {
tmp = Math.abs((x / (y_m / z)));
} else if (z <= 1.85e+25) {
tmp = Math.abs(((x - -4.0) / y_m));
} else {
tmp = Math.abs((z * (x / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -1.95e+92: tmp = math.fabs((x / (y_m / z))) elif z <= 1.85e+25: tmp = math.fabs(((x - -4.0) / y_m)) else: tmp = math.fabs((z * (x / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -1.95e+92) tmp = abs(Float64(x / Float64(y_m / z))); elseif (z <= 1.85e+25) tmp = abs(Float64(Float64(x - -4.0) / y_m)); else tmp = abs(Float64(z * Float64(x / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -1.95e+92) tmp = abs((x / (y_m / z))); elseif (z <= 1.85e+25) tmp = abs(((x - -4.0) / y_m)); else tmp = abs((z * (x / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -1.95e+92], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1.85e+25], N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+92}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+25}:\\
\;\;\;\;\left|\frac{x - -4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if z < -1.95000000000000006e92Initial program 93.0%
Simplified92.7%
Taylor expanded in z around inf 82.8%
mul-1-neg82.8%
associate-*r/83.0%
Simplified83.0%
clear-num82.9%
un-div-inv83.1%
Applied egg-rr83.1%
if -1.95000000000000006e92 < z < 1.8499999999999999e25Initial program 92.9%
fabs-sub92.9%
associate-*l/98.0%
associate-*r/98.1%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 95.5%
associate-*r/95.5%
distribute-lft-in95.5%
metadata-eval95.5%
neg-mul-195.5%
sub-neg95.5%
Simplified95.5%
if 1.8499999999999999e25 < z Initial program 85.0%
Simplified93.3%
Taylor expanded in z around inf 78.9%
associate-*r/78.9%
neg-mul-178.9%
distribute-lft-neg-in78.9%
*-commutative78.9%
associate-*r/83.7%
Simplified83.7%
clear-num83.4%
un-div-inv83.5%
add-sqr-sqrt33.2%
sqrt-unprod64.2%
sqr-neg64.2%
sqrt-unprod50.0%
add-sqr-sqrt83.5%
Applied egg-rr83.5%
associate-/r/76.2%
associate-*l/78.9%
associate-/l*83.7%
Simplified83.7%
Final simplification90.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -2.3) (not (<= x 4.0))) (fabs (/ x y_m)) (fabs (/ 4.0 y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -2.3) || !(x <= 4.0)) {
tmp = fabs((x / y_m));
} else {
tmp = fabs((4.0 / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-2.3d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y_m))
else
tmp = abs((4.0d0 / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if ((x <= -2.3) || !(x <= 4.0)) {
tmp = Math.abs((x / y_m));
} else {
tmp = Math.abs((4.0 / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -2.3) or not (x <= 4.0): tmp = math.fabs((x / y_m)) else: tmp = math.fabs((4.0 / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -2.3) || !(x <= 4.0)) tmp = abs(Float64(x / y_m)); else tmp = abs(Float64(4.0 / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -2.3) || ~((x <= 4.0))) tmp = abs((x / y_m)); else tmp = abs((4.0 / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -2.3], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -2.2999999999999998 or 4 < x Initial program 83.8%
*-commutative83.8%
clear-num83.7%
un-div-inv83.8%
Applied egg-rr83.8%
frac-sub75.4%
associate-/r*85.5%
*-commutative85.5%
Applied egg-rr85.5%
Taylor expanded in z around 0 71.4%
Taylor expanded in x around inf 70.1%
if -2.2999999999999998 < x < 4Initial program 97.1%
Simplified99.8%
Taylor expanded in x around 0 66.3%
Final simplification68.1%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ (- (+ x 4.0) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((((x + 4.0) - (x * z)) / y_m));
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = abs((((x + 4.0d0) - (x * z)) / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs((((x + 4.0) - (x * z)) / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs((((x + 4.0) - (x * z)) / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs((((x + 4.0) - (x * z)) / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|
\end{array}
Initial program 90.7%
associate-*l/92.6%
sub-div97.3%
Applied egg-rr97.3%
Final simplification97.3%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ 4.0 y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((4.0 / y_m));
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = abs((4.0d0 / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs((4.0 / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs((4.0 / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(4.0 / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs((4.0 / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{4}{y\_m}\right|
\end{array}
Initial program 90.7%
Simplified97.2%
Taylor expanded in x around 0 36.8%
Final simplification36.8%
herbie shell --seed 2024039
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))