
(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 1.5e-59) (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 <= 1.5e-59) {
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 <= 1.5e-59) 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, 1.5e-59], 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 1.5 \cdot 10^{-59}:\\
\;\;\;\;\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 < 1.5e-59Initial program 88.3%
associate-*l/90.1%
sub-div96.8%
Applied egg-rr96.8%
if 1.5e-59 < y Initial program 98.7%
fabs-sub98.7%
associate-*l/95.0%
associate-*r/99.9%
fma-neg99.9%
distribute-neg-frac99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification97.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (- (/ (+ x 4.0) y_m) (* z (/ x y_m))))) (if (<= t_0 5e+267) (fabs t_0) (fabs (/ (- (+ x 4.0) (* x z)) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = ((x + 4.0) / y_m) - (z * (x / y_m));
double tmp;
if (t_0 <= 5e+267) {
tmp = fabs(t_0);
} 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) :: t_0
real(8) :: tmp
t_0 = ((x + 4.0d0) / y_m) - (z * (x / y_m))
if (t_0 <= 5d+267) then
tmp = abs(t_0)
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 t_0 = ((x + 4.0) / y_m) - (z * (x / y_m));
double tmp;
if (t_0 <= 5e+267) {
tmp = Math.abs(t_0);
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = ((x + 4.0) / y_m) - (z * (x / y_m)) tmp = 0 if t_0 <= 5e+267: tmp = math.fabs(t_0) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(Float64(Float64(x + 4.0) / y_m) - Float64(z * Float64(x / y_m))) tmp = 0.0 if (t_0 <= 5e+267) tmp = abs(t_0); 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) t_0 = ((x + 4.0) / y_m) - (z * (x / y_m)); tmp = 0.0; if (t_0 <= 5e+267) tmp = abs(t_0); 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_] := Block[{t$95$0 = N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+267], N[Abs[t$95$0], $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}
t_0 := \frac{x + 4}{y\_m} - z \cdot \frac{x}{y\_m}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+267}:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) < 4.9999999999999999e267Initial program 98.6%
if 4.9999999999999999e267 < (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) Initial program 52.5%
associate-*l/67.7%
sub-div97.7%
Applied egg-rr97.7%
Final simplification98.5%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ x y_m))))
(if (<= x -10.2)
t_0
(if (<= x 4.0)
(fabs (/ 4.0 y_m))
(if (or (<= x 5.6e+169) (not (<= x 1.2e+195)))
t_0
(fabs (* x (/ z 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 <= -10.2) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = fabs((4.0 / y_m));
} else if ((x <= 5.6e+169) || !(x <= 1.2e+195)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = abs((x / y_m))
if (x <= (-10.2d0)) then
tmp = t_0
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y_m))
else if ((x <= 5.6d+169) .or. (.not. (x <= 1.2d+195))) then
tmp = t_0
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 t_0 = Math.abs((x / y_m));
double tmp;
if (x <= -10.2) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y_m));
} else if ((x <= 5.6e+169) || !(x <= 1.2e+195)) {
tmp = t_0;
} else {
tmp = Math.abs((x * (z / 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 <= -10.2: tmp = t_0 elif x <= 4.0: tmp = math.fabs((4.0 / y_m)) elif (x <= 5.6e+169) or not (x <= 1.2e+195): tmp = t_0 else: tmp = math.fabs((x * (z / 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 <= -10.2) tmp = t_0; elseif (x <= 4.0) tmp = abs(Float64(4.0 / y_m)); elseif ((x <= 5.6e+169) || !(x <= 1.2e+195)) tmp = t_0; 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) t_0 = abs((x / y_m)); tmp = 0.0; if (x <= -10.2) tmp = t_0; elseif (x <= 4.0) tmp = abs((4.0 / y_m)); elseif ((x <= 5.6e+169) || ~((x <= 1.2e+195))) tmp = t_0; else tmp = abs((x * (z / 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, -10.2], t$95$0, If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 5.6e+169], N[Not[LessEqual[x, 1.2e+195]], $MachinePrecision]], t$95$0, N[Abs[N[(x * N[(z / 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 -10.2:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+169} \lor \neg \left(x \leq 1.2 \cdot 10^{+195}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{z}{y\_m}\right|\\
\end{array}
\end{array}
if x < -10.199999999999999 or 4 < x < 5.6000000000000003e169 or 1.2000000000000001e195 < x Initial program 87.2%
associate-*l/85.1%
sub-div92.8%
Applied egg-rr92.8%
Taylor expanded in x around inf 92.7%
Taylor expanded in z around 0 70.3%
if -10.199999999999999 < x < 4Initial program 97.7%
Simplified99.9%
Taylor expanded in x around 0 84.3%
if 5.6000000000000003e169 < x < 1.2000000000000001e195Initial program 63.6%
Simplified91.5%
Taylor expanded in z around inf 83.1%
mul-1-neg83.1%
distribute-frac-neg283.1%
associate-/l*91.5%
Simplified91.5%
clear-num91.3%
un-div-inv91.5%
add-sqr-sqrt27.1%
sqrt-unprod73.7%
sqr-neg73.7%
sqrt-unprod64.3%
add-sqr-sqrt91.5%
Applied egg-rr91.5%
associate-/r/100.0%
associate-*l/83.1%
associate-*r/91.5%
Simplified91.5%
Final simplification78.1%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -5.7e+99)
(fabs (/ x y_m))
(if (or (<= x -4.2e-15) (not (<= x 1.4e-19)))
(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 <= -5.7e+99) {
tmp = fabs((x / y_m));
} else if ((x <= -4.2e-15) || !(x <= 1.4e-19)) {
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 <= (-5.7d+99)) then
tmp = abs((x / y_m))
else if ((x <= (-4.2d-15)) .or. (.not. (x <= 1.4d-19))) 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 <= -5.7e+99) {
tmp = Math.abs((x / y_m));
} else if ((x <= -4.2e-15) || !(x <= 1.4e-19)) {
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 <= -5.7e+99: tmp = math.fabs((x / y_m)) elif (x <= -4.2e-15) or not (x <= 1.4e-19): 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 <= -5.7e+99) tmp = abs(Float64(x / y_m)); elseif ((x <= -4.2e-15) || !(x <= 1.4e-19)) 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 <= -5.7e+99) tmp = abs((x / y_m)); elseif ((x <= -4.2e-15) || ~((x <= 1.4e-19))) 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[LessEqual[x, -5.7e+99], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, -4.2e-15], N[Not[LessEqual[x, 1.4e-19]], $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 -5.7 \cdot 10^{+99}:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-15} \lor \neg \left(x \leq 1.4 \cdot 10^{-19}\right):\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -5.70000000000000003e99Initial program 87.7%
associate-*l/83.3%
sub-div90.6%
Applied egg-rr90.6%
Taylor expanded in x around inf 90.6%
Taylor expanded in z around 0 74.7%
if -5.70000000000000003e99 < x < -4.19999999999999962e-15 or 1.40000000000000001e-19 < x Initial program 85.0%
Simplified93.8%
Taylor expanded in z around inf 53.3%
mul-1-neg53.3%
distribute-frac-neg253.3%
associate-/l*59.2%
Simplified59.2%
clear-num59.1%
un-div-inv59.1%
add-sqr-sqrt27.1%
sqrt-unprod53.2%
sqr-neg53.2%
sqrt-unprod31.9%
add-sqr-sqrt59.1%
Applied egg-rr59.1%
associate-/r/69.3%
*-commutative69.3%
Simplified69.3%
if -4.19999999999999962e-15 < x < 1.40000000000000001e-19Initial program 97.6%
Simplified99.9%
Taylor expanded in x around 0 87.4%
Final simplification78.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.55e-20) (not (<= x 2.35e-22))) (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 <= -1.55e-20) || !(x <= 2.35e-22)) {
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 <= (-1.55d-20)) .or. (.not. (x <= 2.35d-22))) 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 <= -1.55e-20) || !(x <= 2.35e-22)) {
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 <= -1.55e-20) or not (x <= 2.35e-22): 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 <= -1.55e-20) || !(x <= 2.35e-22)) 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 <= -1.55e-20) || ~((x <= 2.35e-22))) 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, -1.55e-20], N[Not[LessEqual[x, 2.35e-22]], $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 -1.55 \cdot 10^{-20} \lor \neg \left(x \leq 2.35 \cdot 10^{-22}\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 < -1.55e-20 or 2.3500000000000001e-22 < x Initial program 85.8%
Simplified92.8%
Taylor expanded in x around -inf 92.2%
*-commutative92.2%
associate-/l*99.2%
neg-mul-199.2%
unsub-neg99.2%
Simplified99.2%
if -1.55e-20 < x < 2.3500000000000001e-22Initial program 97.6%
fabs-sub97.6%
associate-*l/99.9%
associate-*r/94.8%
fma-neg94.8%
distribute-neg-frac94.8%
+-commutative94.8%
distribute-neg-in94.8%
unsub-neg94.8%
metadata-eval94.8%
Simplified94.8%
Taylor expanded in z around 0 87.4%
associate-*r/87.4%
distribute-lft-in87.4%
metadata-eval87.4%
neg-mul-187.4%
sub-neg87.4%
Simplified87.4%
Final simplification93.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 2e+48) (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+48) {
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+48) 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+48) {
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+48: 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+48) 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+48) 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+48], 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^{+48}:\\
\;\;\;\;\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.00000000000000009e48Initial program 89.6%
associate-*l/91.2%
sub-div97.1%
Applied egg-rr97.1%
if 2.00000000000000009e48 < y Initial program 98.1%
associate-*l/92.9%
associate-*r/99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification97.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -6.5e+152) (fabs (* z (/ x y_m))) (if (<= z 4e+73) (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 <= -6.5e+152) {
tmp = fabs((z * (x / y_m)));
} else if (z <= 4e+73) {
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 <= (-6.5d+152)) then
tmp = abs((z * (x / y_m)))
else if (z <= 4d+73) 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 <= -6.5e+152) {
tmp = Math.abs((z * (x / y_m)));
} else if (z <= 4e+73) {
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 <= -6.5e+152: tmp = math.fabs((z * (x / y_m))) elif z <= 4e+73: 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 <= -6.5e+152) tmp = abs(Float64(z * Float64(x / y_m))); elseif (z <= 4e+73) 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 <= -6.5e+152) tmp = abs((z * (x / y_m))); elseif (z <= 4e+73) 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, -6.5e+152], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 4e+73], 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 -6.5 \cdot 10^{+152}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+73}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}}\right|\\
\end{array}
\end{array}
if z < -6.4999999999999997e152Initial program 99.9%
Simplified81.0%
Taylor expanded in z around inf 67.0%
mul-1-neg67.0%
distribute-frac-neg267.0%
associate-/l*81.5%
Simplified81.5%
clear-num81.2%
un-div-inv81.3%
add-sqr-sqrt52.6%
sqrt-unprod57.7%
sqr-neg57.7%
sqrt-unprod28.5%
add-sqr-sqrt81.3%
Applied egg-rr81.3%
associate-/r/85.7%
*-commutative85.7%
Simplified85.7%
if -6.4999999999999997e152 < z < 3.99999999999999993e73Initial program 93.4%
fabs-sub93.4%
associate-*l/96.7%
associate-*r/97.3%
fma-neg98.9%
distribute-neg-frac98.9%
+-commutative98.9%
distribute-neg-in98.9%
unsub-neg98.9%
metadata-eval98.9%
Simplified98.9%
Taylor expanded in z around 0 92.3%
associate-*r/92.3%
distribute-lft-in92.3%
metadata-eval92.3%
neg-mul-192.3%
sub-neg92.3%
Simplified92.3%
if 3.99999999999999993e73 < z Initial program 78.9%
Simplified91.8%
Taylor expanded in z around inf 77.9%
mul-1-neg77.9%
distribute-frac-neg277.9%
associate-/l*78.6%
Simplified78.6%
clear-num78.6%
un-div-inv79.8%
add-sqr-sqrt41.2%
sqrt-unprod59.2%
sqr-neg59.2%
sqrt-unprod38.4%
add-sqr-sqrt79.8%
Applied egg-rr79.8%
Final simplification89.3%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x 5.5e+14) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (fabs (* (/ x y_m) (- 1.0 z)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= 5.5e+14) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = fabs(((x / y_m) * (1.0 - 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 (x <= 5.5d+14) then
tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
else
tmp = abs(((x / y_m) * (1.0d0 - 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 (x <= 5.5e+14) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = Math.abs(((x / y_m) * (1.0 - z)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= 5.5e+14: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) else: tmp = math.fabs(((x / y_m) * (1.0 - z))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= 5.5e+14) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); else tmp = abs(Float64(Float64(x / y_m) * Float64(1.0 - z))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= 5.5e+14) tmp = abs((((x + 4.0) - (x * z)) / y_m)); else tmp = abs(((x / y_m) * (1.0 - z))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, 5.5e+14], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.5 \cdot 10^{+14}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y\_m} \cdot \left(1 - z\right)\right|\\
\end{array}
\end{array}
if x < 5.5e14Initial program 94.4%
associate-*l/95.4%
sub-div97.9%
Applied egg-rr97.9%
if 5.5e14 < x Initial program 81.9%
Simplified90.6%
Taylor expanded in x around -inf 90.8%
*-commutative90.8%
associate-/l*99.9%
neg-mul-199.9%
unsub-neg99.9%
Simplified99.9%
Final simplification98.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -9.6) (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 <= -9.6) || !(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 <= (-9.6d0)) .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 <= -9.6) || !(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 <= -9.6) 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 <= -9.6) || !(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 <= -9.6) || ~((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, -9.6], 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 -9.6 \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 < -9.59999999999999964 or 4 < x Initial program 85.2%
associate-*l/83.4%
sub-div92.6%
Applied egg-rr92.6%
Taylor expanded in x around inf 92.6%
Taylor expanded in z around 0 67.8%
if -9.59999999999999964 < x < 4Initial program 97.7%
Simplified99.9%
Taylor expanded in x around 0 84.3%
Final simplification76.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 91.4%
Simplified96.2%
Taylor expanded in x around 0 44.5%
Final simplification44.5%
herbie shell --seed 2024047
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))