
(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 1.2e+34) (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 <= 1.2e+34) {
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 <= 1.2e+34) 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, 1.2e+34], 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 1.2 \cdot 10^{+34}:\\
\;\;\;\;\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.19999999999999993e34Initial program 91.2%
associate-*l/93.4%
sub-div98.0%
Applied egg-rr98.0%
if 1.19999999999999993e34 < y Initial program 96.8%
fabs-sub96.8%
associate-*l/98.3%
*-commutative98.3%
associate-*l/99.8%
*-commutative99.8%
fma-neg99.9%
distribute-neg-frac99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification98.4%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))) (t_1 (fabs (* x (/ z y)))))
(if (<= x -34000000.0)
t_0
(if (<= x -1.8e-64)
t_1
(if (<= x 4.0)
(fabs (/ 4.0 y))
(if (or (<= x 1.5e+70) (not (<= x 1.06e+159))) t_0 t_1))))))y = abs(y);
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 <= -34000000.0) {
tmp = t_0;
} else if (x <= -1.8e-64) {
tmp = t_1;
} else if (x <= 4.0) {
tmp = fabs((4.0 / y));
} else if ((x <= 1.5e+70) || !(x <= 1.06e+159)) {
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((x / y))
t_1 = abs((x * (z / y)))
if (x <= (-34000000.0d0)) then
tmp = t_0
else if (x <= (-1.8d-64)) then
tmp = t_1
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y))
else if ((x <= 1.5d+70) .or. (.not. (x <= 1.06d+159))) 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((x / y));
double t_1 = Math.abs((x * (z / y)));
double tmp;
if (x <= -34000000.0) {
tmp = t_0;
} else if (x <= -1.8e-64) {
tmp = t_1;
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y));
} else if ((x <= 1.5e+70) || !(x <= 1.06e+159)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((x / y)) t_1 = math.fabs((x * (z / y))) tmp = 0 if x <= -34000000.0: tmp = t_0 elif x <= -1.8e-64: tmp = t_1 elif x <= 4.0: tmp = math.fabs((4.0 / y)) elif (x <= 1.5e+70) or not (x <= 1.06e+159): tmp = t_0 else: tmp = t_1 return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(x / y)) t_1 = abs(Float64(x * Float64(z / y))) tmp = 0.0 if (x <= -34000000.0) tmp = t_0; elseif (x <= -1.8e-64) tmp = t_1; elseif (x <= 4.0) tmp = abs(Float64(4.0 / y)); elseif ((x <= 1.5e+70) || !(x <= 1.06e+159)) tmp = t_0; else tmp = t_1; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((x / y)); t_1 = abs((x * (z / y))); tmp = 0.0; if (x <= -34000000.0) tmp = t_0; elseif (x <= -1.8e-64) tmp = t_1; elseif (x <= 4.0) tmp = abs((4.0 / y)); elseif ((x <= 1.5e+70) || ~((x <= 1.06e+159))) 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[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -34000000.0], t$95$0, If[LessEqual[x, -1.8e-64], t$95$1, If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 1.5e+70], N[Not[LessEqual[x, 1.06e+159]], $MachinePrecision]], t$95$0, t$95$1]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
t_1 := \left|x \cdot \frac{z}{y}\right|\\
\mathbf{if}\;x \leq -34000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.8 \cdot 10^{-64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+70} \lor \neg \left(x \leq 1.06 \cdot 10^{+159}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -3.4e7 or 4 < x < 1.49999999999999988e70 or 1.06000000000000006e159 < x Initial program 84.0%
associate-*l/87.1%
sub-div95.5%
Applied egg-rr95.5%
Taylor expanded in x around inf 94.2%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in z around 0 76.9%
if -3.4e7 < x < -1.7999999999999999e-64 or 1.49999999999999988e70 < x < 1.06000000000000006e159Initial program 99.8%
Simplified99.8%
Taylor expanded in z around inf 75.4%
associate-*l/75.3%
*-commutative75.3%
Simplified75.3%
if -1.7999999999999999e-64 < x < 4Initial program 98.3%
Taylor expanded in x around 0 76.9%
Final simplification76.7%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))))
(if (<= x -30500000.0)
t_0
(if (<= x -1.3e-65)
(fabs (* z (/ x y)))
(if (<= x 4.0)
(fabs (/ 4.0 y))
(if (or (<= x 5.8e+71) (not (<= x 1.38e+159)))
t_0
(fabs (* x (/ z y)))))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double tmp;
if (x <= -30500000.0) {
tmp = t_0;
} else if (x <= -1.3e-65) {
tmp = fabs((z * (x / y)));
} else if (x <= 4.0) {
tmp = fabs((4.0 / y));
} else if ((x <= 5.8e+71) || !(x <= 1.38e+159)) {
tmp = t_0;
} else {
tmp = fabs((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) :: t_0
real(8) :: tmp
t_0 = abs((x / y))
if (x <= (-30500000.0d0)) then
tmp = t_0
else if (x <= (-1.3d-65)) then
tmp = abs((z * (x / y)))
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y))
else if ((x <= 5.8d+71) .or. (.not. (x <= 1.38d+159))) then
tmp = t_0
else
tmp = abs((x * (z / 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((x / y));
double tmp;
if (x <= -30500000.0) {
tmp = t_0;
} else if (x <= -1.3e-65) {
tmp = Math.abs((z * (x / y)));
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y));
} else if ((x <= 5.8e+71) || !(x <= 1.38e+159)) {
tmp = t_0;
} else {
tmp = Math.abs((x * (z / y)));
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((x / y)) tmp = 0 if x <= -30500000.0: tmp = t_0 elif x <= -1.3e-65: tmp = math.fabs((z * (x / y))) elif x <= 4.0: tmp = math.fabs((4.0 / y)) elif (x <= 5.8e+71) or not (x <= 1.38e+159): tmp = t_0 else: tmp = math.fabs((x * (z / y))) return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(x / y)) tmp = 0.0 if (x <= -30500000.0) tmp = t_0; elseif (x <= -1.3e-65) tmp = abs(Float64(z * Float64(x / y))); elseif (x <= 4.0) tmp = abs(Float64(4.0 / y)); elseif ((x <= 5.8e+71) || !(x <= 1.38e+159)) tmp = t_0; else tmp = abs(Float64(x * Float64(z / y))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((x / y)); tmp = 0.0; if (x <= -30500000.0) tmp = t_0; elseif (x <= -1.3e-65) tmp = abs((z * (x / y))); elseif (x <= 4.0) tmp = abs((4.0 / y)); elseif ((x <= 5.8e+71) || ~((x <= 1.38e+159))) tmp = t_0; else tmp = abs((x * (z / 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[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -30500000.0], t$95$0, If[LessEqual[x, -1.3e-65], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 5.8e+71], N[Not[LessEqual[x, 1.38e+159]], $MachinePrecision]], t$95$0, N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -30500000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-65}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+71} \lor \neg \left(x \leq 1.38 \cdot 10^{+159}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\end{array}
\end{array}
if x < -3.05e7 or 4 < x < 5.80000000000000014e71 or 1.38000000000000001e159 < x Initial program 84.0%
associate-*l/87.1%
sub-div95.5%
Applied egg-rr95.5%
Taylor expanded in x around inf 94.2%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in z around 0 76.9%
if -3.05e7 < x < -1.30000000000000005e-65Initial program 100.0%
Simplified99.7%
Taylor expanded in z around inf 68.2%
*-commutative68.2%
associate-*l/68.5%
*-commutative68.5%
Simplified68.5%
if -1.30000000000000005e-65 < x < 4Initial program 98.3%
Taylor expanded in x around 0 76.9%
if 5.80000000000000014e71 < x < 1.38000000000000001e159Initial program 99.5%
Simplified99.9%
Taylor expanded in z around inf 85.2%
associate-*l/85.1%
*-commutative85.1%
Simplified85.1%
Final simplification76.7%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))))
(if (<= x -13500000.0)
t_0
(if (<= x -1.9e-64)
(fabs (* z (/ x y)))
(if (<= x 4.0)
(fabs (/ 4.0 y))
(if (or (<= x 1e+69) (not (<= x 1.8e+179)))
t_0
(fabs (/ z (/ y x)))))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double tmp;
if (x <= -13500000.0) {
tmp = t_0;
} else if (x <= -1.9e-64) {
tmp = fabs((z * (x / y)));
} else if (x <= 4.0) {
tmp = fabs((4.0 / y));
} else if ((x <= 1e+69) || !(x <= 1.8e+179)) {
tmp = t_0;
} else {
tmp = fabs((z / (y / x)));
}
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((x / y))
if (x <= (-13500000.0d0)) then
tmp = t_0
else if (x <= (-1.9d-64)) then
tmp = abs((z * (x / y)))
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y))
else if ((x <= 1d+69) .or. (.not. (x <= 1.8d+179))) then
tmp = t_0
else
tmp = abs((z / (y / x)))
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((x / y));
double tmp;
if (x <= -13500000.0) {
tmp = t_0;
} else if (x <= -1.9e-64) {
tmp = Math.abs((z * (x / y)));
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y));
} else if ((x <= 1e+69) || !(x <= 1.8e+179)) {
tmp = t_0;
} else {
tmp = Math.abs((z / (y / x)));
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((x / y)) tmp = 0 if x <= -13500000.0: tmp = t_0 elif x <= -1.9e-64: tmp = math.fabs((z * (x / y))) elif x <= 4.0: tmp = math.fabs((4.0 / y)) elif (x <= 1e+69) or not (x <= 1.8e+179): tmp = t_0 else: tmp = math.fabs((z / (y / x))) return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(x / y)) tmp = 0.0 if (x <= -13500000.0) tmp = t_0; elseif (x <= -1.9e-64) tmp = abs(Float64(z * Float64(x / y))); elseif (x <= 4.0) tmp = abs(Float64(4.0 / y)); elseif ((x <= 1e+69) || !(x <= 1.8e+179)) tmp = t_0; else tmp = abs(Float64(z / Float64(y / x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((x / y)); tmp = 0.0; if (x <= -13500000.0) tmp = t_0; elseif (x <= -1.9e-64) tmp = abs((z * (x / y))); elseif (x <= 4.0) tmp = abs((4.0 / y)); elseif ((x <= 1e+69) || ~((x <= 1.8e+179))) tmp = t_0; else tmp = abs((z / (y / x))); 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[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -13500000.0], t$95$0, If[LessEqual[x, -1.9e-64], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 1e+69], N[Not[LessEqual[x, 1.8e+179]], $MachinePrecision]], t$95$0, N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -13500000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{-64}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 10^{+69} \lor \neg \left(x \leq 1.8 \cdot 10^{+179}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\end{array}
\end{array}
if x < -1.35e7 or 4 < x < 1.0000000000000001e69 or 1.7999999999999999e179 < x Initial program 84.0%
associate-*l/87.3%
sub-div96.2%
Applied egg-rr96.2%
Taylor expanded in x around inf 94.7%
associate-/l*98.2%
Simplified98.2%
Taylor expanded in z around 0 77.4%
if -1.35e7 < x < -1.9000000000000001e-64Initial program 100.0%
Simplified99.7%
Taylor expanded in z around inf 68.2%
*-commutative68.2%
associate-*l/68.5%
*-commutative68.5%
Simplified68.5%
if -1.9000000000000001e-64 < x < 4Initial program 98.3%
Taylor expanded in x around 0 76.9%
if 1.0000000000000001e69 < x < 1.7999999999999999e179Initial program 94.3%
Simplified94.9%
Taylor expanded in z around inf 70.0%
*-commutative70.0%
associate-*l/79.7%
*-commutative79.7%
Simplified79.7%
clear-num79.8%
un-div-inv79.8%
Applied egg-rr79.8%
Final simplification76.7%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= z -5.8e+44) (fabs (/ (* x z) y)) (if (<= z 3.2e+31) (fabs (/ (- -4.0 x) y)) (fabs (/ (+ z -1.0) (/ y x))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+44) {
tmp = fabs(((x * z) / y));
} else if (z <= 3.2e+31) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs(((z + -1.0) / (y / x)));
}
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 <= (-5.8d+44)) then
tmp = abs(((x * z) / y))
else if (z <= 3.2d+31) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs(((z + (-1.0d0)) / (y / x)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+44) {
tmp = Math.abs(((x * z) / y));
} else if (z <= 3.2e+31) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs(((z + -1.0) / (y / x)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if z <= -5.8e+44: tmp = math.fabs(((x * z) / y)) elif z <= 3.2e+31: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs(((z + -1.0) / (y / x))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (z <= -5.8e+44) tmp = abs(Float64(Float64(x * z) / y)); elseif (z <= 3.2e+31) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(Float64(z + -1.0) / Float64(y / x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.8e+44) tmp = abs(((x * z) / y)); elseif (z <= 3.2e+31) tmp = abs(((-4.0 - x) / y)); else tmp = abs(((z + -1.0) / (y / x))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[z, -5.8e+44], N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3.2e+31], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(z + -1.0), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+44}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+31}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z + -1}{\frac{y}{x}}\right|\\
\end{array}
\end{array}
if z < -5.8000000000000004e44Initial program 97.8%
Simplified99.8%
Taylor expanded in z around inf 79.7%
if -5.8000000000000004e44 < z < 3.2000000000000001e31Initial program 91.3%
Simplified99.8%
Taylor expanded in z around 0 98.0%
associate-*r/98.0%
distribute-lft-in98.0%
metadata-eval98.0%
neg-mul-198.0%
sub-neg98.0%
Simplified98.0%
if 3.2000000000000001e31 < z Initial program 91.4%
Simplified91.9%
Taylor expanded in x around inf 71.4%
associate-/l*77.6%
sub-neg77.6%
metadata-eval77.6%
Simplified77.6%
Final simplification89.9%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= z -5.8e+44) (fabs (/ (* x z) y)) (if (<= z 2.9e+31) (fabs (/ (- -4.0 x) y)) (fabs (/ z (/ y x))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+44) {
tmp = fabs(((x * z) / y));
} else if (z <= 2.9e+31) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((z / (y / x)));
}
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 <= (-5.8d+44)) then
tmp = abs(((x * z) / y))
else if (z <= 2.9d+31) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((z / (y / x)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+44) {
tmp = Math.abs(((x * z) / y));
} else if (z <= 2.9e+31) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((z / (y / x)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if z <= -5.8e+44: tmp = math.fabs(((x * z) / y)) elif z <= 2.9e+31: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((z / (y / x))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (z <= -5.8e+44) tmp = abs(Float64(Float64(x * z) / y)); elseif (z <= 2.9e+31) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(z / Float64(y / x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.8e+44) tmp = abs(((x * z) / y)); elseif (z <= 2.9e+31) tmp = abs(((-4.0 - x) / y)); else tmp = abs((z / (y / x))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[z, -5.8e+44], N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 2.9e+31], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+44}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+31}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\end{array}
\end{array}
if z < -5.8000000000000004e44Initial program 97.8%
Simplified99.8%
Taylor expanded in z around inf 79.7%
if -5.8000000000000004e44 < z < 2.9e31Initial program 91.3%
Simplified99.8%
Taylor expanded in z around 0 98.0%
associate-*r/98.0%
distribute-lft-in98.0%
metadata-eval98.0%
neg-mul-198.0%
sub-neg98.0%
Simplified98.0%
if 2.9e31 < z Initial program 91.4%
Simplified91.9%
Taylor expanded in z around inf 71.4%
*-commutative71.4%
associate-*l/77.5%
*-commutative77.5%
Simplified77.5%
clear-num77.5%
un-div-inv77.6%
Applied egg-rr77.6%
Final simplification89.9%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (fabs (/ (- (+ x 4.0) (* x z)) y)))
y = abs(y);
double code(double x, double y, double z) {
return fabs((((x + 4.0) - (x * z)) / 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((((x + 4.0d0) - (x * z)) / y))
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) - (x * z)) / y));
}
y = abs(y) def code(x, y, z): return math.fabs((((x + 4.0) - (x * z)) / y))
y = abs(y) function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)) end
y = abs(y) function tmp = code(x, y, z) tmp = abs((((x + 4.0) - (x * z)) / y)); end
NOTE: y should be positive before calling this function code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|
\end{array}
Initial program 92.5%
associate-*l/94.6%
sub-div98.1%
Applied egg-rr98.1%
Final simplification98.1%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -10.2) (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.2) || !(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.2d0)) .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.2) || !(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.2) 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.2) || !(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.2) || ~((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.2], 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.2 \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.199999999999999 or 4 < x Initial program 85.9%
associate-*l/88.7%
sub-div96.0%
Applied egg-rr96.0%
Taylor expanded in x around inf 94.9%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in z around 0 69.7%
if -10.199999999999999 < x < 4Initial program 98.5%
Taylor expanded in x around 0 72.6%
Final simplification71.2%
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 92.5%
Taylor expanded in x around 0 40.4%
Final simplification40.4%
herbie shell --seed 2023238
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))