
(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 2e-29) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (fma x (/ z y) (/ (- -4.0 x) y)))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 2e-29) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs(fma(x, (z / y), ((-4.0 - x) / y)));
}
return tmp;
}
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 2e-29) 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
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 2e-29], 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}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-29}:\\
\;\;\;\;\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 < 1.99999999999999989e-29Initial program 89.2%
associate-*l/92.2%
associate-*r/85.9%
Simplified85.9%
Taylor expanded in x around 0 90.5%
sub-neg90.5%
+-commutative90.5%
distribute-lft-in85.8%
associate-+r+85.8%
distribute-rgt-in85.8%
associate-*l/85.9%
*-lft-identity85.9%
+-commutative85.9%
distribute-rgt-neg-out85.9%
sub-neg85.9%
associate-*r/92.2%
div-sub96.9%
Simplified96.9%
if 1.99999999999999989e-29 < y Initial program 98.2%
Simplified99.8%
Final simplification97.7%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))) (t_1 (fabs (/ x y))))
(if (<= x -5.2e+159)
t_0
(if (<= x -3.2e+34)
t_1
(if (<= x -1.24e-76)
t_0
(if (<= x 3.05e-13) (fabs (/ 4.0 y)) (if (<= x 5.1e+85) t_0 t_1)))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double t_1 = fabs((x / y));
double tmp;
if (x <= -5.2e+159) {
tmp = t_0;
} else if (x <= -3.2e+34) {
tmp = t_1;
} else if (x <= -1.24e-76) {
tmp = t_0;
} else if (x <= 3.05e-13) {
tmp = fabs((4.0 / y));
} else if (x <= 5.1e+85) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = abs((z * (x / y)))
t_1 = abs((x / y))
if (x <= (-5.2d+159)) then
tmp = t_0
else if (x <= (-3.2d+34)) then
tmp = t_1
else if (x <= (-1.24d-76)) then
tmp = t_0
else if (x <= 3.05d-13) then
tmp = abs((4.0d0 / y))
else if (x <= 5.1d+85) then
tmp = t_0
else
tmp = t_1
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 t_1 = Math.abs((x / y));
double tmp;
if (x <= -5.2e+159) {
tmp = t_0;
} else if (x <= -3.2e+34) {
tmp = t_1;
} else if (x <= -1.24e-76) {
tmp = t_0;
} else if (x <= 3.05e-13) {
tmp = Math.abs((4.0 / y));
} else if (x <= 5.1e+85) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((z * (x / y))) t_1 = math.fabs((x / y)) tmp = 0 if x <= -5.2e+159: tmp = t_0 elif x <= -3.2e+34: tmp = t_1 elif x <= -1.24e-76: tmp = t_0 elif x <= 3.05e-13: tmp = math.fabs((4.0 / y)) elif x <= 5.1e+85: tmp = t_0 else: tmp = t_1 return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(z * Float64(x / y))) t_1 = abs(Float64(x / y)) tmp = 0.0 if (x <= -5.2e+159) tmp = t_0; elseif (x <= -3.2e+34) tmp = t_1; elseif (x <= -1.24e-76) tmp = t_0; elseif (x <= 3.05e-13) tmp = abs(Float64(4.0 / y)); elseif (x <= 5.1e+85) tmp = t_0; else tmp = t_1; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((z * (x / y))); t_1 = abs((x / y)); tmp = 0.0; if (x <= -5.2e+159) tmp = t_0; elseif (x <= -3.2e+34) tmp = t_1; elseif (x <= -1.24e-76) tmp = t_0; elseif (x <= 3.05e-13) tmp = abs((4.0 / y)); elseif (x <= 5.1e+85) tmp = t_0; else tmp = t_1; 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]}, Block[{t$95$1 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -5.2e+159], t$95$0, If[LessEqual[x, -3.2e+34], t$95$1, If[LessEqual[x, -1.24e-76], t$95$0, If[LessEqual[x, 3.05e-13], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 5.1e+85], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y}\right|\\
t_1 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -5.2 \cdot 10^{+159}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{+34}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.24 \cdot 10^{-76}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{-13}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{+85}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -5.2000000000000001e159 or -3.1999999999999998e34 < x < -1.24000000000000003e-76 or 3.0500000000000001e-13 < x < 5.0999999999999998e85Initial program 87.3%
associate-*l/87.9%
associate-*r/88.2%
Simplified88.2%
Taylor expanded in z around inf 64.3%
associate-*r/64.3%
neg-mul-164.3%
distribute-lft-neg-in64.3%
associate-*l/75.8%
*-commutative75.8%
Simplified75.8%
*-commutative75.8%
add-sqr-sqrt28.1%
sqrt-unprod70.5%
distribute-frac-neg70.5%
distribute-frac-neg70.5%
sqr-neg70.5%
sqrt-unprod47.4%
add-sqr-sqrt75.8%
clear-num75.1%
associate-*l/73.9%
*-un-lft-identity73.9%
Applied egg-rr73.9%
clear-num73.9%
associate-/r/75.1%
clear-num75.8%
Applied egg-rr75.8%
if -5.2000000000000001e159 < x < -3.1999999999999998e34 or 5.0999999999999998e85 < x Initial program 87.1%
associate-*l/83.6%
associate-*r/94.2%
Simplified94.2%
Taylor expanded in x around inf 94.2%
Taylor expanded in z around 0 72.7%
if -1.24000000000000003e-76 < x < 3.0500000000000001e-13Initial program 97.0%
associate-*l/99.8%
associate-*r/87.3%
Simplified87.3%
Taylor expanded in x around 0 79.2%
Final simplification76.4%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))) (t_1 (fabs (/ x y))))
(if (<= x -5.6e+159)
t_0
(if (<= x -2.6e+34)
t_1
(if (<= x -2.6e-64)
t_0
(if (<= x 2.9e-13)
(fabs (/ 4.0 y))
(if (<= x 1.35e+86) (fabs (/ x (/ y z))) t_1)))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double t_1 = fabs((x / y));
double tmp;
if (x <= -5.6e+159) {
tmp = t_0;
} else if (x <= -2.6e+34) {
tmp = t_1;
} else if (x <= -2.6e-64) {
tmp = t_0;
} else if (x <= 2.9e-13) {
tmp = fabs((4.0 / y));
} else if (x <= 1.35e+86) {
tmp = fabs((x / (y / z)));
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = abs((z * (x / y)))
t_1 = abs((x / y))
if (x <= (-5.6d+159)) then
tmp = t_0
else if (x <= (-2.6d+34)) then
tmp = t_1
else if (x <= (-2.6d-64)) then
tmp = t_0
else if (x <= 2.9d-13) then
tmp = abs((4.0d0 / y))
else if (x <= 1.35d+86) then
tmp = abs((x / (y / z)))
else
tmp = t_1
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 t_1 = Math.abs((x / y));
double tmp;
if (x <= -5.6e+159) {
tmp = t_0;
} else if (x <= -2.6e+34) {
tmp = t_1;
} else if (x <= -2.6e-64) {
tmp = t_0;
} else if (x <= 2.9e-13) {
tmp = Math.abs((4.0 / y));
} else if (x <= 1.35e+86) {
tmp = Math.abs((x / (y / z)));
} else {
tmp = t_1;
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((z * (x / y))) t_1 = math.fabs((x / y)) tmp = 0 if x <= -5.6e+159: tmp = t_0 elif x <= -2.6e+34: tmp = t_1 elif x <= -2.6e-64: tmp = t_0 elif x <= 2.9e-13: tmp = math.fabs((4.0 / y)) elif x <= 1.35e+86: tmp = math.fabs((x / (y / z))) else: tmp = t_1 return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(z * Float64(x / y))) t_1 = abs(Float64(x / y)) tmp = 0.0 if (x <= -5.6e+159) tmp = t_0; elseif (x <= -2.6e+34) tmp = t_1; elseif (x <= -2.6e-64) tmp = t_0; elseif (x <= 2.9e-13) tmp = abs(Float64(4.0 / y)); elseif (x <= 1.35e+86) tmp = abs(Float64(x / Float64(y / z))); else tmp = t_1; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((z * (x / y))); t_1 = abs((x / y)); tmp = 0.0; if (x <= -5.6e+159) tmp = t_0; elseif (x <= -2.6e+34) tmp = t_1; elseif (x <= -2.6e-64) tmp = t_0; elseif (x <= 2.9e-13) tmp = abs((4.0 / y)); elseif (x <= 1.35e+86) tmp = abs((x / (y / z))); else tmp = t_1; 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]}, Block[{t$95$1 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -5.6e+159], t$95$0, If[LessEqual[x, -2.6e+34], t$95$1, If[LessEqual[x, -2.6e-64], t$95$0, If[LessEqual[x, 2.9e-13], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.35e+86], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y}\right|\\
t_1 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{+159}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{+34}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-13}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+86}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -5.6000000000000002e159 or -2.59999999999999997e34 < x < -2.6e-64Initial program 83.8%
associate-*l/84.6%
associate-*r/84.9%
Simplified84.9%
Taylor expanded in z around inf 59.3%
associate-*r/59.3%
neg-mul-159.3%
distribute-lft-neg-in59.3%
associate-*l/74.0%
*-commutative74.0%
Simplified74.0%
*-commutative74.0%
add-sqr-sqrt28.7%
sqrt-unprod72.2%
distribute-frac-neg72.2%
distribute-frac-neg72.2%
sqr-neg72.2%
sqrt-unprod45.1%
add-sqr-sqrt74.0%
clear-num73.3%
associate-*l/71.7%
*-un-lft-identity71.7%
Applied egg-rr71.7%
clear-num71.6%
associate-/r/73.3%
clear-num74.0%
Applied egg-rr74.0%
if -5.6000000000000002e159 < x < -2.59999999999999997e34 or 1.35000000000000009e86 < x Initial program 87.1%
associate-*l/83.6%
associate-*r/94.2%
Simplified94.2%
Taylor expanded in x around inf 94.2%
Taylor expanded in z around 0 72.7%
if -2.6e-64 < x < 2.8999999999999998e-13Initial program 97.0%
associate-*l/99.8%
associate-*r/87.3%
Simplified87.3%
Taylor expanded in x around 0 79.2%
if 2.8999999999999998e-13 < x < 1.35000000000000009e86Initial program 99.8%
associate-*l/99.9%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in z around inf 82.2%
associate-*r/82.2%
neg-mul-182.2%
distribute-lft-neg-in82.2%
associate-*l/82.1%
*-commutative82.1%
Simplified82.1%
*-commutative82.1%
add-sqr-sqrt25.9%
sqrt-unprod64.7%
distribute-frac-neg64.7%
distribute-frac-neg64.7%
sqr-neg64.7%
sqrt-unprod55.9%
add-sqr-sqrt82.1%
associate-/r/82.2%
Applied egg-rr82.2%
Final simplification76.4%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -84000000000000.0) (not (<= x 2.2e+127))) (fabs (/ x (/ y (- 1.0 z)))) (fabs (/ (- (+ x 4.0) (* x z)) y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -84000000000000.0) || !(x <= 2.2e+127)) {
tmp = fabs((x / (y / (1.0 - z))));
} else {
tmp = fabs((((x + 4.0) - (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 ((x <= (-84000000000000.0d0)) .or. (.not. (x <= 2.2d+127))) then
tmp = abs((x / (y / (1.0d0 - z))))
else
tmp = abs((((x + 4.0d0) - (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 ((x <= -84000000000000.0) || !(x <= 2.2e+127)) {
tmp = Math.abs((x / (y / (1.0 - z))));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -84000000000000.0) or not (x <= 2.2e+127): tmp = math.fabs((x / (y / (1.0 - z)))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -84000000000000.0) || !(x <= 2.2e+127)) tmp = abs(Float64(x / Float64(y / Float64(1.0 - z)))); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -84000000000000.0) || ~((x <= 2.2e+127))) tmp = abs((x / (y / (1.0 - z)))); else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[x, -84000000000000.0], N[Not[LessEqual[x, 2.2e+127]], $MachinePrecision]], N[Abs[N[(x / N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -84000000000000 \lor \neg \left(x \leq 2.2 \cdot 10^{+127}\right):\\
\;\;\;\;\left|\frac{x}{\frac{y}{1 - z}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if x < -8.4e13 or 2.2000000000000002e127 < x Initial program 82.2%
associate-*l/80.0%
associate-*r/91.1%
Simplified91.1%
Taylor expanded in x around 0 99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-in90.9%
associate-+r+90.9%
distribute-rgt-in90.9%
associate-*l/91.1%
*-lft-identity91.1%
+-commutative91.1%
distribute-rgt-neg-out91.1%
sub-neg91.1%
associate-*r/80.0%
div-sub88.9%
Simplified88.9%
Taylor expanded in x around inf 88.8%
associate-/l*99.9%
Simplified99.9%
if -8.4e13 < x < 2.2000000000000002e127Initial program 97.6%
associate-*l/99.9%
associate-*r/88.4%
Simplified88.4%
Taylor expanded in x around 0 88.4%
sub-neg88.4%
+-commutative88.4%
distribute-lft-in88.4%
associate-+r+88.4%
distribute-rgt-in88.4%
associate-*l/88.4%
*-lft-identity88.4%
+-commutative88.4%
distribute-rgt-neg-out88.4%
sub-neg88.4%
associate-*r/99.9%
div-sub99.9%
Simplified99.9%
Final simplification99.9%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 3.45e-18) (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 <= 3.45e-18) {
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 <= 3.45d-18) 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 <= 3.45e-18) {
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 <= 3.45e-18: 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 <= 3.45e-18) 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 <= 3.45e-18) 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, 3.45e-18], 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 3.45 \cdot 10^{-18}:\\
\;\;\;\;\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 < 3.4500000000000001e-18Initial program 89.3%
associate-*l/92.3%
associate-*r/86.0%
Simplified86.0%
Taylor expanded in x around 0 90.6%
sub-neg90.6%
+-commutative90.6%
distribute-lft-in86.0%
associate-+r+86.0%
distribute-rgt-in86.0%
associate-*l/86.0%
*-lft-identity86.0%
+-commutative86.0%
distribute-rgt-neg-out86.0%
sub-neg86.0%
associate-*r/92.3%
div-sub97.0%
Simplified97.0%
if 3.4500000000000001e-18 < y Initial program 98.2%
associate-*l/91.0%
associate-*r/99.8%
Simplified99.8%
Final simplification97.7%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -4.8e-38) (not (<= x 3.5e-13))) (fabs (/ x (/ y (- 1.0 z)))) (fabs (/ (+ x 4.0) y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.8e-38) || !(x <= 3.5e-13)) {
tmp = fabs((x / (y / (1.0 - z))));
} 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 <= (-4.8d-38)) .or. (.not. (x <= 3.5d-13))) then
tmp = abs((x / (y / (1.0d0 - z))))
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 <= -4.8e-38) || !(x <= 3.5e-13)) {
tmp = Math.abs((x / (y / (1.0 - z))));
} else {
tmp = Math.abs(((x + 4.0) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -4.8e-38) or not (x <= 3.5e-13): tmp = math.fabs((x / (y / (1.0 - z)))) else: tmp = math.fabs(((x + 4.0) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -4.8e-38) || !(x <= 3.5e-13)) tmp = abs(Float64(x / Float64(y / Float64(1.0 - z)))); 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 <= -4.8e-38) || ~((x <= 3.5e-13))) tmp = abs((x / (y / (1.0 - z)))); 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, -4.8e-38], N[Not[LessEqual[x, 3.5e-13]], $MachinePrecision]], N[Abs[N[(x / N[(y / N[(1.0 - z), $MachinePrecision]), $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 -4.8 \cdot 10^{-38} \lor \neg \left(x \leq 3.5 \cdot 10^{-13}\right):\\
\;\;\;\;\left|\frac{x}{\frac{y}{1 - z}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\
\end{array}
\end{array}
if x < -4.80000000000000044e-38 or 3.5000000000000002e-13 < x Initial program 86.9%
associate-*l/85.4%
associate-*r/92.2%
Simplified92.2%
Taylor expanded in x around 0 98.5%
sub-neg98.5%
+-commutative98.5%
distribute-lft-in92.0%
associate-+r+92.0%
distribute-rgt-in92.1%
associate-*l/92.2%
*-lft-identity92.2%
+-commutative92.2%
distribute-rgt-neg-out92.2%
sub-neg92.2%
associate-*r/85.4%
div-sub91.9%
Simplified91.9%
Taylor expanded in x around inf 88.6%
associate-/l*95.9%
Simplified95.9%
if -4.80000000000000044e-38 < x < 3.5000000000000002e-13Initial program 97.1%
associate-*l/99.8%
associate-*r/86.2%
Simplified86.2%
Taylor expanded in z around 0 78.4%
+-commutative78.4%
*-rgt-identity78.4%
associate-*r/78.4%
distribute-rgt-in78.3%
associate-*l/78.4%
*-lft-identity78.4%
Simplified78.4%
Final simplification88.0%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= z -7e+81) (fabs (/ z (/ y x))) (if (<= z 6.8e+41) (fabs (/ (+ x 4.0) y)) (fabs (* z (/ x y))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (z <= -7e+81) {
tmp = fabs((z / (y / x)));
} else if (z <= 6.8e+41) {
tmp = fabs(((x + 4.0) / y));
} else {
tmp = fabs((z * (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) :: tmp
if (z <= (-7d+81)) then
tmp = abs((z / (y / x)))
else if (z <= 6.8d+41) then
tmp = abs(((x + 4.0d0) / y))
else
tmp = abs((z * (x / 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 <= -7e+81) {
tmp = Math.abs((z / (y / x)));
} else if (z <= 6.8e+41) {
tmp = Math.abs(((x + 4.0) / y));
} else {
tmp = Math.abs((z * (x / y)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if z <= -7e+81: tmp = math.fabs((z / (y / x))) elif z <= 6.8e+41: tmp = math.fabs(((x + 4.0) / y)) else: tmp = math.fabs((z * (x / y))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (z <= -7e+81) tmp = abs(Float64(z / Float64(y / x))); elseif (z <= 6.8e+41) tmp = abs(Float64(Float64(x + 4.0) / y)); else tmp = abs(Float64(z * Float64(x / y))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7e+81) tmp = abs((z / (y / x))); elseif (z <= 6.8e+41) tmp = abs(((x + 4.0) / y)); else tmp = abs((z * (x / y))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[z, -7e+81], N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 6.8e+41], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+81}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+41}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if z < -7.0000000000000001e81Initial program 96.1%
associate-*l/90.5%
associate-*r/90.5%
Simplified90.5%
Taylor expanded in z around inf 77.7%
associate-*r/77.7%
neg-mul-177.7%
distribute-lft-neg-in77.7%
associate-*l/83.2%
*-commutative83.2%
Simplified83.2%
*-commutative83.2%
add-sqr-sqrt22.7%
sqrt-unprod74.8%
distribute-frac-neg74.8%
distribute-frac-neg74.8%
sqr-neg74.8%
sqrt-unprod60.4%
add-sqr-sqrt83.2%
clear-num83.1%
associate-*l/83.2%
*-un-lft-identity83.2%
Applied egg-rr83.2%
if -7.0000000000000001e81 < z < 6.79999999999999996e41Initial program 91.4%
associate-*l/97.8%
associate-*r/95.9%
Simplified95.9%
Taylor expanded in z around 0 93.6%
+-commutative93.6%
*-rgt-identity93.6%
associate-*r/93.5%
distribute-rgt-in93.5%
associate-*l/93.6%
*-lft-identity93.6%
Simplified93.6%
if 6.79999999999999996e41 < z Initial program 88.0%
associate-*l/79.7%
associate-*r/74.0%
Simplified74.0%
Taylor expanded in z around inf 65.1%
associate-*r/65.1%
neg-mul-165.1%
distribute-lft-neg-in65.1%
associate-*l/73.3%
*-commutative73.3%
Simplified73.3%
*-commutative73.3%
add-sqr-sqrt29.5%
sqrt-unprod61.7%
distribute-frac-neg61.7%
distribute-frac-neg61.7%
sqr-neg61.7%
sqrt-unprod43.9%
add-sqr-sqrt73.3%
clear-num72.4%
associate-*l/72.5%
*-un-lft-identity72.5%
Applied egg-rr72.5%
clear-num72.5%
associate-/r/72.4%
clear-num73.3%
Applied egg-rr73.3%
Final simplification86.6%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -10.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 <= -10.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 <= (-10.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 <= -10.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 <= -10.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 <= -10.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 <= -10.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, -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}
y = |y|\\
\\
\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 85.5%
associate-*l/83.7%
associate-*r/92.7%
Simplified92.7%
Taylor expanded in x around inf 92.3%
Taylor expanded in z around 0 61.8%
if -10.5 < x < 4Initial program 97.3%
associate-*l/99.8%
associate-*r/86.4%
Simplified86.4%
Taylor expanded in x around 0 71.6%
Final simplification66.8%
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 91.5%
associate-*l/92.0%
associate-*r/89.5%
Simplified89.5%
Taylor expanded in x around 0 39.1%
Final simplification39.1%
herbie shell --seed 2023268
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))