
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))) (t_2 (fma (/ y a) x (* z (/ t (- 0.0 a))))))
(if (<= t_1 -5e+267)
t_2
(if (<= t_1 1e+283) (/ 1.0 (/ a (fma x y (* z (- 0.0 t))))) t_2))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double t_2 = fma((y / a), x, (z * (t / (0.0 - a))));
double tmp;
if (t_1 <= -5e+267) {
tmp = t_2;
} else if (t_1 <= 1e+283) {
tmp = 1.0 / (a / fma(x, y, (z * (0.0 - t))));
} else {
tmp = t_2;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) t_2 = fma(Float64(y / a), x, Float64(z * Float64(t / Float64(0.0 - a)))) tmp = 0.0 if (t_1 <= -5e+267) tmp = t_2; elseif (t_1 <= 1e+283) tmp = Float64(1.0 / Float64(a / fma(x, y, Float64(z * Float64(0.0 - t))))); else tmp = t_2; end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * x + N[(z * N[(t / N[(0.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+267], t$95$2, If[LessEqual[t$95$1, 1e+283], N[(1.0 / N[(a / N[(x * y + N[(z * N[(0.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
t_2 := \mathsf{fma}\left(\frac{y}{a}, x, z \cdot \frac{t}{0 - a}\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+267}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+283}:\\
\;\;\;\;\frac{1}{\frac{a}{\mathsf{fma}\left(x, y, z \cdot \left(0 - t\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999999e267 or 9.99999999999999955e282 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 74.2%
div-subN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6486.8
Applied egg-rr86.8%
sub0-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f6493.1
Applied egg-rr93.1%
if -4.9999999999999999e267 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.99999999999999955e282Initial program 99.6%
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sub-negN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6499.6
Applied egg-rr99.6%
Final simplification98.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* x y) (* z t))) (t_2 (fma (/ y a) x (* z (/ t (- 0.0 a)))))) (if (<= t_1 -5e+267) t_2 (if (<= t_1 1e+283) (/ t_1 a) t_2))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double t_2 = fma((y / a), x, (z * (t / (0.0 - a))));
double tmp;
if (t_1 <= -5e+267) {
tmp = t_2;
} else if (t_1 <= 1e+283) {
tmp = t_1 / a;
} else {
tmp = t_2;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) t_2 = fma(Float64(y / a), x, Float64(z * Float64(t / Float64(0.0 - a)))) tmp = 0.0 if (t_1 <= -5e+267) tmp = t_2; elseif (t_1 <= 1e+283) tmp = Float64(t_1 / a); else tmp = t_2; end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * x + N[(z * N[(t / N[(0.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+267], t$95$2, If[LessEqual[t$95$1, 1e+283], N[(t$95$1 / a), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
t_2 := \mathsf{fma}\left(\frac{y}{a}, x, z \cdot \frac{t}{0 - a}\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+267}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+283}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999999e267 or 9.99999999999999955e282 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 74.2%
div-subN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6486.8
Applied egg-rr86.8%
sub0-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f6493.1
Applied egg-rr93.1%
if -4.9999999999999999e267 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.99999999999999955e282Initial program 99.6%
Final simplification98.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) (- INFINITY)) (* y (/ x a)) (if (<= (* x y) 1e+216) (/ (- (* x y) (* z t)) a) (/ x (/ a y)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = y * (x / a);
} else if ((x * y) <= 1e+216) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x / (a / y);
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = y * (x / a);
} else if ((x * y) <= 1e+216) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = y * (x / a) elif (x * y) <= 1e+216: tmp = ((x * y) - (z * t)) / a else: tmp = x / (a / y) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 1e+216) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -Inf)
tmp = y * (x / a);
elseif ((x * y) <= 1e+216)
tmp = ((x * y) - (z * t)) / a;
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+216], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+216}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 70.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6476.4
Simplified76.4%
+-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6499.7
Applied egg-rr99.7%
if -inf.0 < (*.f64 x y) < 1e216Initial program 97.9%
if 1e216 < (*.f64 x y) Initial program 73.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6473.5
Simplified73.5%
+-rgt-identityN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6496.2
Applied egg-rr96.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= a 8e-51) (* (fma z t (- 0.0 (* x y))) (/ -1.0 a)) (fma (/ x a) y (/ (* z (- 0.0 t)) a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 8e-51) {
tmp = fma(z, t, (0.0 - (x * y))) * (-1.0 / a);
} else {
tmp = fma((x / a), y, ((z * (0.0 - t)) / a));
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (a <= 8e-51) tmp = Float64(fma(z, t, Float64(0.0 - Float64(x * y))) * Float64(-1.0 / a)); else tmp = fma(Float64(x / a), y, Float64(Float64(z * Float64(0.0 - t)) / a)); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[a, 8e-51], N[(N[(z * t + N[(0.0 - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision], N[(N[(x / a), $MachinePrecision] * y + N[(N[(z * N[(0.0 - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 8 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(z, t, 0 - x \cdot y\right) \cdot \frac{-1}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{a}, y, \frac{z \cdot \left(0 - t\right)}{a}\right)\\
\end{array}
\end{array}
if a < 8.0000000000000001e-51Initial program 95.7%
frac-2negN/A
div-invN/A
*-lowering-*.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
/-lowering-/.f6496.2
Applied egg-rr96.2%
if 8.0000000000000001e-51 < a Initial program 88.1%
div-subN/A
sub-negN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6490.9
Applied egg-rr90.9%
Final simplification94.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -5e+16) (* y (/ x a)) (if (<= (* x y) 1e-85) (/ (* z (- 0.0 t)) a) (* x (/ y a)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e+16) {
tmp = y * (x / a);
} else if ((x * y) <= 1e-85) {
tmp = (z * (0.0 - t)) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-5d+16)) then
tmp = y * (x / a)
else if ((x * y) <= 1d-85) then
tmp = (z * (0.0d0 - t)) / a
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e+16) {
tmp = y * (x / a);
} else if ((x * y) <= 1e-85) {
tmp = (z * (0.0 - t)) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e+16: tmp = y * (x / a) elif (x * y) <= 1e-85: tmp = (z * (0.0 - t)) / a else: tmp = x * (y / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e+16) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 1e-85) tmp = Float64(Float64(z * Float64(0.0 - t)) / a); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -5e+16)
tmp = y * (x / a);
elseif ((x * y) <= 1e-85)
tmp = (z * (0.0 - t)) / a;
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+16], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-85], N[(N[(z * N[(0.0 - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+16}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{-85}:\\
\;\;\;\;\frac{z \cdot \left(0 - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -5e16Initial program 90.0%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6480.3
Simplified80.3%
+-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6481.7
Applied egg-rr81.7%
if -5e16 < (*.f64 x y) < 9.9999999999999998e-86Initial program 97.9%
Taylor expanded in x around 0
+-lft-identityN/A
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6480.9
Simplified80.9%
+-rgt-identityN/A
sub0-negN/A
distribute-rgt-neg-outN/A
div-invN/A
associate-*l*N/A
*-commutativeN/A
div-invN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f6480.6
Applied egg-rr80.6%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
associate-*r/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6487.1
Applied egg-rr87.1%
if 9.9999999999999998e-86 < (*.f64 x y) Initial program 90.9%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6464.6
Simplified64.6%
+-rgt-identityN/A
*-commutativeN/A
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6466.8
Applied egg-rr66.8%
Final simplification79.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -0.0002) (* y (/ x a)) (if (<= (* x y) 1e-85) (* t (- 0.0 (/ z a))) (* x (/ y a)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -0.0002) {
tmp = y * (x / a);
} else if ((x * y) <= 1e-85) {
tmp = t * (0.0 - (z / a));
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-0.0002d0)) then
tmp = y * (x / a)
else if ((x * y) <= 1d-85) then
tmp = t * (0.0d0 - (z / a))
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -0.0002) {
tmp = y * (x / a);
} else if ((x * y) <= 1e-85) {
tmp = t * (0.0 - (z / a));
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -0.0002: tmp = y * (x / a) elif (x * y) <= 1e-85: tmp = t * (0.0 - (z / a)) else: tmp = x * (y / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -0.0002) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 1e-85) tmp = Float64(t * Float64(0.0 - Float64(z / a))); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -0.0002)
tmp = y * (x / a);
elseif ((x * y) <= 1e-85)
tmp = t * (0.0 - (z / a));
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -0.0002], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-85], N[(t * N[(0.0 - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -0.0002:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{-85}:\\
\;\;\;\;t \cdot \left(0 - \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e-4Initial program 90.3%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6479.3
Simplified79.3%
+-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6479.2
Applied egg-rr79.2%
if -2.0000000000000001e-4 < (*.f64 x y) < 9.9999999999999998e-86Initial program 97.9%
Taylor expanded in x around 0
+-lft-identityN/A
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6481.3
Simplified81.3%
+-rgt-identityN/A
*-commutativeN/A
sub0-negN/A
distribute-lft-neg-outN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6481.3
Applied egg-rr81.3%
if 9.9999999999999998e-86 < (*.f64 x y) Initial program 90.9%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6464.6
Simplified64.6%
+-rgt-identityN/A
*-commutativeN/A
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6466.8
Applied egg-rr66.8%
Final simplification75.9%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) 1e+216) (* (fma z t (- 0.0 (* x y))) (/ -1.0 a)) (/ x (/ a y))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 1e+216) {
tmp = fma(z, t, (0.0 - (x * y))) * (-1.0 / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 1e+216) tmp = Float64(fma(z, t, Float64(0.0 - Float64(x * y))) * Float64(-1.0 / a)); else tmp = Float64(x / Float64(a / y)); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], 1e+216], N[(N[(z * t + N[(0.0 - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 10^{+216}:\\
\;\;\;\;\mathsf{fma}\left(z, t, 0 - x \cdot y\right) \cdot \frac{-1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < 1e216Initial program 96.0%
frac-2negN/A
div-invN/A
*-lowering-*.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
/-lowering-/.f6496.3
Applied egg-rr96.3%
if 1e216 < (*.f64 x y) Initial program 73.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6473.5
Simplified73.5%
+-rgt-identityN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6496.2
Applied egg-rr96.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 4.6e-180) (* x (/ y a)) (* y (/ x a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 4.6e-180) {
tmp = x * (y / a);
} else {
tmp = y * (x / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 4.6d-180) then
tmp = x * (y / a)
else
tmp = y * (x / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 4.6e-180) {
tmp = x * (y / a);
} else {
tmp = y * (x / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if t <= 4.6e-180: tmp = x * (y / a) else: tmp = y * (x / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 4.6e-180) tmp = Float64(x * Float64(y / a)); else tmp = Float64(y * Float64(x / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 4.6e-180)
tmp = x * (y / a);
else
tmp = y * (x / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 4.6e-180], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.6 \cdot 10^{-180}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if t < 4.59999999999999992e-180Initial program 93.6%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6456.9
Simplified56.9%
+-rgt-identityN/A
*-commutativeN/A
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6456.2
Applied egg-rr56.2%
if 4.59999999999999992e-180 < t Initial program 94.0%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6444.9
Simplified44.9%
+-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6444.9
Applied egg-rr44.9%
Final simplification51.9%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* y (/ x a)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = y * (x / a)
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return y * (x / a)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / a);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 93.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6452.3
Simplified52.3%
+-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6454.4
Applied egg-rr54.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024196
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))
(/ (- (* x y) (* z t)) a))