
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 1e-93) (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 <= 1e-93) {
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 <= 1e-93) tmp = abs(Float64(Float64(x + Float64(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, 1e-93], N[Abs[N[(N[(x + N[(4.0 - N[(x * z), $MachinePrecision]), $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 10^{-93}:\\
\;\;\;\;\left|\frac{x + \left(4 - x \cdot z\right)}{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 < 9.999999999999999e-94Initial program 90.5%
associate-*l/92.5%
sub-div96.6%
associate--l+96.6%
Applied egg-rr96.6%
if 9.999999999999999e-94 < y Initial program 98.7%
Simplified99.9%
Final simplification97.7%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ x y_m))) (t_1 (fabs (* x (/ z y_m)))))
(if (<= x -6.2e+74)
t_0
(if (<= x -6.8e+44)
t_1
(if (<= x -10.5)
t_0
(if (<= x 8.2e-32)
(fabs (/ 4.0 y_m))
(if (or (<= x 8.5e+21) (and (not (<= x 4.2e+147)) (<= x 2.1e+259)))
t_1
t_0)))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((x / y_m));
double t_1 = fabs((x * (z / y_m)));
double tmp;
if (x <= -6.2e+74) {
tmp = t_0;
} else if (x <= -6.8e+44) {
tmp = t_1;
} else if (x <= -10.5) {
tmp = t_0;
} else if (x <= 8.2e-32) {
tmp = fabs((4.0 / y_m));
} else if ((x <= 8.5e+21) || (!(x <= 4.2e+147) && (x <= 2.1e+259))) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((x / y_m))
t_1 = abs((x * (z / y_m)))
if (x <= (-6.2d+74)) then
tmp = t_0
else if (x <= (-6.8d+44)) then
tmp = t_1
else if (x <= (-10.5d0)) then
tmp = t_0
else if (x <= 8.2d-32) then
tmp = abs((4.0d0 / y_m))
else if ((x <= 8.5d+21) .or. (.not. (x <= 4.2d+147)) .and. (x <= 2.1d+259)) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs((x / y_m));
double t_1 = Math.abs((x * (z / y_m)));
double tmp;
if (x <= -6.2e+74) {
tmp = t_0;
} else if (x <= -6.8e+44) {
tmp = t_1;
} else if (x <= -10.5) {
tmp = t_0;
} else if (x <= 8.2e-32) {
tmp = Math.abs((4.0 / y_m));
} else if ((x <= 8.5e+21) || (!(x <= 4.2e+147) && (x <= 2.1e+259))) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((x / y_m)) t_1 = math.fabs((x * (z / y_m))) tmp = 0 if x <= -6.2e+74: tmp = t_0 elif x <= -6.8e+44: tmp = t_1 elif x <= -10.5: tmp = t_0 elif x <= 8.2e-32: tmp = math.fabs((4.0 / y_m)) elif (x <= 8.5e+21) or (not (x <= 4.2e+147) and (x <= 2.1e+259)): tmp = t_1 else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(x / y_m)) t_1 = abs(Float64(x * Float64(z / y_m))) tmp = 0.0 if (x <= -6.2e+74) tmp = t_0; elseif (x <= -6.8e+44) tmp = t_1; elseif (x <= -10.5) tmp = t_0; elseif (x <= 8.2e-32) tmp = abs(Float64(4.0 / y_m)); elseif ((x <= 8.5e+21) || (!(x <= 4.2e+147) && (x <= 2.1e+259))) tmp = t_1; else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((x / y_m)); t_1 = abs((x * (z / y_m))); tmp = 0.0; if (x <= -6.2e+74) tmp = t_0; elseif (x <= -6.8e+44) tmp = t_1; elseif (x <= -10.5) tmp = t_0; elseif (x <= 8.2e-32) tmp = abs((4.0 / y_m)); elseif ((x <= 8.5e+21) || (~((x <= 4.2e+147)) && (x <= 2.1e+259))) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -6.2e+74], t$95$0, If[LessEqual[x, -6.8e+44], t$95$1, If[LessEqual[x, -10.5], t$95$0, If[LessEqual[x, 8.2e-32], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 8.5e+21], And[N[Not[LessEqual[x, 4.2e+147]], $MachinePrecision], LessEqual[x, 2.1e+259]]], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y\_m}\right|\\
t_1 := \left|x \cdot \frac{z}{y\_m}\right|\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{+74}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -6.8 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -10.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-32}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+21} \lor \neg \left(x \leq 4.2 \cdot 10^{+147}\right) \land x \leq 2.1 \cdot 10^{+259}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.20000000000000043e74 or -6.8e44 < x < -10.5 or 8.5e21 < x < 4.20000000000000012e147 or 2.10000000000000006e259 < x Initial program 86.0%
associate-*l/86.4%
sub-div93.4%
associate--l+93.4%
Applied egg-rr93.4%
Taylor expanded in x around inf 93.0%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in z around 0 74.7%
if -6.20000000000000043e74 < x < -6.8e44 or 8.1999999999999995e-32 < x < 8.5e21 or 4.20000000000000012e147 < x < 2.10000000000000006e259Initial program 95.8%
Simplified99.8%
Taylor expanded in x around inf 90.3%
Taylor expanded in z around inf 66.2%
associate-*r/71.7%
Simplified71.7%
if -10.5 < x < 8.1999999999999995e-32Initial program 97.4%
Taylor expanded in x around 0 84.6%
Final simplification78.7%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ x y_m))) (t_1 (fabs (* z (/ x y_m)))))
(if (<= x -8.6e+170)
t_0
(if (<= x -0.0125)
t_1
(if (<= x 2.6e-32)
(fabs (/ 4.0 y_m))
(if (or (<= x 9e+18) (not (<= x 4.5e+147))) t_1 t_0))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((x / y_m));
double t_1 = fabs((z * (x / y_m)));
double tmp;
if (x <= -8.6e+170) {
tmp = t_0;
} else if (x <= -0.0125) {
tmp = t_1;
} else if (x <= 2.6e-32) {
tmp = fabs((4.0 / y_m));
} else if ((x <= 9e+18) || !(x <= 4.5e+147)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((x / y_m))
t_1 = abs((z * (x / y_m)))
if (x <= (-8.6d+170)) then
tmp = t_0
else if (x <= (-0.0125d0)) then
tmp = t_1
else if (x <= 2.6d-32) then
tmp = abs((4.0d0 / y_m))
else if ((x <= 9d+18) .or. (.not. (x <= 4.5d+147))) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs((x / y_m));
double t_1 = Math.abs((z * (x / y_m)));
double tmp;
if (x <= -8.6e+170) {
tmp = t_0;
} else if (x <= -0.0125) {
tmp = t_1;
} else if (x <= 2.6e-32) {
tmp = Math.abs((4.0 / y_m));
} else if ((x <= 9e+18) || !(x <= 4.5e+147)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((x / y_m)) t_1 = math.fabs((z * (x / y_m))) tmp = 0 if x <= -8.6e+170: tmp = t_0 elif x <= -0.0125: tmp = t_1 elif x <= 2.6e-32: tmp = math.fabs((4.0 / y_m)) elif (x <= 9e+18) or not (x <= 4.5e+147): tmp = t_1 else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(x / y_m)) t_1 = abs(Float64(z * Float64(x / y_m))) tmp = 0.0 if (x <= -8.6e+170) tmp = t_0; elseif (x <= -0.0125) tmp = t_1; elseif (x <= 2.6e-32) tmp = abs(Float64(4.0 / y_m)); elseif ((x <= 9e+18) || !(x <= 4.5e+147)) tmp = t_1; else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((x / y_m)); t_1 = abs((z * (x / y_m))); tmp = 0.0; if (x <= -8.6e+170) tmp = t_0; elseif (x <= -0.0125) tmp = t_1; elseif (x <= 2.6e-32) tmp = abs((4.0 / y_m)); elseif ((x <= 9e+18) || ~((x <= 4.5e+147))) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -8.6e+170], t$95$0, If[LessEqual[x, -0.0125], t$95$1, If[LessEqual[x, 2.6e-32], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 9e+18], N[Not[LessEqual[x, 4.5e+147]], $MachinePrecision]], t$95$1, t$95$0]]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y\_m}\right|\\
t_1 := \left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{if}\;x \leq -8.6 \cdot 10^{+170}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -0.0125:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-32}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+18} \lor \neg \left(x \leq 4.5 \cdot 10^{+147}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -8.5999999999999997e170 or 9e18 < x < 4.50000000000000008e147Initial program 89.6%
associate-*l/88.1%
sub-div90.2%
associate--l+90.2%
Applied egg-rr90.2%
Taylor expanded in x around inf 90.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 73.3%
if -8.5999999999999997e170 < x < -0.012500000000000001 or 2.5999999999999997e-32 < x < 9e18 or 4.50000000000000008e147 < x Initial program 89.6%
Simplified96.5%
Taylor expanded in x around inf 94.1%
Taylor expanded in z around inf 58.6%
associate-*l/70.3%
Simplified70.3%
if -0.012500000000000001 < x < 2.5999999999999997e-32Initial program 97.4%
Taylor expanded in x around 0 84.6%
Final simplification77.5%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y_m)) (t_1 (* z (/ x y_m))))
(if (<= (- t_0 t_1) -1e-45)
(fabs (- t_1 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;
double t_1 = z * (x / y_m);
double tmp;
if ((t_0 - t_1) <= -1e-45) {
tmp = fabs((t_1 - 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) :: t_1
real(8) :: tmp
t_0 = (x + 4.0d0) / y_m
t_1 = z * (x / y_m)
if ((t_0 - t_1) <= (-1d-45)) then
tmp = abs((t_1 - 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;
double t_1 = z * (x / y_m);
double tmp;
if ((t_0 - t_1) <= -1e-45) {
tmp = Math.abs((t_1 - 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 t_1 = z * (x / y_m) tmp = 0 if (t_0 - t_1) <= -1e-45: tmp = math.fabs((t_1 - 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(x + 4.0) / y_m) t_1 = Float64(z * Float64(x / y_m)) tmp = 0.0 if (Float64(t_0 - t_1) <= -1e-45) tmp = abs(Float64(t_1 - t_0)); else tmp = abs(Float64(Float64(x + Float64(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; t_1 = z * (x / y_m); tmp = 0.0; if ((t_0 - t_1) <= -1e-45) tmp = abs((t_1 - 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[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - t$95$1), $MachinePrecision], -1e-45], N[Abs[N[(t$95$1 - t$95$0), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x + N[(4.0 - N[(x * z), $MachinePrecision]), $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}\\
t_1 := z \cdot \frac{x}{y\_m}\\
\mathbf{if}\;t\_0 - t\_1 \leq -1 \cdot 10^{-45}:\\
\;\;\;\;\left|t\_1 - t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + \left(4 - x \cdot z\right)}{y\_m}\right|\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) < -9.99999999999999984e-46Initial program 99.9%
if -9.99999999999999984e-46 < (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) Initial program 90.0%
associate-*l/92.0%
sub-div96.1%
associate--l+96.1%
Applied egg-rr96.1%
Final simplification97.3%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -112.0) (not (<= x 8.9e-32))) (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 <= -112.0) || !(x <= 8.9e-32)) {
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 <= (-112.0d0)) .or. (.not. (x <= 8.9d-32))) 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 <= -112.0) || !(x <= 8.9e-32)) {
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 <= -112.0) or not (x <= 8.9e-32): 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 <= -112.0) || !(x <= 8.9e-32)) tmp = abs(Float64(x / Float64(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 <= -112.0) || ~((x <= 8.9e-32))) 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, -112.0], N[Not[LessEqual[x, 8.9e-32]], $MachinePrecision]], N[Abs[N[(x / N[(y$95$m / N[(1.0 - z), $MachinePrecision]), $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 -112 \lor \neg \left(x \leq 8.9 \cdot 10^{-32}\right):\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{1 - z}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -112 or 8.89999999999999947e-32 < x Initial program 89.6%
associate-*l/88.5%
sub-div93.7%
associate--l+93.7%
Applied egg-rr93.7%
Taylor expanded in x around inf 90.0%
associate-/l*96.2%
Simplified96.2%
if -112 < x < 8.89999999999999947e-32Initial program 97.4%
Simplified93.0%
Taylor expanded in z around 0 85.5%
associate-*r/85.5%
distribute-lft-in85.5%
metadata-eval85.5%
neg-mul-185.5%
sub-neg85.5%
Simplified85.5%
Final simplification91.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -6.5e+69) (fabs (/ (* x z) y_m)) (if (<= z 5.4e+49) (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 <= -6.5e+69) {
tmp = fabs(((x * z) / y_m));
} else if (z <= 5.4e+49) {
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 <= (-6.5d+69)) then
tmp = abs(((x * z) / y_m))
else if (z <= 5.4d+49) 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 <= -6.5e+69) {
tmp = Math.abs(((x * z) / y_m));
} else if (z <= 5.4e+49) {
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 <= -6.5e+69: tmp = math.fabs(((x * z) / y_m)) elif z <= 5.4e+49: 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 <= -6.5e+69) tmp = abs(Float64(Float64(x * z) / y_m)); elseif (z <= 5.4e+49) 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 <= -6.5e+69) tmp = abs(((x * z) / y_m)); elseif (z <= 5.4e+49) 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, -6.5e+69], N[Abs[N[(N[(x * z), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 5.4e+49], 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 -6.5 \cdot 10^{+69}:\\
\;\;\;\;\left|\frac{x \cdot z}{y\_m}\right|\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+49}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{z}{y\_m}\right|\\
\end{array}
\end{array}
if z < -6.5000000000000001e69Initial program 94.7%
Simplified85.2%
Taylor expanded in x around inf 71.0%
Taylor expanded in z around inf 73.5%
if -6.5000000000000001e69 < z < 5.4000000000000002e49Initial program 94.4%
Simplified99.4%
Taylor expanded in z around 0 94.2%
associate-*r/94.2%
distribute-lft-in94.2%
metadata-eval94.2%
neg-mul-194.2%
sub-neg94.2%
Simplified94.2%
if 5.4000000000000002e49 < z Initial program 88.9%
Simplified89.2%
Taylor expanded in x around inf 78.7%
Taylor expanded in z around inf 66.9%
associate-*r/78.7%
Simplified78.7%
Final simplification87.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x 2e+38) (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 <= 2e+38) {
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 <= 2d+38) 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 <= 2e+38) {
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 <= 2e+38: 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 <= 2e+38) tmp = abs(Float64(Float64(x + Float64(4.0 - Float64(x * z))) / y_m)); else tmp = abs(Float64(x / Float64(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 <= 2e+38) 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, 2e+38], N[Abs[N[(N[(x + N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y$95$m / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+38}:\\
\;\;\;\;\left|\frac{x + \left(4 - x \cdot z\right)}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{1 - z}}\right|\\
\end{array}
\end{array}
if x < 1.99999999999999995e38Initial program 94.7%
associate-*l/97.4%
sub-div98.4%
associate--l+98.4%
Applied egg-rr98.4%
if 1.99999999999999995e38 < x Initial program 89.1%
associate-*l/83.6%
sub-div91.3%
associate--l+91.3%
Applied egg-rr91.3%
Taylor expanded in x around inf 91.3%
associate-/l*99.9%
Simplified99.9%
Final simplification98.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -10.0) (not (<= x 4.0))) (fabs (/ x y_m)) (fabs (/ 4.0 y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -10.0) || !(x <= 4.0)) {
tmp = fabs((x / y_m));
} else {
tmp = fabs((4.0 / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-10.0d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y_m))
else
tmp = abs((4.0d0 / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if ((x <= -10.0) || !(x <= 4.0)) {
tmp = Math.abs((x / y_m));
} else {
tmp = Math.abs((4.0 / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -10.0) or not (x <= 4.0): tmp = math.fabs((x / y_m)) else: tmp = math.fabs((4.0 / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -10.0) || !(x <= 4.0)) tmp = abs(Float64(x / y_m)); else tmp = abs(Float64(4.0 / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -10.0) || ~((x <= 4.0))) tmp = abs((x / y_m)); else tmp = abs((4.0 / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -10.0], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -10 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -10 or 4 < x Initial program 88.8%
associate-*l/87.7%
sub-div93.2%
associate--l+93.2%
Applied egg-rr93.2%
Taylor expanded in x around inf 92.0%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in z around 0 62.3%
if -10 < x < 4Initial program 97.6%
Taylor expanded in x around 0 80.5%
Final simplification71.6%
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.3%
Taylor expanded in x around 0 43.4%
Final simplification43.4%
herbie shell --seed 2024026
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))