
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= x -6.2e+78) (not (<= x 3.6e+16))) (fabs (* (- 1.0 z) (/ x y))) (fabs (/ (- (+ x 4.0) (* x z)) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.2e+78) || !(x <= 3.6e+16)) {
tmp = fabs(((1.0 - z) * (x / 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 <= (-6.2d+78)) .or. (.not. (x <= 3.6d+16))) then
tmp = abs(((1.0d0 - z) * (x / 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 <= -6.2e+78) || !(x <= 3.6e+16)) {
tmp = Math.abs(((1.0 - z) * (x / y)));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6.2e+78) or not (x <= 3.6e+16): tmp = math.fabs(((1.0 - z) * (x / y))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -6.2e+78) || !(x <= 3.6e+16)) tmp = abs(Float64(Float64(1.0 - z) * Float64(x / 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 <= -6.2e+78) || ~((x <= 3.6e+16))) tmp = abs(((1.0 - z) * (x / y))); else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -6.2e+78], N[Not[LessEqual[x, 3.6e+16]], $MachinePrecision]], N[Abs[N[(N[(1.0 - z), $MachinePrecision] * N[(x / 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 -6.2 \cdot 10^{+78} \lor \neg \left(x \leq 3.6 \cdot 10^{+16}\right):\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if x < -6.2e78 or 3.6e16 < x Initial program 86.4%
Simplified86.9%
Taylor expanded in x around inf 87.0%
mul-1-neg87.0%
*-commutative87.0%
associate-/l*99.9%
distribute-lft-neg-in99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
if -6.2e78 < x < 3.6e16Initial program 94.5%
associate-*l/99.2%
sub-div99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= z -5.5e+66)
(fabs (/ x (/ y z)))
(if (or (<= z -8e+46) (and (not (<= z -1.3e+18)) (<= z 4.6e+26)))
(fabs (/ (- -4.0 x) y))
(fabs (* z (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.5e+66) {
tmp = fabs((x / (y / z)));
} else if ((z <= -8e+46) || (!(z <= -1.3e+18) && (z <= 4.6e+26))) {
tmp = fabs(((-4.0 - x) / 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 <= (-5.5d+66)) then
tmp = abs((x / (y / z)))
else if ((z <= (-8d+46)) .or. (.not. (z <= (-1.3d+18))) .and. (z <= 4.6d+26)) then
tmp = abs((((-4.0d0) - x) / 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 <= -5.5e+66) {
tmp = Math.abs((x / (y / z)));
} else if ((z <= -8e+46) || (!(z <= -1.3e+18) && (z <= 4.6e+26))) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((z * (x / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.5e+66: tmp = math.fabs((x / (y / z))) elif (z <= -8e+46) or (not (z <= -1.3e+18) and (z <= 4.6e+26)): tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((z * (x / y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.5e+66) tmp = abs(Float64(x / Float64(y / z))); elseif ((z <= -8e+46) || (!(z <= -1.3e+18) && (z <= 4.6e+26))) tmp = abs(Float64(Float64(-4.0 - x) / 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 <= -5.5e+66) tmp = abs((x / (y / z))); elseif ((z <= -8e+46) || (~((z <= -1.3e+18)) && (z <= 4.6e+26))) tmp = abs(((-4.0 - x) / y)); else tmp = abs((z * (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.5e+66], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[z, -8e+46], And[N[Not[LessEqual[z, -1.3e+18]], $MachinePrecision], LessEqual[z, 4.6e+26]]], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+66}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{elif}\;z \leq -8 \cdot 10^{+46} \lor \neg \left(z \leq -1.3 \cdot 10^{+18}\right) \land z \leq 4.6 \cdot 10^{+26}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if z < -5.5e66Initial program 91.5%
Simplified90.0%
Taylor expanded in z around inf 82.5%
associate-*r/82.5%
neg-mul-182.5%
distribute-lft-neg-in82.5%
*-commutative82.5%
associate-*r/83.8%
Simplified83.8%
*-commutative83.8%
distribute-frac-neg83.8%
distribute-lft-neg-in83.8%
associate-/r/86.6%
distribute-neg-frac86.6%
add-sqr-sqrt47.2%
sqrt-unprod74.5%
sqr-neg74.5%
sqrt-unprod39.2%
add-sqr-sqrt86.6%
Applied egg-rr86.6%
if -5.5e66 < z < -7.9999999999999999e46 or -1.3e18 < z < 4.6000000000000001e26Initial program 94.4%
Simplified99.1%
Taylor expanded in z around 0 96.3%
+-commutative96.3%
rem-square-sqrt50.8%
fabs-sqr50.8%
rem-square-sqrt96.3%
fabs-neg96.3%
distribute-neg-frac96.3%
distribute-neg-in96.3%
metadata-eval96.3%
+-commutative96.3%
sub-neg96.3%
rem-square-sqrt44.8%
fabs-sqr44.8%
rem-square-sqrt96.3%
Simplified96.3%
if -7.9999999999999999e46 < z < -1.3e18 or 4.6000000000000001e26 < z Initial program 82.1%
Simplified85.0%
Taylor expanded in z around inf 69.3%
associate-*r/69.3%
neg-mul-169.3%
distribute-lft-neg-in69.3%
*-commutative69.3%
associate-*r/81.2%
Simplified81.2%
*-commutative81.2%
div-inv81.2%
associate-*l*78.0%
add-sqr-sqrt44.2%
sqrt-unprod61.2%
sqr-neg61.2%
sqrt-unprod33.7%
add-sqr-sqrt78.0%
associate-*l*81.2%
div-inv81.2%
clear-num81.1%
associate-*l/81.1%
*-un-lft-identity81.1%
Applied egg-rr81.1%
clear-num80.9%
associate-/r/81.1%
clear-num81.2%
Applied egg-rr81.2%
Final simplification90.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))) (t_1 (fabs (* z (/ x y)))))
(if (<= x -1.65e+120)
t_0
(if (<= x -7.5e-62)
t_1
(if (<= x 1.4e-34) (fabs (/ 4.0 y)) (if (<= x 5.4e+28) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double t_1 = fabs((z * (x / y)));
double tmp;
if (x <= -1.65e+120) {
tmp = t_0;
} else if (x <= -7.5e-62) {
tmp = t_1;
} else if (x <= 1.4e-34) {
tmp = fabs((4.0 / y));
} else if (x <= 5.4e+28) {
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((z * (x / y)))
if (x <= (-1.65d+120)) then
tmp = t_0
else if (x <= (-7.5d-62)) then
tmp = t_1
else if (x <= 1.4d-34) then
tmp = abs((4.0d0 / y))
else if (x <= 5.4d+28) 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((z * (x / y)));
double tmp;
if (x <= -1.65e+120) {
tmp = t_0;
} else if (x <= -7.5e-62) {
tmp = t_1;
} else if (x <= 1.4e-34) {
tmp = Math.abs((4.0 / y));
} else if (x <= 5.4e+28) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((x / y)) t_1 = math.fabs((z * (x / y))) tmp = 0 if x <= -1.65e+120: tmp = t_0 elif x <= -7.5e-62: tmp = t_1 elif x <= 1.4e-34: tmp = math.fabs((4.0 / y)) elif x <= 5.4e+28: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(x / y)) t_1 = abs(Float64(z * Float64(x / y))) tmp = 0.0 if (x <= -1.65e+120) tmp = t_0; elseif (x <= -7.5e-62) tmp = t_1; elseif (x <= 1.4e-34) tmp = abs(Float64(4.0 / y)); elseif (x <= 5.4e+28) 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((z * (x / y))); tmp = 0.0; if (x <= -1.65e+120) tmp = t_0; elseif (x <= -7.5e-62) tmp = t_1; elseif (x <= 1.4e-34) tmp = abs((4.0 / y)); elseif (x <= 5.4e+28) 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[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.65e+120], t$95$0, If[LessEqual[x, -7.5e-62], t$95$1, If[LessEqual[x, 1.4e-34], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 5.4e+28], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
t_1 := \left|z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;x \leq -1.65 \cdot 10^{+120}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{-62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-34}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.64999999999999995e120 or 5.4000000000000003e28 < x Initial program 85.4%
Simplified87.7%
Taylor expanded in x around inf 87.9%
mul-1-neg87.9%
*-commutative87.9%
associate-/l*99.9%
distribute-lft-neg-in99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 72.6%
if -1.64999999999999995e120 < x < -7.5000000000000003e-62 or 1.39999999999999998e-34 < x < 5.4000000000000003e28Initial program 95.1%
Simplified95.7%
Taylor expanded in z around inf 64.4%
associate-*r/64.4%
neg-mul-164.4%
distribute-lft-neg-in64.4%
*-commutative64.4%
associate-*r/65.8%
Simplified65.8%
*-commutative65.8%
div-inv65.8%
associate-*l*66.4%
add-sqr-sqrt49.4%
sqrt-unprod66.4%
sqr-neg66.4%
sqrt-unprod16.9%
add-sqr-sqrt66.4%
associate-*l*65.8%
div-inv65.8%
clear-num64.4%
associate-*l/64.4%
*-un-lft-identity64.4%
Applied egg-rr64.4%
clear-num64.2%
associate-/r/64.4%
clear-num65.8%
Applied egg-rr65.8%
if -7.5000000000000003e-62 < x < 1.39999999999999998e-34Initial program 94.7%
Simplified99.9%
Taylor expanded in x around 0 77.3%
Final simplification73.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))) (t_1 (fabs (* x (/ z y)))))
(if (<= x -8.5e+114)
t_0
(if (<= x -1.4e-61)
t_1
(if (<= x 9.5e-33) (fabs (/ 4.0 y)) (if (<= x 1.95e+27) 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 <= -8.5e+114) {
tmp = t_0;
} else if (x <= -1.4e-61) {
tmp = t_1;
} else if (x <= 9.5e-33) {
tmp = fabs((4.0 / y));
} else if (x <= 1.95e+27) {
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 <= (-8.5d+114)) then
tmp = t_0
else if (x <= (-1.4d-61)) then
tmp = t_1
else if (x <= 9.5d-33) then
tmp = abs((4.0d0 / y))
else if (x <= 1.95d+27) 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 <= -8.5e+114) {
tmp = t_0;
} else if (x <= -1.4e-61) {
tmp = t_1;
} else if (x <= 9.5e-33) {
tmp = Math.abs((4.0 / y));
} else if (x <= 1.95e+27) {
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 <= -8.5e+114: tmp = t_0 elif x <= -1.4e-61: tmp = t_1 elif x <= 9.5e-33: tmp = math.fabs((4.0 / y)) elif x <= 1.95e+27: 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 <= -8.5e+114) tmp = t_0; elseif (x <= -1.4e-61) tmp = t_1; elseif (x <= 9.5e-33) tmp = abs(Float64(4.0 / y)); elseif (x <= 1.95e+27) 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 <= -8.5e+114) tmp = t_0; elseif (x <= -1.4e-61) tmp = t_1; elseif (x <= 9.5e-33) tmp = abs((4.0 / y)); elseif (x <= 1.95e+27) 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, -8.5e+114], t$95$0, If[LessEqual[x, -1.4e-61], t$95$1, If[LessEqual[x, 9.5e-33], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.95e+27], 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 -8.5 \cdot 10^{+114}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{-61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-33}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -8.5000000000000001e114 or 1.9499999999999999e27 < x Initial program 85.4%
Simplified87.7%
Taylor expanded in x around inf 87.9%
mul-1-neg87.9%
*-commutative87.9%
associate-/l*99.9%
distribute-lft-neg-in99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 72.6%
if -8.5000000000000001e114 < x < -1.4000000000000001e-61 or 9.50000000000000019e-33 < x < 1.9499999999999999e27Initial program 95.1%
Simplified95.7%
Taylor expanded in z around inf 64.4%
associate-*r/64.4%
neg-mul-164.4%
distribute-lft-neg-in64.4%
*-commutative64.4%
associate-*r/65.8%
Simplified65.8%
*-commutative65.8%
div-inv65.8%
associate-*l*66.4%
add-sqr-sqrt49.4%
sqrt-unprod66.4%
sqr-neg66.4%
sqrt-unprod16.9%
add-sqr-sqrt66.4%
associate-*l*65.8%
div-inv65.8%
clear-num64.4%
associate-*l/64.4%
*-un-lft-identity64.4%
Applied egg-rr64.4%
associate-/r/66.6%
Applied egg-rr66.6%
if -1.4000000000000001e-61 < x < 9.50000000000000019e-33Initial program 94.7%
Simplified99.9%
Taylor expanded in x around 0 77.3%
Final simplification73.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4e-61) (not (<= x 9.5e-33))) (fabs (* x (/ (- 1.0 z) y))) (fabs (/ (- -4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4e-61) || !(x <= 9.5e-33)) {
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 <= (-1.4d-61)) .or. (.not. (x <= 9.5d-33))) 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 <= -1.4e-61) || !(x <= 9.5e-33)) {
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 <= -1.4e-61) or not (x <= 9.5e-33): 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 <= -1.4e-61) || !(x <= 9.5e-33)) 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 <= -1.4e-61) || ~((x <= 9.5e-33))) 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, -1.4e-61], N[Not[LessEqual[x, 9.5e-33]], $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 -1.4 \cdot 10^{-61} \lor \neg \left(x \leq 9.5 \cdot 10^{-33}\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if x < -1.4000000000000001e-61 or 9.50000000000000019e-33 < x Initial program 88.3%
Simplified90.1%
Taylor expanded in x around inf 85.1%
mul-1-neg85.1%
associate-/l*94.0%
distribute-rgt-neg-in94.0%
mul-1-neg94.0%
associate-*r/94.0%
mul-1-neg94.0%
neg-sub094.0%
associate-+l-94.0%
neg-sub094.0%
+-commutative94.0%
unsub-neg94.0%
Simplified94.0%
if -1.4000000000000001e-61 < x < 9.50000000000000019e-33Initial program 94.7%
Simplified99.9%
Taylor expanded in z around 0 77.3%
+-commutative77.3%
rem-square-sqrt40.1%
fabs-sqr40.1%
rem-square-sqrt77.3%
fabs-neg77.3%
distribute-neg-frac77.3%
distribute-neg-in77.3%
metadata-eval77.3%
+-commutative77.3%
sub-neg77.3%
rem-square-sqrt36.6%
fabs-sqr36.6%
rem-square-sqrt77.3%
Simplified77.3%
Final simplification87.6%
(FPCore (x y z) :precision binary64 (if (<= x -1.4e-61) (fabs (* x (/ (- 1.0 z) y))) (if (<= x 8.2e-33) (fabs (/ (- -4.0 x) y)) (fabs (* (- 1.0 z) (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e-61) {
tmp = fabs((x * ((1.0 - z) / y)));
} else if (x <= 8.2e-33) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs(((1.0 - 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 <= (-1.4d-61)) then
tmp = abs((x * ((1.0d0 - z) / y)))
else if (x <= 8.2d-33) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs(((1.0d0 - z) * (x / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e-61) {
tmp = Math.abs((x * ((1.0 - z) / y)));
} else if (x <= 8.2e-33) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs(((1.0 - z) * (x / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.4e-61: tmp = math.fabs((x * ((1.0 - z) / y))) elif x <= 8.2e-33: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs(((1.0 - z) * (x / y))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.4e-61) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y))); elseif (x <= 8.2e-33) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(Float64(1.0 - z) * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.4e-61) tmp = abs((x * ((1.0 - z) / y))); elseif (x <= 8.2e-33) tmp = abs(((-4.0 - x) / y)); else tmp = abs(((1.0 - z) * (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.4e-61], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 8.2e-33], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(1.0 - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-61}:\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-33}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -1.4000000000000001e-61Initial program 90.8%
Simplified88.3%
Taylor expanded in x around inf 81.6%
mul-1-neg81.6%
associate-/l*91.9%
distribute-rgt-neg-in91.9%
mul-1-neg91.9%
associate-*r/91.9%
mul-1-neg91.9%
neg-sub091.9%
associate-+l-91.9%
neg-sub091.9%
+-commutative91.9%
unsub-neg91.9%
Simplified91.9%
if -1.4000000000000001e-61 < x < 8.2e-33Initial program 94.7%
Simplified99.9%
Taylor expanded in z around 0 77.3%
+-commutative77.3%
rem-square-sqrt40.1%
fabs-sqr40.1%
rem-square-sqrt77.3%
fabs-neg77.3%
distribute-neg-frac77.3%
distribute-neg-in77.3%
metadata-eval77.3%
+-commutative77.3%
sub-neg77.3%
rem-square-sqrt36.6%
fabs-sqr36.6%
rem-square-sqrt77.3%
Simplified77.3%
if 8.2e-33 < x Initial program 85.0%
Simplified92.6%
Taylor expanded in x around inf 89.9%
mul-1-neg89.9%
*-commutative89.9%
associate-/l*97.1%
distribute-lft-neg-in97.1%
neg-sub097.1%
associate-+l-97.1%
neg-sub097.1%
+-commutative97.1%
unsub-neg97.1%
Simplified97.1%
Final simplification87.7%
(FPCore (x y z) :precision binary64 (if (<= y 2e+113) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (/ x (/ y z)) (/ (+ x 4.0) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e+113) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs(((x / (y / z)) - ((x + 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 (y <= 2d+113) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs(((x / (y / z)) - ((x + 4.0d0) / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e+113) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs(((x / (y / z)) - ((x + 4.0) / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e+113: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs(((x / (y / z)) - ((x + 4.0) / y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e+113) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(Float64(x / Float64(y / z)) - Float64(Float64(x + 4.0) / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e+113) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs(((x / (y / z)) - ((x + 4.0) / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e+113], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+113}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}} - \frac{x + 4}{y}\right|\\
\end{array}
\end{array}
if y < 2e113Initial program 90.2%
associate-*l/93.3%
sub-div97.6%
Applied egg-rr97.6%
if 2e113 < y Initial program 93.2%
associate-*l/77.7%
associate-*r/99.7%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (<= y 5e+110) (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 <= 5e+110) {
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 <= 5d+110) 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 <= 5e+110) {
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 <= 5e+110: 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 <= 5e+110) 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 <= 5e+110) 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, 5e+110], 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 5 \cdot 10^{+110}:\\
\;\;\;\;\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 < 4.99999999999999978e110Initial program 90.2%
associate-*l/93.3%
sub-div97.6%
Applied egg-rr97.6%
if 4.99999999999999978e110 < y Initial program 93.2%
Taylor expanded in x around 0 77.7%
associate-*r/99.7%
Simplified99.7%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -10.5) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -10.5) || !(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.5d0)) .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.5) || !(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.5) 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.5) || !(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.5) || ~((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.5], 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.5 \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.5 or 4 < x Initial program 87.3%
Simplified88.5%
Taylor expanded in x around inf 88.6%
mul-1-neg88.6%
*-commutative88.6%
associate-/l*99.8%
distribute-lft-neg-in99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in z around 0 65.2%
if -10.5 < x < 4Initial program 94.6%
Simplified99.8%
Taylor expanded in x around 0 68.8%
Final simplification66.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.8%
Simplified93.9%
Taylor expanded in x around 0 35.1%
Final simplification35.1%
herbie shell --seed 2024115
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))