
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * (y - z)) / y
end function
public static double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
def code(x, y, z): return (x * (y - z)) / y
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function tmp = code(x, y, z) tmp = (x * (y - z)) / y; end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * (y - z)) / y
end function
public static double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
def code(x, y, z): return (x * (y - z)) / y
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function tmp = code(x, y, z) tmp = (x * (y - z)) / y; end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{y}
\end{array}
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= x_m 2.9e-86) (/ (* x_m (- y z)) y) (/ x_m (/ y (- y z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 2.9e-86) {
tmp = (x_m * (y - z)) / y;
} else {
tmp = x_m / (y / (y - z));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x_m <= 2.9d-86) then
tmp = (x_m * (y - z)) / y
else
tmp = x_m / (y / (y - z))
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 2.9e-86) {
tmp = (x_m * (y - z)) / y;
} else {
tmp = x_m / (y / (y - z));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if x_m <= 2.9e-86: tmp = (x_m * (y - z)) / y else: tmp = x_m / (y / (y - z)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (x_m <= 2.9e-86) tmp = Float64(Float64(x_m * Float64(y - z)) / y); else tmp = Float64(x_m / Float64(y / Float64(y - z))); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (x_m <= 2.9e-86) tmp = (x_m * (y - z)) / y; else tmp = x_m / (y / (y - z)); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[x$95$m, 2.9e-86], N[(N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x$95$m / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 2.9 \cdot 10^{-86}:\\
\;\;\;\;\frac{x\_m \cdot \left(y - z\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\frac{y}{y - z}}\\
\end{array}
\end{array}
if x < 2.8999999999999999e-86Initial program 86.8%
if 2.8999999999999999e-86 < x Initial program 72.7%
remove-double-neg72.7%
distribute-frac-neg272.7%
distribute-frac-neg72.7%
distribute-rgt-neg-in72.7%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
*-inverses99.9%
div-sub99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification90.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= z -5.8e+133)
(not
(or (<= z -1.25e+88) (and (not (<= z -2.1e-36)) (<= z 3.7e-39)))))
(* x_m (/ z (- y)))
x_m)))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -5.8e+133) || !((z <= -1.25e+88) || (!(z <= -2.1e-36) && (z <= 3.7e-39)))) {
tmp = x_m * (z / -y);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-5.8d+133)) .or. (.not. (z <= (-1.25d+88)) .or. (.not. (z <= (-2.1d-36))) .and. (z <= 3.7d-39))) then
tmp = x_m * (z / -y)
else
tmp = x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z <= -5.8e+133) || !((z <= -1.25e+88) || (!(z <= -2.1e-36) && (z <= 3.7e-39)))) {
tmp = x_m * (z / -y);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if (z <= -5.8e+133) or not ((z <= -1.25e+88) or (not (z <= -2.1e-36) and (z <= 3.7e-39))): tmp = x_m * (z / -y) else: tmp = x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if ((z <= -5.8e+133) || !((z <= -1.25e+88) || (!(z <= -2.1e-36) && (z <= 3.7e-39)))) tmp = Float64(x_m * Float64(z / Float64(-y))); else tmp = x_m; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if ((z <= -5.8e+133) || ~(((z <= -1.25e+88) || (~((z <= -2.1e-36)) && (z <= 3.7e-39))))) tmp = x_m * (z / -y); else tmp = x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -5.8e+133], N[Not[Or[LessEqual[z, -1.25e+88], And[N[Not[LessEqual[z, -2.1e-36]], $MachinePrecision], LessEqual[z, 3.7e-39]]]], $MachinePrecision]], N[(x$95$m * N[(z / (-y)), $MachinePrecision]), $MachinePrecision], x$95$m]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+133} \lor \neg \left(z \leq -1.25 \cdot 10^{+88} \lor \neg \left(z \leq -2.1 \cdot 10^{-36}\right) \land z \leq 3.7 \cdot 10^{-39}\right):\\
\;\;\;\;x\_m \cdot \frac{z}{-y}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -5.8000000000000002e133 or -1.24999999999999999e88 < z < -2.09999999999999991e-36 or 3.70000000000000015e-39 < z Initial program 88.1%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in y around 0 71.9%
mul-1-neg71.9%
distribute-frac-neg271.9%
Simplified71.9%
if -5.8000000000000002e133 < z < -1.24999999999999999e88 or -2.09999999999999991e-36 < z < 3.70000000000000015e-39Initial program 76.2%
remove-double-neg76.2%
distribute-frac-neg276.2%
distribute-frac-neg76.2%
distribute-rgt-neg-in76.2%
associate-/l*99.2%
distribute-frac-neg99.2%
distribute-frac-neg299.2%
remove-double-neg99.2%
div-sub99.2%
*-inverses99.2%
Simplified99.2%
Taylor expanded in z around 0 86.7%
Final simplification78.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(let* ((t_0 (* z (/ x_m (- y)))))
(*
x_s
(if (<= z -5.8e+133)
t_0
(if (<= z -2e+86)
x_m
(if (<= z -5.7e-36)
(* x_m (/ z (- y)))
(if (<= z 1.3e-34) x_m t_0)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double t_0 = z * (x_m / -y);
double tmp;
if (z <= -5.8e+133) {
tmp = t_0;
} else if (z <= -2e+86) {
tmp = x_m;
} else if (z <= -5.7e-36) {
tmp = x_m * (z / -y);
} else if (z <= 1.3e-34) {
tmp = x_m;
} else {
tmp = t_0;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * (x_m / -y)
if (z <= (-5.8d+133)) then
tmp = t_0
else if (z <= (-2d+86)) then
tmp = x_m
else if (z <= (-5.7d-36)) then
tmp = x_m * (z / -y)
else if (z <= 1.3d-34) then
tmp = x_m
else
tmp = t_0
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = z * (x_m / -y);
double tmp;
if (z <= -5.8e+133) {
tmp = t_0;
} else if (z <= -2e+86) {
tmp = x_m;
} else if (z <= -5.7e-36) {
tmp = x_m * (z / -y);
} else if (z <= 1.3e-34) {
tmp = x_m;
} else {
tmp = t_0;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): t_0 = z * (x_m / -y) tmp = 0 if z <= -5.8e+133: tmp = t_0 elif z <= -2e+86: tmp = x_m elif z <= -5.7e-36: tmp = x_m * (z / -y) elif z <= 1.3e-34: tmp = x_m else: tmp = t_0 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) t_0 = Float64(z * Float64(x_m / Float64(-y))) tmp = 0.0 if (z <= -5.8e+133) tmp = t_0; elseif (z <= -2e+86) tmp = x_m; elseif (z <= -5.7e-36) tmp = Float64(x_m * Float64(z / Float64(-y))); elseif (z <= 1.3e-34) tmp = x_m; else tmp = t_0; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) t_0 = z * (x_m / -y); tmp = 0.0; if (z <= -5.8e+133) tmp = t_0; elseif (z <= -2e+86) tmp = x_m; elseif (z <= -5.7e-36) tmp = x_m * (z / -y); elseif (z <= 1.3e-34) tmp = x_m; else tmp = t_0; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(z * N[(x$95$m / (-y)), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -5.8e+133], t$95$0, If[LessEqual[z, -2e+86], x$95$m, If[LessEqual[z, -5.7e-36], N[(x$95$m * N[(z / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e-34], x$95$m, t$95$0]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := z \cdot \frac{x\_m}{-y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+133}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2 \cdot 10^{+86}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq -5.7 \cdot 10^{-36}:\\
\;\;\;\;x\_m \cdot \frac{z}{-y}\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-34}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if z < -5.8000000000000002e133 or 1.3e-34 < z Initial program 87.8%
remove-double-neg87.8%
distribute-frac-neg287.8%
distribute-frac-neg87.8%
distribute-rgt-neg-in87.8%
associate-/l*89.4%
distribute-frac-neg89.4%
distribute-frac-neg289.4%
remove-double-neg89.4%
div-sub89.4%
*-inverses89.4%
Simplified89.4%
Taylor expanded in z around inf 79.4%
associate-*l/76.4%
associate-*l*76.4%
*-commutative76.4%
associate-*r/76.4%
mul-1-neg76.4%
Simplified76.4%
if -5.8000000000000002e133 < z < -2e86 or -5.6999999999999999e-36 < z < 1.3e-34Initial program 76.2%
remove-double-neg76.2%
distribute-frac-neg276.2%
distribute-frac-neg76.2%
distribute-rgt-neg-in76.2%
associate-/l*99.2%
distribute-frac-neg99.2%
distribute-frac-neg299.2%
remove-double-neg99.2%
div-sub99.2%
*-inverses99.2%
Simplified99.2%
Taylor expanded in z around 0 86.7%
if -2e86 < z < -5.6999999999999999e-36Initial program 89.5%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 69.5%
mul-1-neg69.5%
distribute-frac-neg269.5%
Simplified69.5%
Final simplification80.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(let* ((t_0 (/ (* z (- x_m)) y)))
(*
x_s
(if (<= z -5.8e+133)
t_0
(if (<= z -1.45e+88)
x_m
(if (<= z -2.1e-37)
(* x_m (/ z (- y)))
(if (<= z 3.1e-36) x_m t_0)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double t_0 = (z * -x_m) / y;
double tmp;
if (z <= -5.8e+133) {
tmp = t_0;
} else if (z <= -1.45e+88) {
tmp = x_m;
} else if (z <= -2.1e-37) {
tmp = x_m * (z / -y);
} else if (z <= 3.1e-36) {
tmp = x_m;
} else {
tmp = t_0;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (z * -x_m) / y
if (z <= (-5.8d+133)) then
tmp = t_0
else if (z <= (-1.45d+88)) then
tmp = x_m
else if (z <= (-2.1d-37)) then
tmp = x_m * (z / -y)
else if (z <= 3.1d-36) then
tmp = x_m
else
tmp = t_0
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = (z * -x_m) / y;
double tmp;
if (z <= -5.8e+133) {
tmp = t_0;
} else if (z <= -1.45e+88) {
tmp = x_m;
} else if (z <= -2.1e-37) {
tmp = x_m * (z / -y);
} else if (z <= 3.1e-36) {
tmp = x_m;
} else {
tmp = t_0;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): t_0 = (z * -x_m) / y tmp = 0 if z <= -5.8e+133: tmp = t_0 elif z <= -1.45e+88: tmp = x_m elif z <= -2.1e-37: tmp = x_m * (z / -y) elif z <= 3.1e-36: tmp = x_m else: tmp = t_0 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) t_0 = Float64(Float64(z * Float64(-x_m)) / y) tmp = 0.0 if (z <= -5.8e+133) tmp = t_0; elseif (z <= -1.45e+88) tmp = x_m; elseif (z <= -2.1e-37) tmp = Float64(x_m * Float64(z / Float64(-y))); elseif (z <= 3.1e-36) tmp = x_m; else tmp = t_0; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) t_0 = (z * -x_m) / y; tmp = 0.0; if (z <= -5.8e+133) tmp = t_0; elseif (z <= -1.45e+88) tmp = x_m; elseif (z <= -2.1e-37) tmp = x_m * (z / -y); elseif (z <= 3.1e-36) tmp = x_m; else tmp = t_0; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(N[(z * (-x$95$m)), $MachinePrecision] / y), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -5.8e+133], t$95$0, If[LessEqual[z, -1.45e+88], x$95$m, If[LessEqual[z, -2.1e-37], N[(x$95$m * N[(z / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.1e-36], x$95$m, t$95$0]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := \frac{z \cdot \left(-x\_m\right)}{y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+133}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{+88}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-37}:\\
\;\;\;\;x\_m \cdot \frac{z}{-y}\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-36}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if z < -5.8000000000000002e133 or 3.0999999999999999e-36 < z Initial program 87.8%
Taylor expanded in y around 0 79.4%
associate-*r*79.4%
*-commutative79.4%
mul-1-neg79.4%
Simplified79.4%
if -5.8000000000000002e133 < z < -1.45e88 or -2.1000000000000001e-37 < z < 3.0999999999999999e-36Initial program 76.2%
remove-double-neg76.2%
distribute-frac-neg276.2%
distribute-frac-neg76.2%
distribute-rgt-neg-in76.2%
associate-/l*99.2%
distribute-frac-neg99.2%
distribute-frac-neg299.2%
remove-double-neg99.2%
div-sub99.2%
*-inverses99.2%
Simplified99.2%
Taylor expanded in z around 0 86.7%
if -1.45e88 < z < -2.1000000000000001e-37Initial program 89.5%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 69.5%
mul-1-neg69.5%
distribute-frac-neg269.5%
Simplified69.5%
Final simplification81.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= x_m 2e+26) x_m (* y (/ x_m y)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 2e+26) {
tmp = x_m;
} else {
tmp = y * (x_m / y);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x_m <= 2d+26) then
tmp = x_m
else
tmp = y * (x_m / y)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 2e+26) {
tmp = x_m;
} else {
tmp = y * (x_m / y);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if x_m <= 2e+26: tmp = x_m else: tmp = y * (x_m / y) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (x_m <= 2e+26) tmp = x_m; else tmp = Float64(y * Float64(x_m / y)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (x_m <= 2e+26) tmp = x_m; else tmp = y * (x_m / y); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[x$95$m, 2e+26], x$95$m, N[(y * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 2 \cdot 10^{+26}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{y}\\
\end{array}
\end{array}
if x < 2.0000000000000001e26Initial program 87.4%
remove-double-neg87.4%
distribute-frac-neg287.4%
distribute-frac-neg87.4%
distribute-rgt-neg-in87.4%
associate-/l*93.5%
distribute-frac-neg93.5%
distribute-frac-neg293.5%
remove-double-neg93.5%
div-sub93.5%
*-inverses93.5%
Simplified93.5%
Taylor expanded in z around 0 49.7%
if 2.0000000000000001e26 < x Initial program 67.3%
remove-double-neg67.3%
distribute-frac-neg267.3%
distribute-frac-neg67.3%
distribute-rgt-neg-in67.3%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
*-inverses99.9%
div-sub99.9%
associate-*r/67.3%
clear-num67.2%
associate-/r*95.3%
Applied egg-rr95.3%
Taylor expanded in y around inf 58.0%
clear-num58.1%
div-inv58.1%
metadata-eval58.1%
*-inverses58.1%
associate-/l*30.5%
*-commutative30.5%
associate-/l*66.9%
Applied egg-rr66.9%
Final simplification54.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (* x_m (- 1.0 (/ z y)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
return x_s * (x_m * (1.0 - (z / y)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * (x_m * (1.0d0 - (z / y)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
return x_s * (x_m * (1.0 - (z / y)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): return x_s * (x_m * (1.0 - (z / y)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * Float64(x_m * Float64(1.0 - Float64(z / y)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z) tmp = x_s * (x_m * (1.0 - (z / y))); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * N[(x$95$m * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m \cdot \left(1 - \frac{z}{y}\right)\right)
\end{array}
Initial program 82.5%
remove-double-neg82.5%
distribute-frac-neg282.5%
distribute-frac-neg82.5%
distribute-rgt-neg-in82.5%
associate-/l*95.1%
distribute-frac-neg95.1%
distribute-frac-neg295.1%
remove-double-neg95.1%
div-sub95.1%
*-inverses95.1%
Simplified95.1%
Final simplification95.1%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (/ x_m (/ y (- y z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
return x_s * (x_m / (y / (y - z)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * (x_m / (y / (y - z)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
return x_s * (x_m / (y / (y - z)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): return x_s * (x_m / (y / (y - z)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * Float64(x_m / Float64(y / Float64(y - z)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z) tmp = x_s * (x_m / (y / (y - z))); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * N[(x$95$m / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \frac{x\_m}{\frac{y}{y - z}}
\end{array}
Initial program 82.5%
remove-double-neg82.5%
distribute-frac-neg282.5%
distribute-frac-neg82.5%
distribute-rgt-neg-in82.5%
associate-/l*95.1%
distribute-frac-neg95.1%
distribute-frac-neg295.1%
remove-double-neg95.1%
div-sub95.1%
*-inverses95.1%
Simplified95.1%
*-inverses95.1%
div-sub95.1%
clear-num95.1%
un-div-inv95.6%
Applied egg-rr95.6%
Final simplification95.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s x_m))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * x_m
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): return x_s * x_m
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * x_m) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z) tmp = x_s * x_m; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot x\_m
\end{array}
Initial program 82.5%
remove-double-neg82.5%
distribute-frac-neg282.5%
distribute-frac-neg82.5%
distribute-rgt-neg-in82.5%
associate-/l*95.1%
distribute-frac-neg95.1%
distribute-frac-neg295.1%
remove-double-neg95.1%
div-sub95.1%
*-inverses95.1%
Simplified95.1%
Taylor expanded in z around 0 51.8%
Final simplification51.8%
(FPCore (x y z) :precision binary64 (if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if (z < -2.060202331921739e+104) {
tmp = x - ((z * x) / y);
} else if (z < 1.6939766013828526e+213) {
tmp = x / (y / (y - z));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z < (-2.060202331921739d+104)) then
tmp = x - ((z * x) / y)
else if (z < 1.6939766013828526d+213) then
tmp = x / (y / (y - z))
else
tmp = (y - z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z < -2.060202331921739e+104) {
tmp = x - ((z * x) / y);
} else if (z < 1.6939766013828526e+213) {
tmp = x / (y / (y - z));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z < -2.060202331921739e+104: tmp = x - ((z * x) / y) elif z < 1.6939766013828526e+213: tmp = x / (y / (y - z)) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (z < -2.060202331921739e+104) tmp = Float64(x - Float64(Float64(z * x) / y)); elseif (z < 1.6939766013828526e+213) tmp = Float64(x / Float64(y / Float64(y - z))); else tmp = Float64(Float64(y - z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z < -2.060202331921739e+104) tmp = x - ((z * x) / y); elseif (z < 1.6939766013828526e+213) tmp = x / (y / (y - z)); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Less[z, -2.060202331921739e+104], N[(x - N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[Less[z, 1.6939766013828526e+213], N[(x / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z < -2.060202331921739 \cdot 10^{+104}:\\
\;\;\;\;x - \frac{z \cdot x}{y}\\
\mathbf{elif}\;z < 1.6939766013828526 \cdot 10^{+213}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
herbie shell --seed 2024055
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:alt
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))