
(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}
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 16000000.0) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (/ (+ x 4.0) y) (/ x (/ y z))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 16000000.0) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((((x + 4.0) / y) - (x / (y / z))));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 16000000.0d0) 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
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 16000000.0) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((((x + 4.0) / y) - (x / (y / z))));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 16000000.0: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((((x + 4.0) / y) - (x / (y / z)))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 16000000.0) 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
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 16000000.0) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((((x + 4.0) / y) - (x / (y / z)))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 16000000.0], 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}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 16000000:\\
\;\;\;\;\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 < 1.6e7Initial program 90.2%
associate-*l/89.8%
associate-*r/86.5%
Simplified86.5%
Taylor expanded in x around 0 94.1%
sub-neg94.1%
+-commutative94.1%
distribute-lft-in86.4%
associate-+r+86.4%
distribute-rgt-in86.4%
associate-*l/86.5%
*-lft-identity86.5%
+-commutative86.5%
distribute-rgt-neg-out86.5%
sub-neg86.5%
associate-*r/89.8%
div-sub97.5%
Simplified97.5%
if 1.6e7 < y Initial program 92.5%
associate-*l/87.3%
associate-*r/99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification98.0%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))))
(if (<= x -2.75e-90)
t_0
(if (<= x 1.9e-9)
(fabs (/ 4.0 y))
(if (or (<= x 4.6e+120) (not (<= x 9.2e+175))) t_0 (fabs (/ x y)))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double tmp;
if (x <= -2.75e-90) {
tmp = t_0;
} else if (x <= 1.9e-9) {
tmp = fabs((4.0 / y));
} else if ((x <= 4.6e+120) || !(x <= 9.2e+175)) {
tmp = t_0;
} else {
tmp = fabs((x / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
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.75d-90)) then
tmp = t_0
else if (x <= 1.9d-9) then
tmp = abs((4.0d0 / y))
else if ((x <= 4.6d+120) .or. (.not. (x <= 9.2d+175))) then
tmp = t_0
else
tmp = abs((x / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double t_0 = Math.abs((z * (x / y)));
double tmp;
if (x <= -2.75e-90) {
tmp = t_0;
} else if (x <= 1.9e-9) {
tmp = Math.abs((4.0 / y));
} else if ((x <= 4.6e+120) || !(x <= 9.2e+175)) {
tmp = t_0;
} else {
tmp = Math.abs((x / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((z * (x / y))) tmp = 0 if x <= -2.75e-90: tmp = t_0 elif x <= 1.9e-9: tmp = math.fabs((4.0 / y)) elif (x <= 4.6e+120) or not (x <= 9.2e+175): tmp = t_0 else: tmp = math.fabs((x / y)) return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(z * Float64(x / y))) tmp = 0.0 if (x <= -2.75e-90) tmp = t_0; elseif (x <= 1.9e-9) tmp = abs(Float64(4.0 / y)); elseif ((x <= 4.6e+120) || !(x <= 9.2e+175)) tmp = t_0; else tmp = abs(Float64(x / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((z * (x / y))); tmp = 0.0; if (x <= -2.75e-90) tmp = t_0; elseif (x <= 1.9e-9) tmp = abs((4.0 / y)); elseif ((x <= 4.6e+120) || ~((x <= 9.2e+175))) tmp = t_0; else tmp = abs((x / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.75e-90], t$95$0, If[LessEqual[x, 1.9e-9], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 4.6e+120], N[Not[LessEqual[x, 9.2e+175]], $MachinePrecision]], t$95$0, N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;x \leq -2.75 \cdot 10^{-90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-9}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+120} \lor \neg \left(x \leq 9.2 \cdot 10^{+175}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -2.75000000000000015e-90 or 1.90000000000000006e-9 < x < 4.59999999999999985e120 or 9.1999999999999998e175 < x Initial program 87.0%
associate-*l/81.5%
associate-*r/90.3%
Simplified90.3%
Taylor expanded in z around inf 56.9%
associate-*r/56.9%
neg-mul-156.9%
distribute-lft-neg-in56.9%
associate-*l/69.4%
*-commutative69.4%
Simplified69.4%
add-sqr-sqrt35.4%
sqrt-unprod63.4%
distribute-frac-neg63.4%
distribute-frac-neg63.4%
sqr-neg63.4%
sqrt-unprod33.9%
add-sqr-sqrt69.4%
clear-num69.2%
div-inv67.1%
Applied egg-rr67.1%
associate-/r/65.7%
*-commutative65.7%
add-sqr-sqrt26.4%
sqrt-unprod61.0%
sqr-neg61.0%
sqrt-unprod39.1%
add-sqr-sqrt65.7%
associate-*r/56.9%
associate-*l/69.4%
add-sqr-sqrt40.7%
sqrt-unprod60.6%
sqr-neg60.6%
sqrt-unprod28.4%
add-sqr-sqrt69.4%
Applied egg-rr69.4%
if -2.75000000000000015e-90 < x < 1.90000000000000006e-9Initial program 97.3%
associate-*l/99.9%
associate-*r/89.5%
Simplified89.5%
Taylor expanded in x around 0 80.7%
if 4.59999999999999985e120 < x < 9.1999999999999998e175Initial program 75.0%
associate-*l/83.3%
associate-*r/83.3%
Simplified83.3%
Taylor expanded in x around inf 83.3%
Taylor expanded in z around 0 88.6%
Final simplification75.0%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))))
(if (<= x -2.75e-90)
t_0
(if (<= x 4e-8)
(fabs (/ 4.0 y))
(if (<= x 4.4e+120)
(fabs (/ z (/ y x)))
(if (<= x 1.15e+176) (fabs (/ x y)) t_0))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double tmp;
if (x <= -2.75e-90) {
tmp = t_0;
} else if (x <= 4e-8) {
tmp = fabs((4.0 / y));
} else if (x <= 4.4e+120) {
tmp = fabs((z / (y / x)));
} else if (x <= 1.15e+176) {
tmp = fabs((x / y));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: y should be positive before calling this function
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.75d-90)) then
tmp = t_0
else if (x <= 4d-8) then
tmp = abs((4.0d0 / y))
else if (x <= 4.4d+120) then
tmp = abs((z / (y / x)))
else if (x <= 1.15d+176) then
tmp = abs((x / y))
else
tmp = t_0
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double t_0 = Math.abs((z * (x / y)));
double tmp;
if (x <= -2.75e-90) {
tmp = t_0;
} else if (x <= 4e-8) {
tmp = Math.abs((4.0 / y));
} else if (x <= 4.4e+120) {
tmp = Math.abs((z / (y / x)));
} else if (x <= 1.15e+176) {
tmp = Math.abs((x / y));
} else {
tmp = t_0;
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((z * (x / y))) tmp = 0 if x <= -2.75e-90: tmp = t_0 elif x <= 4e-8: tmp = math.fabs((4.0 / y)) elif x <= 4.4e+120: tmp = math.fabs((z / (y / x))) elif x <= 1.15e+176: tmp = math.fabs((x / y)) else: tmp = t_0 return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(z * Float64(x / y))) tmp = 0.0 if (x <= -2.75e-90) tmp = t_0; elseif (x <= 4e-8) tmp = abs(Float64(4.0 / y)); elseif (x <= 4.4e+120) tmp = abs(Float64(z / Float64(y / x))); elseif (x <= 1.15e+176) tmp = abs(Float64(x / y)); else tmp = t_0; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((z * (x / y))); tmp = 0.0; if (x <= -2.75e-90) tmp = t_0; elseif (x <= 4e-8) tmp = abs((4.0 / y)); elseif (x <= 4.4e+120) tmp = abs((z / (y / x))); elseif (x <= 1.15e+176) tmp = abs((x / y)); else tmp = t_0; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.75e-90], t$95$0, If[LessEqual[x, 4e-8], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4.4e+120], N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.15e+176], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;x \leq -2.75 \cdot 10^{-90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+120}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+176}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -2.75000000000000015e-90 or 1.14999999999999998e176 < x Initial program 84.4%
associate-*l/80.2%
associate-*r/88.4%
Simplified88.4%
Taylor expanded in z around inf 56.9%
associate-*r/56.9%
neg-mul-156.9%
distribute-lft-neg-in56.9%
associate-*l/68.7%
*-commutative68.7%
Simplified68.7%
add-sqr-sqrt35.0%
sqrt-unprod62.5%
distribute-frac-neg62.5%
distribute-frac-neg62.5%
sqr-neg62.5%
sqrt-unprod33.6%
add-sqr-sqrt68.7%
clear-num68.4%
div-inv66.0%
Applied egg-rr66.0%
associate-/r/65.1%
*-commutative65.1%
add-sqr-sqrt17.9%
sqrt-unprod59.4%
sqr-neg59.4%
sqrt-unprod47.0%
add-sqr-sqrt65.1%
associate-*r/56.9%
associate-*l/68.7%
add-sqr-sqrt49.0%
sqrt-unprod58.1%
sqr-neg58.1%
sqrt-unprod19.6%
add-sqr-sqrt68.7%
Applied egg-rr68.7%
if -2.75000000000000015e-90 < x < 4.0000000000000001e-8Initial program 97.3%
associate-*l/99.9%
associate-*r/89.5%
Simplified89.5%
Taylor expanded in x around 0 80.7%
if 4.0000000000000001e-8 < x < 4.4000000000000003e120Initial program 99.6%
associate-*l/87.6%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in z around inf 56.4%
associate-*r/56.4%
neg-mul-156.4%
distribute-lft-neg-in56.4%
associate-*l/72.7%
*-commutative72.7%
Simplified72.7%
add-sqr-sqrt37.6%
sqrt-unprod68.2%
distribute-frac-neg68.2%
distribute-frac-neg68.2%
sqr-neg68.2%
sqrt-unprod35.2%
add-sqr-sqrt72.7%
clear-num72.7%
div-inv72.9%
Applied egg-rr72.9%
if 4.4000000000000003e120 < x < 1.14999999999999998e176Initial program 75.0%
associate-*l/83.3%
associate-*r/83.3%
Simplified83.3%
Taylor expanded in x around inf 83.3%
Taylor expanded in z around 0 88.6%
Final simplification75.1%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 2e-6) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (/ (+ x 4.0) y) (* x (/ z y))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 2e-6) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((((x + 4.0) / y) - (x * (z / y))));
}
return tmp;
}
NOTE: y should be positive before calling this function
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-6) 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
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e-6) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((((x + 4.0) / y) - (x * (z / y))));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 2e-6: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((((x + 4.0) / y) - (x * (z / y)))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 2e-6) 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
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e-6) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((((x + 4.0) / y) - (x * (z / y)))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 2e-6], 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}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-6}:\\
\;\;\;\;\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 < 1.99999999999999991e-6Initial program 90.0%
associate-*l/89.6%
associate-*r/86.2%
Simplified86.2%
Taylor expanded in x around 0 93.9%
sub-neg93.9%
+-commutative93.9%
distribute-lft-in86.1%
associate-+r+86.1%
distribute-rgt-in86.1%
associate-*l/86.2%
*-lft-identity86.2%
+-commutative86.2%
distribute-rgt-neg-out86.2%
sub-neg86.2%
associate-*r/89.6%
div-sub97.4%
Simplified97.4%
if 1.99999999999999991e-6 < y Initial program 93.0%
associate-*l/88.1%
associate-*r/99.9%
Simplified99.9%
Final simplification98.1%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -1.38e-90) (not (<= x 0.00096))) (fabs (* x (/ (- 1.0 z) y))) (fabs (/ (+ x 4.0) y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.38e-90) || !(x <= 0.00096)) {
tmp = fabs((x * ((1.0 - z) / y)));
} else {
tmp = fabs(((x + 4.0) / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
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.38d-90)) .or. (.not. (x <= 0.00096d0))) then
tmp = abs((x * ((1.0d0 - z) / y)))
else
tmp = abs(((x + 4.0d0) / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.38e-90) || !(x <= 0.00096)) {
tmp = Math.abs((x * ((1.0 - z) / y)));
} else {
tmp = Math.abs(((x + 4.0) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -1.38e-90) or not (x <= 0.00096): tmp = math.fabs((x * ((1.0 - z) / y))) else: tmp = math.fabs(((x + 4.0) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -1.38e-90) || !(x <= 0.00096)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y))); else tmp = abs(Float64(Float64(x + 4.0) / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.38e-90) || ~((x <= 0.00096))) tmp = abs((x * ((1.0 - z) / y))); else tmp = abs(((x + 4.0) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[x, -1.38e-90], N[Not[LessEqual[x, 0.00096]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.38 \cdot 10^{-90} \lor \neg \left(x \leq 0.00096\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\
\end{array}
\end{array}
if x < -1.37999999999999992e-90 or 9.60000000000000024e-4 < x Initial program 86.0%
associate-*l/81.6%
associate-*r/89.8%
Simplified89.8%
Taylor expanded in x around 0 99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-in89.6%
associate-+r+89.6%
distribute-rgt-in89.7%
associate-*l/89.8%
*-lft-identity89.8%
+-commutative89.8%
distribute-rgt-neg-out89.8%
sub-neg89.8%
associate-*r/81.6%
div-sub91.7%
Simplified91.7%
Taylor expanded in x around inf 85.6%
*-commutative85.6%
associate-*l/93.7%
div-sub93.7%
*-commutative93.7%
div-sub93.7%
Simplified93.7%
if -1.37999999999999992e-90 < x < 9.60000000000000024e-4Initial program 97.3%
associate-*l/99.9%
associate-*r/89.5%
Simplified89.5%
Taylor expanded in z around 0 81.2%
+-commutative81.2%
*-rgt-identity81.2%
associate-*r/81.2%
distribute-rgt-in81.2%
associate-*l/81.3%
*-lft-identity81.3%
Simplified81.3%
Final simplification88.5%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= x 5e+14) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (* x (/ (- 1.0 z) y)))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (x <= 5e+14) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((x * ((1.0 - z) / y)));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 5d+14) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((x * ((1.0d0 - z) / y)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (x <= 5e+14) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((x * ((1.0 - z) / y)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if x <= 5e+14: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((x * ((1.0 - z) / y))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (x <= 5e+14) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 5e+14) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((x * ((1.0 - z) / y))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[x, 5e+14], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{+14}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\end{array}
\end{array}
if x < 5e14Initial program 92.5%
associate-*l/93.8%
associate-*r/90.0%
Simplified90.0%
Taylor expanded in x around 0 94.1%
sub-neg94.1%
+-commutative94.1%
distribute-lft-in90.0%
associate-+r+90.0%
distribute-rgt-in90.0%
associate-*l/90.0%
*-lft-identity90.0%
+-commutative90.0%
distribute-rgt-neg-out90.0%
sub-neg90.0%
associate-*r/93.8%
div-sub97.9%
Simplified97.9%
if 5e14 < x Initial program 85.1%
associate-*l/74.7%
associate-*r/88.4%
Simplified88.4%
Taylor expanded in x around 0 99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-in88.3%
associate-+r+88.3%
distribute-rgt-in88.3%
associate-*l/88.4%
*-lft-identity88.4%
+-commutative88.4%
distribute-rgt-neg-out88.4%
sub-neg88.4%
associate-*r/74.7%
div-sub86.2%
Simplified86.2%
Taylor expanded in x around inf 86.2%
*-commutative86.2%
associate-*l/99.8%
div-sub99.8%
*-commutative99.8%
div-sub99.8%
Simplified99.8%
Final simplification98.4%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= z -3.4e+41) (not (<= z 7.2e+27))) (fabs (* z (/ x y))) (fabs (/ (+ x 4.0) y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.4e+41) || !(z <= 7.2e+27)) {
tmp = fabs((z * (x / y)));
} else {
tmp = fabs(((x + 4.0) / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= (-3.4d+41)) .or. (.not. (z <= 7.2d+27))) then
tmp = abs((z * (x / y)))
else
tmp = abs(((x + 4.0d0) / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.4e+41) || !(z <= 7.2e+27)) {
tmp = Math.abs((z * (x / y)));
} else {
tmp = Math.abs(((x + 4.0) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (z <= -3.4e+41) or not (z <= 7.2e+27): tmp = math.fabs((z * (x / y))) else: tmp = math.fabs(((x + 4.0) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((z <= -3.4e+41) || !(z <= 7.2e+27)) tmp = abs(Float64(z * Float64(x / y))); else tmp = abs(Float64(Float64(x + 4.0) / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.4e+41) || ~((z <= 7.2e+27))) tmp = abs((z * (x / y))); else tmp = abs(((x + 4.0) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[z, -3.4e+41], N[Not[LessEqual[z, 7.2e+27]], $MachinePrecision]], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+41} \lor \neg \left(z \leq 7.2 \cdot 10^{+27}\right):\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\
\end{array}
\end{array}
if z < -3.39999999999999998e41 or 7.19999999999999966e27 < z Initial program 90.7%
associate-*l/83.9%
associate-*r/85.6%
Simplified85.6%
Taylor expanded in z around inf 69.2%
associate-*r/69.2%
neg-mul-169.2%
distribute-lft-neg-in69.2%
associate-*l/76.2%
*-commutative76.2%
Simplified76.2%
add-sqr-sqrt33.1%
sqrt-unprod64.2%
distribute-frac-neg64.2%
distribute-frac-neg64.2%
sqr-neg64.2%
sqrt-unprod43.4%
add-sqr-sqrt76.2%
clear-num75.0%
div-inv75.1%
Applied egg-rr75.1%
associate-/r/74.5%
*-commutative74.5%
add-sqr-sqrt33.6%
sqrt-unprod60.0%
sqr-neg60.0%
sqrt-unprod40.6%
add-sqr-sqrt74.5%
associate-*r/69.2%
associate-*l/76.2%
add-sqr-sqrt40.4%
sqrt-unprod60.0%
sqr-neg60.0%
sqrt-unprod35.5%
add-sqr-sqrt76.2%
Applied egg-rr76.2%
if -3.39999999999999998e41 < z < 7.19999999999999966e27Initial program 90.8%
associate-*l/93.6%
associate-*r/93.0%
Simplified93.0%
Taylor expanded in z around 0 96.2%
+-commutative96.2%
*-rgt-identity96.2%
associate-*r/96.1%
distribute-rgt-in96.1%
associate-*l/96.3%
*-lft-identity96.3%
Simplified96.3%
Final simplification87.3%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -1.5) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.5) || !(x <= 4.0)) {
tmp = fabs((x / y));
} else {
tmp = fabs((4.0 / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
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.5d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y))
else
tmp = abs((4.0d0 / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.5) || !(x <= 4.0)) {
tmp = Math.abs((x / y));
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -1.5) or not (x <= 4.0): tmp = math.fabs((x / y)) else: tmp = math.fabs((4.0 / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -1.5) || !(x <= 4.0)) tmp = abs(Float64(x / y)); else tmp = abs(Float64(4.0 / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.5) || ~((x <= 4.0))) tmp = abs((x / y)); else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[x, -1.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}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.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 < -1.5 or 4 < x Initial program 84.4%
associate-*l/77.8%
associate-*r/87.7%
Simplified87.7%
Taylor expanded in x around inf 86.9%
Taylor expanded in z around 0 65.4%
if -1.5 < x < 4Initial program 96.5%
associate-*l/99.8%
associate-*r/91.5%
Simplified91.5%
Taylor expanded in x around 0 71.8%
Final simplification68.7%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (fabs (/ 4.0 y)))
y = abs(y);
double code(double x, double y, double z) {
return fabs((4.0 / y));
}
NOTE: y should be positive before calling this function
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
y = Math.abs(y);
public static double code(double x, double y, double z) {
return Math.abs((4.0 / y));
}
y = abs(y) def code(x, y, z): return math.fabs((4.0 / y))
y = abs(y) function code(x, y, z) return abs(Float64(4.0 / y)) end
y = abs(y) function tmp = code(x, y, z) tmp = abs((4.0 / y)); end
NOTE: y should be positive before calling this function code[x_, y_, z_] := N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\left|\frac{4}{y}\right|
\end{array}
Initial program 90.7%
associate-*l/89.2%
associate-*r/89.6%
Simplified89.6%
Taylor expanded in x around 0 39.8%
Final simplification39.8%
herbie shell --seed 2023285
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))