
(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 2e-10) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (fabs (- (/ (+ x 4.0) y_m) (/ x (/ y_m z))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 2e-10) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = fabs((((x + 4.0) / y_m) - (x / (y_m / z))));
}
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 (y_m <= 2d-10) then
tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
else
tmp = abs((((x + 4.0d0) / y_m) - (x / (y_m / z))))
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 (y_m <= 2e-10) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = Math.abs((((x + 4.0) / y_m) - (x / (y_m / z))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 2e-10: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) else: tmp = math.fabs((((x + 4.0) / y_m) - (x / (y_m / z)))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 2e-10) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); else tmp = abs(Float64(Float64(Float64(x + 4.0) / y_m) - Float64(x / Float64(y_m / z)))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (y_m <= 2e-10) tmp = abs((((x + 4.0) - (x * z)) / y_m)); else tmp = abs((((x + 4.0) / y_m) - (x / (y_m / z)))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 2e-10], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\
\end{array}
\end{array}
if y < 2.00000000000000007e-10Initial program 93.1%
associate-*l/93.7%
sub-div96.9%
Applied egg-rr96.9%
if 2.00000000000000007e-10 < y Initial program 98.4%
associate-*l/91.5%
associate-*r/99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -6.4e-71) (not (<= x 2.75e-21))) (fabs (* (/ x y_m) (- 1.0 z))) (fabs (/ (- -4.0 x) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -6.4e-71) || !(x <= 2.75e-21)) {
tmp = fabs(((x / y_m) * (1.0 - z)));
} else {
tmp = fabs(((-4.0 - 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 ((x <= (-6.4d-71)) .or. (.not. (x <= 2.75d-21))) then
tmp = abs(((x / y_m) * (1.0d0 - z)))
else
tmp = abs((((-4.0d0) - 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 ((x <= -6.4e-71) || !(x <= 2.75e-21)) {
tmp = Math.abs(((x / y_m) * (1.0 - z)));
} else {
tmp = Math.abs(((-4.0 - x) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -6.4e-71) or not (x <= 2.75e-21): tmp = math.fabs(((x / y_m) * (1.0 - z))) else: tmp = math.fabs(((-4.0 - x) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -6.4e-71) || !(x <= 2.75e-21)) tmp = abs(Float64(Float64(x / y_m) * Float64(1.0 - z))); else tmp = abs(Float64(Float64(-4.0 - x) / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -6.4e-71) || ~((x <= 2.75e-21))) tmp = abs(((x / y_m) * (1.0 - z))); else tmp = abs(((-4.0 - x) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -6.4e-71], N[Not[LessEqual[x, 2.75e-21]], $MachinePrecision]], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{-71} \lor \neg \left(x \leq 2.75 \cdot 10^{-21}\right):\\
\;\;\;\;\left|\frac{x}{y\_m} \cdot \left(1 - z\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -6.3999999999999998e-71 or 2.74999999999999989e-21 < x Initial program 92.7%
Simplified92.4%
Taylor expanded in x around inf 87.9%
mul-1-neg87.9%
*-commutative87.9%
associate-/l*95.2%
distribute-lft-neg-in95.2%
neg-sub095.2%
associate-+l-95.2%
neg-sub095.2%
+-commutative95.2%
unsub-neg95.2%
Simplified95.2%
if -6.3999999999999998e-71 < x < 2.74999999999999989e-21Initial program 97.3%
Simplified99.9%
Taylor expanded in z around 0 83.7%
+-commutative83.7%
rem-square-sqrt36.3%
fabs-sqr36.3%
rem-square-sqrt83.7%
fabs-neg83.7%
distribute-neg-frac83.7%
distribute-neg-in83.7%
metadata-eval83.7%
+-commutative83.7%
sub-neg83.7%
rem-square-sqrt46.8%
fabs-sqr46.8%
rem-square-sqrt83.7%
Simplified83.7%
Final simplification90.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -6.4e-71) (not (<= x 1.28e-20))) (fabs (* x (/ (- 1.0 z) y_m))) (fabs (/ (- -4.0 x) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -6.4e-71) || !(x <= 1.28e-20)) {
tmp = fabs((x * ((1.0 - z) / y_m)));
} else {
tmp = fabs(((-4.0 - 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 ((x <= (-6.4d-71)) .or. (.not. (x <= 1.28d-20))) then
tmp = abs((x * ((1.0d0 - z) / y_m)))
else
tmp = abs((((-4.0d0) - 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 ((x <= -6.4e-71) || !(x <= 1.28e-20)) {
tmp = Math.abs((x * ((1.0 - z) / y_m)));
} else {
tmp = Math.abs(((-4.0 - x) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -6.4e-71) or not (x <= 1.28e-20): tmp = math.fabs((x * ((1.0 - z) / y_m))) else: tmp = math.fabs(((-4.0 - x) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -6.4e-71) || !(x <= 1.28e-20)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y_m))); else tmp = abs(Float64(Float64(-4.0 - x) / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -6.4e-71) || ~((x <= 1.28e-20))) tmp = abs((x * ((1.0 - z) / y_m))); else tmp = abs(((-4.0 - x) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -6.4e-71], N[Not[LessEqual[x, 1.28e-20]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{-71} \lor \neg \left(x \leq 1.28 \cdot 10^{-20}\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -6.3999999999999998e-71 or 1.2800000000000001e-20 < x Initial program 92.7%
Simplified92.4%
Taylor expanded in x around inf 87.9%
*-commutative87.9%
associate-/l*94.5%
associate-*r*94.5%
*-commutative94.5%
associate-*r/94.5%
mul-1-neg94.5%
neg-sub094.5%
associate-+l-94.5%
neg-sub094.5%
+-commutative94.5%
unsub-neg94.5%
Simplified94.5%
if -6.3999999999999998e-71 < x < 1.2800000000000001e-20Initial program 97.3%
Simplified99.9%
Taylor expanded in z around 0 83.7%
+-commutative83.7%
rem-square-sqrt36.3%
fabs-sqr36.3%
rem-square-sqrt83.7%
fabs-neg83.7%
distribute-neg-frac83.7%
distribute-neg-in83.7%
metadata-eval83.7%
+-commutative83.7%
sub-neg83.7%
rem-square-sqrt46.8%
fabs-sqr46.8%
rem-square-sqrt83.7%
Simplified83.7%
Final simplification90.1%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 2e-21) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (fabs (- (* z (/ x y_m)) (/ (+ x 4.0) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 2e-21) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = fabs(((z * (x / y_m)) - ((x + 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 (y_m <= 2d-21) then
tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
else
tmp = abs(((z * (x / y_m)) - ((x + 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 (y_m <= 2e-21) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = Math.abs(((z * (x / y_m)) - ((x + 4.0) / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 2e-21: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) else: tmp = math.fabs(((z * (x / y_m)) - ((x + 4.0) / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 2e-21) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); else tmp = abs(Float64(Float64(z * Float64(x / y_m)) - Float64(Float64(x + 4.0) / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (y_m <= 2e-21) tmp = abs((((x + 4.0) - (x * z)) / y_m)); else tmp = abs(((z * (x / y_m)) - ((x + 4.0) / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 2e-21], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m} - \frac{x + 4}{y\_m}\right|\\
\end{array}
\end{array}
if y < 1.99999999999999982e-21Initial program 93.1%
associate-*l/93.7%
sub-div96.9%
Applied egg-rr96.9%
if 1.99999999999999982e-21 < y Initial program 98.5%
Final simplification97.3%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -2.5e-16) (not (<= x 3.95e-20))) (fabs (* z (/ 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.5e-16) || !(x <= 3.95e-20)) {
tmp = fabs((z * (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.5d-16)) .or. (.not. (x <= 3.95d-20))) then
tmp = abs((z * (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.5e-16) || !(x <= 3.95e-20)) {
tmp = Math.abs((z * (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.5e-16) or not (x <= 3.95e-20): tmp = math.fabs((z * (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.5e-16) || !(x <= 3.95e-20)) tmp = abs(Float64(z * 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.5e-16) || ~((x <= 3.95e-20))) tmp = abs((z * (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.5e-16], N[Not[LessEqual[x, 3.95e-20]], $MachinePrecision]], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $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.5 \cdot 10^{-16} \lor \neg \left(x \leq 3.95 \cdot 10^{-20}\right):\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -2.5000000000000002e-16 or 3.9499999999999999e-20 < x Initial program 92.0%
Simplified91.7%
Taylor expanded in z around inf 48.0%
mul-1-neg48.0%
distribute-frac-neg248.0%
associate-/l*55.3%
Simplified55.3%
associate-*r/48.0%
add-sqr-sqrt23.6%
sqrt-unprod46.9%
sqr-neg46.9%
sqrt-unprod24.3%
add-sqr-sqrt48.0%
associate-*l/65.3%
associate-/r/55.9%
Applied egg-rr55.9%
associate-/r/65.3%
Applied egg-rr65.3%
if -2.5000000000000002e-16 < x < 3.9499999999999999e-20Initial program 97.6%
Simplified99.9%
Taylor expanded in x around 0 80.6%
Final simplification72.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -2.3e+55) (fabs (* z (/ x y_m))) (if (<= z 900.0) (fabs (/ (- -4.0 x) y_m)) (fabs (/ x (/ y_m z))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -2.3e+55) {
tmp = fabs((z * (x / y_m)));
} else if (z <= 900.0) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((x / (y_m / z)));
}
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 <= (-2.3d+55)) then
tmp = abs((z * (x / y_m)))
else if (z <= 900.0d0) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((x / (y_m / z)))
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 <= -2.3e+55) {
tmp = Math.abs((z * (x / y_m)));
} else if (z <= 900.0) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((x / (y_m / z)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -2.3e+55: tmp = math.fabs((z * (x / y_m))) elif z <= 900.0: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((x / (y_m / z))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -2.3e+55) tmp = abs(Float64(z * Float64(x / y_m))); elseif (z <= 900.0) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(x / Float64(y_m / z))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -2.3e+55) tmp = abs((z * (x / y_m))); elseif (z <= 900.0) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((x / (y_m / z))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -2.3e+55], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 900.0], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+55}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{elif}\;z \leq 900:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}}\right|\\
\end{array}
\end{array}
if z < -2.29999999999999987e55Initial program 98.0%
Simplified88.1%
Taylor expanded in z around inf 74.8%
mul-1-neg74.8%
distribute-frac-neg274.8%
associate-/l*80.9%
Simplified80.9%
associate-*r/74.8%
add-sqr-sqrt47.6%
sqrt-unprod58.6%
sqr-neg58.6%
sqrt-unprod27.2%
add-sqr-sqrt74.8%
associate-*l/84.4%
associate-/r/82.6%
Applied egg-rr82.6%
associate-/r/84.4%
Applied egg-rr84.4%
if -2.29999999999999987e55 < z < 900Initial program 95.3%
Simplified99.8%
Taylor expanded in z around 0 94.3%
+-commutative94.3%
rem-square-sqrt41.3%
fabs-sqr41.3%
rem-square-sqrt94.3%
fabs-neg94.3%
distribute-neg-frac94.3%
distribute-neg-in94.3%
metadata-eval94.3%
+-commutative94.3%
sub-neg94.3%
rem-square-sqrt52.6%
fabs-sqr52.6%
rem-square-sqrt94.3%
Simplified94.3%
if 900 < z Initial program 89.7%
Simplified90.1%
Taylor expanded in z around inf 69.4%
mul-1-neg69.4%
distribute-frac-neg269.4%
associate-/l*75.8%
Simplified75.8%
associate-*r/69.4%
add-sqr-sqrt23.5%
sqrt-unprod49.2%
sqr-neg49.2%
sqrt-unprod45.6%
add-sqr-sqrt69.4%
associate-*l/75.6%
associate-/r/76.1%
Applied egg-rr76.1%
Final simplification88.3%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -1e+27) (fabs (* (/ x y_m) (- 1.0 z))) (fabs (/ (- (+ x 4.0) (* x z)) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1e+27) {
tmp = fabs(((x / y_m) * (1.0 - z)));
} else {
tmp = fabs((((x + 4.0) - (x * z)) / 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 <= (-1d+27)) then
tmp = abs(((x / y_m) * (1.0d0 - z)))
else
tmp = abs((((x + 4.0d0) - (x * z)) / 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 <= -1e+27) {
tmp = Math.abs(((x / y_m) * (1.0 - z)));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -1e+27: tmp = math.fabs(((x / y_m) * (1.0 - z))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -1e+27) tmp = abs(Float64(Float64(x / y_m) * Float64(1.0 - z))); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -1e+27) tmp = abs(((x / y_m) * (1.0 - z))); else tmp = abs((((x + 4.0) - (x * z)) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -1e+27], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 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|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+27}:\\
\;\;\;\;\left|\frac{x}{y\_m} \cdot \left(1 - z\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\end{array}
\end{array}
if x < -1e27Initial program 95.2%
Simplified88.2%
Taylor expanded in x around inf 88.3%
mul-1-neg88.3%
*-commutative88.3%
associate-/l*99.9%
distribute-lft-neg-in99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
if -1e27 < x Initial program 94.3%
associate-*l/95.3%
sub-div97.9%
Applied egg-rr97.9%
Final simplification98.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -10.5) (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 <= -10.5) || !(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 <= (-10.5d0)) .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 <= -10.5) || !(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 <= -10.5) 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 <= -10.5) || !(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 <= -10.5) || ~((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, -10.5], 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 -10.5 \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 < -10.5 or 4 < x Initial program 91.8%
Simplified91.4%
Taylor expanded in x around inf 91.0%
mul-1-neg91.0%
*-commutative91.0%
associate-/l*99.3%
distribute-lft-neg-in99.3%
neg-sub099.3%
associate-+l-99.3%
neg-sub099.3%
+-commutative99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in z around 0 57.4%
if -10.5 < x < 4Initial program 97.7%
Simplified99.9%
Taylor expanded in x around 0 77.9%
Final simplification67.0%
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 94.5%
Simplified95.4%
Taylor expanded in x around 0 39.3%
herbie shell --seed 2024094
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))