
(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}
(FPCore (x y z) :precision binary64 (if (<= y 6e-49) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (/ (+ x 4.0) y) (* x (/ z y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 6e-49) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((((x + 4.0) / y) - (x * (z / y))));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 6d-49) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((((x + 4.0d0) / y) - (x * (z / y))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 6e-49) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((((x + 4.0) / y) - (x * (z / y))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6e-49: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((((x + 4.0) / y) - (x * (z / y)))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6e-49) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(x * Float64(z / y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 6e-49) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((((x + 4.0) / y) - (x * (z / y)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 6e-49], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{-49}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\
\end{array}
\end{array}
if y < 6e-49Initial program 87.9%
associate-*l/92.6%
associate-*r/86.3%
Simplified86.3%
associate-*r/92.6%
sub-div99.9%
Applied egg-rr99.9%
if 6e-49 < y Initial program 98.3%
associate-*l/92.7%
associate-*r/100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))) (t_1 (fabs (* x (/ z y)))))
(if (<= x -2.5e+46)
t_0
(if (<= x -2.35e-11)
t_1
(if (<= x 2e-12) (fabs (/ 4.0 y)) (if (<= x 2.3e+143) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double t_1 = fabs((x * (z / y)));
double tmp;
if (x <= -2.5e+46) {
tmp = t_0;
} else if (x <= -2.35e-11) {
tmp = t_1;
} else if (x <= 2e-12) {
tmp = fabs((4.0 / y));
} else if (x <= 2.3e+143) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((x / y))
t_1 = abs((x * (z / y)))
if (x <= (-2.5d+46)) then
tmp = t_0
else if (x <= (-2.35d-11)) then
tmp = t_1
else if (x <= 2d-12) then
tmp = abs((4.0d0 / y))
else if (x <= 2.3d+143) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x / y));
double t_1 = Math.abs((x * (z / y)));
double tmp;
if (x <= -2.5e+46) {
tmp = t_0;
} else if (x <= -2.35e-11) {
tmp = t_1;
} else if (x <= 2e-12) {
tmp = Math.abs((4.0 / y));
} else if (x <= 2.3e+143) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((x / y)) t_1 = math.fabs((x * (z / y))) tmp = 0 if x <= -2.5e+46: tmp = t_0 elif x <= -2.35e-11: tmp = t_1 elif x <= 2e-12: tmp = math.fabs((4.0 / y)) elif x <= 2.3e+143: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(x / y)) t_1 = abs(Float64(x * Float64(z / y))) tmp = 0.0 if (x <= -2.5e+46) tmp = t_0; elseif (x <= -2.35e-11) tmp = t_1; elseif (x <= 2e-12) tmp = abs(Float64(4.0 / y)); elseif (x <= 2.3e+143) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((x / y)); t_1 = abs((x * (z / y))); tmp = 0.0; if (x <= -2.5e+46) tmp = t_0; elseif (x <= -2.35e-11) tmp = t_1; elseif (x <= 2e-12) tmp = abs((4.0 / y)); elseif (x <= 2.3e+143) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.5e+46], t$95$0, If[LessEqual[x, -2.35e-11], t$95$1, If[LessEqual[x, 2e-12], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2.3e+143], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
t_1 := \left|x \cdot \frac{z}{y}\right|\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.35 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+143}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -2.5000000000000001e46 or 2.3e143 < x Initial program 78.5%
associate-*l/80.1%
associate-*r/84.5%
Simplified84.5%
associate-*r/80.1%
sub-div95.6%
Applied egg-rr95.6%
Taylor expanded in x around inf 95.6%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 79.6%
if -2.5000000000000001e46 < x < -2.34999999999999996e-11 or 1.99999999999999996e-12 < x < 2.3e143Initial program 97.7%
associate-*l/95.6%
associate-*r/97.7%
Simplified97.7%
Taylor expanded in z around inf 59.6%
associate-*r/59.6%
mul-1-neg59.6%
distribute-lft-neg-out59.6%
*-commutative59.6%
Simplified59.6%
div-inv59.7%
associate-*l*61.7%
add-sqr-sqrt26.4%
sqrt-unprod55.7%
sqr-neg55.7%
sqrt-unprod35.2%
add-sqr-sqrt61.7%
div-inv61.7%
Applied egg-rr61.7%
if -2.34999999999999996e-11 < x < 1.99999999999999996e-12Initial program 95.9%
associate-*l/99.9%
associate-*r/90.3%
Simplified90.3%
Taylor expanded in x around 0 75.4%
Final simplification74.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))))
(if (<= x -8e+43)
t_0
(if (<= x -1.45e-12)
(fabs (* z (/ x y)))
(if (<= x 3.5e-13)
(fabs (/ 4.0 y))
(if (<= x 4.6e+143) (fabs (* x (/ z y))) t_0))))))
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double tmp;
if (x <= -8e+43) {
tmp = t_0;
} else if (x <= -1.45e-12) {
tmp = fabs((z * (x / y)));
} else if (x <= 3.5e-13) {
tmp = fabs((4.0 / y));
} else if (x <= 4.6e+143) {
tmp = fabs((x * (z / y)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((x / y))
if (x <= (-8d+43)) then
tmp = t_0
else if (x <= (-1.45d-12)) then
tmp = abs((z * (x / y)))
else if (x <= 3.5d-13) then
tmp = abs((4.0d0 / y))
else if (x <= 4.6d+143) then
tmp = abs((x * (z / y)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x / y));
double tmp;
if (x <= -8e+43) {
tmp = t_0;
} else if (x <= -1.45e-12) {
tmp = Math.abs((z * (x / y)));
} else if (x <= 3.5e-13) {
tmp = Math.abs((4.0 / y));
} else if (x <= 4.6e+143) {
tmp = Math.abs((x * (z / y)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((x / y)) tmp = 0 if x <= -8e+43: tmp = t_0 elif x <= -1.45e-12: tmp = math.fabs((z * (x / y))) elif x <= 3.5e-13: tmp = math.fabs((4.0 / y)) elif x <= 4.6e+143: tmp = math.fabs((x * (z / y))) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(x / y)) tmp = 0.0 if (x <= -8e+43) tmp = t_0; elseif (x <= -1.45e-12) tmp = abs(Float64(z * Float64(x / y))); elseif (x <= 3.5e-13) tmp = abs(Float64(4.0 / y)); elseif (x <= 4.6e+143) tmp = abs(Float64(x * Float64(z / y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((x / y)); tmp = 0.0; if (x <= -8e+43) tmp = t_0; elseif (x <= -1.45e-12) tmp = abs((z * (x / y))); elseif (x <= 3.5e-13) tmp = abs((4.0 / y)); elseif (x <= 4.6e+143) tmp = abs((x * (z / y))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -8e+43], t$95$0, If[LessEqual[x, -1.45e-12], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 3.5e-13], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4.6e+143], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -8 \cdot 10^{+43}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-12}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-13}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+143}:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -8.00000000000000011e43 or 4.5999999999999999e143 < x Initial program 78.5%
associate-*l/80.1%
associate-*r/84.5%
Simplified84.5%
associate-*r/80.1%
sub-div95.6%
Applied egg-rr95.6%
Taylor expanded in x around inf 95.6%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 79.6%
if -8.00000000000000011e43 < x < -1.4500000000000001e-12Initial program 99.8%
associate-*l/99.8%
associate-*r/99.6%
Simplified99.6%
Taylor expanded in z around inf 57.1%
associate-*r/57.1%
mul-1-neg57.1%
distribute-lft-neg-out57.1%
*-commutative57.1%
Simplified57.1%
distribute-rgt-neg-out57.1%
distribute-frac-neg57.1%
associate-*l/57.1%
distribute-rgt-neg-in57.1%
add-sqr-sqrt14.6%
sqrt-unprod45.1%
sqr-neg45.1%
sqrt-unprod42.3%
add-sqr-sqrt57.1%
Applied egg-rr57.1%
if -1.4500000000000001e-12 < x < 3.5000000000000002e-13Initial program 95.9%
associate-*l/99.9%
associate-*r/90.3%
Simplified90.3%
Taylor expanded in x around 0 75.4%
if 3.5000000000000002e-13 < x < 4.5999999999999999e143Initial program 96.7%
associate-*l/93.7%
associate-*r/96.8%
Simplified96.8%
Taylor expanded in z around inf 60.8%
associate-*r/60.8%
mul-1-neg60.8%
distribute-lft-neg-out60.8%
*-commutative60.8%
Simplified60.8%
div-inv60.9%
associate-*l*63.8%
add-sqr-sqrt32.0%
sqrt-unprod60.7%
sqr-neg60.7%
sqrt-unprod31.9%
add-sqr-sqrt63.8%
div-inv63.9%
Applied egg-rr63.9%
Final simplification74.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))))
(if (<= x -7.2e+47)
t_0
(if (<= x -2.2e-11)
(fabs (* z (/ x y)))
(if (<= x 1.7e-10)
(fabs (/ 4.0 y))
(if (<= x 2.3e+143) (fabs (/ x (/ y z))) t_0))))))
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double tmp;
if (x <= -7.2e+47) {
tmp = t_0;
} else if (x <= -2.2e-11) {
tmp = fabs((z * (x / y)));
} else if (x <= 1.7e-10) {
tmp = fabs((4.0 / y));
} else if (x <= 2.3e+143) {
tmp = fabs((x / (y / z)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((x / y))
if (x <= (-7.2d+47)) then
tmp = t_0
else if (x <= (-2.2d-11)) then
tmp = abs((z * (x / y)))
else if (x <= 1.7d-10) then
tmp = abs((4.0d0 / y))
else if (x <= 2.3d+143) then
tmp = abs((x / (y / z)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x / y));
double tmp;
if (x <= -7.2e+47) {
tmp = t_0;
} else if (x <= -2.2e-11) {
tmp = Math.abs((z * (x / y)));
} else if (x <= 1.7e-10) {
tmp = Math.abs((4.0 / y));
} else if (x <= 2.3e+143) {
tmp = Math.abs((x / (y / z)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((x / y)) tmp = 0 if x <= -7.2e+47: tmp = t_0 elif x <= -2.2e-11: tmp = math.fabs((z * (x / y))) elif x <= 1.7e-10: tmp = math.fabs((4.0 / y)) elif x <= 2.3e+143: tmp = math.fabs((x / (y / z))) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(x / y)) tmp = 0.0 if (x <= -7.2e+47) tmp = t_0; elseif (x <= -2.2e-11) tmp = abs(Float64(z * Float64(x / y))); elseif (x <= 1.7e-10) tmp = abs(Float64(4.0 / y)); elseif (x <= 2.3e+143) tmp = abs(Float64(x / Float64(y / z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((x / y)); tmp = 0.0; if (x <= -7.2e+47) tmp = t_0; elseif (x <= -2.2e-11) tmp = abs((z * (x / y))); elseif (x <= 1.7e-10) tmp = abs((4.0 / y)); elseif (x <= 2.3e+143) tmp = abs((x / (y / z))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -7.2e+47], t$95$0, If[LessEqual[x, -2.2e-11], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.7e-10], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2.3e+143], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{+47}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-11}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-10}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+143}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -7.20000000000000015e47 or 2.3e143 < x Initial program 78.5%
associate-*l/80.1%
associate-*r/84.5%
Simplified84.5%
associate-*r/80.1%
sub-div95.6%
Applied egg-rr95.6%
Taylor expanded in x around inf 95.6%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 79.6%
if -7.20000000000000015e47 < x < -2.2000000000000002e-11Initial program 99.8%
associate-*l/99.8%
associate-*r/99.6%
Simplified99.6%
Taylor expanded in z around inf 57.1%
associate-*r/57.1%
mul-1-neg57.1%
distribute-lft-neg-out57.1%
*-commutative57.1%
Simplified57.1%
distribute-rgt-neg-out57.1%
distribute-frac-neg57.1%
associate-*l/57.1%
distribute-rgt-neg-in57.1%
add-sqr-sqrt14.6%
sqrt-unprod45.1%
sqr-neg45.1%
sqrt-unprod42.3%
add-sqr-sqrt57.1%
Applied egg-rr57.1%
if -2.2000000000000002e-11 < x < 1.70000000000000007e-10Initial program 95.9%
associate-*l/99.9%
associate-*r/90.3%
Simplified90.3%
Taylor expanded in x around 0 75.4%
if 1.70000000000000007e-10 < x < 2.3e143Initial program 96.7%
associate-*l/93.7%
associate-*r/96.8%
Simplified96.8%
Taylor expanded in z around inf 60.8%
associate-*r/60.8%
mul-1-neg60.8%
distribute-lft-neg-out60.8%
*-commutative60.8%
Simplified60.8%
div-inv60.9%
associate-*l*63.8%
add-sqr-sqrt32.0%
sqrt-unprod60.7%
sqr-neg60.7%
sqrt-unprod31.9%
add-sqr-sqrt63.8%
div-inv63.9%
Applied egg-rr63.9%
clear-num63.9%
un-div-inv64.0%
Applied egg-rr64.0%
Final simplification74.3%
(FPCore (x y z) :precision binary64 (if (<= z -4000000000.0) (fabs (/ (* x z) y)) (if (<= z 2.5e+49) (fabs (/ (+ x 4.0) y)) (fabs (* z (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4000000000.0) {
tmp = fabs(((x * z) / y));
} else if (z <= 2.5e+49) {
tmp = fabs(((x + 4.0) / y));
} else {
tmp = fabs((z * (x / y)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-4000000000.0d0)) then
tmp = abs(((x * z) / y))
else if (z <= 2.5d+49) then
tmp = abs(((x + 4.0d0) / y))
else
tmp = abs((z * (x / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4000000000.0) {
tmp = Math.abs(((x * z) / y));
} else if (z <= 2.5e+49) {
tmp = Math.abs(((x + 4.0) / y));
} else {
tmp = Math.abs((z * (x / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4000000000.0: tmp = math.fabs(((x * z) / y)) elif z <= 2.5e+49: tmp = math.fabs(((x + 4.0) / y)) else: tmp = math.fabs((z * (x / y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4000000000.0) tmp = abs(Float64(Float64(x * z) / y)); elseif (z <= 2.5e+49) tmp = abs(Float64(Float64(x + 4.0) / y)); else tmp = abs(Float64(z * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4000000000.0) tmp = abs(((x * z) / y)); elseif (z <= 2.5e+49) tmp = abs(((x + 4.0) / y)); else tmp = abs((z * (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4000000000.0], N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 2.5e+49], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4000000000:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+49}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if z < -4e9Initial program 96.9%
associate-*l/98.2%
associate-*r/88.9%
Simplified88.9%
sub-neg88.9%
+-commutative88.9%
distribute-lft-neg-in88.9%
div-inv88.9%
associate-*r*98.3%
fma-def98.3%
Applied egg-rr98.3%
fma-udef98.3%
distribute-lft-neg-out98.3%
distribute-rgt-neg-out98.3%
div-inv98.2%
associate-/l*88.9%
frac-add71.0%
add-sqr-sqrt71.0%
sqrt-unprod67.9%
sqr-neg67.9%
sqrt-unprod0.0%
add-sqr-sqrt71.0%
Applied egg-rr71.0%
Taylor expanded in z around inf 75.1%
if -4e9 < z < 2.5000000000000002e49Initial program 91.6%
associate-*l/95.1%
associate-*r/94.5%
Simplified94.5%
Taylor expanded in z around 0 97.0%
+-commutative97.0%
*-rgt-identity97.0%
associate-*r/96.9%
distribute-rgt-in96.9%
associate-*l/97.0%
*-lft-identity97.0%
Simplified97.0%
if 2.5000000000000002e49 < z Initial program 80.2%
associate-*l/79.1%
associate-*r/77.5%
Simplified77.5%
Taylor expanded in z around inf 77.4%
associate-*r/77.4%
mul-1-neg77.4%
distribute-lft-neg-out77.4%
*-commutative77.4%
Simplified77.4%
distribute-rgt-neg-out77.4%
distribute-frac-neg77.4%
associate-*l/80.2%
distribute-rgt-neg-in80.2%
add-sqr-sqrt0.0%
sqrt-unprod55.7%
sqr-neg55.7%
sqrt-unprod80.0%
add-sqr-sqrt80.2%
Applied egg-rr80.2%
Final simplification88.5%
(FPCore (x y z) :precision binary64 (if (<= z -2100000000.0) (fabs (/ 1.0 (/ y (* x z)))) (if (<= z 3.2e+46) (fabs (/ (+ x 4.0) y)) (fabs (* z (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2100000000.0) {
tmp = fabs((1.0 / (y / (x * z))));
} else if (z <= 3.2e+46) {
tmp = fabs(((x + 4.0) / y));
} else {
tmp = fabs((z * (x / y)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-2100000000.0d0)) then
tmp = abs((1.0d0 / (y / (x * z))))
else if (z <= 3.2d+46) then
tmp = abs(((x + 4.0d0) / y))
else
tmp = abs((z * (x / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2100000000.0) {
tmp = Math.abs((1.0 / (y / (x * z))));
} else if (z <= 3.2e+46) {
tmp = Math.abs(((x + 4.0) / y));
} else {
tmp = Math.abs((z * (x / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2100000000.0: tmp = math.fabs((1.0 / (y / (x * z)))) elif z <= 3.2e+46: tmp = math.fabs(((x + 4.0) / y)) else: tmp = math.fabs((z * (x / y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2100000000.0) tmp = abs(Float64(1.0 / Float64(y / Float64(x * z)))); elseif (z <= 3.2e+46) tmp = abs(Float64(Float64(x + 4.0) / y)); else tmp = abs(Float64(z * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2100000000.0) tmp = abs((1.0 / (y / (x * z)))); elseif (z <= 3.2e+46) tmp = abs(((x + 4.0) / y)); else tmp = abs((z * (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2100000000.0], N[Abs[N[(1.0 / N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3.2e+46], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2100000000:\\
\;\;\;\;\left|\frac{1}{\frac{y}{x \cdot z}}\right|\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+46}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if z < -2.1e9Initial program 96.9%
associate-*l/98.2%
associate-*r/88.9%
Simplified88.9%
Taylor expanded in z around inf 75.1%
associate-*r/75.1%
mul-1-neg75.1%
distribute-lft-neg-out75.1%
*-commutative75.1%
Simplified75.1%
clear-num75.2%
inv-pow75.2%
add-sqr-sqrt75.0%
sqrt-unprod55.9%
sqr-neg55.9%
sqrt-unprod0.0%
add-sqr-sqrt75.2%
Applied egg-rr75.2%
unpow-175.2%
*-commutative75.2%
Simplified75.2%
if -2.1e9 < z < 3.1999999999999998e46Initial program 91.6%
associate-*l/95.1%
associate-*r/94.5%
Simplified94.5%
Taylor expanded in z around 0 97.0%
+-commutative97.0%
*-rgt-identity97.0%
associate-*r/96.9%
distribute-rgt-in96.9%
associate-*l/97.0%
*-lft-identity97.0%
Simplified97.0%
if 3.1999999999999998e46 < z Initial program 80.2%
associate-*l/79.1%
associate-*r/77.5%
Simplified77.5%
Taylor expanded in z around inf 77.4%
associate-*r/77.4%
mul-1-neg77.4%
distribute-lft-neg-out77.4%
*-commutative77.4%
Simplified77.4%
distribute-rgt-neg-out77.4%
distribute-frac-neg77.4%
associate-*l/80.2%
distribute-rgt-neg-in80.2%
add-sqr-sqrt0.0%
sqrt-unprod55.7%
sqr-neg55.7%
sqrt-unprod80.0%
add-sqr-sqrt80.2%
Applied egg-rr80.2%
Final simplification88.5%
(FPCore (x y z) :precision binary64 (fabs (/ (- (+ x 4.0) (* x z)) y)))
double code(double x, double y, double z) {
return fabs((((x + 4.0) - (x * z)) / y));
}
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) - (x * z)) / y))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) - (x * z)) / y));
}
def code(x, y, z): return math.fabs((((x + 4.0) - (x * z)) / y))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) - (x * z)) / y)); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|
\end{array}
Initial program 90.5%
associate-*l/92.6%
associate-*r/89.7%
Simplified89.7%
associate-*r/92.6%
sub-div98.1%
Applied egg-rr98.1%
Final simplification98.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.55) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.55) || !(x <= 4.0)) {
tmp = fabs((x / y));
} else {
tmp = fabs((4.0 / y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.55d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y))
else
tmp = abs((4.0d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.55) || !(x <= 4.0)) {
tmp = Math.abs((x / y));
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.55) or not (x <= 4.0): tmp = math.fabs((x / y)) else: tmp = math.fabs((4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.55) || !(x <= 4.0)) tmp = abs(Float64(x / y)); else tmp = abs(Float64(4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.55) || ~((x <= 4.0))) tmp = abs((x / y)); else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.55], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -1.55000000000000004 or 4 < x Initial program 84.6%
associate-*l/84.9%
associate-*r/88.6%
Simplified88.6%
associate-*r/84.9%
sub-div96.2%
Applied egg-rr96.2%
Taylor expanded in x around inf 94.8%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in z around 0 65.3%
if -1.55000000000000004 < x < 4Initial program 96.1%
associate-*l/99.9%
associate-*r/90.8%
Simplified90.8%
Taylor expanded in x around 0 72.3%
Final simplification68.9%
(FPCore (x y z) :precision binary64 (fabs (/ 4.0 y)))
double code(double x, double y, double z) {
return fabs((4.0 / y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((4.0d0 / y))
end function
public static double code(double x, double y, double z) {
return Math.abs((4.0 / y));
}
def code(x, y, z): return math.fabs((4.0 / y))
function code(x, y, z) return abs(Float64(4.0 / y)) end
function tmp = code(x, y, z) tmp = abs((4.0 / y)); end
code[x_, y_, z_] := N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{4}{y}\right|
\end{array}
Initial program 90.5%
associate-*l/92.6%
associate-*r/89.7%
Simplified89.7%
Taylor expanded in x around 0 39.9%
Final simplification39.9%
herbie shell --seed 2023275
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))