
(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 12 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 3.9e+108) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (/ (+ x 4.0) y) (/ x (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.9e+108) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((((x + 4.0) / y) - (x / (y / z))));
}
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 <= 3.9d+108) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((((x + 4.0d0) / y) - (x / (y / z))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.9e+108) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((((x + 4.0) / y) - (x / (y / z))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.9e+108: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((((x + 4.0) / y) - (x / (y / z)))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.9e+108) 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(y / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.9e+108) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((((x + 4.0) / y) - (x / (y / z)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.9e+108], 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[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.9 \cdot 10^{+108}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - \frac{x}{\frac{y}{z}}\right|\\
\end{array}
\end{array}
if y < 3.89999999999999985e108Initial program 91.9%
associate-*l/95.1%
sub-div99.0%
Applied egg-rr99.0%
if 3.89999999999999985e108 < y Initial program 89.4%
associate-*l/87.1%
associate-/l*99.8%
Applied egg-rr99.8%
Final simplification99.1%
(FPCore (x y z)
:precision binary64
(if (<= x -6.8e-42)
(fabs (/ (+ z -1.0) (/ y x)))
(if (<= x 1.2e-12)
(fabs (/ (- -4.0 x) y))
(fabs (/ 1.0 (/ (/ y x) (+ z -1.0)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.8e-42) {
tmp = fabs(((z + -1.0) / (y / x)));
} else if (x <= 1.2e-12) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((1.0 / ((y / x) / (z + -1.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) :: tmp
if (x <= (-6.8d-42)) then
tmp = abs(((z + (-1.0d0)) / (y / x)))
else if (x <= 1.2d-12) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((1.0d0 / ((y / x) / (z + (-1.0d0)))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.8e-42) {
tmp = Math.abs(((z + -1.0) / (y / x)));
} else if (x <= 1.2e-12) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((1.0 / ((y / x) / (z + -1.0))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.8e-42: tmp = math.fabs(((z + -1.0) / (y / x))) elif x <= 1.2e-12: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((1.0 / ((y / x) / (z + -1.0)))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.8e-42) tmp = abs(Float64(Float64(z + -1.0) / Float64(y / x))); elseif (x <= 1.2e-12) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(1.0 / Float64(Float64(y / x) / Float64(z + -1.0)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.8e-42) tmp = abs(((z + -1.0) / (y / x))); elseif (x <= 1.2e-12) tmp = abs(((-4.0 - x) / y)); else tmp = abs((1.0 / ((y / x) / (z + -1.0)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.8e-42], N[Abs[N[(N[(z + -1.0), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.2e-12], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(1.0 / N[(N[(y / x), $MachinePrecision] / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-42}:\\
\;\;\;\;\left|\frac{z + -1}{\frac{y}{x}}\right|\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-12}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\frac{\frac{y}{x}}{z + -1}}\right|\\
\end{array}
\end{array}
if x < -6.80000000000000045e-42Initial program 91.9%
Simplified89.1%
Taylor expanded in x around inf 85.5%
associate-/l*95.8%
sub-neg95.8%
metadata-eval95.8%
Simplified95.8%
if -6.80000000000000045e-42 < x < 1.19999999999999994e-12Initial program 92.1%
Simplified99.9%
Taylor expanded in z around 0 78.0%
associate-*r/78.0%
distribute-lft-in78.0%
metadata-eval78.0%
neg-mul-178.0%
sub-neg78.0%
Simplified78.0%
if 1.19999999999999994e-12 < x Initial program 89.7%
Simplified96.9%
Taylor expanded in x around inf 95.0%
associate-/l*97.6%
sub-neg97.6%
metadata-eval97.6%
Simplified97.6%
clear-num97.6%
inv-pow97.6%
Applied egg-rr97.6%
unpow-197.6%
Simplified97.6%
Final simplification87.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* x (/ z y)))))
(if (<= x -5.8e-40)
t_0
(if (<= x 8.5e-7)
(fabs (/ 4.0 y))
(if (<= x 5.5e+145) t_0 (fabs (/ x y)))))))
double code(double x, double y, double z) {
double t_0 = fabs((x * (z / y)));
double tmp;
if (x <= -5.8e-40) {
tmp = t_0;
} else if (x <= 8.5e-7) {
tmp = fabs((4.0 / y));
} else if (x <= 5.5e+145) {
tmp = t_0;
} else {
tmp = fabs((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) :: t_0
real(8) :: tmp
t_0 = abs((x * (z / y)))
if (x <= (-5.8d-40)) then
tmp = t_0
else if (x <= 8.5d-7) then
tmp = abs((4.0d0 / y))
else if (x <= 5.5d+145) then
tmp = t_0
else
tmp = abs((x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x * (z / y)));
double tmp;
if (x <= -5.8e-40) {
tmp = t_0;
} else if (x <= 8.5e-7) {
tmp = Math.abs((4.0 / y));
} else if (x <= 5.5e+145) {
tmp = t_0;
} else {
tmp = Math.abs((x / y));
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((x * (z / y))) tmp = 0 if x <= -5.8e-40: tmp = t_0 elif x <= 8.5e-7: tmp = math.fabs((4.0 / y)) elif x <= 5.5e+145: tmp = t_0 else: tmp = math.fabs((x / y)) return tmp
function code(x, y, z) t_0 = abs(Float64(x * Float64(z / y))) tmp = 0.0 if (x <= -5.8e-40) tmp = t_0; elseif (x <= 8.5e-7) tmp = abs(Float64(4.0 / y)); elseif (x <= 5.5e+145) tmp = t_0; else tmp = abs(Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((x * (z / y))); tmp = 0.0; if (x <= -5.8e-40) tmp = t_0; elseif (x <= 8.5e-7) tmp = abs((4.0 / y)); elseif (x <= 5.5e+145) tmp = t_0; else tmp = abs((x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -5.8e-40], t$95$0, If[LessEqual[x, 8.5e-7], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 5.5e+145], t$95$0, N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|x \cdot \frac{z}{y}\right|\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{-40}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-7}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+145}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -5.7999999999999998e-40 or 8.50000000000000014e-7 < x < 5.4999999999999995e145Initial program 93.6%
Simplified91.8%
Taylor expanded in z around inf 51.9%
associate-*l/58.9%
*-commutative58.9%
Simplified58.9%
if -5.7999999999999998e-40 < x < 8.50000000000000014e-7Initial program 92.2%
Taylor expanded in x around 0 77.2%
if 5.4999999999999995e145 < x Initial program 81.8%
clear-num81.5%
associate-*l/87.8%
frac-sub78.4%
*-un-lft-identity78.4%
Applied egg-rr78.4%
Taylor expanded in x around inf 70.5%
associate-/l*87.8%
unpow287.8%
Simplified87.8%
Taylor expanded in z around 0 80.1%
Final simplification70.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))))
(if (<= x -2.4e-40)
t_0
(if (<= x 1.02e-11)
(fabs (/ 4.0 y))
(if (<= x 3.2e+149) t_0 (fabs (/ x y)))))))
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double tmp;
if (x <= -2.4e-40) {
tmp = t_0;
} else if (x <= 1.02e-11) {
tmp = fabs((4.0 / y));
} else if (x <= 3.2e+149) {
tmp = t_0;
} else {
tmp = fabs((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) :: t_0
real(8) :: tmp
t_0 = abs((z * (x / y)))
if (x <= (-2.4d-40)) then
tmp = t_0
else if (x <= 1.02d-11) then
tmp = abs((4.0d0 / y))
else if (x <= 3.2d+149) then
tmp = t_0
else
tmp = abs((x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((z * (x / y)));
double tmp;
if (x <= -2.4e-40) {
tmp = t_0;
} else if (x <= 1.02e-11) {
tmp = Math.abs((4.0 / y));
} else if (x <= 3.2e+149) {
tmp = t_0;
} else {
tmp = Math.abs((x / y));
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((z * (x / y))) tmp = 0 if x <= -2.4e-40: tmp = t_0 elif x <= 1.02e-11: tmp = math.fabs((4.0 / y)) elif x <= 3.2e+149: tmp = t_0 else: tmp = math.fabs((x / y)) return tmp
function code(x, y, z) t_0 = abs(Float64(z * Float64(x / y))) tmp = 0.0 if (x <= -2.4e-40) tmp = t_0; elseif (x <= 1.02e-11) tmp = abs(Float64(4.0 / y)); elseif (x <= 3.2e+149) tmp = t_0; else tmp = abs(Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((z * (x / y))); tmp = 0.0; if (x <= -2.4e-40) tmp = t_0; elseif (x <= 1.02e-11) tmp = abs((4.0 / y)); elseif (x <= 3.2e+149) tmp = t_0; else tmp = abs((x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.4e-40], t$95$0, If[LessEqual[x, 1.02e-11], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 3.2e+149], t$95$0, N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{-40}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-11}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+149}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -2.39999999999999991e-40 or 1.01999999999999994e-11 < x < 3.2000000000000002e149Initial program 93.7%
Simplified92.0%
Taylor expanded in x around inf 88.3%
associate-/l*95.8%
sub-neg95.8%
metadata-eval95.8%
Simplified95.8%
Taylor expanded in z around inf 51.9%
associate-*r/62.3%
Simplified62.3%
if -2.39999999999999991e-40 < x < 1.01999999999999994e-11Initial program 92.1%
Taylor expanded in x around 0 77.9%
if 3.2000000000000002e149 < x Initial program 81.8%
clear-num81.5%
associate-*l/87.8%
frac-sub78.4%
*-un-lft-identity78.4%
Applied egg-rr78.4%
Taylor expanded in x around inf 70.5%
associate-/l*87.8%
unpow287.8%
Simplified87.8%
Taylor expanded in z around 0 80.1%
Final simplification72.1%
(FPCore (x y z)
:precision binary64
(if (<= x -1e-44)
(fabs (* z (/ x y)))
(if (<= x 7.5e-13)
(fabs (/ 4.0 y))
(if (<= x 1.1e+148) (fabs (/ z (/ y x))) (fabs (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1e-44) {
tmp = fabs((z * (x / y)));
} else if (x <= 7.5e-13) {
tmp = fabs((4.0 / y));
} else if (x <= 1.1e+148) {
tmp = fabs((z / (y / x)));
} else {
tmp = fabs((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 (x <= (-1d-44)) then
tmp = abs((z * (x / y)))
else if (x <= 7.5d-13) then
tmp = abs((4.0d0 / y))
else if (x <= 1.1d+148) then
tmp = abs((z / (y / x)))
else
tmp = abs((x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1e-44) {
tmp = Math.abs((z * (x / y)));
} else if (x <= 7.5e-13) {
tmp = Math.abs((4.0 / y));
} else if (x <= 1.1e+148) {
tmp = Math.abs((z / (y / x)));
} else {
tmp = Math.abs((x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1e-44: tmp = math.fabs((z * (x / y))) elif x <= 7.5e-13: tmp = math.fabs((4.0 / y)) elif x <= 1.1e+148: tmp = math.fabs((z / (y / x))) else: tmp = math.fabs((x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1e-44) tmp = abs(Float64(z * Float64(x / y))); elseif (x <= 7.5e-13) tmp = abs(Float64(4.0 / y)); elseif (x <= 1.1e+148) tmp = abs(Float64(z / Float64(y / x))); else tmp = abs(Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1e-44) tmp = abs((z * (x / y))); elseif (x <= 7.5e-13) tmp = abs((4.0 / y)); elseif (x <= 1.1e+148) tmp = abs((z / (y / x))); else tmp = abs((x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1e-44], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 7.5e-13], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.1e+148], N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-44}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-13}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+148}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -9.99999999999999953e-45Initial program 91.9%
Simplified89.1%
Taylor expanded in x around inf 85.5%
associate-/l*95.8%
sub-neg95.8%
metadata-eval95.8%
Simplified95.8%
Taylor expanded in z around inf 46.7%
associate-*r/61.6%
Simplified61.6%
if -9.99999999999999953e-45 < x < 7.5000000000000004e-13Initial program 92.1%
Taylor expanded in x around 0 77.9%
if 7.5000000000000004e-13 < x < 1.0999999999999999e148Initial program 96.9%
Taylor expanded in z around inf 61.0%
associate-*r/61.0%
mul-1-neg61.0%
distribute-rgt-neg-out61.0%
associate-*r/63.5%
distribute-frac-neg63.5%
mul-1-neg63.5%
metadata-eval63.5%
times-frac63.5%
*-lft-identity63.5%
neg-mul-163.5%
Simplified63.5%
clear-num63.4%
un-div-inv63.7%
add-sqr-sqrt34.0%
sqrt-unprod47.2%
sqr-neg47.2%
sqrt-unprod29.5%
add-sqr-sqrt63.7%
Applied egg-rr63.7%
if 1.0999999999999999e148 < x Initial program 81.8%
clear-num81.5%
associate-*l/87.8%
frac-sub78.4%
*-un-lft-identity78.4%
Applied egg-rr78.4%
Taylor expanded in x around inf 70.5%
associate-/l*87.8%
unpow287.8%
Simplified87.8%
Taylor expanded in z around 0 80.1%
Final simplification72.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -9.8e-43) (not (<= x 400000.0))) (fabs (* x (/ (- 1.0 z) y))) (fabs (/ (- -4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9.8e-43) || !(x <= 400000.0)) {
tmp = fabs((x * ((1.0 - z) / y)));
} else {
tmp = fabs(((-4.0 - 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 ((x <= (-9.8d-43)) .or. (.not. (x <= 400000.0d0))) then
tmp = abs((x * ((1.0d0 - z) / y)))
else
tmp = abs((((-4.0d0) - x) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -9.8e-43) || !(x <= 400000.0)) {
tmp = Math.abs((x * ((1.0 - z) / y)));
} else {
tmp = Math.abs(((-4.0 - x) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9.8e-43) or not (x <= 400000.0): tmp = math.fabs((x * ((1.0 - z) / y))) else: tmp = math.fabs(((-4.0 - x) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -9.8e-43) || !(x <= 400000.0)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y))); else tmp = abs(Float64(Float64(-4.0 - x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -9.8e-43) || ~((x <= 400000.0))) tmp = abs((x * ((1.0 - z) / y))); else tmp = abs(((-4.0 - x) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -9.8e-43], N[Not[LessEqual[x, 400000.0]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.8 \cdot 10^{-43} \lor \neg \left(x \leq 400000\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if x < -9.79999999999999976e-43 or 4e5 < x Initial program 90.6%
Taylor expanded in x around inf 96.7%
*-commutative96.7%
sub-neg96.7%
mul-1-neg96.7%
distribute-lft-in90.6%
associate-*r/90.8%
*-rgt-identity90.8%
mul-1-neg90.8%
distribute-rgt-neg-in90.8%
unsub-neg90.8%
*-lft-identity90.8%
associate-/l*90.7%
*-commutative90.7%
associate-/r/88.9%
div-sub97.4%
associate-/r/96.8%
Simplified96.8%
if -9.79999999999999976e-43 < x < 4e5Initial program 92.2%
Simplified99.9%
Taylor expanded in z around 0 77.6%
associate-*r/77.6%
distribute-lft-in77.6%
metadata-eval77.6%
neg-mul-177.6%
sub-neg77.6%
Simplified77.6%
Final simplification87.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.1e-44) (not (<= x 0.0075))) (fabs (* x (/ (- 1.0 z) y))) (fabs (+ (/ 4.0 y) (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.1e-44) || !(x <= 0.0075)) {
tmp = fabs((x * ((1.0 - z) / y)));
} else {
tmp = fabs(((4.0 / y) + (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 ((x <= (-2.1d-44)) .or. (.not. (x <= 0.0075d0))) then
tmp = abs((x * ((1.0d0 - z) / y)))
else
tmp = abs(((4.0d0 / y) + (x / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.1e-44) || !(x <= 0.0075)) {
tmp = Math.abs((x * ((1.0 - z) / y)));
} else {
tmp = Math.abs(((4.0 / y) + (x / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.1e-44) or not (x <= 0.0075): tmp = math.fabs((x * ((1.0 - z) / y))) else: tmp = math.fabs(((4.0 / y) + (x / y))) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.1e-44) || !(x <= 0.0075)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y))); else tmp = abs(Float64(Float64(4.0 / y) + Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.1e-44) || ~((x <= 0.0075))) tmp = abs((x * ((1.0 - z) / y))); else tmp = abs(((4.0 / y) + (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.1e-44], N[Not[LessEqual[x, 0.0075]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(4.0 / y), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-44} \lor \neg \left(x \leq 0.0075\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y} + \frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -2.10000000000000001e-44 or 0.0074999999999999997 < x Initial program 90.6%
Taylor expanded in x around inf 96.7%
*-commutative96.7%
sub-neg96.7%
mul-1-neg96.7%
distribute-lft-in90.6%
associate-*r/90.8%
*-rgt-identity90.8%
mul-1-neg90.8%
distribute-rgt-neg-in90.8%
unsub-neg90.8%
*-lft-identity90.8%
associate-/l*90.7%
*-commutative90.7%
associate-/r/88.9%
div-sub97.4%
associate-/r/96.8%
Simplified96.8%
if -2.10000000000000001e-44 < x < 0.0074999999999999997Initial program 92.2%
Taylor expanded in z around 0 77.7%
associate-*r/77.7%
metadata-eval77.7%
Simplified77.7%
Final simplification87.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.06e-39) (not (<= x 4.3e-12))) (fabs (/ (+ z -1.0) (/ y x))) (fabs (/ (- -4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.06e-39) || !(x <= 4.3e-12)) {
tmp = fabs(((z + -1.0) / (y / x)));
} else {
tmp = fabs(((-4.0 - 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 ((x <= (-1.06d-39)) .or. (.not. (x <= 4.3d-12))) then
tmp = abs(((z + (-1.0d0)) / (y / x)))
else
tmp = abs((((-4.0d0) - x) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.06e-39) || !(x <= 4.3e-12)) {
tmp = Math.abs(((z + -1.0) / (y / x)));
} else {
tmp = Math.abs(((-4.0 - x) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.06e-39) or not (x <= 4.3e-12): tmp = math.fabs(((z + -1.0) / (y / x))) else: tmp = math.fabs(((-4.0 - x) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.06e-39) || !(x <= 4.3e-12)) tmp = abs(Float64(Float64(z + -1.0) / Float64(y / x))); else tmp = abs(Float64(Float64(-4.0 - x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.06e-39) || ~((x <= 4.3e-12))) tmp = abs(((z + -1.0) / (y / x))); else tmp = abs(((-4.0 - x) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.06e-39], N[Not[LessEqual[x, 4.3e-12]], $MachinePrecision]], N[Abs[N[(N[(z + -1.0), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.06 \cdot 10^{-39} \lor \neg \left(x \leq 4.3 \cdot 10^{-12}\right):\\
\;\;\;\;\left|\frac{z + -1}{\frac{y}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if x < -1.06000000000000004e-39 or 4.29999999999999985e-12 < x Initial program 90.7%
Simplified93.2%
Taylor expanded in x around inf 90.5%
associate-/l*96.7%
sub-neg96.7%
metadata-eval96.7%
Simplified96.7%
if -1.06000000000000004e-39 < x < 4.29999999999999985e-12Initial program 92.1%
Simplified99.9%
Taylor expanded in z around 0 78.0%
associate-*r/78.0%
distribute-lft-in78.0%
metadata-eval78.0%
neg-mul-178.0%
sub-neg78.0%
Simplified78.0%
Final simplification87.7%
(FPCore (x y z) :precision binary64 (if (<= x -2.8e+154) (fabs (* x (/ (- 1.0 z) y))) (fabs (/ (- (+ x 4.0) (* x z)) y))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.8e+154) {
tmp = fabs((x * ((1.0 - z) / y)));
} else {
tmp = fabs((((x + 4.0) - (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 (x <= (-2.8d+154)) then
tmp = abs((x * ((1.0d0 - z) / y)))
else
tmp = abs((((x + 4.0d0) - (x * z)) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.8e+154) {
tmp = Math.abs((x * ((1.0 - z) / y)));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.8e+154: tmp = math.fabs((x * ((1.0 - z) / y))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.8e+154) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y))); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.8e+154) tmp = abs((x * ((1.0 - z) / y))); else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.8e+154], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+154}:\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if x < -2.7999999999999999e154Initial program 92.4%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
sub-neg99.8%
mul-1-neg99.8%
distribute-lft-in92.4%
associate-*r/92.5%
*-rgt-identity92.5%
mul-1-neg92.5%
distribute-rgt-neg-in92.5%
unsub-neg92.5%
*-lft-identity92.5%
associate-/l*92.5%
*-commutative92.5%
associate-/r/92.4%
div-sub99.8%
associate-/r/99.8%
Simplified99.8%
if -2.7999999999999999e154 < x Initial program 91.2%
associate-*l/96.4%
sub-div99.0%
Applied egg-rr99.0%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.4e+104) (not (<= z 1.45e+84))) (fabs (* x (/ z y))) (fabs (/ (- -4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.4e+104) || !(z <= 1.45e+84)) {
tmp = fabs((x * (z / y)));
} else {
tmp = fabs(((-4.0 - 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 <= (-5.4d+104)) .or. (.not. (z <= 1.45d+84))) then
tmp = abs((x * (z / y)))
else
tmp = abs((((-4.0d0) - x) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.4e+104) || !(z <= 1.45e+84)) {
tmp = Math.abs((x * (z / y)));
} else {
tmp = Math.abs(((-4.0 - x) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.4e+104) or not (z <= 1.45e+84): tmp = math.fabs((x * (z / y))) else: tmp = math.fabs(((-4.0 - x) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.4e+104) || !(z <= 1.45e+84)) tmp = abs(Float64(x * Float64(z / y))); else tmp = abs(Float64(Float64(-4.0 - x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.4e+104) || ~((z <= 1.45e+84))) tmp = abs((x * (z / y))); else tmp = abs(((-4.0 - x) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.4e+104], N[Not[LessEqual[z, 1.45e+84]], $MachinePrecision]], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+104} \lor \neg \left(z \leq 1.45 \cdot 10^{+84}\right):\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if z < -5.39999999999999969e104 or 1.44999999999999994e84 < z Initial program 83.9%
Simplified91.6%
Taylor expanded in z around inf 74.6%
associate-*l/77.8%
*-commutative77.8%
Simplified77.8%
if -5.39999999999999969e104 < z < 1.44999999999999994e84Initial program 95.6%
Simplified99.2%
Taylor expanded in z around 0 89.6%
associate-*r/89.6%
distribute-lft-in89.6%
metadata-eval89.6%
neg-mul-189.6%
sub-neg89.6%
Simplified89.6%
Final simplification85.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -10.2) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -10.2) || !(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 <= (-10.2d0)) .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 <= -10.2) || !(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 <= -10.2) 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 <= -10.2) || !(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 <= -10.2) || ~((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, -10.2], 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 -10.2 \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 < -10.199999999999999 or 4 < x Initial program 90.2%
clear-num90.0%
associate-*l/86.4%
frac-sub62.4%
*-un-lft-identity62.4%
Applied egg-rr62.4%
Taylor expanded in x around inf 55.3%
associate-/l*67.3%
unpow267.3%
Simplified67.3%
Taylor expanded in z around 0 59.2%
if -10.199999999999999 < x < 4Initial program 92.5%
Taylor expanded in x around 0 75.0%
Final simplification67.3%
(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 91.4%
Taylor expanded in x around 0 41.1%
Final simplification41.1%
herbie shell --seed 2023200
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))