
(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}
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 1.5e-27) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (fma x (/ z y) (/ (- -4.0 x) y)))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 1.5e-27) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs(fma(x, (z / y), ((-4.0 - x) / y)));
}
return tmp;
}
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 1.5e-27) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(fma(x, Float64(z / y), Float64(Float64(-4.0 - x) / y))); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 1.5e-27], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.5 \cdot 10^{-27}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|\\
\end{array}
\end{array}
if y < 1.5000000000000001e-27Initial program 88.0%
associate-*l/88.8%
sub-div96.7%
Applied egg-rr96.7%
if 1.5000000000000001e-27 < y Initial program 98.2%
Simplified99.8%
Final simplification97.7%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (let* ((t_0 (- (/ (+ x 4.0) y) (* z (/ x y))))) (if (<= t_0 4e+306) (fabs t_0) (fabs (/ (- (+ x 4.0) (* x z)) y)))))
y = abs(y);
double code(double x, double y, double z) {
double t_0 = ((x + 4.0) / y) - (z * (x / y));
double tmp;
if (t_0 <= 4e+306) {
tmp = fabs(t_0);
} else {
tmp = fabs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((x + 4.0d0) / y) - (z * (x / y))
if (t_0 <= 4d+306) then
tmp = abs(t_0)
else
tmp = abs((((x + 4.0d0) - (x * z)) / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double t_0 = ((x + 4.0) / y) - (z * (x / y));
double tmp;
if (t_0 <= 4e+306) {
tmp = Math.abs(t_0);
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = ((x + 4.0) / y) - (z * (x / y)) tmp = 0 if t_0 <= 4e+306: tmp = math.fabs(t_0) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
y = abs(y) 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 <= 4e+306) tmp = abs(t_0); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = ((x + 4.0) / y) - (z * (x / y)); tmp = 0.0; if (t_0 <= 4e+306) tmp = abs(t_0); else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := 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, 4e+306], 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}
y = |y|\\
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y} - z \cdot \frac{x}{y}\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{+306}:\\
\;\;\;\;\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 4) y) (*.f64 (/.f64 x y) z)) < 4.00000000000000007e306Initial program 99.7%
if 4.00000000000000007e306 < (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) Initial program 48.8%
associate-*l/65.1%
sub-div100.0%
Applied egg-rr100.0%
Final simplification99.7%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* x (/ z y)))))
(if (<= x -2.5e+245)
t_0
(if (<= x -2.1e+172)
(fabs (/ x y))
(if (or (<= x -8e-78) (not (<= x 0.00033))) t_0 (fabs (/ 4.0 y)))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((x * (z / y)));
double tmp;
if (x <= -2.5e+245) {
tmp = t_0;
} else if (x <= -2.1e+172) {
tmp = fabs((x / y));
} else if ((x <= -8e-78) || !(x <= 0.00033)) {
tmp = t_0;
} else {
tmp = fabs((4.0 / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((x * (z / y)))
if (x <= (-2.5d+245)) then
tmp = t_0
else if (x <= (-2.1d+172)) then
tmp = abs((x / y))
else if ((x <= (-8d-78)) .or. (.not. (x <= 0.00033d0))) then
tmp = t_0
else
tmp = abs((4.0d0 / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x * (z / y)));
double tmp;
if (x <= -2.5e+245) {
tmp = t_0;
} else if (x <= -2.1e+172) {
tmp = Math.abs((x / y));
} else if ((x <= -8e-78) || !(x <= 0.00033)) {
tmp = t_0;
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((x * (z / y))) tmp = 0 if x <= -2.5e+245: tmp = t_0 elif x <= -2.1e+172: tmp = math.fabs((x / y)) elif (x <= -8e-78) or not (x <= 0.00033): tmp = t_0 else: tmp = math.fabs((4.0 / y)) return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(x * Float64(z / y))) tmp = 0.0 if (x <= -2.5e+245) tmp = t_0; elseif (x <= -2.1e+172) tmp = abs(Float64(x / y)); elseif ((x <= -8e-78) || !(x <= 0.00033)) tmp = t_0; else tmp = abs(Float64(4.0 / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((x * (z / y))); tmp = 0.0; if (x <= -2.5e+245) tmp = t_0; elseif (x <= -2.1e+172) tmp = abs((x / y)); elseif ((x <= -8e-78) || ~((x <= 0.00033))) tmp = t_0; else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.5e+245], t$95$0, If[LessEqual[x, -2.1e+172], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, -8e-78], N[Not[LessEqual[x, 0.00033]], $MachinePrecision]], t$95$0, N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|x \cdot \frac{z}{y}\right|\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+245}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.1 \cdot 10^{+172}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-78} \lor \neg \left(x \leq 0.00033\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -2.50000000000000017e245 or -2.1000000000000001e172 < x < -7.99999999999999999e-78 or 3.3e-4 < x Initial program 86.4%
Taylor expanded in z around inf 57.2%
mul-1-neg57.2%
associate-*r/69.7%
distribute-rgt-neg-out69.7%
distribute-neg-frac69.7%
Simplified69.7%
add-sqr-sqrt35.6%
sqrt-unprod54.3%
sqr-neg54.3%
sqrt-unprod33.9%
add-sqr-sqrt69.7%
clear-num69.6%
expm1-log1p-u35.3%
div-inv35.3%
expm1-udef29.4%
associate-/r/31.8%
associate-/r/29.4%
div-inv29.4%
clear-num29.4%
Applied egg-rr29.4%
expm1-def35.4%
expm1-log1p69.7%
Simplified69.7%
if -2.50000000000000017e245 < x < -2.1000000000000001e172Initial program 71.4%
Taylor expanded in z around 0 82.1%
associate-*r/82.1%
metadata-eval82.1%
Simplified82.1%
Taylor expanded in x around inf 82.1%
if -7.99999999999999999e-78 < x < 3.3e-4Initial program 99.7%
Taylor expanded in x around 0 86.1%
Final simplification78.2%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.07))) (fabs (* (/ z y) (- (/ 4.0 z) x))) (fabs (/ (- -4.0 x) y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.07)) {
tmp = fabs(((z / y) * ((4.0 / z) - x)));
} else {
tmp = fabs(((-4.0 - x) / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 0.07d0))) then
tmp = abs(((z / y) * ((4.0d0 / z) - x)))
else
tmp = abs((((-4.0d0) - x) / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.07)) {
tmp = Math.abs(((z / y) * ((4.0 / z) - x)));
} else {
tmp = Math.abs(((-4.0 - x) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 0.07): tmp = math.fabs(((z / y) * ((4.0 / z) - x))) else: tmp = math.fabs(((-4.0 - x) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 0.07)) tmp = abs(Float64(Float64(z / y) * Float64(Float64(4.0 / z) - x))); else tmp = abs(Float64(Float64(-4.0 - x) / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 0.07))) tmp = abs(((z / y) * ((4.0 / z) - x))); else tmp = abs(((-4.0 - x) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 0.07]], $MachinePrecision]], N[Abs[N[(N[(z / y), $MachinePrecision] * N[(N[(4.0 / z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 0.07\right):\\
\;\;\;\;\left|\frac{z}{y} \cdot \left(\frac{4}{z} - x\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if z < -1 or 0.070000000000000007 < z Initial program 92.2%
associate-/r/81.7%
frac-sub56.4%
associate-/r*68.4%
*-commutative68.4%
Applied egg-rr68.4%
Taylor expanded in x around 0 68.1%
*-commutative68.1%
associate-*l/68.1%
Simplified68.1%
Taylor expanded in y around 0 87.5%
associate-/l*94.3%
associate-/r/88.3%
associate-*r/88.3%
metadata-eval88.3%
Simplified88.3%
if -1 < z < 0.070000000000000007Initial program 90.0%
Simplified100.0%
Taylor expanded in z around 0 99.8%
associate-*r/99.8%
distribute-lft-in99.8%
metadata-eval99.8%
neg-mul-199.8%
sub-neg99.8%
Simplified99.8%
Final simplification93.7%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 2e-10) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (/ (+ x 4.0) y) (/ x (/ y z))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 2e-10) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((((x + 4.0) / y) - (x / (y / z))));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2d-10) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((((x + 4.0d0) / y) - (x / (y / z))))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e-10) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((((x + 4.0) / y) - (x / (y / z))));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 2e-10: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((((x + 4.0) / y) - (x / (y / z)))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 2e-10) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(x / Float64(y / z)))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e-10) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((((x + 4.0) / y) - (x / (y / z)))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 2e-10], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - \frac{x}{\frac{y}{z}}\right|\\
\end{array}
\end{array}
if y < 2.00000000000000007e-10Initial program 87.7%
associate-*l/88.4%
sub-div96.8%
Applied egg-rr96.8%
if 2.00000000000000007e-10 < y Initial program 99.4%
Simplified99.9%
Final simplification97.7%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= x 2.2e+224) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (* x (/ z y)))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (x <= 2.2e+224) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((x * (z / y)));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 2.2d+224) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((x * (z / y)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2.2e+224) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((x * (z / y)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if x <= 2.2e+224: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((x * (z / y))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (x <= 2.2e+224) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(x * Float64(z / y))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2.2e+224) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((x * (z / y))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[x, 2.2e+224], 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]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.2 \cdot 10^{+224}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\end{array}
\end{array}
if x < 2.2e224Initial program 91.3%
associate-*l/90.9%
sub-div96.3%
Applied egg-rr96.3%
if 2.2e224 < x Initial program 88.8%
Taylor expanded in z around inf 47.8%
mul-1-neg47.8%
associate-*r/89.5%
distribute-rgt-neg-out89.5%
distribute-neg-frac89.5%
Simplified89.5%
add-sqr-sqrt44.7%
sqrt-unprod78.8%
sqr-neg78.8%
sqrt-unprod44.5%
add-sqr-sqrt89.5%
clear-num89.3%
expm1-log1p-u42.8%
div-inv42.8%
expm1-udef42.8%
associate-/r/42.9%
associate-/r/42.8%
div-inv42.8%
clear-num42.9%
Applied egg-rr42.9%
expm1-def42.9%
expm1-log1p89.5%
Simplified89.5%
Final simplification95.9%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -9e-78) (not (<= x 7.2e-6))) (fabs (* z (/ x y))) (fabs (/ 4.0 y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -9e-78) || !(x <= 7.2e-6)) {
tmp = fabs((z * (x / y)));
} else {
tmp = fabs((4.0 / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-9d-78)) .or. (.not. (x <= 7.2d-6))) then
tmp = abs((z * (x / y)))
else
tmp = abs((4.0d0 / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -9e-78) || !(x <= 7.2e-6)) {
tmp = Math.abs((z * (x / y)));
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -9e-78) or not (x <= 7.2e-6): tmp = math.fabs((z * (x / y))) else: tmp = math.fabs((4.0 / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -9e-78) || !(x <= 7.2e-6)) tmp = abs(Float64(z * Float64(x / y))); else tmp = abs(Float64(4.0 / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -9e-78) || ~((x <= 7.2e-6))) tmp = abs((z * (x / y))); else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[x, -9e-78], N[Not[LessEqual[x, 7.2e-6]], $MachinePrecision]], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-78} \lor \neg \left(x \leq 7.2 \cdot 10^{-6}\right):\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -9e-78 or 7.19999999999999967e-6 < x Initial program 84.1%
Taylor expanded in z around inf 56.8%
mul-1-neg56.8%
associate-*r/68.1%
distribute-rgt-neg-out68.1%
distribute-neg-frac68.1%
Simplified68.1%
add-sqr-sqrt35.4%
sqrt-unprod54.9%
sqr-neg54.9%
sqrt-unprod32.5%
add-sqr-sqrt68.1%
clear-num68.0%
expm1-log1p-u32.3%
div-inv32.3%
expm1-udef27.2%
associate-/r/29.9%
associate-/r/27.2%
div-inv27.2%
clear-num27.2%
Applied egg-rr27.2%
expm1-def32.3%
expm1-log1p68.1%
associate-*r/56.8%
associate-*l/74.2%
*-commutative74.2%
Simplified74.2%
if -9e-78 < x < 7.19999999999999967e-6Initial program 99.7%
Taylor expanded in x around 0 86.1%
Final simplification79.6%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= z -1550000000.0) (fabs (* z (/ x y))) (if (<= z 3.9e+56) (fabs (/ (- -4.0 x) y)) (fabs (/ z (/ y x))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (z <= -1550000000.0) {
tmp = fabs((z * (x / y)));
} else if (z <= 3.9e+56) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((z / (y / x)));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1550000000.0d0)) then
tmp = abs((z * (x / y)))
else if (z <= 3.9d+56) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((z / (y / x)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1550000000.0) {
tmp = Math.abs((z * (x / y)));
} else if (z <= 3.9e+56) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((z / (y / x)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if z <= -1550000000.0: tmp = math.fabs((z * (x / y))) elif z <= 3.9e+56: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((z / (y / x))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (z <= -1550000000.0) tmp = abs(Float64(z * Float64(x / y))); elseif (z <= 3.9e+56) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(z / Float64(y / x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1550000000.0) tmp = abs((z * (x / y))); elseif (z <= 3.9e+56) tmp = abs(((-4.0 - x) / y)); else tmp = abs((z / (y / x))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[z, -1550000000.0], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3.9e+56], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1550000000:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+56}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\end{array}
\end{array}
if z < -1.55e9Initial program 99.8%
Taylor expanded in z around inf 71.4%
mul-1-neg71.4%
associate-*r/78.0%
distribute-rgt-neg-out78.0%
distribute-neg-frac78.0%
Simplified78.0%
add-sqr-sqrt77.8%
sqrt-unprod61.2%
sqr-neg61.2%
sqrt-unprod0.0%
add-sqr-sqrt78.0%
clear-num77.8%
expm1-log1p-u44.6%
div-inv44.7%
expm1-udef36.6%
associate-/r/41.4%
associate-/r/36.6%
div-inv36.6%
clear-num36.6%
Applied egg-rr36.6%
expm1-def44.6%
expm1-log1p78.0%
associate-*r/71.4%
associate-*l/84.7%
*-commutative84.7%
Simplified84.7%
if -1.55e9 < z < 3.89999999999999994e56Initial program 90.3%
Simplified99.3%
Taylor expanded in z around 0 97.1%
associate-*r/97.1%
distribute-lft-in97.1%
metadata-eval97.1%
neg-mul-197.1%
sub-neg97.1%
Simplified97.1%
if 3.89999999999999994e56 < z Initial program 82.2%
Taylor expanded in z around inf 66.5%
mul-1-neg66.5%
associate-*r/74.0%
distribute-rgt-neg-out74.0%
distribute-neg-frac74.0%
Simplified74.0%
associate-*r/66.5%
add-cube-cbrt65.9%
times-frac74.6%
add-sqr-sqrt0.0%
sqrt-unprod51.6%
sqr-neg51.6%
sqrt-unprod74.5%
add-sqr-sqrt74.6%
times-frac65.9%
*-commutative65.9%
add-cube-cbrt66.5%
associate-/l*77.0%
Applied egg-rr77.0%
Final simplification89.6%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -1.52) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.52) || !(x <= 4.0)) {
tmp = fabs((x / y));
} else {
tmp = fabs((4.0 / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.52d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y))
else
tmp = abs((4.0d0 / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.52) || !(x <= 4.0)) {
tmp = Math.abs((x / y));
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -1.52) or not (x <= 4.0): tmp = math.fabs((x / y)) else: tmp = math.fabs((4.0 / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -1.52) || !(x <= 4.0)) tmp = abs(Float64(x / y)); else tmp = abs(Float64(4.0 / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.52) || ~((x <= 4.0))) tmp = abs((x / y)); else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[x, -1.52], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.52 \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.52 or 4 < x Initial program 82.1%
Taylor expanded in z around 0 57.3%
associate-*r/57.3%
metadata-eval57.3%
Simplified57.3%
Taylor expanded in x around inf 56.5%
if -1.52 < x < 4Initial program 99.7%
Taylor expanded in x around 0 80.1%
Final simplification68.7%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (fabs (/ 4.0 y)))
y = abs(y);
double code(double x, double y, double z) {
return fabs((4.0 / y));
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((4.0d0 / y))
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
return Math.abs((4.0 / y));
}
y = abs(y) def code(x, y, z): return math.fabs((4.0 / y))
y = abs(y) function code(x, y, z) return abs(Float64(4.0 / y)) end
y = abs(y) function tmp = code(x, y, z) tmp = abs((4.0 / y)); end
NOTE: y should be positive before calling this function code[x_, y_, z_] := N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\left|\frac{4}{y}\right|
\end{array}
Initial program 91.2%
Taylor expanded in x around 0 44.2%
Final simplification44.2%
herbie shell --seed 2023314
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))