
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
(FPCore (x y z) :precision binary64 (if (<= x 6.5e+81) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (* x (/ (- 1.0 z) y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 6.5e+81) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((x * ((1.0 - z) / y)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 6.5d+81) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((x * ((1.0d0 - z) / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 6.5e+81) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((x * ((1.0 - z) / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 6.5e+81: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((x * ((1.0 - z) / y))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 6.5e+81) 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
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 6.5e+81) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((x * ((1.0 - z) / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 6.5e+81], 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}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{+81}:\\
\;\;\;\;\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 < 6.4999999999999996e81Initial program 94.2%
associate-*l/96.2%
sub-div98.6%
Applied egg-rr98.6%
if 6.4999999999999996e81 < x Initial program 87.4%
Taylor expanded in x around inf 99.7%
*-commutative99.7%
sub-neg99.7%
mul-1-neg99.7%
distribute-lft-in93.5%
associate-*r/93.7%
*-rgt-identity93.7%
mul-1-neg93.7%
distribute-rgt-neg-in93.7%
unsub-neg93.7%
*-lft-identity93.7%
associate-/l*93.5%
*-commutative93.5%
associate-/r/89.3%
div-sub99.7%
associate-/r/99.7%
Simplified99.7%
Final simplification98.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ 4.0 y))) (t_1 (fabs (/ x y))) (t_2 (fabs (* x (/ z y)))))
(if (<= x -2.15e+172)
t_1
(if (<= x -3.85e-32)
t_2
(if (<= x 2.9e-124)
t_0
(if (<= x 1.9e-51)
t_2
(if (<= x 4.0)
t_0
(if (or (<= x 2.6e+50)
(and (not (<= x 1.05e+120)) (<= x 1.35e+156)))
t_1
t_2))))))))
double code(double x, double y, double z) {
double t_0 = fabs((4.0 / y));
double t_1 = fabs((x / y));
double t_2 = fabs((x * (z / y)));
double tmp;
if (x <= -2.15e+172) {
tmp = t_1;
} else if (x <= -3.85e-32) {
tmp = t_2;
} else if (x <= 2.9e-124) {
tmp = t_0;
} else if (x <= 1.9e-51) {
tmp = t_2;
} else if (x <= 4.0) {
tmp = t_0;
} else if ((x <= 2.6e+50) || (!(x <= 1.05e+120) && (x <= 1.35e+156))) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = abs((4.0d0 / y))
t_1 = abs((x / y))
t_2 = abs((x * (z / y)))
if (x <= (-2.15d+172)) then
tmp = t_1
else if (x <= (-3.85d-32)) then
tmp = t_2
else if (x <= 2.9d-124) then
tmp = t_0
else if (x <= 1.9d-51) then
tmp = t_2
else if (x <= 4.0d0) then
tmp = t_0
else if ((x <= 2.6d+50) .or. (.not. (x <= 1.05d+120)) .and. (x <= 1.35d+156)) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((4.0 / y));
double t_1 = Math.abs((x / y));
double t_2 = Math.abs((x * (z / y)));
double tmp;
if (x <= -2.15e+172) {
tmp = t_1;
} else if (x <= -3.85e-32) {
tmp = t_2;
} else if (x <= 2.9e-124) {
tmp = t_0;
} else if (x <= 1.9e-51) {
tmp = t_2;
} else if (x <= 4.0) {
tmp = t_0;
} else if ((x <= 2.6e+50) || (!(x <= 1.05e+120) && (x <= 1.35e+156))) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((4.0 / y)) t_1 = math.fabs((x / y)) t_2 = math.fabs((x * (z / y))) tmp = 0 if x <= -2.15e+172: tmp = t_1 elif x <= -3.85e-32: tmp = t_2 elif x <= 2.9e-124: tmp = t_0 elif x <= 1.9e-51: tmp = t_2 elif x <= 4.0: tmp = t_0 elif (x <= 2.6e+50) or (not (x <= 1.05e+120) and (x <= 1.35e+156)): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z) t_0 = abs(Float64(4.0 / y)) t_1 = abs(Float64(x / y)) t_2 = abs(Float64(x * Float64(z / y))) tmp = 0.0 if (x <= -2.15e+172) tmp = t_1; elseif (x <= -3.85e-32) tmp = t_2; elseif (x <= 2.9e-124) tmp = t_0; elseif (x <= 1.9e-51) tmp = t_2; elseif (x <= 4.0) tmp = t_0; elseif ((x <= 2.6e+50) || (!(x <= 1.05e+120) && (x <= 1.35e+156))) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((4.0 / y)); t_1 = abs((x / y)); t_2 = abs((x * (z / y))); tmp = 0.0; if (x <= -2.15e+172) tmp = t_1; elseif (x <= -3.85e-32) tmp = t_2; elseif (x <= 2.9e-124) tmp = t_0; elseif (x <= 1.9e-51) tmp = t_2; elseif (x <= 4.0) tmp = t_0; elseif ((x <= 2.6e+50) || (~((x <= 1.05e+120)) && (x <= 1.35e+156))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.15e+172], t$95$1, If[LessEqual[x, -3.85e-32], t$95$2, If[LessEqual[x, 2.9e-124], t$95$0, If[LessEqual[x, 1.9e-51], t$95$2, If[LessEqual[x, 4.0], t$95$0, If[Or[LessEqual[x, 2.6e+50], And[N[Not[LessEqual[x, 1.05e+120]], $MachinePrecision], LessEqual[x, 1.35e+156]]], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{4}{y}\right|\\
t_1 := \left|\frac{x}{y}\right|\\
t_2 := \left|x \cdot \frac{z}{y}\right|\\
\mathbf{if}\;x \leq -2.15 \cdot 10^{+172}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.85 \cdot 10^{-32}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-124}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-51}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+50} \lor \neg \left(x \leq 1.05 \cdot 10^{+120}\right) \land x \leq 1.35 \cdot 10^{+156}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -2.1500000000000001e172 or 4 < x < 2.6000000000000002e50 or 1.05e120 < x < 1.35e156Initial program 89.3%
associate-*l/90.0%
sub-div94.3%
Applied egg-rr94.3%
Taylor expanded in x around inf 93.9%
sub-neg93.9%
+-commutative93.9%
distribute-rgt1-in93.9%
cancel-sign-sub-inv93.9%
Simplified93.9%
Taylor expanded in z around 0 73.7%
if -2.1500000000000001e172 < x < -3.8499999999999998e-32 or 2.9000000000000002e-124 < x < 1.90000000000000001e-51 or 2.6000000000000002e50 < x < 1.05e120 or 1.35e156 < x Initial program 88.2%
Simplified92.7%
Taylor expanded in z around inf 69.0%
associate-*l/74.2%
*-commutative74.2%
Simplified74.2%
if -3.8499999999999998e-32 < x < 2.9000000000000002e-124 or 1.90000000000000001e-51 < x < 4Initial program 98.3%
Taylor expanded in x around 0 83.6%
Final simplification78.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ (- -4.0 x) y))) (t_1 (fabs (* x (/ (- 1.0 z) y)))))
(if (<= x -3.5e-32)
t_1
(if (<= x 4e-125)
t_0
(if (<= x 2.25e-51)
(fabs (/ (* x z) y))
(if (<= x 0.00335) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = fabs(((-4.0 - x) / y));
double t_1 = fabs((x * ((1.0 - z) / y)));
double tmp;
if (x <= -3.5e-32) {
tmp = t_1;
} else if (x <= 4e-125) {
tmp = t_0;
} else if (x <= 2.25e-51) {
tmp = fabs(((x * z) / y));
} else if (x <= 0.00335) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((((-4.0d0) - x) / y))
t_1 = abs((x * ((1.0d0 - z) / y)))
if (x <= (-3.5d-32)) then
tmp = t_1
else if (x <= 4d-125) then
tmp = t_0
else if (x <= 2.25d-51) then
tmp = abs(((x * z) / y))
else if (x <= 0.00335d0) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs(((-4.0 - x) / y));
double t_1 = Math.abs((x * ((1.0 - z) / y)));
double tmp;
if (x <= -3.5e-32) {
tmp = t_1;
} else if (x <= 4e-125) {
tmp = t_0;
} else if (x <= 2.25e-51) {
tmp = Math.abs(((x * z) / y));
} else if (x <= 0.00335) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(((-4.0 - x) / y)) t_1 = math.fabs((x * ((1.0 - z) / y))) tmp = 0 if x <= -3.5e-32: tmp = t_1 elif x <= 4e-125: tmp = t_0 elif x <= 2.25e-51: tmp = math.fabs(((x * z) / y)) elif x <= 0.00335: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(-4.0 - x) / y)) t_1 = abs(Float64(x * Float64(Float64(1.0 - z) / y))) tmp = 0.0 if (x <= -3.5e-32) tmp = t_1; elseif (x <= 4e-125) tmp = t_0; elseif (x <= 2.25e-51) tmp = abs(Float64(Float64(x * z) / y)); elseif (x <= 0.00335) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(((-4.0 - x) / y)); t_1 = abs((x * ((1.0 - z) / y))); tmp = 0.0; if (x <= -3.5e-32) tmp = t_1; elseif (x <= 4e-125) tmp = t_0; elseif (x <= 2.25e-51) tmp = abs(((x * z) / y)); elseif (x <= 0.00335) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -3.5e-32], t$95$1, If[LessEqual[x, 4e-125], t$95$0, If[LessEqual[x, 2.25e-51], N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 0.00335], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{-4 - x}{y}\right|\\
t_1 := \left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{if}\;x \leq -3.5 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-125}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{-51}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\
\mathbf{elif}\;x \leq 0.00335:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -3.4999999999999999e-32 or 0.00335000000000000011 < x Initial program 88.1%
Taylor expanded in x around inf 98.3%
*-commutative98.3%
sub-neg98.3%
mul-1-neg98.3%
distribute-lft-in92.1%
associate-*r/92.3%
*-rgt-identity92.3%
mul-1-neg92.3%
distribute-rgt-neg-in92.3%
unsub-neg92.3%
*-lft-identity92.3%
associate-/l*92.2%
*-commutative92.2%
associate-/r/89.0%
div-sub98.4%
associate-/r/98.3%
Simplified98.3%
if -3.4999999999999999e-32 < x < 4.00000000000000005e-125 or 2.24999999999999987e-51 < x < 0.00335000000000000011Initial program 98.3%
Simplified99.9%
Taylor expanded in z around 0 84.3%
associate-*r/84.3%
distribute-lft-in84.3%
metadata-eval84.3%
neg-mul-184.3%
sub-neg84.3%
Simplified84.3%
if 4.00000000000000005e-125 < x < 2.24999999999999987e-51Initial program 93.0%
Simplified100.0%
Taylor expanded in z around inf 77.3%
Final simplification90.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* x (/ (- 1.0 z) y)))))
(if (<= x -4.8e-32)
t_0
(if (<= x 5.6e-124)
(fabs (/ (- -4.0 x) y))
(if (<= x 3e-51)
(fabs (/ (* x z) y))
(if (<= x 0.00385) (fabs (+ (/ 4.0 y) (/ x y))) t_0))))))
double code(double x, double y, double z) {
double t_0 = fabs((x * ((1.0 - z) / y)));
double tmp;
if (x <= -4.8e-32) {
tmp = t_0;
} else if (x <= 5.6e-124) {
tmp = fabs(((-4.0 - x) / y));
} else if (x <= 3e-51) {
tmp = fabs(((x * z) / y));
} else if (x <= 0.00385) {
tmp = fabs(((4.0 / y) + (x / y)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((x * ((1.0d0 - z) / y)))
if (x <= (-4.8d-32)) then
tmp = t_0
else if (x <= 5.6d-124) then
tmp = abs((((-4.0d0) - x) / y))
else if (x <= 3d-51) then
tmp = abs(((x * z) / y))
else if (x <= 0.00385d0) then
tmp = abs(((4.0d0 / y) + (x / y)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x * ((1.0 - z) / y)));
double tmp;
if (x <= -4.8e-32) {
tmp = t_0;
} else if (x <= 5.6e-124) {
tmp = Math.abs(((-4.0 - x) / y));
} else if (x <= 3e-51) {
tmp = Math.abs(((x * z) / y));
} else if (x <= 0.00385) {
tmp = Math.abs(((4.0 / y) + (x / y)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((x * ((1.0 - z) / y))) tmp = 0 if x <= -4.8e-32: tmp = t_0 elif x <= 5.6e-124: tmp = math.fabs(((-4.0 - x) / y)) elif x <= 3e-51: tmp = math.fabs(((x * z) / y)) elif x <= 0.00385: tmp = math.fabs(((4.0 / y) + (x / y))) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(x * Float64(Float64(1.0 - z) / y))) tmp = 0.0 if (x <= -4.8e-32) tmp = t_0; elseif (x <= 5.6e-124) tmp = abs(Float64(Float64(-4.0 - x) / y)); elseif (x <= 3e-51) tmp = abs(Float64(Float64(x * z) / y)); elseif (x <= 0.00385) tmp = abs(Float64(Float64(4.0 / y) + Float64(x / y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((x * ((1.0 - z) / y))); tmp = 0.0; if (x <= -4.8e-32) tmp = t_0; elseif (x <= 5.6e-124) tmp = abs(((-4.0 - x) / y)); elseif (x <= 3e-51) tmp = abs(((x * z) / y)); elseif (x <= 0.00385) tmp = abs(((4.0 / y) + (x / y))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -4.8e-32], t$95$0, If[LessEqual[x, 5.6e-124], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 3e-51], N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 0.00385], N[Abs[N[(N[(4.0 / y), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{if}\;x \leq -4.8 \cdot 10^{-32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-124}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-51}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\
\mathbf{elif}\;x \leq 0.00385:\\
\;\;\;\;\left|\frac{4}{y} + \frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -4.8000000000000003e-32 or 0.0038500000000000001 < x Initial program 88.1%
Taylor expanded in x around inf 98.3%
*-commutative98.3%
sub-neg98.3%
mul-1-neg98.3%
distribute-lft-in92.1%
associate-*r/92.3%
*-rgt-identity92.3%
mul-1-neg92.3%
distribute-rgt-neg-in92.3%
unsub-neg92.3%
*-lft-identity92.3%
associate-/l*92.2%
*-commutative92.2%
associate-/r/89.0%
div-sub98.4%
associate-/r/98.3%
Simplified98.3%
if -4.8000000000000003e-32 < x < 5.59999999999999996e-124Initial program 98.2%
Simplified99.9%
Taylor expanded in z around 0 85.8%
associate-*r/85.8%
distribute-lft-in85.8%
metadata-eval85.8%
neg-mul-185.8%
sub-neg85.8%
Simplified85.8%
if 5.59999999999999996e-124 < x < 3.00000000000000002e-51Initial program 93.0%
Simplified100.0%
Taylor expanded in z around inf 77.3%
if 3.00000000000000002e-51 < x < 0.0038500000000000001Initial program 99.7%
Taylor expanded in z around 0 67.8%
associate-*r/67.8%
metadata-eval67.8%
Simplified67.8%
Final simplification90.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))))
(if (<= x -8.2e-32)
t_0
(if (<= x 5.6e-124)
(fabs (/ 4.0 y))
(if (or (<= x 1.06e+119) (not (<= x 1.2e+156))) t_0 (fabs (/ x y)))))))
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double tmp;
if (x <= -8.2e-32) {
tmp = t_0;
} else if (x <= 5.6e-124) {
tmp = fabs((4.0 / y));
} else if ((x <= 1.06e+119) || !(x <= 1.2e+156)) {
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 <= (-8.2d-32)) then
tmp = t_0
else if (x <= 5.6d-124) then
tmp = abs((4.0d0 / y))
else if ((x <= 1.06d+119) .or. (.not. (x <= 1.2d+156))) 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 <= -8.2e-32) {
tmp = t_0;
} else if (x <= 5.6e-124) {
tmp = Math.abs((4.0 / y));
} else if ((x <= 1.06e+119) || !(x <= 1.2e+156)) {
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 <= -8.2e-32: tmp = t_0 elif x <= 5.6e-124: tmp = math.fabs((4.0 / y)) elif (x <= 1.06e+119) or not (x <= 1.2e+156): 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 <= -8.2e-32) tmp = t_0; elseif (x <= 5.6e-124) tmp = abs(Float64(4.0 / y)); elseif ((x <= 1.06e+119) || !(x <= 1.2e+156)) 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 <= -8.2e-32) tmp = t_0; elseif (x <= 5.6e-124) tmp = abs((4.0 / y)); elseif ((x <= 1.06e+119) || ~((x <= 1.2e+156))) 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, -8.2e-32], t$95$0, If[LessEqual[x, 5.6e-124], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 1.06e+119], N[Not[LessEqual[x, 1.2e+156]], $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 -8.2 \cdot 10^{-32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-124}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{+119} \lor \neg \left(x \leq 1.2 \cdot 10^{+156}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -8.1999999999999995e-32 or 5.59999999999999996e-124 < x < 1.0599999999999999e119 or 1.2000000000000001e156 < x Initial program 88.5%
Simplified93.1%
Taylor expanded in z around inf 59.8%
*-commutative59.8%
associate-*l/72.6%
*-commutative72.6%
Simplified72.6%
if -8.1999999999999995e-32 < x < 5.59999999999999996e-124Initial program 98.2%
Taylor expanded in x around 0 85.8%
if 1.0599999999999999e119 < x < 1.2000000000000001e156Initial program 100.0%
associate-*l/100.0%
sub-div100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
sub-neg100.0%
+-commutative100.0%
distribute-rgt1-in100.0%
cancel-sign-sub-inv100.0%
Simplified100.0%
Taylor expanded in z around 0 91.4%
Final simplification78.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))))
(if (<= x -9.3e-32)
t_0
(if (<= x 5.5e-124)
(fabs (/ 4.0 y))
(if (<= x 2.1e+119)
(fabs (/ z (/ y x)))
(if (<= x 1.2e+156) (fabs (/ x y)) t_0))))))
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double tmp;
if (x <= -9.3e-32) {
tmp = t_0;
} else if (x <= 5.5e-124) {
tmp = fabs((4.0 / y));
} else if (x <= 2.1e+119) {
tmp = fabs((z / (y / x)));
} else if (x <= 1.2e+156) {
tmp = fabs((x / y));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((z * (x / y)))
if (x <= (-9.3d-32)) then
tmp = t_0
else if (x <= 5.5d-124) then
tmp = abs((4.0d0 / y))
else if (x <= 2.1d+119) then
tmp = abs((z / (y / x)))
else if (x <= 1.2d+156) then
tmp = abs((x / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((z * (x / y)));
double tmp;
if (x <= -9.3e-32) {
tmp = t_0;
} else if (x <= 5.5e-124) {
tmp = Math.abs((4.0 / y));
} else if (x <= 2.1e+119) {
tmp = Math.abs((z / (y / x)));
} else if (x <= 1.2e+156) {
tmp = Math.abs((x / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((z * (x / y))) tmp = 0 if x <= -9.3e-32: tmp = t_0 elif x <= 5.5e-124: tmp = math.fabs((4.0 / y)) elif x <= 2.1e+119: tmp = math.fabs((z / (y / x))) elif x <= 1.2e+156: tmp = math.fabs((x / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(z * Float64(x / y))) tmp = 0.0 if (x <= -9.3e-32) tmp = t_0; elseif (x <= 5.5e-124) tmp = abs(Float64(4.0 / y)); elseif (x <= 2.1e+119) tmp = abs(Float64(z / Float64(y / x))); elseif (x <= 1.2e+156) tmp = abs(Float64(x / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((z * (x / y))); tmp = 0.0; if (x <= -9.3e-32) tmp = t_0; elseif (x <= 5.5e-124) tmp = abs((4.0 / y)); elseif (x <= 2.1e+119) tmp = abs((z / (y / x))); elseif (x <= 1.2e+156) tmp = abs((x / y)); else tmp = t_0; 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, -9.3e-32], t$95$0, If[LessEqual[x, 5.5e-124], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2.1e+119], N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.2e+156], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;x \leq -9.3 \cdot 10^{-32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-124}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+119}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+156}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -9.29999999999999977e-32 or 1.2000000000000001e156 < x Initial program 85.7%
Simplified91.3%
Taylor expanded in z around inf 58.5%
*-commutative58.5%
associate-*l/76.3%
*-commutative76.3%
Simplified76.3%
if -9.29999999999999977e-32 < x < 5.50000000000000016e-124Initial program 98.2%
Taylor expanded in x around 0 85.8%
if 5.50000000000000016e-124 < x < 2.09999999999999983e119Initial program 95.2%
Simplified97.5%
Taylor expanded in z around inf 62.8%
*-commutative62.8%
associate-*l/63.5%
*-commutative63.5%
Simplified63.5%
clear-num63.4%
un-div-inv63.6%
Applied egg-rr63.6%
if 2.09999999999999983e119 < x < 1.2000000000000001e156Initial program 100.0%
associate-*l/100.0%
sub-div100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
sub-neg100.0%
+-commutative100.0%
distribute-rgt1-in100.0%
cancel-sign-sub-inv100.0%
Simplified100.0%
Taylor expanded in z around 0 91.4%
Final simplification78.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -5e-32) (not (<= x 5.6e-124))) (fabs (/ (+ z -1.0) (/ y x))) (fabs (/ (- -4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5e-32) || !(x <= 5.6e-124)) {
tmp = fabs(((z + -1.0) / (y / x)));
} 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 <= (-5d-32)) .or. (.not. (x <= 5.6d-124))) then
tmp = abs(((z + (-1.0d0)) / (y / x)))
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 <= -5e-32) || !(x <= 5.6e-124)) {
tmp = Math.abs(((z + -1.0) / (y / x)));
} else {
tmp = Math.abs(((-4.0 - x) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5e-32) or not (x <= 5.6e-124): tmp = math.fabs(((z + -1.0) / (y / x))) else: tmp = math.fabs(((-4.0 - x) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5e-32) || !(x <= 5.6e-124)) tmp = abs(Float64(Float64(z + -1.0) / Float64(y / x))); 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 <= -5e-32) || ~((x <= 5.6e-124))) tmp = abs(((z + -1.0) / (y / x))); else tmp = abs(((-4.0 - x) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5e-32], N[Not[LessEqual[x, 5.6e-124]], $MachinePrecision]], N[Abs[N[(N[(z + -1.0), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-32} \lor \neg \left(x \leq 5.6 \cdot 10^{-124}\right):\\
\;\;\;\;\left|\frac{z + -1}{\frac{y}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if x < -5e-32 or 5.59999999999999996e-124 < x Initial program 89.3%
Simplified93.5%
Taylor expanded in x around inf 86.4%
associate-/l*92.1%
sub-neg92.1%
metadata-eval92.1%
Simplified92.1%
if -5e-32 < x < 5.59999999999999996e-124Initial program 98.2%
Simplified99.9%
Taylor expanded in z around 0 85.8%
associate-*r/85.8%
distribute-lft-in85.8%
metadata-eval85.8%
neg-mul-185.8%
sub-neg85.8%
Simplified85.8%
Final simplification89.5%
(FPCore (x y z) :precision binary64 (if (<= z -9e+42) (fabs (/ z (/ y x))) (if (<= z 3.6e+34) (fabs (/ (- -4.0 x) y)) (fabs (/ x (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9e+42) {
tmp = fabs((z / (y / x)));
} else if (z <= 3.6e+34) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((x / (y / z)));
}
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 <= (-9d+42)) then
tmp = abs((z / (y / x)))
else if (z <= 3.6d+34) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((x / (y / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -9e+42) {
tmp = Math.abs((z / (y / x)));
} else if (z <= 3.6e+34) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((x / (y / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9e+42: tmp = math.fabs((z / (y / x))) elif z <= 3.6e+34: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((x / (y / z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9e+42) tmp = abs(Float64(z / Float64(y / x))); elseif (z <= 3.6e+34) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(x / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9e+42) tmp = abs((z / (y / x))); elseif (z <= 3.6e+34) tmp = abs(((-4.0 - x) / y)); else tmp = abs((x / (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9e+42], N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3.6e+34], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+42}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+34}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\end{array}
\end{array}
if z < -9.00000000000000025e42Initial program 98.4%
Simplified94.0%
Taylor expanded in z around inf 67.0%
*-commutative67.0%
associate-*l/71.7%
*-commutative71.7%
Simplified71.7%
clear-num71.6%
un-div-inv71.7%
Applied egg-rr71.7%
if -9.00000000000000025e42 < z < 3.6e34Initial program 92.9%
Simplified99.8%
Taylor expanded in z around 0 95.7%
associate-*r/95.7%
distribute-lft-in95.7%
metadata-eval95.7%
neg-mul-195.7%
sub-neg95.7%
Simplified95.7%
if 3.6e34 < z Initial program 87.8%
Simplified91.2%
Taylor expanded in z around inf 73.0%
*-commutative73.0%
associate-*l/78.7%
*-commutative78.7%
Simplified78.7%
associate-*r/73.0%
*-commutative73.0%
associate-/l*78.9%
Applied egg-rr78.9%
Final simplification85.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.55) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.55) || !(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 <= (-1.55d0)) .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 <= -1.55) || !(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 <= -1.55) 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 <= -1.55) || !(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 <= -1.55) || ~((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, -1.55], 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 -1.55 \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.55000000000000004 or 4 < x Initial program 87.4%
associate-*l/85.6%
sub-div92.2%
Applied egg-rr92.2%
Taylor expanded in x around inf 91.5%
sub-neg91.5%
+-commutative91.5%
distribute-rgt1-in91.5%
cancel-sign-sub-inv91.5%
Simplified91.5%
Taylor expanded in z around 0 55.0%
if -1.55000000000000004 < x < 4Initial program 97.9%
Taylor expanded in x around 0 73.7%
Final simplification64.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 92.9%
Taylor expanded in x around 0 41.2%
Final simplification41.2%
herbie shell --seed 2023187
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))