
(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 11 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
(let* ((t_0 (fabs (- (/ (+ x 4.0) y) (* z (/ x y))))))
(if (<= t_0 5e-27)
(fabs (/ (- (+ x 4.0) (* x z)) y))
(if (<= t_0 1.1e+296) t_0 (fabs (* (/ x y) (+ z -1.0)))))))
double code(double x, double y, double z) {
double t_0 = fabs((((x + 4.0) / y) - (z * (x / y))));
double tmp;
if (t_0 <= 5e-27) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else if (t_0 <= 1.1e+296) {
tmp = t_0;
} else {
tmp = fabs(((x / y) * (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) :: t_0
real(8) :: tmp
t_0 = abs((((x + 4.0d0) / y) - (z * (x / y))))
if (t_0 <= 5d-27) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else if (t_0 <= 1.1d+296) then
tmp = t_0
else
tmp = abs(((x / y) * (z + (-1.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((((x + 4.0) / y) - (z * (x / y))));
double tmp;
if (t_0 <= 5e-27) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else if (t_0 <= 1.1e+296) {
tmp = t_0;
} else {
tmp = Math.abs(((x / y) * (z + -1.0)));
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((((x + 4.0) / y) - (z * (x / y)))) tmp = 0 if t_0 <= 5e-27: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) elif t_0 <= 1.1e+296: tmp = t_0 else: tmp = math.fabs(((x / y) * (z + -1.0))) return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(z * Float64(x / y)))) tmp = 0.0 if (t_0 <= 5e-27) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); elseif (t_0 <= 1.1e+296) tmp = t_0; else tmp = abs(Float64(Float64(x / y) * Float64(z + -1.0))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((((x + 4.0) / y) - (z * (x / y)))); tmp = 0.0; if (t_0 <= 5e-27) tmp = abs((((x + 4.0) - (x * z)) / y)); elseif (t_0 <= 1.1e+296) tmp = t_0; else tmp = abs(((x / y) * (z + -1.0))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 5e-27], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$0, 1.1e+296], t$95$0, N[Abs[N[(N[(x / y), $MachinePrecision] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-27}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{elif}\;t\_0 \leq 1.1 \cdot 10^{+296}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(z + -1\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 5.0000000000000002e-27Initial program 91.6%
associate-*l/99.9%
sub-div99.9%
Applied egg-rr99.9%
if 5.0000000000000002e-27 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 1.10000000000000007e296Initial program 99.8%
if 1.10000000000000007e296 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 81.8%
Simplified98.3%
Taylor expanded in x around inf 98.3%
mul-1-neg98.3%
*-commutative98.3%
associate-/l*100.0%
distribute-lft-neg-in100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y 9.5e+52) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (fma x (/ z y) (/ (- -4.0 x) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 9.5e+52) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs(fma(x, (z / y), ((-4.0 - x) / y)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 9.5e+52) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(fma(x, Float64(z / y), Float64(Float64(-4.0 - x) / y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 9.5e+52], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.5 \cdot 10^{+52}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|\\
\end{array}
\end{array}
if y < 9.49999999999999994e52Initial program 93.9%
associate-*l/94.9%
sub-div97.3%
Applied egg-rr97.3%
if 9.49999999999999994e52 < y Initial program 93.8%
fabs-sub93.8%
associate-*l/85.7%
associate-*r/99.7%
fma-neg99.7%
distribute-neg-frac99.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification97.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))))
(if (<= x -6.5e-26)
t_0
(if (<= x 6.2e-14)
(fabs (/ 4.0 y))
(if (or (<= x 7.5e+136) (not (<= x 1.15e+234))) t_0 (fabs (/ x y)))))))
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double tmp;
if (x <= -6.5e-26) {
tmp = t_0;
} else if (x <= 6.2e-14) {
tmp = fabs((4.0 / y));
} else if ((x <= 7.5e+136) || !(x <= 1.15e+234)) {
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 <= (-6.5d-26)) then
tmp = t_0
else if (x <= 6.2d-14) then
tmp = abs((4.0d0 / y))
else if ((x <= 7.5d+136) .or. (.not. (x <= 1.15d+234))) 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 <= -6.5e-26) {
tmp = t_0;
} else if (x <= 6.2e-14) {
tmp = Math.abs((4.0 / y));
} else if ((x <= 7.5e+136) || !(x <= 1.15e+234)) {
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 <= -6.5e-26: tmp = t_0 elif x <= 6.2e-14: tmp = math.fabs((4.0 / y)) elif (x <= 7.5e+136) or not (x <= 1.15e+234): 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 <= -6.5e-26) tmp = t_0; elseif (x <= 6.2e-14) tmp = abs(Float64(4.0 / y)); elseif ((x <= 7.5e+136) || !(x <= 1.15e+234)) 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 <= -6.5e-26) tmp = t_0; elseif (x <= 6.2e-14) tmp = abs((4.0 / y)); elseif ((x <= 7.5e+136) || ~((x <= 1.15e+234))) 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, -6.5e-26], t$95$0, If[LessEqual[x, 6.2e-14], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 7.5e+136], N[Not[LessEqual[x, 1.15e+234]], $MachinePrecision]], 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 -6.5 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-14}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+136} \lor \neg \left(x \leq 1.15 \cdot 10^{+234}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -6.5e-26 or 6.20000000000000009e-14 < x < 7.5000000000000002e136 or 1.15e234 < x Initial program 93.2%
fabs-sub93.2%
associate-*l/87.3%
associate-*r/96.4%
fma-neg98.1%
distribute-neg-frac98.1%
+-commutative98.1%
distribute-neg-in98.1%
unsub-neg98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in z around inf 84.8%
+-commutative84.8%
associate-*r/84.8%
distribute-lft-in84.8%
metadata-eval84.8%
neg-mul-184.8%
sub-neg84.8%
associate-/r*83.2%
Simplified83.2%
Taylor expanded in z around inf 53.5%
*-commutative53.5%
associate-*r/69.8%
Simplified69.8%
if -6.5e-26 < x < 6.20000000000000009e-14Initial program 95.4%
Simplified99.9%
Taylor expanded in x around 0 79.8%
if 7.5000000000000002e136 < x < 1.15e234Initial program 86.7%
Simplified93.5%
Taylor expanded in x around inf 93.5%
mul-1-neg93.5%
*-commutative93.5%
associate-/l*100.0%
distribute-lft-neg-in100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 81.4%
Final simplification75.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -200.0) (not (<= x 4.0))) (fabs (* (/ x y) (+ z -1.0))) (fabs (/ (* z (- (/ 4.0 z) x)) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -200.0) || !(x <= 4.0)) {
tmp = fabs(((x / y) * (z + -1.0)));
} else {
tmp = fabs(((z * ((4.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 <= (-200.0d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs(((x / y) * (z + (-1.0d0))))
else
tmp = abs(((z * ((4.0d0 / z) - x)) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -200.0) || !(x <= 4.0)) {
tmp = Math.abs(((x / y) * (z + -1.0)));
} else {
tmp = Math.abs(((z * ((4.0 / z) - x)) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -200.0) or not (x <= 4.0): tmp = math.fabs(((x / y) * (z + -1.0))) else: tmp = math.fabs(((z * ((4.0 / z) - x)) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -200.0) || !(x <= 4.0)) tmp = abs(Float64(Float64(x / y) * Float64(z + -1.0))); else tmp = abs(Float64(Float64(z * Float64(Float64(4.0 / z) - x)) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -200.0) || ~((x <= 4.0))) tmp = abs(((x / y) * (z + -1.0))); else tmp = abs(((z * ((4.0 / z) - x)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -200.0], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(N[(x / y), $MachinePrecision] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(z * N[(N[(4.0 / z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -200 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(z + -1\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z \cdot \left(\frac{4}{z} - x\right)}{y}\right|\\
\end{array}
\end{array}
if x < -200 or 4 < x Initial program 91.8%
Simplified90.0%
Taylor expanded in x around inf 88.3%
mul-1-neg88.3%
*-commutative88.3%
associate-/l*98.0%
distribute-lft-neg-in98.0%
neg-sub098.0%
associate-+l-98.0%
neg-sub098.0%
+-commutative98.0%
unsub-neg98.0%
Simplified98.0%
if -200 < x < 4Initial program 95.8%
associate-*l/99.9%
sub-div99.9%
Applied egg-rr99.9%
Taylor expanded in z around -inf 99.8%
associate-*r*99.8%
neg-mul-199.8%
distribute-lft-out--99.8%
associate-*r*99.8%
distribute-lft-neg-in99.8%
*-commutative99.8%
neg-mul-199.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in x around 0 98.6%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -2e+70) (not (<= x 9e+51))) (fabs (* (/ x y) (+ z -1.0))) (fabs (/ (- (+ x 4.0) (* x z)) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2e+70) || !(x <= 9e+51)) {
tmp = fabs(((x / y) * (z + -1.0)));
} 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 <= (-2d+70)) .or. (.not. (x <= 9d+51))) then
tmp = abs(((x / y) * (z + (-1.0d0))))
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 <= -2e+70) || !(x <= 9e+51)) {
tmp = Math.abs(((x / y) * (z + -1.0)));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2e+70) or not (x <= 9e+51): tmp = math.fabs(((x / y) * (z + -1.0))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2e+70) || !(x <= 9e+51)) tmp = abs(Float64(Float64(x / y) * Float64(z + -1.0))); 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 <= -2e+70) || ~((x <= 9e+51))) tmp = abs(((x / y) * (z + -1.0))); else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2e+70], N[Not[LessEqual[x, 9e+51]], $MachinePrecision]], N[Abs[N[(N[(x / y), $MachinePrecision] * N[(z + -1.0), $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 \cdot 10^{+70} \lor \neg \left(x \leq 9 \cdot 10^{+51}\right):\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(z + -1\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if x < -2.00000000000000015e70 or 8.9999999999999999e51 < x Initial program 90.5%
Simplified87.2%
Taylor expanded in x around inf 87.3%
mul-1-neg87.3%
*-commutative87.3%
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 -2.00000000000000015e70 < x < 8.9999999999999999e51Initial program 95.8%
associate-*l/99.9%
sub-div99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.6e-26) (not (<= x 3000000000.0))) (fabs (* x (/ (- 1.0 z) y))) (fabs (/ (- -4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.6e-26) || !(x <= 3000000000.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 <= (-2.6d-26)) .or. (.not. (x <= 3000000000.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 <= -2.6e-26) || !(x <= 3000000000.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 <= -2.6e-26) or not (x <= 3000000000.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 <= -2.6e-26) || !(x <= 3000000000.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 <= -2.6e-26) || ~((x <= 3000000000.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, -2.6e-26], N[Not[LessEqual[x, 3000000000.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 -2.6 \cdot 10^{-26} \lor \neg \left(x \leq 3000000000\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if x < -2.6000000000000001e-26 or 3e9 < x Initial program 92.1%
Simplified90.3%
Taylor expanded in x around inf 89.1%
*-commutative89.1%
associate-/l*98.3%
associate-*r*98.3%
*-commutative98.3%
associate-*r/98.3%
mul-1-neg98.3%
neg-sub098.3%
associate-+l-98.3%
neg-sub098.3%
+-commutative98.3%
unsub-neg98.3%
Simplified98.3%
if -2.6000000000000001e-26 < x < 3e9Initial program 95.6%
Simplified99.9%
Taylor expanded in z around 0 79.5%
+-commutative79.5%
rem-square-sqrt29.5%
fabs-sqr29.5%
rem-square-sqrt79.5%
fabs-neg79.5%
distribute-neg-frac79.5%
distribute-neg-in79.5%
metadata-eval79.5%
+-commutative79.5%
sub-neg79.5%
rem-square-sqrt49.5%
fabs-sqr49.5%
rem-square-sqrt79.5%
Simplified79.5%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.5e-29) (not (<= x 2200000000.0))) (fabs (* (/ x y) (+ z -1.0))) (fabs (/ (- -4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.5e-29) || !(x <= 2200000000.0)) {
tmp = fabs(((x / y) * (z + -1.0)));
} 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 <= (-2.5d-29)) .or. (.not. (x <= 2200000000.0d0))) then
tmp = abs(((x / y) * (z + (-1.0d0))))
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 <= -2.5e-29) || !(x <= 2200000000.0)) {
tmp = Math.abs(((x / y) * (z + -1.0)));
} else {
tmp = Math.abs(((-4.0 - x) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.5e-29) or not (x <= 2200000000.0): tmp = math.fabs(((x / y) * (z + -1.0))) else: tmp = math.fabs(((-4.0 - x) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.5e-29) || !(x <= 2200000000.0)) tmp = abs(Float64(Float64(x / y) * Float64(z + -1.0))); 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 <= -2.5e-29) || ~((x <= 2200000000.0))) tmp = abs(((x / y) * (z + -1.0))); else tmp = abs(((-4.0 - x) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.5e-29], N[Not[LessEqual[x, 2200000000.0]], $MachinePrecision]], N[Abs[N[(N[(x / y), $MachinePrecision] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-29} \lor \neg \left(x \leq 2200000000\right):\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(z + -1\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if x < -2.49999999999999993e-29 or 2.2e9 < x Initial program 92.1%
Simplified90.3%
Taylor expanded in x around inf 89.1%
mul-1-neg89.1%
*-commutative89.1%
associate-/l*98.5%
distribute-lft-neg-in98.5%
neg-sub098.5%
associate-+l-98.5%
neg-sub098.5%
+-commutative98.5%
unsub-neg98.5%
Simplified98.5%
if -2.49999999999999993e-29 < x < 2.2e9Initial program 95.6%
Simplified99.9%
Taylor expanded in z around 0 79.5%
+-commutative79.5%
rem-square-sqrt29.5%
fabs-sqr29.5%
rem-square-sqrt79.5%
fabs-neg79.5%
distribute-neg-frac79.5%
distribute-neg-in79.5%
metadata-eval79.5%
+-commutative79.5%
sub-neg79.5%
rem-square-sqrt49.5%
fabs-sqr49.5%
rem-square-sqrt79.5%
Simplified79.5%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (if (<= z -210000000000.0) (fabs (* z (/ x y))) (if (<= z 1.45e+75) (fabs (/ (- -4.0 x) y)) (fabs (/ z (/ y x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -210000000000.0) {
tmp = fabs((z * (x / y)));
} else if (z <= 1.45e+75) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((z / (y / x)));
}
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 <= (-210000000000.0d0)) then
tmp = abs((z * (x / y)))
else if (z <= 1.45d+75) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((z / (y / x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -210000000000.0) {
tmp = Math.abs((z * (x / y)));
} else if (z <= 1.45e+75) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((z / (y / x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -210000000000.0: tmp = math.fabs((z * (x / y))) elif z <= 1.45e+75: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((z / (y / x))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -210000000000.0) tmp = abs(Float64(z * Float64(x / y))); elseif (z <= 1.45e+75) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -210000000000.0) tmp = abs((z * (x / y))); elseif (z <= 1.45e+75) tmp = abs(((-4.0 - x) / y)); else tmp = abs((z / (y / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -210000000000.0], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1.45e+75], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -210000000000:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+75}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\end{array}
\end{array}
if z < -2.1e11Initial program 98.1%
fabs-sub98.1%
associate-*l/89.4%
associate-*r/90.9%
fma-neg90.9%
distribute-neg-frac90.9%
+-commutative90.9%
distribute-neg-in90.9%
unsub-neg90.9%
metadata-eval90.9%
Simplified90.9%
Taylor expanded in z around inf 94.5%
+-commutative94.5%
associate-*r/94.5%
distribute-lft-in94.5%
metadata-eval94.5%
neg-mul-194.5%
sub-neg94.5%
associate-/r*94.6%
Simplified94.6%
Taylor expanded in z around inf 68.0%
*-commutative68.0%
associate-*r/76.6%
Simplified76.6%
if -2.1e11 < z < 1.4499999999999999e75Initial program 94.6%
Simplified99.8%
Taylor expanded in z around 0 95.1%
+-commutative95.1%
rem-square-sqrt43.2%
fabs-sqr43.2%
rem-square-sqrt95.1%
fabs-neg95.1%
distribute-neg-frac95.1%
distribute-neg-in95.1%
metadata-eval95.1%
+-commutative95.1%
sub-neg95.1%
rem-square-sqrt51.3%
fabs-sqr51.3%
rem-square-sqrt95.1%
Simplified95.1%
if 1.4499999999999999e75 < z Initial program 87.8%
Simplified87.8%
Taylor expanded in z around inf 69.8%
associate-*r/69.8%
neg-mul-169.8%
distribute-lft-neg-in69.8%
*-commutative69.8%
associate-*r/74.3%
Simplified74.3%
add-sqr-sqrt45.9%
sqrt-unprod61.9%
sqr-neg61.9%
sqrt-unprod28.1%
add-sqr-sqrt74.3%
clear-num74.2%
un-div-inv74.3%
Applied egg-rr74.3%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (<= z -215000000000.0) (fabs (* z (/ x y))) (if (<= z 3e+75) (fabs (/ (- -4.0 x) y)) (fabs (* x (/ z y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -215000000000.0) {
tmp = fabs((z * (x / y)));
} else if (z <= 3e+75) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((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 (z <= (-215000000000.0d0)) then
tmp = abs((z * (x / y)))
else if (z <= 3d+75) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((x * (z / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -215000000000.0) {
tmp = Math.abs((z * (x / y)));
} else if (z <= 3e+75) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((x * (z / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -215000000000.0: tmp = math.fabs((z * (x / y))) elif z <= 3e+75: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((x * (z / y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -215000000000.0) tmp = abs(Float64(z * Float64(x / y))); elseif (z <= 3e+75) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(x * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -215000000000.0) tmp = abs((z * (x / y))); elseif (z <= 3e+75) tmp = abs(((-4.0 - x) / y)); else tmp = abs((x * (z / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -215000000000.0], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3e+75], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -215000000000:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+75}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\end{array}
\end{array}
if z < -2.15e11Initial program 98.1%
fabs-sub98.1%
associate-*l/89.4%
associate-*r/90.9%
fma-neg90.9%
distribute-neg-frac90.9%
+-commutative90.9%
distribute-neg-in90.9%
unsub-neg90.9%
metadata-eval90.9%
Simplified90.9%
Taylor expanded in z around inf 94.5%
+-commutative94.5%
associate-*r/94.5%
distribute-lft-in94.5%
metadata-eval94.5%
neg-mul-194.5%
sub-neg94.5%
associate-/r*94.6%
Simplified94.6%
Taylor expanded in z around inf 68.0%
*-commutative68.0%
associate-*r/76.6%
Simplified76.6%
if -2.15e11 < z < 3e75Initial program 94.6%
Simplified99.8%
Taylor expanded in z around 0 95.1%
+-commutative95.1%
rem-square-sqrt43.2%
fabs-sqr43.2%
rem-square-sqrt95.1%
fabs-neg95.1%
distribute-neg-frac95.1%
distribute-neg-in95.1%
metadata-eval95.1%
+-commutative95.1%
sub-neg95.1%
rem-square-sqrt51.3%
fabs-sqr51.3%
rem-square-sqrt95.1%
Simplified95.1%
if 3e75 < z Initial program 87.8%
Simplified87.8%
Taylor expanded in z around inf 69.8%
mul-1-neg69.8%
distribute-frac-neg269.8%
associate-/l*75.0%
Simplified75.0%
Final simplification86.9%
(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 91.9%
Simplified90.1%
Taylor expanded in x around inf 88.4%
mul-1-neg88.4%
*-commutative88.4%
associate-/l*98.0%
distribute-lft-neg-in98.0%
neg-sub098.0%
associate-+l-98.0%
neg-sub098.0%
+-commutative98.0%
unsub-neg98.0%
Simplified98.0%
Taylor expanded in z around 0 56.0%
if -10.5 < x < 4Initial program 95.7%
Simplified99.8%
Taylor expanded in x around 0 75.1%
Final simplification65.8%
(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 93.8%
Simplified95.1%
Taylor expanded in x around 0 40.9%
Final simplification40.9%
herbie shell --seed 2024071
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))