
(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 4e-84) (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 <= 4e-84) {
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 <= 4d-84) 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 <= 4e-84) {
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 <= 4e-84: 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 <= 4e-84) 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 <= 4e-84) 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, 4e-84], 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 4 \cdot 10^{-84}:\\
\;\;\;\;\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 < 4.0000000000000001e-84Initial program 92.5%
associate-*l/92.8%
sub-div96.5%
Applied egg-rr96.5%
if 4.0000000000000001e-84 < y Initial program 94.5%
associate-*l/95.9%
associate-*r/99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ x y_m))))
(if (<= x -7.6e+260)
(fabs (/ x (/ y_m z)))
(if (<= x -1.52)
t_0
(if (<= x 4.0)
(fabs (/ 4.0 y_m))
(if (or (<= x 2.25e+172) (not (<= x 1.6e+217)))
t_0
(fabs (* z (/ x y_m)))))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((x / y_m));
double tmp;
if (x <= -7.6e+260) {
tmp = fabs((x / (y_m / z)));
} else if (x <= -1.52) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = fabs((4.0 / y_m));
} else if ((x <= 2.25e+172) || !(x <= 1.6e+217)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = abs((x / y_m))
if (x <= (-7.6d+260)) then
tmp = abs((x / (y_m / z)))
else if (x <= (-1.52d0)) then
tmp = t_0
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y_m))
else if ((x <= 2.25d+172) .or. (.not. (x <= 1.6d+217))) then
tmp = t_0
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 t_0 = Math.abs((x / y_m));
double tmp;
if (x <= -7.6e+260) {
tmp = Math.abs((x / (y_m / z)));
} else if (x <= -1.52) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y_m));
} else if ((x <= 2.25e+172) || !(x <= 1.6e+217)) {
tmp = t_0;
} else {
tmp = Math.abs((z * (x / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((x / y_m)) tmp = 0 if x <= -7.6e+260: tmp = math.fabs((x / (y_m / z))) elif x <= -1.52: tmp = t_0 elif x <= 4.0: tmp = math.fabs((4.0 / y_m)) elif (x <= 2.25e+172) or not (x <= 1.6e+217): tmp = t_0 else: tmp = math.fabs((z * (x / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(x / y_m)) tmp = 0.0 if (x <= -7.6e+260) tmp = abs(Float64(x / Float64(y_m / z))); elseif (x <= -1.52) tmp = t_0; elseif (x <= 4.0) tmp = abs(Float64(4.0 / y_m)); elseif ((x <= 2.25e+172) || !(x <= 1.6e+217)) tmp = t_0; 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) t_0 = abs((x / y_m)); tmp = 0.0; if (x <= -7.6e+260) tmp = abs((x / (y_m / z))); elseif (x <= -1.52) tmp = t_0; elseif (x <= 4.0) tmp = abs((4.0 / y_m)); elseif ((x <= 2.25e+172) || ~((x <= 1.6e+217))) tmp = t_0; else tmp = abs((z * (x / y_m))); 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]}, If[LessEqual[x, -7.6e+260], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, -1.52], t$95$0, If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 2.25e+172], N[Not[LessEqual[x, 1.6e+217]], $MachinePrecision]], t$95$0, N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y\_m}\right|\\
\mathbf{if}\;x \leq -7.6 \cdot 10^{+260}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{elif}\;x \leq -1.52:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{+172} \lor \neg \left(x \leq 1.6 \cdot 10^{+217}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -7.5999999999999995e260Initial program 99.8%
Simplified60.2%
Taylor expanded in z around inf 46.7%
mul-1-neg46.7%
distribute-frac-neg246.7%
associate-/l*86.3%
Simplified86.3%
clear-num86.3%
un-div-inv86.5%
add-sqr-sqrt29.1%
sqrt-unprod58.5%
sqr-neg58.5%
sqrt-unprod56.7%
add-sqr-sqrt86.5%
Applied egg-rr86.5%
if -7.5999999999999995e260 < x < -1.52 or 4 < x < 2.2500000000000001e172 or 1.6e217 < x Initial program 93.1%
Simplified94.3%
Taylor expanded in x around inf 94.0%
mul-1-neg94.0%
*-commutative94.0%
associate-/l*99.4%
distribute-lft-neg-in99.4%
neg-sub099.4%
associate-+l-99.4%
neg-sub099.4%
+-commutative99.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in z around 0 73.4%
if -1.52 < x < 4Initial program 93.2%
Simplified99.8%
Taylor expanded in x around 0 75.5%
if 2.2500000000000001e172 < x < 1.6e217Initial program 88.7%
Simplified89.5%
Taylor expanded in z around inf 78.7%
mul-1-neg78.7%
distribute-frac-neg278.7%
associate-/l*89.4%
Simplified89.4%
clear-num89.2%
un-div-inv89.2%
add-sqr-sqrt55.8%
sqrt-unprod89.1%
sqr-neg89.1%
sqrt-unprod33.3%
add-sqr-sqrt89.2%
Applied egg-rr89.2%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Final simplification75.8%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y_m)))) (t_1 (fabs (/ x y_m))))
(if (<= x -4.8e+259)
t_0
(if (<= x -1.52)
t_1
(if (<= x 4.0)
(fabs (/ 4.0 y_m))
(if (or (<= x 6.2e+172) (not (<= x 8.2e+216))) t_1 t_0))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((z * (x / y_m)));
double t_1 = fabs((x / y_m));
double tmp;
if (x <= -4.8e+259) {
tmp = t_0;
} else if (x <= -1.52) {
tmp = t_1;
} else if (x <= 4.0) {
tmp = fabs((4.0 / y_m));
} else if ((x <= 6.2e+172) || !(x <= 8.2e+216)) {
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((z * (x / y_m)))
t_1 = abs((x / y_m))
if (x <= (-4.8d+259)) then
tmp = t_0
else if (x <= (-1.52d0)) then
tmp = t_1
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y_m))
else if ((x <= 6.2d+172) .or. (.not. (x <= 8.2d+216))) 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((z * (x / y_m)));
double t_1 = Math.abs((x / y_m));
double tmp;
if (x <= -4.8e+259) {
tmp = t_0;
} else if (x <= -1.52) {
tmp = t_1;
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y_m));
} else if ((x <= 6.2e+172) || !(x <= 8.2e+216)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((z * (x / y_m))) t_1 = math.fabs((x / y_m)) tmp = 0 if x <= -4.8e+259: tmp = t_0 elif x <= -1.52: tmp = t_1 elif x <= 4.0: tmp = math.fabs((4.0 / y_m)) elif (x <= 6.2e+172) or not (x <= 8.2e+216): tmp = t_1 else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(z * Float64(x / y_m))) t_1 = abs(Float64(x / y_m)) tmp = 0.0 if (x <= -4.8e+259) tmp = t_0; elseif (x <= -1.52) tmp = t_1; elseif (x <= 4.0) tmp = abs(Float64(4.0 / y_m)); elseif ((x <= 6.2e+172) || !(x <= 8.2e+216)) 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((z * (x / y_m))); t_1 = abs((x / y_m)); tmp = 0.0; if (x <= -4.8e+259) tmp = t_0; elseif (x <= -1.52) tmp = t_1; elseif (x <= 4.0) tmp = abs((4.0 / y_m)); elseif ((x <= 6.2e+172) || ~((x <= 8.2e+216))) 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[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -4.8e+259], t$95$0, If[LessEqual[x, -1.52], t$95$1, If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 6.2e+172], N[Not[LessEqual[x, 8.2e+216]], $MachinePrecision]], t$95$1, t$95$0]]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y\_m}\right|\\
t_1 := \left|\frac{x}{y\_m}\right|\\
\mathbf{if}\;x \leq -4.8 \cdot 10^{+259}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.52:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+172} \lor \neg \left(x \leq 8.2 \cdot 10^{+216}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.7999999999999999e259 or 6.19999999999999976e172 < x < 8.1999999999999995e216Initial program 93.6%
Simplified76.7%
Taylor expanded in z around inf 64.7%
mul-1-neg64.7%
distribute-frac-neg264.7%
associate-/l*88.0%
Simplified88.0%
clear-num87.9%
un-div-inv88.0%
add-sqr-sqrt44.1%
sqrt-unprod75.7%
sqr-neg75.7%
sqrt-unprod43.6%
add-sqr-sqrt88.0%
Applied egg-rr88.0%
associate-/r/93.9%
*-commutative93.9%
Simplified93.9%
if -4.7999999999999999e259 < x < -1.52 or 4 < x < 6.19999999999999976e172 or 8.1999999999999995e216 < x Initial program 93.1%
Simplified94.3%
Taylor expanded in x around inf 94.0%
mul-1-neg94.0%
*-commutative94.0%
associate-/l*99.4%
distribute-lft-neg-in99.4%
neg-sub099.4%
associate-+l-99.4%
neg-sub099.4%
+-commutative99.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in z around 0 73.4%
if -1.52 < x < 4Initial program 93.2%
Simplified99.8%
Taylor expanded in x around 0 75.5%
Final simplification75.8%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= z -6.5e+43)
(fabs (/ x (/ y_m z)))
(if (<= z 3.05e+141)
(fabs (+ (/ x y_m) (* 4.0 (/ 1.0 y_m))))
(fabs (* x (/ (- 1.0 z) y_m))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -6.5e+43) {
tmp = fabs((x / (y_m / z)));
} else if (z <= 3.05e+141) {
tmp = fabs(((x / y_m) + (4.0 * (1.0 / y_m))));
} else {
tmp = fabs((x * ((1.0 - 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 (z <= (-6.5d+43)) then
tmp = abs((x / (y_m / z)))
else if (z <= 3.05d+141) then
tmp = abs(((x / y_m) + (4.0d0 * (1.0d0 / y_m))))
else
tmp = abs((x * ((1.0d0 - 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 (z <= -6.5e+43) {
tmp = Math.abs((x / (y_m / z)));
} else if (z <= 3.05e+141) {
tmp = Math.abs(((x / y_m) + (4.0 * (1.0 / y_m))));
} else {
tmp = Math.abs((x * ((1.0 - z) / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -6.5e+43: tmp = math.fabs((x / (y_m / z))) elif z <= 3.05e+141: tmp = math.fabs(((x / y_m) + (4.0 * (1.0 / y_m)))) else: tmp = math.fabs((x * ((1.0 - z) / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -6.5e+43) tmp = abs(Float64(x / Float64(y_m / z))); elseif (z <= 3.05e+141) tmp = abs(Float64(Float64(x / y_m) + Float64(4.0 * Float64(1.0 / y_m)))); else tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -6.5e+43) tmp = abs((x / (y_m / z))); elseif (z <= 3.05e+141) tmp = abs(((x / y_m) + (4.0 * (1.0 / y_m)))); else tmp = abs((x * ((1.0 - z) / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -6.5e+43], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3.05e+141], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] + N[(4.0 * N[(1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+43}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{elif}\;z \leq 3.05 \cdot 10^{+141}:\\
\;\;\;\;\left|\frac{x}{y\_m} + 4 \cdot \frac{1}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y\_m}\right|\\
\end{array}
\end{array}
if z < -6.4999999999999998e43Initial program 89.0%
Simplified90.5%
Taylor expanded in z around inf 75.9%
mul-1-neg75.9%
distribute-frac-neg275.9%
associate-/l*79.6%
Simplified79.6%
clear-num79.5%
un-div-inv80.4%
add-sqr-sqrt37.9%
sqrt-unprod53.6%
sqr-neg53.6%
sqrt-unprod42.3%
add-sqr-sqrt80.4%
Applied egg-rr80.4%
if -6.4999999999999998e43 < z < 3.04999999999999996e141Initial program 98.2%
Taylor expanded in z around 0 93.2%
if 3.04999999999999996e141 < z Initial program 74.5%
Simplified88.8%
Taylor expanded in x around inf 72.7%
*-commutative72.7%
associate-/l*76.7%
associate-*r*76.7%
*-commutative76.7%
associate-*r/76.7%
mul-1-neg76.7%
neg-sub076.7%
associate-+l-76.7%
neg-sub076.7%
+-commutative76.7%
unsub-neg76.7%
Simplified76.7%
Final simplification88.5%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= z -7.8e+43)
(fabs (/ x (/ y_m z)))
(if (<= z 2.4e+141)
(fabs (/ (- -4.0 x) y_m))
(fabs (* x (/ (- 1.0 z) y_m))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -7.8e+43) {
tmp = fabs((x / (y_m / z)));
} else if (z <= 2.4e+141) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((x * ((1.0 - 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 (z <= (-7.8d+43)) then
tmp = abs((x / (y_m / z)))
else if (z <= 2.4d+141) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((x * ((1.0d0 - 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 (z <= -7.8e+43) {
tmp = Math.abs((x / (y_m / z)));
} else if (z <= 2.4e+141) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((x * ((1.0 - z) / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -7.8e+43: tmp = math.fabs((x / (y_m / z))) elif z <= 2.4e+141: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((x * ((1.0 - z) / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -7.8e+43) tmp = abs(Float64(x / Float64(y_m / z))); elseif (z <= 2.4e+141) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -7.8e+43) tmp = abs((x / (y_m / z))); elseif (z <= 2.4e+141) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((x * ((1.0 - z) / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -7.8e+43], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 2.4e+141], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+43}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+141}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y\_m}\right|\\
\end{array}
\end{array}
if z < -7.8000000000000001e43Initial program 89.0%
Simplified90.5%
Taylor expanded in z around inf 75.9%
mul-1-neg75.9%
distribute-frac-neg275.9%
associate-/l*79.6%
Simplified79.6%
clear-num79.5%
un-div-inv80.4%
add-sqr-sqrt37.9%
sqrt-unprod53.6%
sqr-neg53.6%
sqrt-unprod42.3%
add-sqr-sqrt80.4%
Applied egg-rr80.4%
if -7.8000000000000001e43 < z < 2.39999999999999997e141Initial program 98.2%
Simplified99.3%
Taylor expanded in z around 0 93.2%
+-commutative93.2%
rem-square-sqrt48.0%
fabs-sqr48.0%
rem-square-sqrt93.2%
fabs-neg93.2%
distribute-neg-frac93.2%
distribute-neg-in93.2%
metadata-eval93.2%
+-commutative93.2%
sub-neg93.2%
rem-square-sqrt44.5%
fabs-sqr44.5%
rem-square-sqrt93.2%
Simplified93.2%
if 2.39999999999999997e141 < z Initial program 74.5%
Simplified88.8%
Taylor expanded in x around inf 72.7%
*-commutative72.7%
associate-/l*76.7%
associate-*r*76.7%
*-commutative76.7%
associate-*r/76.7%
mul-1-neg76.7%
neg-sub076.7%
associate-+l-76.7%
neg-sub076.7%
+-commutative76.7%
unsub-neg76.7%
Simplified76.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 2e-47) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (fabs (- (/ (+ x 4.0) y_m) (* x (/ z y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 2e-47) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = fabs((((x + 4.0) / y_m) - (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 (y_m <= 2d-47) then
tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
else
tmp = abs((((x + 4.0d0) / y_m) - (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 (y_m <= 2e-47) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = Math.abs((((x + 4.0) / y_m) - (x * (z / y_m))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 2e-47: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) else: tmp = math.fabs((((x + 4.0) / y_m) - (x * (z / y_m)))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 2e-47) 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(z / 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-47) tmp = abs((((x + 4.0) - (x * z)) / y_m)); else tmp = abs((((x + 4.0) / y_m) - (x * (z / 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-47], 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[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 2 \cdot 10^{-47}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m} - x \cdot \frac{z}{y\_m}\right|\\
\end{array}
\end{array}
if y < 1.9999999999999999e-47Initial program 93.0%
associate-*l/93.3%
sub-div96.7%
Applied egg-rr96.7%
if 1.9999999999999999e-47 < y Initial program 93.7%
associate-*l/95.3%
sub-div95.3%
Applied egg-rr95.3%
div-sub95.3%
associate-/l*99.9%
Applied egg-rr99.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -2.3e+44) (fabs (/ x (/ y_m z))) (if (<= z 1.15e+142) (fabs (/ (- -4.0 x) y_m)) (fabs (* x (/ z y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -2.3e+44) {
tmp = fabs((x / (y_m / z)));
} else if (z <= 1.15e+142) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((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 (z <= (-2.3d+44)) then
tmp = abs((x / (y_m / z)))
else if (z <= 1.15d+142) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((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 (z <= -2.3e+44) {
tmp = Math.abs((x / (y_m / z)));
} else if (z <= 1.15e+142) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((x * (z / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -2.3e+44: tmp = math.fabs((x / (y_m / z))) elif z <= 1.15e+142: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((x * (z / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -2.3e+44) tmp = abs(Float64(x / Float64(y_m / z))); elseif (z <= 1.15e+142) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(x * Float64(z / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -2.3e+44) tmp = abs((x / (y_m / z))); elseif (z <= 1.15e+142) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((x * (z / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -2.3e+44], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1.15e+142], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+44}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+142}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{z}{y\_m}\right|\\
\end{array}
\end{array}
if z < -2.30000000000000004e44Initial program 89.0%
Simplified90.5%
Taylor expanded in z around inf 75.9%
mul-1-neg75.9%
distribute-frac-neg275.9%
associate-/l*79.6%
Simplified79.6%
clear-num79.5%
un-div-inv80.4%
add-sqr-sqrt37.9%
sqrt-unprod53.6%
sqr-neg53.6%
sqrt-unprod42.3%
add-sqr-sqrt80.4%
Applied egg-rr80.4%
if -2.30000000000000004e44 < z < 1.15000000000000001e142Initial program 98.2%
Simplified99.3%
Taylor expanded in z around 0 93.2%
+-commutative93.2%
rem-square-sqrt48.0%
fabs-sqr48.0%
rem-square-sqrt93.2%
fabs-neg93.2%
distribute-neg-frac93.2%
distribute-neg-in93.2%
metadata-eval93.2%
+-commutative93.2%
sub-neg93.2%
rem-square-sqrt44.5%
fabs-sqr44.5%
rem-square-sqrt93.2%
Simplified93.2%
if 1.15000000000000001e142 < z Initial program 74.5%
Simplified88.8%
Taylor expanded in z around inf 72.7%
associate-*r/72.7%
neg-mul-172.7%
distribute-rgt-neg-in72.7%
Simplified72.7%
distribute-rgt-neg-out72.7%
distribute-frac-neg72.7%
distribute-frac-neg272.7%
associate-*r/76.7%
*-commutative76.7%
add-sqr-sqrt34.3%
sqrt-unprod53.7%
sqr-neg53.7%
sqrt-unprod42.1%
add-sqr-sqrt76.7%
Applied egg-rr76.7%
Final simplification88.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x 6e+16) (fabs (/ (- (+ x 4.0) (* x 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 <= 6e+16) {
tmp = fabs((((x + 4.0) - (x * 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 <= 6d+16) then
tmp = abs((((x + 4.0d0) - (x * 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 <= 6e+16) {
tmp = Math.abs((((x + 4.0) - (x * 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 <= 6e+16: tmp = math.fabs((((x + 4.0) - (x * 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 <= 6e+16) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * 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 <= 6e+16) tmp = abs((((x + 4.0) - (x * 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, 6e+16], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $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 6 \cdot 10^{+16}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if x < 6e16Initial program 92.5%
associate-*l/95.8%
sub-div97.9%
Applied egg-rr97.9%
if 6e16 < x Initial program 95.4%
Simplified91.3%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
*-commutative91.4%
associate-/l*100.0%
distribute-lft-neg-in100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.52) (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.52) || !(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.52d0)) .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.52) || !(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.52) 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.52) || !(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.52) || ~((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.52], 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.52 \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.52 or 4 < x Initial program 93.2%
Simplified91.9%
Taylor expanded in x around inf 91.7%
mul-1-neg91.7%
*-commutative91.7%
associate-/l*99.5%
distribute-lft-neg-in99.5%
neg-sub099.5%
associate-+l-99.5%
neg-sub099.5%
+-commutative99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in z around 0 66.7%
if -1.52 < x < 4Initial program 93.2%
Simplified99.8%
Taylor expanded in x around 0 75.5%
Final simplification71.4%
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 93.2%
Simplified96.1%
Taylor expanded in x around 0 42.8%
herbie shell --seed 2024092
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))