
(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 10 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))))
(if (<= t_1 (- INFINITY))
(fma y (/ x a) (* (/ t a) (- z)))
(if (<= t_1 5e+297) (/ t_1 a) (* y (- (/ x a) (* z (/ t (* y a)))))))))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 tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(y, (x / a), ((t / a) * -z));
} else if (t_1 <= 5e+297) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - (z * (t / (y * a))));
}
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)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(y, Float64(x / a), Float64(Float64(t / a) * Float64(-z))); elseif (t_1 <= 5e+297) tmp = Float64(t_1 / a); else tmp = Float64(y * Float64(Float64(x / a) - Float64(z * Float64(t / Float64(y * 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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(x / a), $MachinePrecision] + N[(N[(t / a), $MachinePrecision] * (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+297], N[(t$95$1 / a), $MachinePrecision], N[(y * N[(N[(x / a), $MachinePrecision] - N[(z * N[(t / N[(y * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{a}, \frac{t}{a} \cdot \left(-z\right)\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+297}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - z \cdot \frac{t}{y \cdot a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 57.0%
div-sub52.9%
*-commutative52.9%
associate-/l*64.6%
fma-neg64.6%
associate-/l*95.6%
Applied egg-rr95.6%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.9999999999999998e297Initial program 97.8%
if 4.9999999999999998e297 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 64.3%
Taylor expanded in y around inf 76.1%
+-commutative76.1%
mul-1-neg76.1%
unsub-neg76.1%
*-commutative76.1%
associate-/l*88.1%
Simplified88.1%
Final simplification96.7%
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))))
(if (<= t_1 (- INFINITY))
(- (* x (/ y a)) (/ t (/ a z)))
(if (<= t_1 5e+297) (/ t_1 a) (* y (- (/ x a) (* z (/ t (* y a)))))))))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 tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x * (y / a)) - (t / (a / z));
} else if (t_1 <= 5e+297) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - (z * (t / (y * a))));
}
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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x * (y / a)) - (t / (a / z));
} else if (t_1 <= 5e+297) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - (z * (t / (y * a))));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= -math.inf: tmp = (x * (y / a)) - (t / (a / z)) elif t_1 <= 5e+297: tmp = t_1 / a else: tmp = y * ((x / a) - (z * (t / (y * a)))) 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)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(t / Float64(a / z))); elseif (t_1 <= 5e+297) tmp = Float64(t_1 / a); else tmp = Float64(y * Float64(Float64(x / a) - Float64(z * Float64(t / 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)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -Inf)
tmp = (x * (y / a)) - (t / (a / z));
elseif (t_1 <= 5e+297)
tmp = t_1 / a;
else
tmp = y * ((x / a) - (z * (t / (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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+297], N[(t$95$1 / a), $MachinePrecision], N[(y * N[(N[(x / a), $MachinePrecision] - N[(z * N[(t / N[(y * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+297}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - z \cdot \frac{t}{y \cdot a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 57.0%
div-sub52.9%
associate-/l*64.7%
associate-/l*95.7%
Applied egg-rr95.7%
associate-*r/64.7%
add-sqr-sqrt34.5%
sqrt-unprod42.0%
sqr-neg42.0%
sqrt-unprod16.7%
add-sqr-sqrt41.7%
associate-*l/41.8%
*-commutative41.8%
clear-num41.8%
un-div-inv41.8%
add-sqr-sqrt16.7%
sqrt-unprod46.3%
sqr-neg46.3%
sqrt-unprod45.7%
add-sqr-sqrt95.7%
Applied egg-rr95.7%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.9999999999999998e297Initial program 97.8%
if 4.9999999999999998e297 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 64.3%
Taylor expanded in y around inf 76.1%
+-commutative76.1%
mul-1-neg76.1%
unsub-neg76.1%
*-commutative76.1%
associate-/l*88.1%
Simplified88.1%
Final simplification96.7%
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 (* (- t) (/ z a))))
(if (<= (* x y) -1e-87)
(* x (/ y a))
(if (<= (* x y) 1e-13)
t_1
(if (<= (* x y) 1e+24)
(/ x (/ a y))
(if (<= (* x y) 5e+32) t_1 (* 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 t_1 = -t * (z / a);
double tmp;
if ((x * y) <= -1e-87) {
tmp = x * (y / a);
} else if ((x * y) <= 1e-13) {
tmp = t_1;
} else if ((x * y) <= 1e+24) {
tmp = x / (a / y);
} else if ((x * y) <= 5e+32) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -t * (z / a)
if ((x * y) <= (-1d-87)) then
tmp = x * (y / a)
else if ((x * y) <= 1d-13) then
tmp = t_1
else if ((x * y) <= 1d+24) then
tmp = x / (a / y)
else if ((x * y) <= 5d+32) then
tmp = t_1
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 t_1 = -t * (z / a);
double tmp;
if ((x * y) <= -1e-87) {
tmp = x * (y / a);
} else if ((x * y) <= 1e-13) {
tmp = t_1;
} else if ((x * y) <= 1e+24) {
tmp = x / (a / y);
} else if ((x * y) <= 5e+32) {
tmp = t_1;
} 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): t_1 = -t * (z / a) tmp = 0 if (x * y) <= -1e-87: tmp = x * (y / a) elif (x * y) <= 1e-13: tmp = t_1 elif (x * y) <= 1e+24: tmp = x / (a / y) elif (x * y) <= 5e+32: tmp = t_1 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) t_1 = Float64(Float64(-t) * Float64(z / a)) tmp = 0.0 if (Float64(x * y) <= -1e-87) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= 1e-13) tmp = t_1; elseif (Float64(x * y) <= 1e+24) tmp = Float64(x / Float64(a / y)); elseif (Float64(x * y) <= 5e+32) tmp = t_1; 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)
t_1 = -t * (z / a);
tmp = 0.0;
if ((x * y) <= -1e-87)
tmp = x * (y / a);
elseif ((x * y) <= 1e-13)
tmp = t_1;
elseif ((x * y) <= 1e+24)
tmp = x / (a / y);
elseif ((x * y) <= 5e+32)
tmp = t_1;
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_] := Block[{t$95$1 = N[((-t) * N[(z / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1e-87], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-13], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e+24], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+32], t$95$1, 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}
t_1 := \left(-t\right) \cdot \frac{z}{a}\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-87}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{+24}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000002e-87Initial program 89.3%
Taylor expanded in x around inf 77.1%
associate-*r/78.9%
Simplified78.9%
if -1.00000000000000002e-87 < (*.f64 x y) < 1e-13 or 9.9999999999999998e23 < (*.f64 x y) < 4.9999999999999997e32Initial program 91.2%
Taylor expanded in x around 0 77.4%
mul-1-neg77.4%
associate-/l*79.3%
distribute-rgt-neg-in79.3%
distribute-neg-frac279.3%
Simplified79.3%
if 1e-13 < (*.f64 x y) < 9.9999999999999998e23Initial program 99.3%
Taylor expanded in x around inf 77.4%
associate-*r/63.6%
Simplified63.6%
clear-num63.6%
un-div-inv63.8%
Applied egg-rr63.8%
if 4.9999999999999997e32 < (*.f64 x y) Initial program 90.9%
Taylor expanded in x around inf 77.8%
associate-*l/85.2%
Applied egg-rr76.1%
Final simplification78.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))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 4e+260)))
(- (* x (/ y a)) (* z (/ t a)))
(/ t_1 a))))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 tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 4e+260)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = t_1 / a;
}
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 t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 4e+260)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 4e+260): tmp = (x * (y / a)) - (z * (t / a)) else: tmp = t_1 / a 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)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 4e+260)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); else tmp = Float64(t_1 / 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)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if ((t_1 <= -Inf) || ~((t_1 <= 4e+260)))
tmp = (x * (y / a)) - (z * (t / a));
else
tmp = t_1 / 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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 4e+260]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\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\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 4 \cdot 10^{+260}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 4.00000000000000026e260 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 67.4%
div-sub65.7%
associate-/l*75.5%
associate-/l*93.0%
Applied egg-rr93.0%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.00000000000000026e260Initial program 97.7%
Final simplification96.7%
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))))
(if (<= t_1 (- INFINITY))
(- (* x (/ y a)) (/ t (/ a z)))
(if (<= t_1 1e+151) (/ t_1 a) (- (* y (/ x a)) (* z (/ t a)))))))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 tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x * (y / a)) - (t / (a / z));
} else if (t_1 <= 1e+151) {
tmp = t_1 / a;
} else {
tmp = (y * (x / a)) - (z * (t / a));
}
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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x * (y / a)) - (t / (a / z));
} else if (t_1 <= 1e+151) {
tmp = t_1 / a;
} else {
tmp = (y * (x / a)) - (z * (t / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= -math.inf: tmp = (x * (y / a)) - (t / (a / z)) elif t_1 <= 1e+151: tmp = t_1 / a else: tmp = (y * (x / a)) - (z * (t / a)) 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)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(t / Float64(a / z))); elseif (t_1 <= 1e+151) tmp = Float64(t_1 / a); else tmp = Float64(Float64(y * Float64(x / a)) - Float64(z * Float64(t / 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)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -Inf)
tmp = (x * (y / a)) - (t / (a / z));
elseif (t_1 <= 1e+151)
tmp = t_1 / a;
else
tmp = (y * (x / a)) - (z * (t / 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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+151], N[(t$95$1 / a), $MachinePrecision], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;t\_1 \leq 10^{+151}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a} - z \cdot \frac{t}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 57.0%
div-sub52.9%
associate-/l*64.7%
associate-/l*95.7%
Applied egg-rr95.7%
associate-*r/64.7%
add-sqr-sqrt34.5%
sqrt-unprod42.0%
sqr-neg42.0%
sqrt-unprod16.7%
add-sqr-sqrt41.7%
associate-*l/41.8%
*-commutative41.8%
clear-num41.8%
un-div-inv41.8%
add-sqr-sqrt16.7%
sqrt-unprod46.3%
sqr-neg46.3%
sqrt-unprod45.7%
add-sqr-sqrt95.7%
Applied egg-rr95.7%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000002e151Initial program 97.5%
if 1.00000000000000002e151 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 83.9%
div-sub83.9%
associate-/l*89.2%
associate-/l*94.3%
Applied egg-rr94.3%
Taylor expanded in x around 0 89.0%
associate-*l/90.7%
Applied egg-rr90.7%
Final simplification95.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
(let* ((t_1 (* x (/ y a))) (t_2 (- (* x y) (* z t))))
(if (<= t_2 (- INFINITY))
(- t_1 (/ t (/ a z)))
(if (<= t_2 4e+260) (/ t_2 a) (- t_1 (* z (/ t a)))))))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 / a);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1 - (t / (a / z));
} else if (t_2 <= 4e+260) {
tmp = t_2 / a;
} else {
tmp = t_1 - (z * (t / a));
}
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 t_1 = x * (y / a);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1 - (t / (a / z));
} else if (t_2 <= 4e+260) {
tmp = t_2 / a;
} else {
tmp = t_1 - (z * (t / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = x * (y / a) t_2 = (x * y) - (z * t) tmp = 0 if t_2 <= -math.inf: tmp = t_1 - (t / (a / z)) elif t_2 <= 4e+260: tmp = t_2 / a else: tmp = t_1 - (z * (t / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(x * Float64(y / a)) t_2 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(t_1 - Float64(t / Float64(a / z))); elseif (t_2 <= 4e+260) tmp = Float64(t_2 / a); else tmp = Float64(t_1 - Float64(z * Float64(t / 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)
t_1 = x * (y / a);
t_2 = (x * y) - (z * t);
tmp = 0.0;
if (t_2 <= -Inf)
tmp = t_1 - (t / (a / z));
elseif (t_2 <= 4e+260)
tmp = t_2 / a;
else
tmp = t_1 - (z * (t / 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_] := Block[{t$95$1 = N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(t$95$1 - N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+260], N[(t$95$2 / a), $MachinePrecision], N[(t$95$1 - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{a}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1 - \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+260}:\\
\;\;\;\;\frac{t\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1 - z \cdot \frac{t}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 57.0%
div-sub52.9%
associate-/l*64.7%
associate-/l*95.7%
Applied egg-rr95.7%
associate-*r/64.7%
add-sqr-sqrt34.5%
sqrt-unprod42.0%
sqr-neg42.0%
sqrt-unprod16.7%
add-sqr-sqrt41.7%
associate-*l/41.8%
*-commutative41.8%
clear-num41.8%
un-div-inv41.8%
add-sqr-sqrt16.7%
sqrt-unprod46.3%
sqr-neg46.3%
sqrt-unprod45.7%
add-sqr-sqrt95.7%
Applied egg-rr95.7%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.00000000000000026e260Initial program 97.7%
if 4.00000000000000026e260 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 74.7%
div-sub74.7%
associate-/l*83.1%
associate-/l*91.1%
Applied egg-rr91.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 (<= (* z t) -1e+49) (* (- t) (/ z a)) (if (<= (* z t) 5e-26) (/ (* x y) a) (* (/ t a) (- z)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -1e+49) {
tmp = -t * (z / a);
} else if ((z * t) <= 5e-26) {
tmp = (x * y) / a;
} else {
tmp = (t / a) * -z;
}
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 ((z * t) <= (-1d+49)) then
tmp = -t * (z / a)
else if ((z * t) <= 5d-26) then
tmp = (x * y) / a
else
tmp = (t / a) * -z
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 ((z * t) <= -1e+49) {
tmp = -t * (z / a);
} else if ((z * t) <= 5e-26) {
tmp = (x * y) / a;
} else {
tmp = (t / a) * -z;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -1e+49: tmp = -t * (z / a) elif (z * t) <= 5e-26: tmp = (x * y) / a else: tmp = (t / a) * -z 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(z * t) <= -1e+49) tmp = Float64(Float64(-t) * Float64(z / a)); elseif (Float64(z * t) <= 5e-26) tmp = Float64(Float64(x * y) / a); else tmp = Float64(Float64(t / a) * Float64(-z)); 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 ((z * t) <= -1e+49)
tmp = -t * (z / a);
elseif ((z * t) <= 5e-26)
tmp = (x * y) / a;
else
tmp = (t / a) * -z;
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[(z * t), $MachinePrecision], -1e+49], N[((-t) * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-26], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * (-z)), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+49}:\\
\;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-26}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -9.99999999999999946e48Initial program 86.1%
Taylor expanded in x around 0 81.9%
mul-1-neg81.9%
associate-/l*87.7%
distribute-rgt-neg-in87.7%
distribute-neg-frac287.7%
Simplified87.7%
if -9.99999999999999946e48 < (*.f64 z t) < 5.00000000000000019e-26Initial program 95.3%
Taylor expanded in x around inf 79.7%
if 5.00000000000000019e-26 < (*.f64 z t) Initial program 83.6%
Taylor expanded in x around 0 70.8%
*-commutative70.8%
associate-*r/80.4%
neg-mul-180.4%
distribute-rgt-neg-in80.4%
distribute-frac-neg80.4%
Simplified80.4%
Final simplification81.4%
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 (<= (* z t) 1e+294) (/ (- (* x y) (* z t)) a) (/ t (- (/ a z)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= 1e+294) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t / -(a / z);
}
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 ((z * t) <= 1d+294) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t / -(a / z)
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 ((z * t) <= 1e+294) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t / -(a / z);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= 1e+294: tmp = ((x * y) - (z * t)) / a else: tmp = t / -(a / z) 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(z * t) <= 1e+294) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(t / Float64(-Float64(a / z))); 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 ((z * t) <= 1e+294)
tmp = ((x * y) - (z * t)) / a;
else
tmp = t / -(a / z);
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[(z * t), $MachinePrecision], 1e+294], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(t / (-N[(a / z), $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq 10^{+294}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{-\frac{a}{z}}\\
\end{array}
\end{array}
if (*.f64 z t) < 1.00000000000000007e294Initial program 93.4%
if 1.00000000000000007e294 < (*.f64 z t) Initial program 50.3%
Taylor expanded in x around 0 50.3%
associate-*r*50.3%
mul-1-neg50.3%
Simplified50.3%
add-sqr-sqrt21.9%
sqrt-unprod20.6%
sqr-neg20.6%
sqrt-unprod0.1%
add-sqr-sqrt0.2%
associate-*l/0.3%
frac-2neg0.3%
Applied egg-rr0.3%
add-sqr-sqrt0.1%
sqrt-unprod20.8%
sqr-neg20.8%
sqrt-unprod33.3%
add-sqr-sqrt99.9%
distribute-rgt-neg-out99.9%
associate-/r/99.9%
distribute-neg-frac99.9%
Applied egg-rr99.9%
Final simplification93.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) -1e-129) (* 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 ((x * y) <= -1e-129) {
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 ((x * y) <= (-1d-129)) 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 ((x * y) <= -1e-129) {
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 (x * y) <= -1e-129: 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 (Float64(x * y) <= -1e-129) 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 ((x * y) <= -1e-129)
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[N[(x * y), $MachinePrecision], -1e-129], 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}\;x \cdot y \leq -1 \cdot 10^{-129}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -9.9999999999999993e-130Initial program 89.2%
Taylor expanded in x around inf 73.3%
associate-*r/75.0%
Simplified75.0%
if -9.9999999999999993e-130 < (*.f64 x y) Initial program 91.6%
Taylor expanded in x around inf 44.0%
associate-*l/86.8%
Applied egg-rr41.4%
Final simplification52.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 (* x (/ y a)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return x * (y / 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 = x * (y / 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 x * (y / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return x * (y / a)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / 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[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 90.9%
Taylor expanded in x around inf 53.4%
associate-*r/55.1%
Simplified55.1%
(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 2024084
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))
(/ (- (* x y) (* z t)) a))