
(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 4e-6) (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 <= 4e-6) {
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 <= 4e-6) 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, 4e-6], 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 4 \cdot 10^{-6}:\\
\;\;\;\;\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 < 3.99999999999999982e-6Initial program 90.9%
associate-*l/93.0%
sub-div97.3%
Applied egg-rr97.3%
if 3.99999999999999982e-6 < y Initial program 97.6%
fabs-sub97.6%
associate-*l/91.9%
*-commutative91.9%
associate-*l/99.9%
*-commutative99.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%
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 -1.35e+121)
t_0
(if (<= x -5.2e+43)
t_1
(if (<= x -2.25e-73)
t_0
(if (<= x 5e-56) (fabs (/ 4.0 y)) (if (<= x 1.32e+44) 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 <= -1.35e+121) {
tmp = t_0;
} else if (x <= -5.2e+43) {
tmp = t_1;
} else if (x <= -2.25e-73) {
tmp = t_0;
} else if (x <= 5e-56) {
tmp = fabs((4.0 / y));
} else if (x <= 1.32e+44) {
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 <= (-1.35d+121)) then
tmp = t_0
else if (x <= (-5.2d+43)) then
tmp = t_1
else if (x <= (-2.25d-73)) then
tmp = t_0
else if (x <= 5d-56) then
tmp = abs((4.0d0 / y))
else if (x <= 1.32d+44) 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 <= -1.35e+121) {
tmp = t_0;
} else if (x <= -5.2e+43) {
tmp = t_1;
} else if (x <= -2.25e-73) {
tmp = t_0;
} else if (x <= 5e-56) {
tmp = Math.abs((4.0 / y));
} else if (x <= 1.32e+44) {
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 <= -1.35e+121: tmp = t_0 elif x <= -5.2e+43: tmp = t_1 elif x <= -2.25e-73: tmp = t_0 elif x <= 5e-56: tmp = math.fabs((4.0 / y)) elif x <= 1.32e+44: 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 <= -1.35e+121) tmp = t_0; elseif (x <= -5.2e+43) tmp = t_1; elseif (x <= -2.25e-73) tmp = t_0; elseif (x <= 5e-56) tmp = abs(Float64(4.0 / y)); elseif (x <= 1.32e+44) 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 <= -1.35e+121) tmp = t_0; elseif (x <= -5.2e+43) tmp = t_1; elseif (x <= -2.25e-73) tmp = t_0; elseif (x <= 5e-56) tmp = abs((4.0 / y)); elseif (x <= 1.32e+44) 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, -1.35e+121], t$95$0, If[LessEqual[x, -5.2e+43], t$95$1, If[LessEqual[x, -2.25e-73], t$95$0, If[LessEqual[x, 5e-56], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.32e+44], 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 -1.35 \cdot 10^{+121}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{+43}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{-73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-56}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.3500000000000001e121 or -5.20000000000000042e43 < x < -2.25e-73 or 4.99999999999999997e-56 < x < 1.3200000000000001e44Initial program 90.2%
Taylor expanded in z around inf 61.7%
associate-*r/61.7%
associate-*r*61.7%
neg-mul-161.7%
associate-*r/69.8%
*-commutative69.8%
Simplified69.8%
expm1-log1p-u38.3%
expm1-udef30.2%
add-sqr-sqrt11.7%
sqrt-unprod19.9%
sqr-neg19.9%
sqrt-unprod13.0%
add-sqr-sqrt30.1%
associate-*l/25.5%
associate-/l*27.7%
Applied egg-rr27.7%
expm1-def36.4%
expm1-log1p64.6%
associate-/r/69.8%
*-commutative69.8%
Simplified69.8%
if -1.3500000000000001e121 < x < -5.20000000000000042e43 or 1.3200000000000001e44 < x Initial program 89.7%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
sub-neg99.8%
mul-1-neg99.8%
distribute-rgt-in96.0%
associate-*l/96.1%
*-lft-identity96.1%
associate-*r*96.1%
associate-*l/87.7%
associate-*r/87.7%
associate-*r*87.7%
neg-mul-187.7%
associate-*r/89.7%
distribute-rgt1-in99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 72.7%
if -2.25e-73 < x < 4.99999999999999997e-56Initial program 97.2%
Taylor expanded in x around 0 81.8%
Final simplification75.4%
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 -4.3e+120)
t_0
(if (<= x -3.4e+42)
t_1
(if (<= x -1.35e-73)
t_0
(if (<= x 2.85e-55)
(fabs (/ 4.0 y))
(if (<= x 1.32e+44) (fabs (* x (/ z y))) 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 <= -4.3e+120) {
tmp = t_0;
} else if (x <= -3.4e+42) {
tmp = t_1;
} else if (x <= -1.35e-73) {
tmp = t_0;
} else if (x <= 2.85e-55) {
tmp = fabs((4.0 / y));
} else if (x <= 1.32e+44) {
tmp = fabs((x * (z / y)));
} 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 <= (-4.3d+120)) then
tmp = t_0
else if (x <= (-3.4d+42)) then
tmp = t_1
else if (x <= (-1.35d-73)) then
tmp = t_0
else if (x <= 2.85d-55) then
tmp = abs((4.0d0 / y))
else if (x <= 1.32d+44) then
tmp = abs((x * (z / y)))
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 <= -4.3e+120) {
tmp = t_0;
} else if (x <= -3.4e+42) {
tmp = t_1;
} else if (x <= -1.35e-73) {
tmp = t_0;
} else if (x <= 2.85e-55) {
tmp = Math.abs((4.0 / y));
} else if (x <= 1.32e+44) {
tmp = Math.abs((x * (z / y)));
} 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 <= -4.3e+120: tmp = t_0 elif x <= -3.4e+42: tmp = t_1 elif x <= -1.35e-73: tmp = t_0 elif x <= 2.85e-55: tmp = math.fabs((4.0 / y)) elif x <= 1.32e+44: tmp = math.fabs((x * (z / y))) 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 <= -4.3e+120) tmp = t_0; elseif (x <= -3.4e+42) tmp = t_1; elseif (x <= -1.35e-73) tmp = t_0; elseif (x <= 2.85e-55) tmp = abs(Float64(4.0 / y)); elseif (x <= 1.32e+44) tmp = abs(Float64(x * Float64(z / y))); 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 <= -4.3e+120) tmp = t_0; elseif (x <= -3.4e+42) tmp = t_1; elseif (x <= -1.35e-73) tmp = t_0; elseif (x <= 2.85e-55) tmp = abs((4.0 / y)); elseif (x <= 1.32e+44) tmp = abs((x * (z / y))); 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, -4.3e+120], t$95$0, If[LessEqual[x, -3.4e+42], t$95$1, If[LessEqual[x, -1.35e-73], t$95$0, If[LessEqual[x, 2.85e-55], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.32e+44], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 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 -4.3 \cdot 10^{+120}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -3.4 \cdot 10^{+42}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{-55}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+44}:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -4.3000000000000002e120 or -3.39999999999999975e42 < x < -1.34999999999999997e-73Initial program 86.1%
Taylor expanded in z around inf 59.1%
associate-*r/59.1%
associate-*r*59.1%
neg-mul-159.1%
associate-*r/72.0%
*-commutative72.0%
Simplified72.0%
expm1-log1p-u39.0%
expm1-udef35.2%
add-sqr-sqrt9.7%
sqrt-unprod21.4%
sqr-neg21.4%
sqrt-unprod13.6%
add-sqr-sqrt31.1%
associate-*l/24.2%
associate-/l*27.6%
Applied egg-rr27.6%
expm1-def31.4%
expm1-log1p63.2%
associate-/r/72.0%
*-commutative72.0%
Simplified72.0%
if -4.3000000000000002e120 < x < -3.39999999999999975e42 or 1.3200000000000001e44 < x Initial program 89.7%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
sub-neg99.8%
mul-1-neg99.8%
distribute-rgt-in96.0%
associate-*l/96.1%
*-lft-identity96.1%
associate-*r*96.1%
associate-*l/87.7%
associate-*r/87.7%
associate-*r*87.7%
neg-mul-187.7%
associate-*r/89.7%
distribute-rgt1-in99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 72.7%
if -1.34999999999999997e-73 < x < 2.8500000000000001e-55Initial program 97.2%
Taylor expanded in x around 0 81.8%
if 2.8500000000000001e-55 < x < 1.3200000000000001e44Initial program 98.1%
Taylor expanded in z around inf 66.9%
associate-*r/66.9%
associate-*r*66.9%
neg-mul-166.9%
associate-*r/65.5%
*-commutative65.5%
Simplified65.5%
expm1-log1p-u37.0%
expm1-udef20.4%
add-sqr-sqrt15.6%
sqrt-unprod17.0%
sqr-neg17.0%
sqrt-unprod11.7%
add-sqr-sqrt28.1%
associate-*l/28.1%
associate-/l*28.1%
Applied egg-rr28.1%
expm1-def46.3%
expm1-log1p67.1%
Simplified67.1%
clear-num67.0%
associate-/r/67.1%
clear-num67.1%
Applied egg-rr67.1%
Final simplification75.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 -3.2e+120)
t_0
(if (<= x -1.65e+41)
t_1
(if (<= x -2.25e-73)
t_0
(if (<= x 2.85e-55)
(fabs (/ 4.0 y))
(if (<= x 1.32e+44) (fabs (/ x (/ y z))) 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 <= -3.2e+120) {
tmp = t_0;
} else if (x <= -1.65e+41) {
tmp = t_1;
} else if (x <= -2.25e-73) {
tmp = t_0;
} else if (x <= 2.85e-55) {
tmp = fabs((4.0 / y));
} else if (x <= 1.32e+44) {
tmp = fabs((x / (y / z)));
} 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 <= (-3.2d+120)) then
tmp = t_0
else if (x <= (-1.65d+41)) then
tmp = t_1
else if (x <= (-2.25d-73)) then
tmp = t_0
else if (x <= 2.85d-55) then
tmp = abs((4.0d0 / y))
else if (x <= 1.32d+44) then
tmp = abs((x / (y / z)))
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 <= -3.2e+120) {
tmp = t_0;
} else if (x <= -1.65e+41) {
tmp = t_1;
} else if (x <= -2.25e-73) {
tmp = t_0;
} else if (x <= 2.85e-55) {
tmp = Math.abs((4.0 / y));
} else if (x <= 1.32e+44) {
tmp = Math.abs((x / (y / z)));
} 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 <= -3.2e+120: tmp = t_0 elif x <= -1.65e+41: tmp = t_1 elif x <= -2.25e-73: tmp = t_0 elif x <= 2.85e-55: tmp = math.fabs((4.0 / y)) elif x <= 1.32e+44: tmp = math.fabs((x / (y / z))) 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 <= -3.2e+120) tmp = t_0; elseif (x <= -1.65e+41) tmp = t_1; elseif (x <= -2.25e-73) tmp = t_0; elseif (x <= 2.85e-55) tmp = abs(Float64(4.0 / y)); elseif (x <= 1.32e+44) tmp = abs(Float64(x / Float64(y / z))); 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 <= -3.2e+120) tmp = t_0; elseif (x <= -1.65e+41) tmp = t_1; elseif (x <= -2.25e-73) tmp = t_0; elseif (x <= 2.85e-55) tmp = abs((4.0 / y)); elseif (x <= 1.32e+44) tmp = abs((x / (y / z))); 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, -3.2e+120], t$95$0, If[LessEqual[x, -1.65e+41], t$95$1, If[LessEqual[x, -2.25e-73], t$95$0, If[LessEqual[x, 2.85e-55], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.32e+44], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 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 -3.2 \cdot 10^{+120}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{+41}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{-73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{-55}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+44}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -3.19999999999999982e120 or -1.65e41 < x < -2.25e-73Initial program 86.1%
Taylor expanded in z around inf 59.1%
associate-*r/59.1%
associate-*r*59.1%
neg-mul-159.1%
associate-*r/72.0%
*-commutative72.0%
Simplified72.0%
expm1-log1p-u39.0%
expm1-udef35.2%
add-sqr-sqrt9.7%
sqrt-unprod21.4%
sqr-neg21.4%
sqrt-unprod13.6%
add-sqr-sqrt31.1%
associate-*l/24.2%
associate-/l*27.6%
Applied egg-rr27.6%
expm1-def31.4%
expm1-log1p63.2%
associate-/r/72.0%
*-commutative72.0%
Simplified72.0%
if -3.19999999999999982e120 < x < -1.65e41 or 1.3200000000000001e44 < x Initial program 89.7%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
sub-neg99.8%
mul-1-neg99.8%
distribute-rgt-in96.0%
associate-*l/96.1%
*-lft-identity96.1%
associate-*r*96.1%
associate-*l/87.7%
associate-*r/87.7%
associate-*r*87.7%
neg-mul-187.7%
associate-*r/89.7%
distribute-rgt1-in99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 72.7%
if -2.25e-73 < x < 2.8500000000000001e-55Initial program 97.2%
Taylor expanded in x around 0 81.8%
if 2.8500000000000001e-55 < x < 1.3200000000000001e44Initial program 98.1%
Taylor expanded in z around inf 66.9%
associate-*r/66.9%
associate-*r*66.9%
neg-mul-166.9%
associate-*r/65.5%
*-commutative65.5%
Simplified65.5%
expm1-log1p-u37.0%
expm1-udef20.4%
add-sqr-sqrt15.6%
sqrt-unprod17.0%
sqr-neg17.0%
sqrt-unprod11.7%
add-sqr-sqrt28.1%
associate-*l/28.1%
associate-/l*28.1%
Applied egg-rr28.1%
expm1-def46.3%
expm1-log1p67.1%
Simplified67.1%
Final simplification75.6%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))))
(if (<= x -1.3e+120)
(fabs (* z (/ x y)))
(if (<= x -2.8e+42)
t_0
(if (<= x -2.05e-73)
(fabs (/ (* x z) y))
(if (<= x 2.85e-55)
(fabs (/ 4.0 y))
(if (<= x 1.32e+44) (fabs (/ x (/ y z))) t_0)))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double tmp;
if (x <= -1.3e+120) {
tmp = fabs((z * (x / y)));
} else if (x <= -2.8e+42) {
tmp = t_0;
} else if (x <= -2.05e-73) {
tmp = fabs(((x * z) / y));
} else if (x <= 2.85e-55) {
tmp = fabs((4.0 / y));
} else if (x <= 1.32e+44) {
tmp = fabs((x / (y / z)));
} else {
tmp = t_0;
}
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 / y))
if (x <= (-1.3d+120)) then
tmp = abs((z * (x / y)))
else if (x <= (-2.8d+42)) then
tmp = t_0
else if (x <= (-2.05d-73)) then
tmp = abs(((x * z) / y))
else if (x <= 2.85d-55) then
tmp = abs((4.0d0 / y))
else if (x <= 1.32d+44) then
tmp = abs((x / (y / z)))
else
tmp = t_0
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 / y));
double tmp;
if (x <= -1.3e+120) {
tmp = Math.abs((z * (x / y)));
} else if (x <= -2.8e+42) {
tmp = t_0;
} else if (x <= -2.05e-73) {
tmp = Math.abs(((x * z) / y));
} else if (x <= 2.85e-55) {
tmp = Math.abs((4.0 / y));
} else if (x <= 1.32e+44) {
tmp = Math.abs((x / (y / z)));
} else {
tmp = t_0;
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((x / y)) tmp = 0 if x <= -1.3e+120: tmp = math.fabs((z * (x / y))) elif x <= -2.8e+42: tmp = t_0 elif x <= -2.05e-73: tmp = math.fabs(((x * z) / y)) elif x <= 2.85e-55: tmp = math.fabs((4.0 / y)) elif x <= 1.32e+44: tmp = math.fabs((x / (y / z))) else: tmp = t_0 return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(x / y)) tmp = 0.0 if (x <= -1.3e+120) tmp = abs(Float64(z * Float64(x / y))); elseif (x <= -2.8e+42) tmp = t_0; elseif (x <= -2.05e-73) tmp = abs(Float64(Float64(x * z) / y)); elseif (x <= 2.85e-55) tmp = abs(Float64(4.0 / y)); elseif (x <= 1.32e+44) tmp = abs(Float64(x / Float64(y / z))); else tmp = t_0; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((x / y)); tmp = 0.0; if (x <= -1.3e+120) tmp = abs((z * (x / y))); elseif (x <= -2.8e+42) tmp = t_0; elseif (x <= -2.05e-73) tmp = abs(((x * z) / y)); elseif (x <= 2.85e-55) tmp = abs((4.0 / y)); elseif (x <= 1.32e+44) tmp = abs((x / (y / z))); else tmp = t_0; 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 / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.3e+120], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, -2.8e+42], t$95$0, If[LessEqual[x, -2.05e-73], N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2.85e-55], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.32e+44], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{+120}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{+42}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.05 \cdot 10^{-73}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{-55}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+44}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -1.2999999999999999e120Initial program 77.3%
Taylor expanded in z around inf 57.1%
associate-*r/57.1%
associate-*r*57.1%
neg-mul-157.1%
associate-*r/78.4%
*-commutative78.4%
Simplified78.4%
expm1-log1p-u44.7%
expm1-udef44.6%
add-sqr-sqrt15.2%
sqrt-unprod24.9%
sqr-neg24.9%
sqrt-unprod12.9%
add-sqr-sqrt31.6%
associate-*l/20.3%
associate-/l*28.6%
Applied egg-rr28.6%
expm1-def28.6%
expm1-log1p69.2%
associate-/r/78.4%
*-commutative78.4%
Simplified78.4%
if -1.2999999999999999e120 < x < -2.7999999999999999e42 or 1.3200000000000001e44 < x Initial program 89.7%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
sub-neg99.8%
mul-1-neg99.8%
distribute-rgt-in96.0%
associate-*l/96.1%
*-lft-identity96.1%
associate-*r*96.1%
associate-*l/87.7%
associate-*r/87.7%
associate-*r*87.7%
neg-mul-187.7%
associate-*r/89.7%
distribute-rgt1-in99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 72.7%
if -2.7999999999999999e42 < x < -2.05000000000000008e-73Initial program 99.8%
Taylor expanded in z around inf 62.2%
associate-*r/62.2%
associate-*r*62.2%
neg-mul-162.2%
associate-*r/62.0%
*-commutative62.0%
Simplified62.0%
add-sqr-sqrt16.4%
sqrt-unprod52.7%
sqr-neg52.7%
sqrt-unprod45.2%
add-sqr-sqrt62.0%
associate-*l/62.2%
Applied egg-rr62.2%
if -2.05000000000000008e-73 < x < 2.8500000000000001e-55Initial program 97.2%
Taylor expanded in x around 0 81.8%
if 2.8500000000000001e-55 < x < 1.3200000000000001e44Initial program 98.1%
Taylor expanded in z around inf 66.9%
associate-*r/66.9%
associate-*r*66.9%
neg-mul-166.9%
associate-*r/65.5%
*-commutative65.5%
Simplified65.5%
expm1-log1p-u37.0%
expm1-udef20.4%
add-sqr-sqrt15.6%
sqrt-unprod17.0%
sqr-neg17.0%
sqrt-unprod11.7%
add-sqr-sqrt28.1%
associate-*l/28.1%
associate-/l*28.1%
Applied egg-rr28.1%
expm1-def46.3%
expm1-log1p67.1%
Simplified67.1%
Final simplification75.6%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 0.0004) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (/ (+ x 4.0) y) (* z (/ x y))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 0.0004) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((((x + 4.0) / y) - (z * (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 (y <= 0.0004d0) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((((x + 4.0d0) / y) - (z * (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 (y <= 0.0004) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((((x + 4.0) / y) - (z * (x / y))));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 0.0004: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((((x + 4.0) / y) - (z * (x / y)))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 0.0004) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(z * Float64(x / y)))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.0004) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((((x + 4.0) / y) - (z * (x / y)))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 0.0004], 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[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.0004:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if y < 4.00000000000000019e-4Initial program 90.9%
associate-*l/93.0%
sub-div97.3%
Applied egg-rr97.3%
if 4.00000000000000019e-4 < y Initial program 97.6%
Final simplification97.4%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= x 2e+143) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (* (/ x y) (- 1.0 z)))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (x <= 2e+143) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs(((x / y) * (1.0 - 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 (x <= 2d+143) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs(((x / y) * (1.0d0 - z)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2e+143) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs(((x / y) * (1.0 - z)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if x <= 2e+143: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs(((x / y) * (1.0 - z))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (x <= 2e+143) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(Float64(x / y) * Float64(1.0 - z))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2e+143) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs(((x / y) * (1.0 - z))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[x, 2e+143], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+143}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(1 - z\right)\right|\\
\end{array}
\end{array}
if x < 2e143Initial program 93.0%
associate-*l/95.0%
sub-div98.2%
Applied egg-rr98.2%
if 2e143 < x Initial program 91.1%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
sub-neg99.8%
mul-1-neg99.8%
distribute-rgt-in96.9%
associate-*l/97.0%
*-lft-identity97.0%
associate-*r*97.0%
associate-*l/77.7%
associate-*r/77.7%
associate-*r*77.7%
neg-mul-177.7%
associate-*r/91.1%
distribute-rgt1-in99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Final simplification98.4%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= z -2.2e+18) (fabs (/ x (/ y z))) (if (<= z 2.3e-10) (fabs (/ (- -4.0 x) y)) (fabs (* z (/ x y))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (z <= -2.2e+18) {
tmp = fabs((x / (y / z)));
} else if (z <= 2.3e-10) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((z * (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 <= (-2.2d+18)) then
tmp = abs((x / (y / z)))
else if (z <= 2.3d-10) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((z * (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 <= -2.2e+18) {
tmp = Math.abs((x / (y / z)));
} else if (z <= 2.3e-10) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((z * (x / y)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if z <= -2.2e+18: tmp = math.fabs((x / (y / z))) elif z <= 2.3e-10: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((z * (x / y))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (z <= -2.2e+18) tmp = abs(Float64(x / Float64(y / z))); elseif (z <= 2.3e-10) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(z * Float64(x / y))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.2e+18) tmp = abs((x / (y / z))); elseif (z <= 2.3e-10) tmp = abs(((-4.0 - x) / y)); else tmp = abs((z * (x / y))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[z, -2.2e+18], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 2.3e-10], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{+18}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-10}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if z < -2.2e18Initial program 96.2%
Taylor expanded in z around inf 64.9%
associate-*r/64.9%
associate-*r*64.9%
neg-mul-164.9%
associate-*r/73.0%
*-commutative73.0%
Simplified73.0%
expm1-log1p-u36.0%
expm1-udef24.4%
add-sqr-sqrt24.4%
sqrt-unprod17.5%
sqr-neg17.5%
sqrt-unprod0.0%
add-sqr-sqrt35.6%
associate-*l/30.3%
associate-/l*35.8%
Applied egg-rr35.8%
expm1-def49.7%
expm1-log1p75.0%
Simplified75.0%
if -2.2e18 < z < 2.30000000000000007e-10Initial program 95.0%
fabs-sub95.0%
associate-*l/100.0%
*-commutative100.0%
associate-*l/100.0%
*-commutative100.0%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 98.9%
associate-*r/98.9%
distribute-lft-in98.9%
metadata-eval98.9%
neg-mul-198.9%
sub-neg98.9%
Simplified98.9%
if 2.30000000000000007e-10 < z Initial program 83.0%
Taylor expanded in z around inf 80.4%
associate-*r/80.4%
associate-*r*80.4%
neg-mul-180.4%
associate-*r/85.7%
*-commutative85.7%
Simplified85.7%
expm1-log1p-u53.7%
expm1-udef41.2%
add-sqr-sqrt0.0%
sqrt-unprod21.3%
sqr-neg21.3%
sqrt-unprod29.7%
add-sqr-sqrt29.7%
associate-*l/24.8%
associate-/l*26.2%
Applied egg-rr26.2%
expm1-def40.5%
expm1-log1p82.1%
associate-/r/85.7%
*-commutative85.7%
Simplified85.7%
Final simplification90.3%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -1.5) (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.5) || !(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.5d0)) .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.5) || !(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.5) 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.5) || !(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.5) || ~((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.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}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.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 < -1.5 or 4 < x Initial program 88.1%
Taylor expanded in x around inf 96.7%
*-commutative96.7%
sub-neg96.7%
mul-1-neg96.7%
distribute-rgt-in90.4%
associate-*l/90.5%
*-lft-identity90.5%
associate-*r*90.5%
associate-*l/82.4%
associate-*r/82.4%
associate-*r*82.4%
neg-mul-182.4%
associate-*r/85.0%
distribute-rgt1-in96.8%
+-commutative96.8%
sub-neg96.8%
Simplified96.8%
Taylor expanded in z around 0 63.8%
if -1.5 < x < 4Initial program 97.4%
Taylor expanded in x around 0 71.3%
Final simplification67.6%
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 92.8%
Taylor expanded in x around 0 38.6%
Final simplification38.6%
herbie shell --seed 2023217
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))