
(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 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 1.2e+78) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (* x (/ z y)) (/ (+ x 4.0) y)))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 1.2e+78) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs(((x * (z / y)) - ((x + 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 (y <= 1.2d+78) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs(((x * (z / y)) - ((x + 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 (y <= 1.2e+78) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs(((x * (z / y)) - ((x + 4.0) / y)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 1.2e+78: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs(((x * (z / y)) - ((x + 4.0) / y))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 1.2e+78) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(Float64(x * Float64(z / y)) - Float64(Float64(x + 4.0) / y))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.2e+78) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs(((x * (z / y)) - ((x + 4.0) / y))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 1.2e+78], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.2 \cdot 10^{+78}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{z}{y} - \frac{x + 4}{y}\right|\\
\end{array}
\end{array}
if y < 1.1999999999999999e78Initial program 93.5%
associate-*l/91.9%
associate-*r/92.9%
Simplified92.9%
Taylor expanded in x around 0 96.7%
sub-neg96.7%
+-commutative96.7%
distribute-lft-in92.8%
associate-+r+92.8%
distribute-rgt-in92.8%
associate-*l/92.9%
*-lft-identity92.9%
+-commutative92.9%
distribute-rgt-neg-out92.9%
sub-neg92.9%
associate-*r/91.9%
div-sub95.8%
Simplified95.8%
if 1.1999999999999999e78 < y Initial program 94.4%
associate-*l/94.4%
associate-*r/99.8%
Simplified99.8%
Final simplification96.6%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))) (t_1 (fabs (/ x y))))
(if (<= x -2.1e+123)
t_0
(if (<= x -1.52)
t_1
(if (<= x 5.4e-8)
(fabs (/ 4.0 y))
(if (or (<= x 1.05e+77) (not (<= x 5.8e+128))) t_0 t_1))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double t_1 = fabs((x / y));
double tmp;
if (x <= -2.1e+123) {
tmp = t_0;
} else if (x <= -1.52) {
tmp = t_1;
} else if (x <= 5.4e-8) {
tmp = fabs((4.0 / y));
} else if ((x <= 1.05e+77) || !(x <= 5.8e+128)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((z * (x / y)))
t_1 = abs((x / y))
if (x <= (-2.1d+123)) then
tmp = t_0
else if (x <= (-1.52d0)) then
tmp = t_1
else if (x <= 5.4d-8) then
tmp = abs((4.0d0 / y))
else if ((x <= 1.05d+77) .or. (.not. (x <= 5.8d+128))) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double t_0 = Math.abs((z * (x / y)));
double t_1 = Math.abs((x / y));
double tmp;
if (x <= -2.1e+123) {
tmp = t_0;
} else if (x <= -1.52) {
tmp = t_1;
} else if (x <= 5.4e-8) {
tmp = Math.abs((4.0 / y));
} else if ((x <= 1.05e+77) || !(x <= 5.8e+128)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((z * (x / y))) t_1 = math.fabs((x / y)) tmp = 0 if x <= -2.1e+123: tmp = t_0 elif x <= -1.52: tmp = t_1 elif x <= 5.4e-8: tmp = math.fabs((4.0 / y)) elif (x <= 1.05e+77) or not (x <= 5.8e+128): tmp = t_0 else: tmp = t_1 return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(z * Float64(x / y))) t_1 = abs(Float64(x / y)) tmp = 0.0 if (x <= -2.1e+123) tmp = t_0; elseif (x <= -1.52) tmp = t_1; elseif (x <= 5.4e-8) tmp = abs(Float64(4.0 / y)); elseif ((x <= 1.05e+77) || !(x <= 5.8e+128)) tmp = t_0; else tmp = t_1; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((z * (x / y))); t_1 = abs((x / y)); tmp = 0.0; if (x <= -2.1e+123) tmp = t_0; elseif (x <= -1.52) tmp = t_1; elseif (x <= 5.4e-8) tmp = abs((4.0 / y)); elseif ((x <= 1.05e+77) || ~((x <= 5.8e+128))) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.1e+123], t$95$0, If[LessEqual[x, -1.52], t$95$1, If[LessEqual[x, 5.4e-8], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 1.05e+77], N[Not[LessEqual[x, 5.8e+128]], $MachinePrecision]], t$95$0, t$95$1]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y}\right|\\
t_1 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -2.1 \cdot 10^{+123}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.52:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{-8}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+77} \lor \neg \left(x \leq 5.8 \cdot 10^{+128}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.09999999999999994e123 or 5.40000000000000005e-8 < x < 1.0499999999999999e77 or 5.8000000000000001e128 < x Initial program 92.3%
associate-*l/84.1%
associate-*r/94.4%
Simplified94.4%
Taylor expanded in z around inf 59.7%
associate-*r/59.7%
neg-mul-159.7%
distribute-lft-neg-in59.7%
associate-*l/76.3%
*-commutative76.3%
Simplified76.3%
expm1-log1p-u40.8%
expm1-udef35.1%
add-sqr-sqrt15.2%
sqrt-unprod25.3%
sqr-neg25.3%
sqrt-unprod16.6%
add-sqr-sqrt34.2%
Applied egg-rr34.2%
expm1-def39.9%
expm1-log1p76.3%
Simplified76.3%
if -2.09999999999999994e123 < x < -1.52 or 1.0499999999999999e77 < x < 5.8000000000000001e128Initial program 88.8%
associate-*l/86.6%
associate-*r/91.6%
Simplified91.6%
Taylor expanded in z around 0 84.1%
associate-*r/84.1%
metadata-eval84.1%
Simplified84.1%
Taylor expanded in x around inf 82.5%
if -1.52 < x < 5.40000000000000005e-8Initial program 96.0%
associate-*l/99.9%
associate-*r/94.9%
Simplified94.9%
Taylor expanded in x around 0 82.5%
Final simplification80.3%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -1.32e+99) (not (<= x 9e+30))) (fabs (/ (- 1.0 z) (/ y x))) (fabs (/ (- (+ x 4.0) (* x z)) y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.32e+99) || !(x <= 9e+30)) {
tmp = fabs(((1.0 - z) / (y / x)));
} 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) :: tmp
if ((x <= (-1.32d+99)) .or. (.not. (x <= 9d+30))) then
tmp = abs(((1.0d0 - z) / (y / x)))
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 tmp;
if ((x <= -1.32e+99) || !(x <= 9e+30)) {
tmp = Math.abs(((1.0 - z) / (y / x)));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -1.32e+99) or not (x <= 9e+30): tmp = math.fabs(((1.0 - z) / (y / x))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -1.32e+99) || !(x <= 9e+30)) tmp = abs(Float64(Float64(1.0 - z) / Float64(y / x))); 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) tmp = 0.0; if ((x <= -1.32e+99) || ~((x <= 9e+30))) tmp = abs(((1.0 - z) / (y / x))); 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_] := If[Or[LessEqual[x, -1.32e+99], N[Not[LessEqual[x, 9e+30]], $MachinePrecision]], N[Abs[N[(N[(1.0 - z), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]], $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}
\mathbf{if}\;x \leq -1.32 \cdot 10^{+99} \lor \neg \left(x \leq 9 \cdot 10^{+30}\right):\\
\;\;\;\;\left|\frac{1 - z}{\frac{y}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if x < -1.32000000000000011e99 or 8.9999999999999999e30 < x Initial program 90.6%
associate-*l/82.0%
associate-*r/92.4%
Simplified92.4%
Taylor expanded in x around inf 92.4%
*-un-lft-identity92.4%
associate-*r/82.0%
associate-*l/90.6%
*-commutative90.6%
distribute-rgt-out--99.9%
associate-/r/99.9%
associate-/l*89.4%
*-commutative89.4%
associate-/l*99.7%
Applied egg-rr99.7%
if -1.32000000000000011e99 < x < 8.9999999999999999e30Initial program 95.8%
associate-*l/99.9%
associate-*r/95.5%
Simplified95.5%
Taylor expanded in x around 0 95.5%
sub-neg95.5%
+-commutative95.5%
distribute-lft-in95.5%
associate-+r+95.5%
distribute-rgt-in95.5%
associate-*l/95.5%
*-lft-identity95.5%
+-commutative95.5%
distribute-rgt-neg-out95.5%
sub-neg95.5%
associate-*r/99.9%
div-sub99.9%
Simplified99.9%
Final simplification99.8%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -6.9e-40) (not (<= x 9.2e-8))) (fabs (/ (- 1.0 z) (/ y x))) (fabs (/ (+ x 4.0) y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.9e-40) || !(x <= 9.2e-8)) {
tmp = fabs(((1.0 - z) / (y / x)));
} else {
tmp = fabs(((x + 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 <= (-6.9d-40)) .or. (.not. (x <= 9.2d-8))) then
tmp = abs(((1.0d0 - z) / (y / x)))
else
tmp = abs(((x + 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 <= -6.9e-40) || !(x <= 9.2e-8)) {
tmp = Math.abs(((1.0 - z) / (y / x)));
} else {
tmp = Math.abs(((x + 4.0) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -6.9e-40) or not (x <= 9.2e-8): tmp = math.fabs(((1.0 - z) / (y / x))) else: tmp = math.fabs(((x + 4.0) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -6.9e-40) || !(x <= 9.2e-8)) tmp = abs(Float64(Float64(1.0 - z) / Float64(y / x))); else tmp = abs(Float64(Float64(x + 4.0) / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -6.9e-40) || ~((x <= 9.2e-8))) tmp = abs(((1.0 - z) / (y / x))); else tmp = abs(((x + 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, -6.9e-40], N[Not[LessEqual[x, 9.2e-8]], $MachinePrecision]], N[Abs[N[(N[(1.0 - z), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.9 \cdot 10^{-40} \lor \neg \left(x \leq 9.2 \cdot 10^{-8}\right):\\
\;\;\;\;\left|\frac{1 - z}{\frac{y}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\
\end{array}
\end{array}
if x < -6.8999999999999996e-40 or 9.2000000000000003e-8 < x Initial program 92.0%
associate-*l/86.0%
associate-*r/93.4%
Simplified93.4%
Taylor expanded in x around inf 89.0%
*-un-lft-identity89.0%
associate-*r/81.5%
associate-*l/87.5%
*-commutative87.5%
distribute-rgt-out--95.5%
associate-/r/94.8%
associate-/l*87.3%
*-commutative87.3%
associate-/l*95.2%
Applied egg-rr95.2%
if -6.8999999999999996e-40 < x < 9.2000000000000003e-8Initial program 95.6%
associate-*l/99.9%
associate-*r/95.2%
Simplified95.2%
Taylor expanded in z around 0 87.0%
+-commutative87.0%
*-rgt-identity87.0%
associate-*r/87.0%
distribute-rgt-in87.0%
associate-*l/87.0%
*-lft-identity87.0%
Simplified87.0%
Final simplification91.4%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= z -2.6e+98) (not (<= z 2.6e+125))) (fabs (/ x (/ y z))) (fabs (/ (+ x 4.0) y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.6e+98) || !(z <= 2.6e+125)) {
tmp = fabs((x / (y / z)));
} else {
tmp = fabs(((x + 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 ((z <= (-2.6d+98)) .or. (.not. (z <= 2.6d+125))) then
tmp = abs((x / (y / z)))
else
tmp = abs(((x + 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 ((z <= -2.6e+98) || !(z <= 2.6e+125)) {
tmp = Math.abs((x / (y / z)));
} else {
tmp = Math.abs(((x + 4.0) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (z <= -2.6e+98) or not (z <= 2.6e+125): tmp = math.fabs((x / (y / z))) else: tmp = math.fabs(((x + 4.0) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((z <= -2.6e+98) || !(z <= 2.6e+125)) tmp = abs(Float64(x / Float64(y / z))); else tmp = abs(Float64(Float64(x + 4.0) / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.6e+98) || ~((z <= 2.6e+125))) tmp = abs((x / (y / z))); else tmp = abs(((x + 4.0) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[z, -2.6e+98], N[Not[LessEqual[z, 2.6e+125]], $MachinePrecision]], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+98} \lor \neg \left(z \leq 2.6 \cdot 10^{+125}\right):\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\
\end{array}
\end{array}
if z < -2.6e98 or 2.60000000000000003e125 < z Initial program 93.8%
associate-*l/87.6%
associate-*r/94.2%
Simplified94.2%
Taylor expanded in z around inf 70.0%
associate-*r/70.0%
neg-mul-170.0%
distribute-lft-neg-in70.0%
associate-*l/76.8%
*-commutative76.8%
Simplified76.8%
associate-*r/70.0%
add-cube-cbrt69.6%
times-frac78.4%
add-sqr-sqrt40.6%
sqrt-unprod70.3%
sqr-neg70.3%
sqrt-unprod37.8%
add-sqr-sqrt78.4%
times-frac69.6%
*-commutative69.6%
add-cube-cbrt70.0%
associate-/l*79.0%
Applied egg-rr79.0%
if -2.6e98 < z < 2.60000000000000003e125Initial program 93.6%
associate-*l/94.7%
associate-*r/94.2%
Simplified94.2%
Taylor expanded in z around 0 93.2%
+-commutative93.2%
*-rgt-identity93.2%
associate-*r/93.1%
distribute-rgt-in93.1%
associate-*l/93.2%
*-lft-identity93.2%
Simplified93.2%
Final simplification88.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 91.2%
associate-*l/84.7%
associate-*r/93.5%
Simplified93.5%
Taylor expanded in z around 0 60.6%
associate-*r/60.6%
metadata-eval60.6%
Simplified60.6%
Taylor expanded in x around inf 59.3%
if -1.52 < x < 4Initial program 96.0%
associate-*l/99.9%
associate-*r/94.9%
Simplified94.9%
Taylor expanded in x around 0 81.9%
Final simplification70.8%
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 93.6%
associate-*l/92.4%
associate-*r/94.2%
Simplified94.2%
Taylor expanded in x around 0 44.2%
Final simplification44.2%
herbie shell --seed 2023293
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))