
(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 10 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-19) (fabs (/ (+ 4.0 (* x (- 1.0 z))) y_m)) (fabs (- (/ (+ 4.0 x) 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-19) {
tmp = fabs(((4.0 + (x * (1.0 - z))) / y_m));
} else {
tmp = fabs((((4.0 + x) / 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-19) then
tmp = abs(((4.0d0 + (x * (1.0d0 - z))) / y_m))
else
tmp = abs((((4.0d0 + x) / 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-19) {
tmp = Math.abs(((4.0 + (x * (1.0 - z))) / y_m));
} else {
tmp = Math.abs((((4.0 + x) / 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-19: tmp = math.fabs(((4.0 + (x * (1.0 - z))) / y_m)) else: tmp = math.fabs((((4.0 + x) / 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-19) tmp = abs(Float64(Float64(4.0 + Float64(x * Float64(1.0 - z))) / y_m)); else tmp = abs(Float64(Float64(Float64(4.0 + x) / 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-19) tmp = abs(((4.0 + (x * (1.0 - z))) / y_m)); else tmp = abs((((4.0 + x) / 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-19], N[Abs[N[(N[(4.0 + N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(4.0 + x), $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^{-19}:\\
\;\;\;\;\left|\frac{4 + x \cdot \left(1 - z\right)}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4 + x}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\
\end{array}
\end{array}
if y < 2e-19Initial program 90.0%
Simplified96.8%
Taylor expanded in y around 0 96.9%
associate-*r/96.9%
associate--r+96.9%
sub-neg96.9%
metadata-eval96.9%
associate-+r-96.9%
distribute-lft-in96.9%
neg-mul-196.9%
neg-sub096.9%
associate--r-96.9%
metadata-eval96.9%
+-commutative96.9%
associate-+l+96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
neg-mul-196.9%
distribute-rgt-neg-in96.9%
*-rgt-identity96.9%
distribute-lft-in96.9%
+-commutative96.9%
unsub-neg96.9%
Simplified96.9%
if 2e-19 < y Initial program 93.2%
associate-*l/90.3%
associate-*r/99.8%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification97.7%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -5.8e+67)
(fabs (/ x y_m))
(if (or (<= x -2.3e-52) (not (<= x 0.02)))
(fabs (/ z (/ y_m x)))
(fabs (/ 4.0 y_m)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -5.8e+67) {
tmp = fabs((x / y_m));
} else if ((x <= -2.3e-52) || !(x <= 0.02)) {
tmp = fabs((z / (y_m / x)));
} 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 <= (-5.8d+67)) then
tmp = abs((x / y_m))
else if ((x <= (-2.3d-52)) .or. (.not. (x <= 0.02d0))) then
tmp = abs((z / (y_m / x)))
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 <= -5.8e+67) {
tmp = Math.abs((x / y_m));
} else if ((x <= -2.3e-52) || !(x <= 0.02)) {
tmp = Math.abs((z / (y_m / x)));
} 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 <= -5.8e+67: tmp = math.fabs((x / y_m)) elif (x <= -2.3e-52) or not (x <= 0.02): tmp = math.fabs((z / (y_m / x))) 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 <= -5.8e+67) tmp = abs(Float64(x / y_m)); elseif ((x <= -2.3e-52) || !(x <= 0.02)) tmp = abs(Float64(z / Float64(y_m / x))); 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 <= -5.8e+67) tmp = abs((x / y_m)); elseif ((x <= -2.3e-52) || ~((x <= 0.02))) tmp = abs((z / (y_m / x))); 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[LessEqual[x, -5.8e+67], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, -2.3e-52], N[Not[LessEqual[x, 0.02]], $MachinePrecision]], N[Abs[N[(z / N[(y$95$m / x), $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 -5.8 \cdot 10^{+67}:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-52} \lor \neg \left(x \leq 0.02\right):\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -5.80000000000000047e67Initial program 87.6%
Taylor expanded in z around 0 71.3%
Taylor expanded in x around inf 71.3%
if -5.80000000000000047e67 < x < -2.29999999999999994e-52 or 0.0200000000000000004 < x Initial program 88.5%
Simplified89.1%
Taylor expanded in z around inf 52.0%
associate-*r/52.0%
neg-mul-152.0%
distribute-lft-neg-in52.0%
*-commutative52.0%
associate-*r/73.9%
Simplified73.9%
clear-num73.9%
un-div-inv74.1%
add-sqr-sqrt19.4%
sqrt-unprod64.5%
sqr-neg64.5%
sqrt-unprod54.5%
add-sqr-sqrt74.1%
Applied egg-rr74.1%
if -2.29999999999999994e-52 < x < 0.0200000000000000004Initial program 93.6%
Simplified99.9%
Taylor expanded in x around 0 78.1%
Final simplification75.6%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -5.1e+67)
(fabs (/ x y_m))
(if (or (<= x -3.1e-51) (not (<= x 0.02)))
(fabs (* x (/ z y_m)))
(fabs (/ 4.0 y_m)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -5.1e+67) {
tmp = fabs((x / y_m));
} else if ((x <= -3.1e-51) || !(x <= 0.02)) {
tmp = fabs((x * (z / 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 <= (-5.1d+67)) then
tmp = abs((x / y_m))
else if ((x <= (-3.1d-51)) .or. (.not. (x <= 0.02d0))) then
tmp = abs((x * (z / 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 <= -5.1e+67) {
tmp = Math.abs((x / y_m));
} else if ((x <= -3.1e-51) || !(x <= 0.02)) {
tmp = Math.abs((x * (z / 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 <= -5.1e+67: tmp = math.fabs((x / y_m)) elif (x <= -3.1e-51) or not (x <= 0.02): tmp = math.fabs((x * (z / 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 <= -5.1e+67) tmp = abs(Float64(x / y_m)); elseif ((x <= -3.1e-51) || !(x <= 0.02)) tmp = abs(Float64(x * Float64(z / 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 <= -5.1e+67) tmp = abs((x / y_m)); elseif ((x <= -3.1e-51) || ~((x <= 0.02))) tmp = abs((x * (z / 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[LessEqual[x, -5.1e+67], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, -3.1e-51], N[Not[LessEqual[x, 0.02]], $MachinePrecision]], N[Abs[N[(x * N[(z / 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 -5.1 \cdot 10^{+67}:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{elif}\;x \leq -3.1 \cdot 10^{-51} \lor \neg \left(x \leq 0.02\right):\\
\;\;\;\;\left|x \cdot \frac{z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -5.1000000000000002e67Initial program 87.6%
Taylor expanded in z around 0 71.3%
Taylor expanded in x around inf 71.3%
if -5.1000000000000002e67 < x < -3.0999999999999997e-51 or 0.0200000000000000004 < x Initial program 88.5%
Simplified89.1%
Taylor expanded in z around inf 52.0%
associate-*r/52.0%
neg-mul-152.0%
distribute-lft-neg-in52.0%
*-commutative52.0%
associate-*r/73.9%
Simplified73.9%
associate-*r/52.0%
add-cube-cbrt51.6%
times-frac64.1%
add-sqr-sqrt19.1%
sqrt-unprod59.3%
sqr-neg59.3%
sqrt-unprod45.0%
add-sqr-sqrt64.1%
times-frac51.6%
*-commutative51.6%
add-cube-cbrt52.0%
clear-num52.0%
Applied egg-rr52.0%
associate-/r/52.0%
*-commutative52.0%
associate-*l*62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in y around 0 62.4%
if -3.0999999999999997e-51 < x < 0.0200000000000000004Initial program 93.6%
Simplified99.9%
Taylor expanded in x around 0 78.1%
Final simplification71.9%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -4.8e+67)
(fabs (/ x y_m))
(if (<= x -1.52e-52)
(fabs (/ x (/ y_m z)))
(if (<= x 0.02) (fabs (/ 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 (x <= -4.8e+67) {
tmp = fabs((x / y_m));
} else if (x <= -1.52e-52) {
tmp = fabs((x / (y_m / z)));
} else if (x <= 0.02) {
tmp = fabs((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 (x <= (-4.8d+67)) then
tmp = abs((x / y_m))
else if (x <= (-1.52d-52)) then
tmp = abs((x / (y_m / z)))
else if (x <= 0.02d0) then
tmp = abs((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 (x <= -4.8e+67) {
tmp = Math.abs((x / y_m));
} else if (x <= -1.52e-52) {
tmp = Math.abs((x / (y_m / z)));
} else if (x <= 0.02) {
tmp = Math.abs((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 x <= -4.8e+67: tmp = math.fabs((x / y_m)) elif x <= -1.52e-52: tmp = math.fabs((x / (y_m / z))) elif x <= 0.02: tmp = math.fabs((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 (x <= -4.8e+67) tmp = abs(Float64(x / y_m)); elseif (x <= -1.52e-52) tmp = abs(Float64(x / Float64(y_m / z))); elseif (x <= 0.02) tmp = abs(Float64(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 (x <= -4.8e+67) tmp = abs((x / y_m)); elseif (x <= -1.52e-52) tmp = abs((x / (y_m / z))); elseif (x <= 0.02) tmp = abs((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[x, -4.8e+67], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, -1.52e-52], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 0.02], N[Abs[N[(4.0 / 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}\;x \leq -4.8 \cdot 10^{+67}:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{elif}\;x \leq -1.52 \cdot 10^{-52}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{elif}\;x \leq 0.02:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -4.80000000000000004e67Initial program 87.6%
Taylor expanded in z around 0 71.3%
Taylor expanded in x around inf 71.3%
if -4.80000000000000004e67 < x < -1.5199999999999999e-52Initial program 99.6%
Simplified99.4%
Taylor expanded in z around inf 67.2%
associate-*r/67.2%
neg-mul-167.2%
distribute-lft-neg-in67.2%
*-commutative67.2%
associate-*r/67.2%
Simplified67.2%
associate-*r/67.2%
add-cube-cbrt66.5%
times-frac66.4%
add-sqr-sqrt66.5%
sqrt-unprod66.4%
sqr-neg66.4%
sqrt-unprod0.0%
add-sqr-sqrt66.4%
times-frac66.5%
*-commutative66.5%
add-cube-cbrt67.2%
clear-num67.2%
Applied egg-rr67.2%
associate-/r/67.2%
*-commutative67.2%
associate-*l*67.2%
*-commutative67.2%
Simplified67.2%
Taylor expanded in y around 0 67.3%
clear-num67.3%
div-inv67.4%
Applied egg-rr67.4%
if -1.5199999999999999e-52 < x < 0.0200000000000000004Initial program 93.6%
Simplified99.9%
Taylor expanded in x around 0 78.1%
if 0.0200000000000000004 < x Initial program 84.0%
Simplified84.9%
Taylor expanded in z around inf 45.8%
associate-*r/45.8%
neg-mul-145.8%
distribute-lft-neg-in45.8%
*-commutative45.8%
associate-*r/76.7%
Simplified76.7%
associate-*r/45.8%
add-cube-cbrt45.6%
times-frac63.1%
add-sqr-sqrt0.0%
sqrt-unprod56.4%
sqr-neg56.4%
sqrt-unprod63.2%
add-sqr-sqrt63.1%
times-frac45.6%
*-commutative45.6%
add-cube-cbrt45.8%
clear-num45.9%
Applied egg-rr45.9%
associate-/r/45.8%
associate-*l/45.8%
*-lft-identity45.8%
*-commutative45.8%
associate-*r/76.7%
Simplified76.7%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -5.4e+67)
(fabs (/ x y_m))
(if (<= x -1.85e-52)
(fabs (* x (/ z y_m)))
(if (<= x 0.02) (fabs (/ 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 (x <= -5.4e+67) {
tmp = fabs((x / y_m));
} else if (x <= -1.85e-52) {
tmp = fabs((x * (z / y_m)));
} else if (x <= 0.02) {
tmp = fabs((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 (x <= (-5.4d+67)) then
tmp = abs((x / y_m))
else if (x <= (-1.85d-52)) then
tmp = abs((x * (z / y_m)))
else if (x <= 0.02d0) then
tmp = abs((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 (x <= -5.4e+67) {
tmp = Math.abs((x / y_m));
} else if (x <= -1.85e-52) {
tmp = Math.abs((x * (z / y_m)));
} else if (x <= 0.02) {
tmp = Math.abs((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 x <= -5.4e+67: tmp = math.fabs((x / y_m)) elif x <= -1.85e-52: tmp = math.fabs((x * (z / y_m))) elif x <= 0.02: tmp = math.fabs((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 (x <= -5.4e+67) tmp = abs(Float64(x / y_m)); elseif (x <= -1.85e-52) tmp = abs(Float64(x * Float64(z / y_m))); elseif (x <= 0.02) tmp = abs(Float64(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 (x <= -5.4e+67) tmp = abs((x / y_m)); elseif (x <= -1.85e-52) tmp = abs((x * (z / y_m))); elseif (x <= 0.02) tmp = abs((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[x, -5.4e+67], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, -1.85e-52], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 0.02], N[Abs[N[(4.0 / 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}\;x \leq -5.4 \cdot 10^{+67}:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-52}:\\
\;\;\;\;\left|x \cdot \frac{z}{y\_m}\right|\\
\mathbf{elif}\;x \leq 0.02:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -5.3999999999999998e67Initial program 87.6%
Taylor expanded in z around 0 71.3%
Taylor expanded in x around inf 71.3%
if -5.3999999999999998e67 < x < -1.8499999999999999e-52Initial program 99.6%
Simplified99.4%
Taylor expanded in z around inf 67.2%
associate-*r/67.2%
neg-mul-167.2%
distribute-lft-neg-in67.2%
*-commutative67.2%
associate-*r/67.2%
Simplified67.2%
associate-*r/67.2%
add-cube-cbrt66.5%
times-frac66.4%
add-sqr-sqrt66.5%
sqrt-unprod66.4%
sqr-neg66.4%
sqrt-unprod0.0%
add-sqr-sqrt66.4%
times-frac66.5%
*-commutative66.5%
add-cube-cbrt67.2%
clear-num67.2%
Applied egg-rr67.2%
associate-/r/67.2%
*-commutative67.2%
associate-*l*67.2%
*-commutative67.2%
Simplified67.2%
Taylor expanded in y around 0 67.3%
if -1.8499999999999999e-52 < x < 0.0200000000000000004Initial program 93.6%
Simplified99.9%
Taylor expanded in x around 0 78.1%
if 0.0200000000000000004 < x Initial program 84.0%
Simplified84.9%
Taylor expanded in z around inf 45.8%
associate-*r/45.8%
neg-mul-145.8%
distribute-lft-neg-in45.8%
*-commutative45.8%
associate-*r/76.7%
Simplified76.7%
associate-*r/45.8%
add-cube-cbrt45.6%
times-frac63.1%
add-sqr-sqrt0.0%
sqrt-unprod56.4%
sqr-neg56.4%
sqrt-unprod63.2%
add-sqr-sqrt63.1%
times-frac45.6%
*-commutative45.6%
add-cube-cbrt45.8%
clear-num45.9%
Applied egg-rr45.9%
associate-/r/45.8%
associate-*l/45.8%
*-lft-identity45.8%
*-commutative45.8%
associate-*r/76.7%
Simplified76.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -10.5) (not (<= x 3.4))) (fabs (* (- 1.0 z) (/ x y_m))) (fabs (/ (* z (- (/ 4.0 z) x)) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -10.5) || !(x <= 3.4)) {
tmp = fabs(((1.0 - z) * (x / y_m)));
} else {
tmp = fabs(((z * ((4.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 ((x <= (-10.5d0)) .or. (.not. (x <= 3.4d0))) then
tmp = abs(((1.0d0 - z) * (x / y_m)))
else
tmp = abs(((z * ((4.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 ((x <= -10.5) || !(x <= 3.4)) {
tmp = Math.abs(((1.0 - z) * (x / y_m)));
} else {
tmp = Math.abs(((z * ((4.0 / z) - x)) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -10.5) or not (x <= 3.4): tmp = math.fabs(((1.0 - z) * (x / y_m))) else: tmp = math.fabs(((z * ((4.0 / z) - x)) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -10.5) || !(x <= 3.4)) tmp = abs(Float64(Float64(1.0 - z) * Float64(x / y_m))); else tmp = abs(Float64(Float64(z * Float64(Float64(4.0 / z) - x)) / 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 <= 3.4))) tmp = abs(((1.0 - z) * (x / y_m))); else tmp = abs(((z * ((4.0 / z) - x)) / 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, 3.4]], $MachinePrecision]], N[Abs[N[(N[(1.0 - z), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(z * N[(N[(4.0 / z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 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 3.4\right):\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z \cdot \left(\frac{4}{z} - x\right)}{y\_m}\right|\\
\end{array}
\end{array}
if x < -10.5 or 3.39999999999999991 < x Initial program 87.5%
Simplified89.7%
Taylor expanded in x around inf 89.3%
mul-1-neg89.3%
*-commutative89.3%
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%
if -10.5 < x < 3.39999999999999991Initial program 93.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
associate-*r/99.9%
associate--r+99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+r-99.9%
distribute-lft-in99.9%
neg-mul-199.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
neg-mul-199.9%
distribute-rgt-neg-in99.9%
*-rgt-identity99.9%
distribute-lft-in99.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 98.0%
Final simplification98.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -1.9e+100) (fabs (/ x (/ y_m z))) (if (<= z 1e+23) (fabs (/ (- -4.0 x) y_m)) (fabs (/ z (/ y_m x))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -1.9e+100) {
tmp = fabs((x / (y_m / z)));
} else if (z <= 1e+23) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((z / (y_m / x)));
}
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.9d+100)) then
tmp = abs((x / (y_m / z)))
else if (z <= 1d+23) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((z / (y_m / x)))
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.9e+100) {
tmp = Math.abs((x / (y_m / z)));
} else if (z <= 1e+23) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((z / (y_m / x)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -1.9e+100: tmp = math.fabs((x / (y_m / z))) elif z <= 1e+23: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((z / (y_m / x))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -1.9e+100) tmp = abs(Float64(x / Float64(y_m / z))); elseif (z <= 1e+23) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(z / Float64(y_m / x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -1.9e+100) tmp = abs((x / (y_m / z))); elseif (z <= 1e+23) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((z / (y_m / x))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -1.9e+100], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1e+23], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+100}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{elif}\;z \leq 10^{+23}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}}\right|\\
\end{array}
\end{array}
if z < -1.89999999999999982e100Initial program 88.2%
Simplified87.2%
Taylor expanded in z around inf 78.3%
associate-*r/78.3%
neg-mul-178.3%
distribute-lft-neg-in78.3%
*-commutative78.3%
associate-*r/80.9%
Simplified80.9%
associate-*r/78.3%
add-cube-cbrt77.6%
times-frac84.6%
add-sqr-sqrt49.3%
sqrt-unprod69.5%
sqr-neg69.5%
sqrt-unprod35.4%
add-sqr-sqrt84.6%
times-frac77.6%
*-commutative77.6%
add-cube-cbrt78.3%
clear-num78.3%
Applied egg-rr78.3%
associate-/r/78.2%
*-commutative78.2%
associate-*l*86.3%
*-commutative86.3%
Simplified86.3%
Taylor expanded in y around 0 86.5%
clear-num86.4%
div-inv86.5%
Applied egg-rr86.5%
if -1.89999999999999982e100 < z < 9.9999999999999992e22Initial program 92.4%
Simplified99.2%
Taylor expanded in z around 0 93.8%
+-commutative93.8%
rem-square-sqrt50.7%
fabs-sqr50.7%
rem-square-sqrt93.8%
fabs-neg93.8%
distribute-neg-frac93.8%
distribute-neg-in93.8%
metadata-eval93.8%
+-commutative93.8%
sub-neg93.8%
rem-square-sqrt42.4%
fabs-sqr42.4%
rem-square-sqrt93.8%
Simplified93.8%
if 9.9999999999999992e22 < z Initial program 88.3%
Simplified88.7%
Taylor expanded in z around inf 70.9%
associate-*r/70.9%
neg-mul-170.9%
distribute-lft-neg-in70.9%
*-commutative70.9%
associate-*r/78.5%
Simplified78.5%
clear-num78.5%
un-div-inv78.6%
add-sqr-sqrt37.9%
sqrt-unprod63.2%
sqr-neg63.2%
sqrt-unprod40.3%
add-sqr-sqrt78.6%
Applied egg-rr78.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x 2e+16) (fabs (/ (+ 4.0 (* x (- 1.0 z))) 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 (x <= 2e+16) {
tmp = fabs(((4.0 + (x * (1.0 - z))) / 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 (x <= 2d+16) then
tmp = abs(((4.0d0 + (x * (1.0d0 - z))) / 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 (x <= 2e+16) {
tmp = Math.abs(((4.0 + (x * (1.0 - z))) / 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 x <= 2e+16: tmp = math.fabs(((4.0 + (x * (1.0 - z))) / 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 (x <= 2e+16) tmp = abs(Float64(Float64(4.0 + Float64(x * Float64(1.0 - z))) / 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 (x <= 2e+16) tmp = abs(((4.0 + (x * (1.0 - z))) / 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[x, 2e+16], N[Abs[N[(N[(4.0 + N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $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}\;x \leq 2 \cdot 10^{+16}:\\
\;\;\;\;\left|\frac{4 + x \cdot \left(1 - z\right)}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if x < 2e16Initial program 93.0%
Simplified97.9%
Taylor expanded in y around 0 98.0%
associate-*r/98.0%
associate--r+98.0%
sub-neg98.0%
metadata-eval98.0%
associate-+r-98.0%
distribute-lft-in98.0%
neg-mul-198.0%
neg-sub098.0%
associate--r-98.0%
metadata-eval98.0%
+-commutative98.0%
associate-+l+98.0%
+-commutative98.0%
+-commutative98.0%
+-commutative98.0%
neg-mul-198.0%
distribute-rgt-neg-in98.0%
*-rgt-identity98.0%
distribute-lft-in98.0%
+-commutative98.0%
unsub-neg98.0%
Simplified98.0%
if 2e16 < x Initial program 82.5%
Simplified83.5%
Taylor expanded in x around inf 83.7%
mul-1-neg83.7%
*-commutative83.7%
associate-/l*99.8%
distribute-lft-neg-in99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.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 <= -1.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 <= (-1.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 <= -1.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 <= -1.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 <= -1.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 <= -1.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, -1.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 -1.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 < -1.5 or 4 < x Initial program 87.6%
Taylor expanded in z around 0 59.6%
Taylor expanded in x around inf 59.1%
if -1.5 < x < 4Initial program 93.9%
Simplified99.9%
Taylor expanded in x around 0 75.8%
Final simplification67.8%
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.9%
Simplified95.0%
Taylor expanded in x around 0 41.9%
herbie shell --seed 2024085
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))