
(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 11 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
(let* ((t_0 (fabs (- (/ (+ x 4.0) y) (* z (/ x y))))))
(if (<= t_0 5e-62)
(fabs (/ (- (+ x 4.0) (* x z)) y))
(if (<= t_0 1e+291) t_0 (fabs (* (/ -1.0 y) (fma x z (- -4.0 x))))))))
double code(double x, double y, double z) {
double t_0 = fabs((((x + 4.0) / y) - (z * (x / y))));
double tmp;
if (t_0 <= 5e-62) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else if (t_0 <= 1e+291) {
tmp = t_0;
} else {
tmp = fabs(((-1.0 / y) * fma(x, z, (-4.0 - x))));
}
return tmp;
}
function code(x, y, z) t_0 = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(z * Float64(x / y)))) tmp = 0.0 if (t_0 <= 5e-62) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); elseif (t_0 <= 1e+291) tmp = 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[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 5e-62], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$0, 1e+291], t$95$0, 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 := \left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-62}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{elif}\;t\_0 \leq 10^{+291}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 5.0000000000000002e-62Initial program 91.1%
associate-*l/99.8%
sub-div99.9%
Applied egg-rr99.9%
if 5.0000000000000002e-62 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 9.9999999999999996e290Initial program 99.9%
if 9.9999999999999996e290 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) Initial program 74.6%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (- (/ (+ x 4.0) y) (* z (/ x y))))))
(if (or (<= t_0 5e-62) (not (<= t_0 1e+291)))
(fabs (/ (- (+ x 4.0) (* x z)) y))
t_0)))
double code(double x, double y, double z) {
double t_0 = fabs((((x + 4.0) / y) - (z * (x / y))));
double tmp;
if ((t_0 <= 5e-62) || !(t_0 <= 1e+291)) {
tmp = fabs((((x + 4.0) - (x * z)) / 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 + 4.0d0) / y) - (z * (x / y))))
if ((t_0 <= 5d-62) .or. (.not. (t_0 <= 1d+291))) then
tmp = abs((((x + 4.0d0) - (x * z)) / 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 + 4.0) / y) - (z * (x / y))));
double tmp;
if ((t_0 <= 5e-62) || !(t_0 <= 1e+291)) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((((x + 4.0) / y) - (z * (x / y)))) tmp = 0 if (t_0 <= 5e-62) or not (t_0 <= 1e+291): tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(z * Float64(x / y)))) tmp = 0.0 if ((t_0 <= 5e-62) || !(t_0 <= 1e+291)) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((((x + 4.0) / y) - (z * (x / y)))); tmp = 0.0; if ((t_0 <= 5e-62) || ~((t_0 <= 1e+291))) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[t$95$0, 5e-62], N[Not[LessEqual[t$95$0, 1e+291]], $MachinePrecision]], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-62} \lor \neg \left(t\_0 \leq 10^{+291}\right):\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 5.0000000000000002e-62 or 9.9999999999999996e290 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) Initial program 82.6%
associate-*l/91.0%
sub-div99.9%
Applied egg-rr99.9%
if 5.0000000000000002e-62 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 9.9999999999999996e290Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y 185000.0) (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 <= 185000.0) {
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 <= 185000.0) 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, 185000.0], 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 185000:\\
\;\;\;\;\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 < 185000Initial program 89.8%
associate-*l/91.7%
sub-div97.4%
Applied egg-rr97.4%
if 185000 < y Initial program 96.9%
fabs-sub96.9%
associate-*l/91.0%
associate-*r/99.8%
fma-neg99.8%
distribute-neg-frac99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.2) (not (<= z 13.5))) (fabs (* (/ z y) (+ x (/ -4.0 z)))) (fabs (+ (/ x y) (/ 4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.2) || !(z <= 13.5)) {
tmp = fabs(((z / y) * (x + (-4.0 / z))));
} else {
tmp = fabs(((x / y) + (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 ((z <= (-1.2d0)) .or. (.not. (z <= 13.5d0))) then
tmp = abs(((z / y) * (x + ((-4.0d0) / z))))
else
tmp = abs(((x / y) + (4.0d0 / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.2) || !(z <= 13.5)) {
tmp = Math.abs(((z / y) * (x + (-4.0 / z))));
} else {
tmp = Math.abs(((x / y) + (4.0 / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.2) or not (z <= 13.5): tmp = math.fabs(((z / y) * (x + (-4.0 / z)))) else: tmp = math.fabs(((x / y) + (4.0 / y))) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.2) || !(z <= 13.5)) tmp = abs(Float64(Float64(z / y) * Float64(x + Float64(-4.0 / z)))); else tmp = abs(Float64(Float64(x / y) + Float64(4.0 / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.2) || ~((z <= 13.5))) tmp = abs(((z / y) * (x + (-4.0 / z)))); else tmp = abs(((x / y) + (4.0 / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.2], N[Not[LessEqual[z, 13.5]], $MachinePrecision]], N[Abs[N[(N[(z / y), $MachinePrecision] * N[(x + N[(-4.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / y), $MachinePrecision] + N[(4.0 / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \lor \neg \left(z \leq 13.5\right):\\
\;\;\;\;\left|\frac{z}{y} \cdot \left(x + \frac{-4}{z}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} + \frac{4}{y}\right|\\
\end{array}
\end{array}
if z < -1.19999999999999996 or 13.5 < z Initial program 89.0%
fabs-sub89.0%
associate-*l/85.4%
associate-*r/88.8%
fma-neg91.6%
distribute-neg-frac91.6%
+-commutative91.6%
distribute-neg-in91.6%
unsub-neg91.6%
metadata-eval91.6%
Simplified91.6%
Taylor expanded in z around inf 91.1%
+-commutative91.1%
associate-*r/91.1%
distribute-lft-in91.1%
metadata-eval91.1%
neg-mul-191.1%
sub-neg91.1%
associate-/r*87.6%
Simplified87.6%
Taylor expanded in z around inf 91.1%
+-commutative91.1%
mul-1-neg91.1%
unsub-neg91.1%
*-commutative91.1%
associate-/r*92.5%
div-sub94.6%
unsub-neg94.6%
mul-1-neg94.6%
associate-/l*92.4%
*-commutative92.4%
associate-/l*95.7%
associate-*r/95.7%
distribute-lft-in95.7%
metadata-eval95.7%
mul-1-neg95.7%
unsub-neg95.7%
Simplified95.7%
Taylor expanded in x around 0 94.2%
if -1.19999999999999996 < z < 13.5Initial program 94.7%
Taylor expanded in x around 0 99.0%
associate-*r/99.0%
*-commutative99.0%
associate-/r/95.6%
Simplified95.6%
Taylor expanded in z around 0 99.2%
associate-*r/99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification96.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -9e+92) (not (<= x 5e+53))) (fabs (* x (/ (- 1.0 z) y))) (fabs (/ (- (+ x 4.0) (* x z)) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9e+92) || !(x <= 5e+53)) {
tmp = fabs((x * ((1.0 - z) / y)));
} 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) :: tmp
if ((x <= (-9d+92)) .or. (.not. (x <= 5d+53))) then
tmp = abs((x * ((1.0d0 - z) / y)))
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 tmp;
if ((x <= -9e+92) || !(x <= 5e+53)) {
tmp = Math.abs((x * ((1.0 - z) / y)));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9e+92) or not (x <= 5e+53): tmp = math.fabs((x * ((1.0 - z) / y))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -9e+92) || !(x <= 5e+53)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y))); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -9e+92) || ~((x <= 5e+53))) tmp = abs((x * ((1.0 - z) / y))); else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -9e+92], N[Not[LessEqual[x, 5e+53]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $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}
\mathbf{if}\;x \leq -9 \cdot 10^{+92} \lor \neg \left(x \leq 5 \cdot 10^{+53}\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if x < -8.9999999999999998e92 or 5.0000000000000004e53 < x Initial program 84.6%
Simplified89.3%
Taylor expanded in x around inf 89.3%
*-commutative89.3%
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%
if -8.9999999999999998e92 < x < 5.0000000000000004e53Initial program 95.9%
associate-*l/99.8%
sub-div99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.3e-69) (not (<= x 0.58))) (fabs (* x (/ (- 1.0 z) y))) (fabs (/ (- -4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.3e-69) || !(x <= 0.58)) {
tmp = fabs((x * ((1.0 - z) / y)));
} 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 <= (-2.3d-69)) .or. (.not. (x <= 0.58d0))) then
tmp = abs((x * ((1.0d0 - z) / y)))
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 <= -2.3e-69) || !(x <= 0.58)) {
tmp = Math.abs((x * ((1.0 - z) / y)));
} else {
tmp = Math.abs(((-4.0 - x) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.3e-69) or not (x <= 0.58): tmp = math.fabs((x * ((1.0 - z) / y))) else: tmp = math.fabs(((-4.0 - x) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.3e-69) || !(x <= 0.58)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y))); 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 <= -2.3e-69) || ~((x <= 0.58))) tmp = abs((x * ((1.0 - z) / y))); else tmp = abs(((-4.0 - x) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.3e-69], N[Not[LessEqual[x, 0.58]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-69} \lor \neg \left(x \leq 0.58\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if x < -2.3000000000000001e-69 or 0.57999999999999996 < x Initial program 87.7%
Simplified92.3%
Taylor expanded in x around inf 89.7%
*-commutative89.7%
associate-/l*96.5%
associate-*r*96.5%
*-commutative96.5%
associate-*r/96.5%
mul-1-neg96.5%
neg-sub096.5%
associate-+l-96.5%
neg-sub096.5%
+-commutative96.5%
unsub-neg96.5%
Simplified96.5%
if -2.3000000000000001e-69 < x < 0.57999999999999996Initial program 96.2%
Simplified99.9%
Taylor expanded in z around 0 82.3%
+-commutative82.3%
rem-square-sqrt42.2%
fabs-sqr42.2%
rem-square-sqrt82.3%
fabs-neg82.3%
distribute-neg-frac82.3%
distribute-neg-in82.3%
metadata-eval82.3%
+-commutative82.3%
sub-neg82.3%
rem-square-sqrt39.5%
fabs-sqr39.5%
rem-square-sqrt82.3%
Simplified82.3%
Final simplification89.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -7e-68) (not (<= x 2.6))) (fabs (* x (/ (- 1.0 z) y))) (fabs (+ (/ x y) (/ 4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -7e-68) || !(x <= 2.6)) {
tmp = fabs((x * ((1.0 - z) / y)));
} else {
tmp = fabs(((x / y) + (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 <= (-7d-68)) .or. (.not. (x <= 2.6d0))) then
tmp = abs((x * ((1.0d0 - z) / y)))
else
tmp = abs(((x / y) + (4.0d0 / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -7e-68) || !(x <= 2.6)) {
tmp = Math.abs((x * ((1.0 - z) / y)));
} else {
tmp = Math.abs(((x / y) + (4.0 / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -7e-68) or not (x <= 2.6): tmp = math.fabs((x * ((1.0 - z) / y))) else: tmp = math.fabs(((x / y) + (4.0 / y))) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -7e-68) || !(x <= 2.6)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y))); else tmp = abs(Float64(Float64(x / y) + Float64(4.0 / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -7e-68) || ~((x <= 2.6))) tmp = abs((x * ((1.0 - z) / y))); else tmp = abs(((x / y) + (4.0 / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -7e-68], N[Not[LessEqual[x, 2.6]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / y), $MachinePrecision] + N[(4.0 / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-68} \lor \neg \left(x \leq 2.6\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} + \frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -7.00000000000000026e-68 or 2.60000000000000009 < x Initial program 87.7%
Simplified92.3%
Taylor expanded in x around inf 89.7%
*-commutative89.7%
associate-/l*96.5%
associate-*r*96.5%
*-commutative96.5%
associate-*r/96.5%
mul-1-neg96.5%
neg-sub096.5%
associate-+l-96.5%
neg-sub096.5%
+-commutative96.5%
unsub-neg96.5%
Simplified96.5%
if -7.00000000000000026e-68 < x < 2.60000000000000009Initial program 96.2%
Taylor expanded in x around 0 99.9%
associate-*r/95.9%
*-commutative95.9%
associate-/r/96.2%
Simplified96.2%
Taylor expanded in z around 0 82.3%
associate-*r/82.3%
metadata-eval82.3%
Simplified82.3%
Final simplification89.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.4e-69) (not (<= x 2.3e-17))) (fabs (* z (/ x y))) (fabs (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.4e-69) || !(x <= 2.3e-17)) {
tmp = fabs((z * (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 <= (-3.4d-69)) .or. (.not. (x <= 2.3d-17))) then
tmp = abs((z * (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 <= -3.4e-69) || !(x <= 2.3e-17)) {
tmp = Math.abs((z * (x / y)));
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.4e-69) or not (x <= 2.3e-17): tmp = math.fabs((z * (x / y))) else: tmp = math.fabs((4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.4e-69) || !(x <= 2.3e-17)) tmp = abs(Float64(z * 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 <= -3.4e-69) || ~((x <= 2.3e-17))) tmp = abs((z * (x / y))); else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.4e-69], N[Not[LessEqual[x, 2.3e-17]], $MachinePrecision]], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-69} \lor \neg \left(x \leq 2.3 \cdot 10^{-17}\right):\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -3.40000000000000008e-69 or 2.30000000000000009e-17 < x Initial program 88.2%
Simplified92.6%
Taylor expanded in z around inf 55.4%
mul-1-neg55.4%
distribute-frac-neg255.4%
associate-/l*61.8%
Simplified61.8%
*-commutative61.8%
associate-*l/55.4%
add-sqr-sqrt24.5%
sqrt-unprod52.0%
sqr-neg52.0%
sqrt-unprod30.9%
add-sqr-sqrt55.4%
associate-*l/61.8%
associate-/r/67.0%
Applied egg-rr67.0%
clear-num66.9%
associate-/r/67.6%
clear-num68.5%
Applied egg-rr68.5%
if -3.40000000000000008e-69 < x < 2.30000000000000009e-17Initial program 95.9%
Simplified99.9%
Taylor expanded in x around 0 83.8%
Final simplification75.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.12e+103) (not (<= z 2000.0))) (fabs (/ x (/ y z))) (fabs (/ (- -4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.12e+103) || !(z <= 2000.0)) {
tmp = fabs((x / (y / z)));
} 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 ((z <= (-1.12d+103)) .or. (.not. (z <= 2000.0d0))) then
tmp = abs((x / (y / z)))
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 ((z <= -1.12e+103) || !(z <= 2000.0)) {
tmp = Math.abs((x / (y / z)));
} else {
tmp = Math.abs(((-4.0 - x) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.12e+103) or not (z <= 2000.0): tmp = math.fabs((x / (y / z))) else: tmp = math.fabs(((-4.0 - x) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.12e+103) || !(z <= 2000.0)) tmp = abs(Float64(x / Float64(y / z))); else tmp = abs(Float64(Float64(-4.0 - x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.12e+103) || ~((z <= 2000.0))) tmp = abs((x / (y / z))); else tmp = abs(((-4.0 - x) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.12e+103], N[Not[LessEqual[z, 2000.0]], $MachinePrecision]], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+103} \lor \neg \left(z \leq 2000\right):\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if z < -1.12000000000000007e103 or 2e3 < z Initial program 86.6%
Simplified91.6%
Taylor expanded in z around inf 71.0%
mul-1-neg71.0%
distribute-frac-neg271.0%
associate-/l*77.5%
Simplified77.5%
clear-num77.4%
un-div-inv77.6%
add-sqr-sqrt38.7%
sqrt-unprod57.2%
sqr-neg57.2%
sqrt-unprod38.6%
add-sqr-sqrt77.6%
Applied egg-rr77.6%
if -1.12000000000000007e103 < z < 2e3Initial program 95.6%
Simplified99.2%
Taylor expanded in z around 0 92.2%
+-commutative92.2%
rem-square-sqrt52.7%
fabs-sqr52.7%
rem-square-sqrt92.2%
fabs-neg92.2%
distribute-neg-frac92.2%
distribute-neg-in92.2%
metadata-eval92.2%
+-commutative92.2%
sub-neg92.2%
rem-square-sqrt38.9%
fabs-sqr38.9%
rem-square-sqrt92.2%
Simplified92.2%
Final simplification85.6%
(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.5%
Simplified91.7%
Taylor expanded in x around inf 89.7%
*-commutative89.7%
associate-/l*97.6%
associate-*r*97.6%
*-commutative97.6%
associate-*r/97.6%
mul-1-neg97.6%
neg-sub097.6%
associate-+l-97.6%
neg-sub097.6%
+-commutative97.6%
unsub-neg97.6%
Simplified97.6%
Taylor expanded in z around 0 54.7%
if -1.55000000000000004 < x < 4Initial program 95.8%
Simplified99.9%
Taylor expanded in x around 0 76.0%
Final simplification65.2%
(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 91.6%
Simplified95.8%
Taylor expanded in x around 0 40.4%
Final simplification40.4%
herbie shell --seed 2024054
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))