
(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 12 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 -3e+34)
(fabs (* (/ x y) (- 1.0 z)))
(if (<= x 6.5e+130)
(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 <= -3e+34) {
tmp = fabs(((x / y) * (1.0 - z)));
} else if (x <= 6.5e+130) {
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 <= (-3d+34)) then
tmp = abs(((x / y) * (1.0d0 - z)))
else if (x <= 6.5d+130) 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 <= -3e+34) {
tmp = Math.abs(((x / y) * (1.0 - z)));
} else if (x <= 6.5e+130) {
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 <= -3e+34: tmp = math.fabs(((x / y) * (1.0 - z))) elif x <= 6.5e+130: 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 <= -3e+34) tmp = abs(Float64(Float64(x / y) * Float64(1.0 - z))); elseif (x <= 6.5e+130) 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 <= -3e+34) tmp = abs(((x / y) * (1.0 - z))); elseif (x <= 6.5e+130) 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, -3e+34], N[Abs[N[(N[(x / y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 6.5e+130], 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 -3 \cdot 10^{+34}:\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(1 - z\right)\right|\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+130}:\\
\;\;\;\;\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 < -3.00000000000000018e34Initial program 82.3%
Simplified90.7%
Taylor expanded in x around inf 90.9%
mul-1-neg90.9%
*-commutative90.9%
associate-/l*99.9%
distribute-lft-neg-in99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
if -3.00000000000000018e34 < x < 6.5e130Initial program 94.3%
associate-*l/99.3%
sub-div99.9%
Applied egg-rr99.9%
if 6.5e130 < x Initial program 96.3%
Simplified83.0%
Taylor expanded in x around inf 83.0%
*-commutative83.0%
associate-/l*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r/99.9%
mul-1-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (/ (+ x 4.0) y) (* z (/ x y)))))
(if (<= t_0 -1e-175)
(fabs t_0)
(fabs (* (/ -1.0 y) (fma x z (- -4.0 x)))))))
double code(double x, double y, double z) {
double t_0 = ((x + 4.0) / y) - (z * (x / y));
double tmp;
if (t_0 <= -1e-175) {
tmp = fabs(t_0);
} else {
tmp = fabs(((-1.0 / y) * fma(x, z, (-4.0 - x))));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(x + 4.0) / y) - Float64(z * Float64(x / y))) tmp = 0.0 if (t_0 <= -1e-175) tmp = abs(t_0); else tmp = abs(Float64(Float64(-1.0 / y) * fma(x, z, Float64(-4.0 - x)))); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-175], N[Abs[t$95$0], $MachinePrecision], N[Abs[N[(N[(-1.0 / y), $MachinePrecision] * N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y} - z \cdot \frac{x}{y}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-175}:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < -1e-175Initial program 99.9%
if -1e-175 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 86.6%
Simplified96.1%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (if (<= y 5e+129) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (fma x (/ z y) (/ (- -4.0 x) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5e+129) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs(fma(x, (z / y), ((-4.0 - x) / y)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 5e+129) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(fma(x, Float64(z / y), Float64(Float64(-4.0 - x) / y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 5e+129], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{+129}:\\
\;\;\;\;\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 < 5.0000000000000003e129Initial program 91.8%
associate-*l/94.6%
sub-div97.8%
Applied egg-rr97.8%
if 5.0000000000000003e129 < y Initial program 94.2%
fabs-sub94.2%
associate-*l/86.4%
associate-*r/99.9%
fma-neg99.9%
distribute-neg-frac99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification98.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (/ (+ x 4.0) y) (* z (/ x y))))) (if (<= t_0 -2e-67) (fabs t_0) (fabs (/ (- (+ x 4.0) (* x z)) y)))))
double code(double x, double y, double z) {
double t_0 = ((x + 4.0) / y) - (z * (x / y));
double tmp;
if (t_0 <= -2e-67) {
tmp = fabs(t_0);
} else {
tmp = fabs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((x + 4.0d0) / y) - (z * (x / y))
if (t_0 <= (-2d-67)) then
tmp = abs(t_0)
else
tmp = abs((((x + 4.0d0) - (x * z)) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((x + 4.0) / y) - (z * (x / y));
double tmp;
if (t_0 <= -2e-67) {
tmp = Math.abs(t_0);
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
def code(x, y, z): t_0 = ((x + 4.0) / y) - (z * (x / y)) tmp = 0 if t_0 <= -2e-67: tmp = math.fabs(t_0) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(x + 4.0) / y) - Float64(z * Float64(x / y))) tmp = 0.0 if (t_0 <= -2e-67) tmp = abs(t_0); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((x + 4.0) / y) - (z * (x / y)); tmp = 0.0; if (t_0 <= -2e-67) tmp = abs(t_0); else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-67], N[Abs[t$95$0], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y} - z \cdot \frac{x}{y}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-67}:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < -1.99999999999999989e-67Initial program 99.9%
if -1.99999999999999989e-67 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 87.9%
associate-*l/92.3%
sub-div96.5%
Applied egg-rr96.5%
Final simplification97.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y)))
(if (<= (- t_0 (* z (/ x y))) -5e+35)
(fabs (- t_0 (/ z (/ y x))))
(fabs (/ (- (+ x 4.0) (* x z)) y)))))
double code(double x, double y, double z) {
double t_0 = (x + 4.0) / y;
double tmp;
if ((t_0 - (z * (x / y))) <= -5e+35) {
tmp = fabs((t_0 - (z / (y / x))));
} else {
tmp = fabs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 4.0d0) / y
if ((t_0 - (z * (x / y))) <= (-5d+35)) then
tmp = abs((t_0 - (z / (y / x))))
else
tmp = abs((((x + 4.0d0) - (x * z)) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + 4.0) / y;
double tmp;
if ((t_0 - (z * (x / y))) <= -5e+35) {
tmp = Math.abs((t_0 - (z / (y / x))));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + 4.0) / y tmp = 0 if (t_0 - (z * (x / y))) <= -5e+35: tmp = math.fabs((t_0 - (z / (y / x)))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(x + 4.0) / y) tmp = 0.0 if (Float64(t_0 - Float64(z * Float64(x / y))) <= -5e+35) tmp = abs(Float64(t_0 - Float64(z / Float64(y / x)))); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + 4.0) / y; tmp = 0.0; if ((t_0 - (z * (x / y))) <= -5e+35) tmp = abs((t_0 - (z / (y / x)))); else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+35], N[Abs[N[(t$95$0 - N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y}\\
\mathbf{if}\;t\_0 - z \cdot \frac{x}{y} \leq -5 \cdot 10^{+35}:\\
\;\;\;\;\left|t\_0 - \frac{z}{\frac{y}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < -5.00000000000000021e35Initial program 99.9%
Taylor expanded in x around 0 94.9%
associate-*r/92.7%
*-commutative92.7%
associate-/r/99.9%
Simplified99.9%
if -5.00000000000000021e35 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 88.9%
associate-*l/92.9%
sub-div96.8%
Applied egg-rr96.8%
Final simplification97.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))))
(if (<= x -1.45e-34)
t_0
(if (<= x 4.0) (fabs (/ 4.0 y)) (if (<= x 4e+163) (fabs (/ x y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double tmp;
if (x <= -1.45e-34) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = fabs((4.0 / y));
} else if (x <= 4e+163) {
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 <= (-1.45d-34)) then
tmp = t_0
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y))
else if (x <= 4d+163) 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 <= -1.45e-34) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y));
} else if (x <= 4e+163) {
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 <= -1.45e-34: tmp = t_0 elif x <= 4.0: tmp = math.fabs((4.0 / y)) elif x <= 4e+163: 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 <= -1.45e-34) tmp = t_0; elseif (x <= 4.0) tmp = abs(Float64(4.0 / y)); elseif (x <= 4e+163) 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 <= -1.45e-34) tmp = t_0; elseif (x <= 4.0) tmp = abs((4.0 / y)); elseif (x <= 4e+163) 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, -1.45e-34], t$95$0, If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4e+163], 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 -1.45 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+163}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.4500000000000001e-34 or 3.9999999999999998e163 < x Initial program 88.2%
Simplified89.9%
Taylor expanded in z around inf 50.4%
mul-1-neg50.4%
distribute-frac-neg250.4%
associate-/l*59.5%
Simplified59.5%
clear-num59.5%
un-div-inv59.5%
add-sqr-sqrt29.7%
sqrt-unprod48.9%
sqr-neg48.9%
sqrt-unprod29.7%
add-sqr-sqrt59.5%
Applied egg-rr59.5%
associate-/r/67.2%
*-commutative67.2%
Simplified67.2%
if -1.4500000000000001e-34 < x < 4Initial program 97.0%
Simplified99.9%
Taylor expanded in x around 0 73.7%
if 4 < x < 3.9999999999999998e163Initial program 82.8%
Simplified99.9%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
*-commutative98.4%
associate-/l*98.4%
distribute-lft-neg-in98.4%
neg-sub098.4%
associate-+l-98.4%
neg-sub098.4%
+-commutative98.4%
unsub-neg98.4%
Simplified98.4%
Taylor expanded in z around 0 72.6%
Final simplification71.2%
(FPCore (x y z)
:precision binary64
(if (<= x -2.4e-34)
(fabs (* z (/ x y)))
(if (<= x 4.0)
(fabs (/ 4.0 y))
(if (<= x 1.95e+172) (fabs (/ x y)) (fabs (/ z (/ y x)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.4e-34) {
tmp = fabs((z * (x / y)));
} else if (x <= 4.0) {
tmp = fabs((4.0 / y));
} else if (x <= 1.95e+172) {
tmp = fabs((x / y));
} else {
tmp = fabs((z / (y / x)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2.4d-34)) then
tmp = abs((z * (x / y)))
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y))
else if (x <= 1.95d+172) then
tmp = abs((x / y))
else
tmp = abs((z / (y / x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.4e-34) {
tmp = Math.abs((z * (x / y)));
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y));
} else if (x <= 1.95e+172) {
tmp = Math.abs((x / y));
} else {
tmp = Math.abs((z / (y / x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.4e-34: tmp = math.fabs((z * (x / y))) elif x <= 4.0: tmp = math.fabs((4.0 / y)) elif x <= 1.95e+172: tmp = math.fabs((x / y)) else: tmp = math.fabs((z / (y / x))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.4e-34) tmp = abs(Float64(z * Float64(x / y))); elseif (x <= 4.0) tmp = abs(Float64(4.0 / y)); elseif (x <= 1.95e+172) tmp = abs(Float64(x / y)); else tmp = abs(Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.4e-34) tmp = abs((z * (x / y))); elseif (x <= 4.0) tmp = abs((4.0 / y)); elseif (x <= 1.95e+172) tmp = abs((x / y)); else tmp = abs((z / (y / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.4e-34], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.95e+172], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-34}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+172}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\end{array}
\end{array}
if x < -2.39999999999999991e-34Initial program 85.7%
Simplified93.2%
Taylor expanded in z around inf 52.6%
mul-1-neg52.6%
distribute-frac-neg252.6%
associate-/l*58.1%
Simplified58.1%
clear-num58.1%
un-div-inv58.2%
add-sqr-sqrt29.9%
sqrt-unprod50.8%
sqr-neg50.8%
sqrt-unprod28.2%
add-sqr-sqrt58.2%
Applied egg-rr58.2%
associate-/r/67.0%
*-commutative67.0%
Simplified67.0%
if -2.39999999999999991e-34 < x < 4Initial program 97.0%
Simplified99.9%
Taylor expanded in x around 0 73.7%
if 4 < x < 1.94999999999999984e172Initial program 82.8%
Simplified99.9%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
*-commutative98.4%
associate-/l*98.4%
distribute-lft-neg-in98.4%
neg-sub098.4%
associate-+l-98.4%
neg-sub098.4%
+-commutative98.4%
unsub-neg98.4%
Simplified98.4%
Taylor expanded in z around 0 72.6%
if 1.94999999999999984e172 < x Initial program 95.7%
Simplified80.1%
Taylor expanded in z around inf 44.1%
associate-*r/44.1%
neg-mul-144.1%
distribute-rgt-neg-in44.1%
Simplified44.1%
distribute-rgt-neg-out44.1%
distribute-frac-neg44.1%
distribute-frac-neg244.1%
associate-*r/63.5%
*-commutative63.5%
add-sqr-sqrt29.2%
sqrt-unprod43.3%
sqr-neg43.3%
sqrt-unprod34.2%
add-sqr-sqrt63.5%
Applied egg-rr63.5%
associate-/r/67.9%
Applied egg-rr67.9%
Final simplification71.2%
(FPCore (x y z) :precision binary64 (if (<= z -2.1e+127) (fabs (* x (/ z y))) (if (<= z 2200.0) (fabs (/ (- -4.0 x) y)) (fabs (* (/ x y) (- 1.0 z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.1e+127) {
tmp = fabs((x * (z / y)));
} else if (z <= 2200.0) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs(((x / y) * (1.0 - 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 <= (-2.1d+127)) then
tmp = abs((x * (z / y)))
else if (z <= 2200.0d0) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs(((x / y) * (1.0d0 - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.1e+127) {
tmp = Math.abs((x * (z / y)));
} else if (z <= 2200.0) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs(((x / y) * (1.0 - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.1e+127: tmp = math.fabs((x * (z / y))) elif z <= 2200.0: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs(((x / y) * (1.0 - z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.1e+127) tmp = abs(Float64(x * Float64(z / y))); elseif (z <= 2200.0) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(Float64(x / y) * Float64(1.0 - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.1e+127) tmp = abs((x * (z / y))); elseif (z <= 2200.0) tmp = abs(((-4.0 - x) / y)); else tmp = abs(((x / y) * (1.0 - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.1e+127], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 2200.0], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+127}:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\mathbf{elif}\;z \leq 2200:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(1 - z\right)\right|\\
\end{array}
\end{array}
if z < -2.09999999999999992e127Initial program 92.4%
Simplified90.4%
Taylor expanded in z around inf 86.7%
associate-*r/86.7%
neg-mul-186.7%
distribute-rgt-neg-in86.7%
Simplified86.7%
distribute-rgt-neg-out86.7%
distribute-frac-neg86.7%
distribute-frac-neg286.7%
associate-*r/91.4%
*-commutative91.4%
add-sqr-sqrt56.2%
sqrt-unprod64.8%
sqr-neg64.8%
sqrt-unprod35.1%
add-sqr-sqrt91.4%
Applied egg-rr91.4%
if -2.09999999999999992e127 < z < 2200Initial program 93.4%
Simplified98.7%
Taylor expanded in z around 0 94.4%
+-commutative94.4%
rem-square-sqrt41.7%
fabs-sqr41.7%
rem-square-sqrt94.4%
fabs-neg94.4%
distribute-neg-frac94.4%
distribute-neg-in94.4%
metadata-eval94.4%
+-commutative94.4%
sub-neg94.4%
rem-square-sqrt52.1%
fabs-sqr52.1%
rem-square-sqrt94.4%
Simplified94.4%
if 2200 < z Initial program 88.7%
Simplified93.8%
Taylor expanded in x around inf 73.0%
mul-1-neg73.0%
*-commutative73.0%
associate-/l*77.3%
distribute-lft-neg-in77.3%
neg-sub077.3%
associate-+l-77.3%
neg-sub077.3%
+-commutative77.3%
unsub-neg77.3%
Simplified77.3%
Final simplification89.8%
(FPCore (x y z)
:precision binary64
(if (<= z -1.3e+126)
(fabs (* x (/ z y)))
(if (<= z 15.5)
(fabs (- (/ -4.0 y) (/ x y)))
(fabs (* (/ x y) (- 1.0 z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e+126) {
tmp = fabs((x * (z / y)));
} else if (z <= 15.5) {
tmp = fabs(((-4.0 / y) - (x / y)));
} else {
tmp = fabs(((x / y) * (1.0 - 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 <= (-1.3d+126)) then
tmp = abs((x * (z / y)))
else if (z <= 15.5d0) then
tmp = abs((((-4.0d0) / y) - (x / y)))
else
tmp = abs(((x / y) * (1.0d0 - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e+126) {
tmp = Math.abs((x * (z / y)));
} else if (z <= 15.5) {
tmp = Math.abs(((-4.0 / y) - (x / y)));
} else {
tmp = Math.abs(((x / y) * (1.0 - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.3e+126: tmp = math.fabs((x * (z / y))) elif z <= 15.5: tmp = math.fabs(((-4.0 / y) - (x / y))) else: tmp = math.fabs(((x / y) * (1.0 - z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.3e+126) tmp = abs(Float64(x * Float64(z / y))); elseif (z <= 15.5) tmp = abs(Float64(Float64(-4.0 / y) - Float64(x / y))); else tmp = abs(Float64(Float64(x / y) * Float64(1.0 - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.3e+126) tmp = abs((x * (z / y))); elseif (z <= 15.5) tmp = abs(((-4.0 / y) - (x / y))); else tmp = abs(((x / y) * (1.0 - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.3e+126], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 15.5], N[Abs[N[(N[(-4.0 / y), $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+126}:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\mathbf{elif}\;z \leq 15.5:\\
\;\;\;\;\left|\frac{-4}{y} - \frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(1 - z\right)\right|\\
\end{array}
\end{array}
if z < -1.3e126Initial program 92.4%
Simplified90.4%
Taylor expanded in z around inf 86.7%
associate-*r/86.7%
neg-mul-186.7%
distribute-rgt-neg-in86.7%
Simplified86.7%
distribute-rgt-neg-out86.7%
distribute-frac-neg86.7%
distribute-frac-neg286.7%
associate-*r/91.4%
*-commutative91.4%
add-sqr-sqrt56.2%
sqrt-unprod64.8%
sqr-neg64.8%
sqrt-unprod35.1%
add-sqr-sqrt91.4%
Applied egg-rr91.4%
if -1.3e126 < z < 15.5Initial program 93.4%
Simplified98.7%
Taylor expanded in z around 0 94.4%
+-commutative94.4%
rem-square-sqrt41.7%
fabs-sqr41.7%
rem-square-sqrt94.4%
fabs-neg94.4%
distribute-neg-frac94.4%
distribute-neg-in94.4%
metadata-eval94.4%
+-commutative94.4%
sub-neg94.4%
rem-square-sqrt52.1%
fabs-sqr52.1%
rem-square-sqrt94.4%
Simplified94.4%
div-sub94.5%
Applied egg-rr94.5%
if 15.5 < z Initial program 88.7%
Simplified93.8%
Taylor expanded in x around inf 73.0%
mul-1-neg73.0%
*-commutative73.0%
associate-/l*77.3%
distribute-lft-neg-in77.3%
neg-sub077.3%
associate-+l-77.3%
neg-sub077.3%
+-commutative77.3%
unsub-neg77.3%
Simplified77.3%
Final simplification89.8%
(FPCore (x y z) :precision binary64 (if (<= z -1.25e+126) (fabs (* x (/ z y))) (if (<= z 3.2e+99) (fabs (/ (- -4.0 x) y)) (fabs (* z (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.25e+126) {
tmp = fabs((x * (z / y)));
} else if (z <= 3.2e+99) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((z * (x / y)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.25d+126)) then
tmp = abs((x * (z / y)))
else if (z <= 3.2d+99) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((z * (x / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.25e+126) {
tmp = Math.abs((x * (z / y)));
} else if (z <= 3.2e+99) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((z * (x / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.25e+126: tmp = math.fabs((x * (z / y))) elif z <= 3.2e+99: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((z * (x / y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.25e+126) tmp = abs(Float64(x * Float64(z / y))); elseif (z <= 3.2e+99) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(z * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.25e+126) tmp = abs((x * (z / y))); elseif (z <= 3.2e+99) tmp = abs(((-4.0 - x) / y)); else tmp = abs((z * (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.25e+126], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3.2e+99], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+126}:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+99}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if z < -1.24999999999999994e126Initial program 92.4%
Simplified90.4%
Taylor expanded in z around inf 86.7%
associate-*r/86.7%
neg-mul-186.7%
distribute-rgt-neg-in86.7%
Simplified86.7%
distribute-rgt-neg-out86.7%
distribute-frac-neg86.7%
distribute-frac-neg286.7%
associate-*r/91.4%
*-commutative91.4%
add-sqr-sqrt56.2%
sqrt-unprod64.8%
sqr-neg64.8%
sqrt-unprod35.1%
add-sqr-sqrt91.4%
Applied egg-rr91.4%
if -1.24999999999999994e126 < z < 3.19999999999999999e99Initial program 93.4%
Simplified98.2%
Taylor expanded in z around 0 90.2%
+-commutative90.2%
rem-square-sqrt39.8%
fabs-sqr39.8%
rem-square-sqrt90.2%
fabs-neg90.2%
distribute-neg-frac90.2%
distribute-neg-in90.2%
metadata-eval90.2%
+-commutative90.2%
sub-neg90.2%
rem-square-sqrt49.8%
fabs-sqr49.8%
rem-square-sqrt90.2%
Simplified90.2%
if 3.19999999999999999e99 < z Initial program 87.0%
Simplified93.7%
Taylor expanded in z around inf 79.9%
mul-1-neg79.9%
distribute-frac-neg279.9%
associate-/l*79.9%
Simplified79.9%
clear-num79.9%
un-div-inv80.0%
add-sqr-sqrt38.4%
sqrt-unprod69.3%
sqr-neg69.3%
sqrt-unprod41.4%
add-sqr-sqrt80.0%
Applied egg-rr80.0%
associate-/r/83.8%
*-commutative83.8%
Simplified83.8%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -10.5) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -10.5) || !(x <= 4.0)) {
tmp = fabs((x / y));
} else {
tmp = fabs((4.0 / y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-10.5d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y))
else
tmp = abs((4.0d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -10.5) || !(x <= 4.0)) {
tmp = Math.abs((x / y));
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -10.5) or not (x <= 4.0): tmp = math.fabs((x / y)) else: tmp = math.fabs((4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -10.5) || !(x <= 4.0)) tmp = abs(Float64(x / y)); else tmp = abs(Float64(4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -10.5) || ~((x <= 4.0))) tmp = abs((x / y)); else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -10.5], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -10.5 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -10.5 or 4 < x Initial program 85.8%
Simplified91.5%
Taylor expanded in x around inf 90.2%
mul-1-neg90.2%
*-commutative90.2%
associate-/l*98.5%
distribute-lft-neg-in98.5%
neg-sub098.5%
associate-+l-98.5%
neg-sub098.5%
+-commutative98.5%
unsub-neg98.5%
Simplified98.5%
Taylor expanded in z around 0 62.2%
if -10.5 < x < 4Initial program 97.1%
Simplified99.9%
Taylor expanded in x around 0 69.6%
Final simplification66.3%
(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.1%
Simplified96.2%
Taylor expanded in x around 0 41.2%
Final simplification41.2%
herbie shell --seed 2024073
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))