
(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 (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(x + Float64(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[(x + N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + \left(4 - x \cdot z\right)}{y}\right|
\end{array}
Initial program 90.2%
associate-*l/94.5%
sub-div98.4%
associate--l+98.4%
Applied egg-rr98.4%
Final simplification98.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ 4.0 y))) (t_1 (fabs (/ (* x z) y))))
(if (<= x -2.5e+34)
(fabs (/ x y))
(if (<= x -4.4e-72)
t_1
(if (<= x -2.8e-206)
t_0
(if (<= x -2.95e-217)
t_1
(if (<= x 1.75e-90) t_0 (fabs (* z (/ x y))))))))))
double code(double x, double y, double z) {
double t_0 = fabs((4.0 / y));
double t_1 = fabs(((x * z) / y));
double tmp;
if (x <= -2.5e+34) {
tmp = fabs((x / y));
} else if (x <= -4.4e-72) {
tmp = t_1;
} else if (x <= -2.8e-206) {
tmp = t_0;
} else if (x <= -2.95e-217) {
tmp = t_1;
} else if (x <= 1.75e-90) {
tmp = t_0;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((4.0d0 / y))
t_1 = abs(((x * z) / y))
if (x <= (-2.5d+34)) then
tmp = abs((x / y))
else if (x <= (-4.4d-72)) then
tmp = t_1
else if (x <= (-2.8d-206)) then
tmp = t_0
else if (x <= (-2.95d-217)) then
tmp = t_1
else if (x <= 1.75d-90) then
tmp = t_0
else
tmp = abs((z * (x / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((4.0 / y));
double t_1 = Math.abs(((x * z) / y));
double tmp;
if (x <= -2.5e+34) {
tmp = Math.abs((x / y));
} else if (x <= -4.4e-72) {
tmp = t_1;
} else if (x <= -2.8e-206) {
tmp = t_0;
} else if (x <= -2.95e-217) {
tmp = t_1;
} else if (x <= 1.75e-90) {
tmp = t_0;
} else {
tmp = Math.abs((z * (x / y)));
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((4.0 / y)) t_1 = math.fabs(((x * z) / y)) tmp = 0 if x <= -2.5e+34: tmp = math.fabs((x / y)) elif x <= -4.4e-72: tmp = t_1 elif x <= -2.8e-206: tmp = t_0 elif x <= -2.95e-217: tmp = t_1 elif x <= 1.75e-90: tmp = t_0 else: tmp = math.fabs((z * (x / y))) return tmp
function code(x, y, z) t_0 = abs(Float64(4.0 / y)) t_1 = abs(Float64(Float64(x * z) / y)) tmp = 0.0 if (x <= -2.5e+34) tmp = abs(Float64(x / y)); elseif (x <= -4.4e-72) tmp = t_1; elseif (x <= -2.8e-206) tmp = t_0; elseif (x <= -2.95e-217) tmp = t_1; elseif (x <= 1.75e-90) tmp = t_0; else tmp = abs(Float64(z * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((4.0 / y)); t_1 = abs(((x * z) / y)); tmp = 0.0; if (x <= -2.5e+34) tmp = abs((x / y)); elseif (x <= -4.4e-72) tmp = t_1; elseif (x <= -2.8e-206) tmp = t_0; elseif (x <= -2.95e-217) tmp = t_1; elseif (x <= 1.75e-90) tmp = t_0; else tmp = abs((z * (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.5e+34], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, -4.4e-72], t$95$1, If[LessEqual[x, -2.8e-206], t$95$0, If[LessEqual[x, -2.95e-217], t$95$1, If[LessEqual[x, 1.75e-90], t$95$0, N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{4}{y}\right|\\
t_1 := \left|\frac{x \cdot z}{y}\right|\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+34}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-72}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-206}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.95 \cdot 10^{-217}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-90}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -2.4999999999999999e34Initial program 80.2%
associate-*l/85.5%
sub-div95.4%
associate--l+95.4%
Applied egg-rr95.4%
Taylor expanded in x around inf 95.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 68.7%
if -2.4999999999999999e34 < x < -4.40000000000000005e-72 or -2.8000000000000001e-206 < x < -2.9499999999999999e-217Initial program 90.0%
Simplified89.7%
Taylor expanded in x around inf 63.5%
Taylor expanded in z around inf 67.6%
if -4.40000000000000005e-72 < x < -2.8000000000000001e-206 or -2.9499999999999999e-217 < x < 1.7499999999999999e-90Initial program 93.9%
Taylor expanded in x around 0 86.9%
if 1.7499999999999999e-90 < x Initial program 93.9%
Simplified97.6%
Taylor expanded in x around inf 85.6%
Taylor expanded in z around inf 56.6%
associate-*l/60.0%
Simplified60.0%
Final simplification71.6%
(FPCore (x y z)
:precision binary64
(if (<= x -3.6e+35)
(fabs (/ x y))
(if (or (<= x -4.1e-63) (not (<= x 1.25e-78)))
(fabs (* z (/ x y)))
(fabs (/ 4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.6e+35) {
tmp = fabs((x / y));
} else if ((x <= -4.1e-63) || !(x <= 1.25e-78)) {
tmp = fabs((z * (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 <= (-3.6d+35)) then
tmp = abs((x / y))
else if ((x <= (-4.1d-63)) .or. (.not. (x <= 1.25d-78))) then
tmp = abs((z * (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 <= -3.6e+35) {
tmp = Math.abs((x / y));
} else if ((x <= -4.1e-63) || !(x <= 1.25e-78)) {
tmp = Math.abs((z * (x / y)));
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.6e+35: tmp = math.fabs((x / y)) elif (x <= -4.1e-63) or not (x <= 1.25e-78): tmp = math.fabs((z * (x / y))) else: tmp = math.fabs((4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.6e+35) tmp = abs(Float64(x / y)); elseif ((x <= -4.1e-63) || !(x <= 1.25e-78)) tmp = abs(Float64(z * 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 <= -3.6e+35) tmp = abs((x / y)); elseif ((x <= -4.1e-63) || ~((x <= 1.25e-78))) tmp = abs((z * (x / y))); else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.6e+35], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, -4.1e-63], N[Not[LessEqual[x, 1.25e-78]], $MachinePrecision]], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+35}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-63} \lor \neg \left(x \leq 1.25 \cdot 10^{-78}\right):\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -3.6e35Initial program 80.2%
associate-*l/85.5%
sub-div95.4%
associate--l+95.4%
Applied egg-rr95.4%
Taylor expanded in x around inf 95.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 68.7%
if -3.6e35 < x < -4.0999999999999998e-63 or 1.2499999999999999e-78 < x Initial program 94.3%
Simplified97.2%
Taylor expanded in x around inf 81.2%
Taylor expanded in z around inf 57.8%
associate-*l/59.7%
Simplified59.7%
if -4.0999999999999998e-63 < x < 1.2499999999999999e-78Initial program 92.2%
Taylor expanded in x around 0 82.4%
Final simplification69.6%
(FPCore (x y z)
:precision binary64
(if (<= x -9e+34)
(fabs (/ x y))
(if (<= x -4.1e-63)
(fabs (/ x (/ y z)))
(if (<= x 1.75e-90) (fabs (/ 4.0 y)) (fabs (* z (/ x y)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -9e+34) {
tmp = fabs((x / y));
} else if (x <= -4.1e-63) {
tmp = fabs((x / (y / z)));
} else if (x <= 1.75e-90) {
tmp = fabs((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 (x <= (-9d+34)) then
tmp = abs((x / y))
else if (x <= (-4.1d-63)) then
tmp = abs((x / (y / z)))
else if (x <= 1.75d-90) then
tmp = abs((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 (x <= -9e+34) {
tmp = Math.abs((x / y));
} else if (x <= -4.1e-63) {
tmp = Math.abs((x / (y / z)));
} else if (x <= 1.75e-90) {
tmp = Math.abs((4.0 / y));
} else {
tmp = Math.abs((z * (x / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -9e+34: tmp = math.fabs((x / y)) elif x <= -4.1e-63: tmp = math.fabs((x / (y / z))) elif x <= 1.75e-90: tmp = math.fabs((4.0 / y)) else: tmp = math.fabs((z * (x / y))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -9e+34) tmp = abs(Float64(x / y)); elseif (x <= -4.1e-63) tmp = abs(Float64(x / Float64(y / z))); elseif (x <= 1.75e-90) tmp = abs(Float64(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 (x <= -9e+34) tmp = abs((x / y)); elseif (x <= -4.1e-63) tmp = abs((x / (y / z))); elseif (x <= 1.75e-90) tmp = abs((4.0 / y)); else tmp = abs((z * (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -9e+34], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, -4.1e-63], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.75e-90], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+34}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-63}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-90}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -9.0000000000000001e34Initial program 80.2%
associate-*l/85.5%
sub-div95.4%
associate--l+95.4%
Applied egg-rr95.4%
Taylor expanded in x around inf 95.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 68.7%
if -9.0000000000000001e34 < x < -4.0999999999999998e-63Initial program 95.7%
Taylor expanded in z around inf 62.2%
mul-1-neg62.2%
associate-*l/58.4%
distribute-rgt-neg-out58.4%
Simplified58.4%
associate-*l/62.2%
associate-/l*61.0%
add-sqr-sqrt22.1%
sqrt-unprod39.8%
sqr-neg39.8%
sqrt-unprod38.6%
add-sqr-sqrt61.0%
Applied egg-rr61.0%
if -4.0999999999999998e-63 < x < 1.7499999999999999e-90Initial program 92.2%
Taylor expanded in x around 0 82.4%
if 1.7499999999999999e-90 < x Initial program 93.9%
Simplified97.6%
Taylor expanded in x around inf 85.6%
Taylor expanded in z around inf 56.6%
associate-*l/60.0%
Simplified60.0%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (<= z -55000000.0) (fabs (- (/ x y) (/ (* x z) y))) (if (<= z 1e+49) (fabs (/ (- -4.0 x) y)) (fabs (/ x (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -55000000.0) {
tmp = fabs(((x / y) - ((x * z) / y)));
} else if (z <= 1e+49) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((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 (z <= (-55000000.0d0)) then
tmp = abs(((x / y) - ((x * z) / y)))
else if (z <= 1d+49) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((x / (y / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -55000000.0) {
tmp = Math.abs(((x / y) - ((x * z) / y)));
} else if (z <= 1e+49) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((x / (y / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -55000000.0: tmp = math.fabs(((x / y) - ((x * z) / y))) elif z <= 1e+49: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((x / (y / z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -55000000.0) tmp = abs(Float64(Float64(x / y) - Float64(Float64(x * z) / y))); elseif (z <= 1e+49) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(x / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -55000000.0) tmp = abs(((x / y) - ((x * z) / y))); elseif (z <= 1e+49) tmp = abs(((-4.0 - x) / y)); else tmp = abs((x / (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -55000000.0], N[Abs[N[(N[(x / y), $MachinePrecision] - N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1e+49], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -55000000:\\
\;\;\;\;\left|\frac{x}{y} - \frac{x \cdot z}{y}\right|\\
\mathbf{elif}\;z \leq 10^{+49}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\end{array}
\end{array}
if z < -5.5e7Initial program 91.6%
Simplified98.1%
Taylor expanded in x around inf 84.3%
if -5.5e7 < z < 9.99999999999999946e48Initial program 90.2%
Simplified98.0%
Taylor expanded in z around 0 95.3%
associate-*r/95.3%
distribute-lft-in95.3%
metadata-eval95.3%
neg-mul-195.3%
sub-neg95.3%
Simplified95.3%
if 9.99999999999999946e48 < z Initial program 88.9%
Taylor expanded in z around inf 77.6%
mul-1-neg77.6%
associate-*l/78.2%
distribute-rgt-neg-out78.2%
Simplified78.2%
associate-*l/77.6%
associate-/l*81.4%
add-sqr-sqrt0.0%
sqrt-unprod53.2%
sqr-neg53.2%
sqrt-unprod81.2%
add-sqr-sqrt81.4%
Applied egg-rr81.4%
Final simplification89.9%
(FPCore (x y z) :precision binary64 (if (<= z -126000000.0) (fabs (/ (* x z) y)) (if (<= z 4.2e+49) (fabs (/ (- -4.0 x) y)) (fabs (/ x (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -126000000.0) {
tmp = fabs(((x * z) / y));
} else if (z <= 4.2e+49) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((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 (z <= (-126000000.0d0)) then
tmp = abs(((x * z) / y))
else if (z <= 4.2d+49) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((x / (y / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -126000000.0) {
tmp = Math.abs(((x * z) / y));
} else if (z <= 4.2e+49) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((x / (y / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -126000000.0: tmp = math.fabs(((x * z) / y)) elif z <= 4.2e+49: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((x / (y / z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -126000000.0) tmp = abs(Float64(Float64(x * z) / y)); elseif (z <= 4.2e+49) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(x / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -126000000.0) tmp = abs(((x * z) / y)); elseif (z <= 4.2e+49) tmp = abs(((-4.0 - x) / y)); else tmp = abs((x / (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -126000000.0], N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 4.2e+49], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -126000000:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+49}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\end{array}
\end{array}
if z < -1.26e8Initial program 91.6%
Simplified94.7%
Taylor expanded in x around inf 82.6%
Taylor expanded in z around inf 83.2%
if -1.26e8 < z < 4.20000000000000022e49Initial program 90.2%
Simplified98.0%
Taylor expanded in z around 0 95.3%
associate-*r/95.3%
distribute-lft-in95.3%
metadata-eval95.3%
neg-mul-195.3%
sub-neg95.3%
Simplified95.3%
if 4.20000000000000022e49 < z Initial program 88.9%
Taylor expanded in z around inf 77.6%
mul-1-neg77.6%
associate-*l/78.2%
distribute-rgt-neg-out78.2%
Simplified78.2%
associate-*l/77.6%
associate-/l*81.4%
add-sqr-sqrt0.0%
sqrt-unprod53.2%
sqr-neg53.2%
sqrt-unprod81.2%
add-sqr-sqrt81.4%
Applied egg-rr81.4%
Final simplification89.6%
(FPCore (x y z) :precision binary64 (if (<= z -118000000.0) (fabs (/ 1.0 (/ y (* x z)))) (if (<= z 2.6e+49) (fabs (/ (- -4.0 x) y)) (fabs (/ x (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -118000000.0) {
tmp = fabs((1.0 / (y / (x * z))));
} else if (z <= 2.6e+49) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((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 (z <= (-118000000.0d0)) then
tmp = abs((1.0d0 / (y / (x * z))))
else if (z <= 2.6d+49) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((x / (y / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -118000000.0) {
tmp = Math.abs((1.0 / (y / (x * z))));
} else if (z <= 2.6e+49) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((x / (y / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -118000000.0: tmp = math.fabs((1.0 / (y / (x * z)))) elif z <= 2.6e+49: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((x / (y / z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -118000000.0) tmp = abs(Float64(1.0 / Float64(y / Float64(x * z)))); elseif (z <= 2.6e+49) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(x / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -118000000.0) tmp = abs((1.0 / (y / (x * z)))); elseif (z <= 2.6e+49) tmp = abs(((-4.0 - x) / y)); else tmp = abs((x / (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -118000000.0], N[Abs[N[(1.0 / N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 2.6e+49], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -118000000:\\
\;\;\;\;\left|\frac{1}{\frac{y}{x \cdot z}}\right|\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+49}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\end{array}
\end{array}
if z < -1.18e8Initial program 91.6%
Taylor expanded in z around inf 83.2%
mul-1-neg83.2%
associate-*l/76.9%
distribute-rgt-neg-out76.9%
Simplified76.9%
associate-*l/83.2%
clear-num83.2%
add-sqr-sqrt83.2%
sqrt-unprod62.8%
sqr-neg62.8%
sqrt-unprod0.0%
add-sqr-sqrt83.2%
Applied egg-rr83.2%
if -1.18e8 < z < 2.59999999999999989e49Initial program 90.2%
Simplified98.0%
Taylor expanded in z around 0 95.3%
associate-*r/95.3%
distribute-lft-in95.3%
metadata-eval95.3%
neg-mul-195.3%
sub-neg95.3%
Simplified95.3%
if 2.59999999999999989e49 < z Initial program 88.9%
Taylor expanded in z around inf 77.6%
mul-1-neg77.6%
associate-*l/78.2%
distribute-rgt-neg-out78.2%
Simplified78.2%
associate-*l/77.6%
associate-/l*81.4%
add-sqr-sqrt0.0%
sqrt-unprod53.2%
sqr-neg53.2%
sqrt-unprod81.2%
add-sqr-sqrt81.4%
Applied egg-rr81.4%
Final simplification89.6%
(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 86.7%
associate-*l/89.2%
sub-div97.0%
associate--l+97.0%
Applied egg-rr97.0%
Taylor expanded in x around inf 96.4%
associate-/l*99.4%
Simplified99.4%
Taylor expanded in z around 0 63.2%
if -1.55000000000000004 < x < 4Initial program 93.8%
Taylor expanded in x around 0 70.8%
Final simplification67.0%
(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.2%
Taylor expanded in x around 0 38.1%
Final simplification38.1%
herbie shell --seed 2023319
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))