
(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 and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 -1.0 (/ t (/ a z)) (* y (/ x a)))
(if (<= t_1 1e+260)
(/ (fma x y (* t (- z))) a)
(- (/ x (/ a y)) (/ z (/ a t)))))))assert(x < y);
assert(z < t);
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(-1.0, (t / (a / z)), (y * (x / a)));
} else if (t_1 <= 1e+260) {
tmp = fma(x, y, (t * -z)) / a;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
return tmp;
}
x, y = sort([x, y]) z, t = sort([z, t]) 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(-1.0, Float64(t / Float64(a / z)), Float64(y * Float64(x / a))); elseif (t_1 <= 1e+260) tmp = Float64(fma(x, y, Float64(t * Float64(-z))) / a); else tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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[(-1.0 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+260], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{t}{\frac{a}{z}}, y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;t_1 \leq 10^{+260}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 69.6%
Taylor expanded in x around 0 63.2%
fma-def63.2%
associate-/l*78.2%
associate-*l/90.1%
Simplified90.1%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000007e260Initial program 97.8%
fma-neg97.8%
distribute-lft-neg-out97.8%
*-commutative97.8%
Simplified97.8%
if 1.00000000000000007e260 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 65.7%
div-sub65.7%
associate-/l*80.5%
associate-/l*93.1%
Applied egg-rr93.1%
Final simplification96.1%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 1e+260)))
(- (/ x (/ a y)) (/ z (/ a t)))
(/ (fma x y (* t (- z))) a))))assert(x < y);
assert(z < t);
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 <= 1e+260)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = fma(x, y, (t * -z)) / a;
}
return tmp;
}
x, y = sort([x, y]) z, t = sort([z, t]) 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 <= 1e+260)) tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); else tmp = Float64(fma(x, y, Float64(t * Float64(-z))) / a); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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, 1e+260]], $MachinePrecision]], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 10^{+260}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right)}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 1.00000000000000007e260 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 67.3%
div-sub64.7%
associate-/l*79.6%
associate-/l*91.9%
Applied egg-rr91.9%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000007e260Initial program 97.8%
fma-neg97.8%
distribute-lft-neg-out97.8%
*-commutative97.8%
Simplified97.8%
Final simplification96.1%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 1e+260)))
(- (/ x (/ a y)) (/ z (/ a t)))
(/ t_1 a))))assert(x < y);
assert(z < t);
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 <= 1e+260)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
assert x < y;
assert z < t;
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 <= 1e+260)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 1e+260): tmp = (x / (a / y)) - (z / (a / t)) else: tmp = t_1 / a return tmp
x, y = sort([x, y]) z, t = sort([z, t]) 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 <= 1e+260)) tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); else tmp = Float64(t_1 / a); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if ((t_1 <= -Inf) || ~((t_1 <= 1e+260)))
tmp = (x / (a / y)) - (z / (a / t));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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, 1e+260]], $MachinePrecision]], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 10^{+260}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 1.00000000000000007e260 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 67.3%
div-sub64.7%
associate-/l*79.6%
associate-/l*91.9%
Applied egg-rr91.9%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000007e260Initial program 97.8%
Final simplification96.1%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 (* (- z) (/ t a))))
(if (<= (* x y) (- INFINITY))
(/ y (/ a x))
(if (<= (* x y) -2e-66)
t_1
(if (<= (* x y) 5e-61)
t_2
(if (<= (* x y) 2.0)
t_1
(if (<= (* x y) 4e+74) t_2 (/ x (/ a y)))))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double t_2 = -z * (t / a);
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = y / (a / x);
} else if ((x * y) <= -2e-66) {
tmp = t_1;
} else if ((x * y) <= 5e-61) {
tmp = t_2;
} else if ((x * y) <= 2.0) {
tmp = t_1;
} else if ((x * y) <= 4e+74) {
tmp = t_2;
} else {
tmp = x / (a / y);
}
return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double t_2 = -z * (t / a);
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = y / (a / x);
} else if ((x * y) <= -2e-66) {
tmp = t_1;
} else if ((x * y) <= 5e-61) {
tmp = t_2;
} else if ((x * y) <= 2.0) {
tmp = t_1;
} else if ((x * y) <= 4e+74) {
tmp = t_2;
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) / a t_2 = -z * (t / a) tmp = 0 if (x * y) <= -math.inf: tmp = y / (a / x) elif (x * y) <= -2e-66: tmp = t_1 elif (x * y) <= 5e-61: tmp = t_2 elif (x * y) <= 2.0: tmp = t_1 elif (x * y) <= 4e+74: tmp = t_2 else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) t_2 = Float64(Float64(-z) * Float64(t / a)) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= -2e-66) tmp = t_1; elseif (Float64(x * y) <= 5e-61) tmp = t_2; elseif (Float64(x * y) <= 2.0) tmp = t_1; elseif (Float64(x * y) <= 4e+74) tmp = t_2; else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) / a;
t_2 = -z * (t / a);
tmp = 0.0;
if ((x * y) <= -Inf)
tmp = y / (a / x);
elseif ((x * y) <= -2e-66)
tmp = t_1;
elseif ((x * y) <= 5e-61)
tmp = t_2;
elseif ((x * y) <= 2.0)
tmp = t_1;
elseif ((x * y) <= 4e+74)
tmp = t_2;
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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] / a), $MachinePrecision]}, Block[{t$95$2 = N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e-66], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-61], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 2.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4e+74], t$95$2, N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
t_2 := \left(-z\right) \cdot \frac{t}{a}\\
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-66}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-61}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot y \leq 2:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+74}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 64.1%
Taylor expanded in x around inf 64.1%
associate-*l/93.6%
Simplified93.6%
*-commutative93.6%
clear-num93.6%
un-div-inv93.5%
Applied egg-rr93.5%
if -inf.0 < (*.f64 x y) < -2e-66 or 4.9999999999999999e-61 < (*.f64 x y) < 2Initial program 95.5%
Taylor expanded in x around inf 73.3%
if -2e-66 < (*.f64 x y) < 4.9999999999999999e-61 or 2 < (*.f64 x y) < 3.99999999999999981e74Initial program 92.0%
Taylor expanded in x around 0 83.9%
mul-1-neg83.9%
associate-/l*79.2%
associate-/r/85.0%
distribute-rgt-neg-in85.0%
Simplified85.0%
if 3.99999999999999981e74 < (*.f64 x y) Initial program 81.2%
Taylor expanded in x around inf 75.7%
associate-*r/89.1%
Simplified89.1%
associate-*r/75.7%
associate-/l*89.2%
Applied egg-rr89.2%
Final simplification83.3%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) a)))
(if (<= (* x y) (- INFINITY))
(/ y (/ a x))
(if (<= (* x y) -2e-66)
t_1
(if (<= (* x y) 5e-61)
(* t (/ (- z) a))
(if (<= (* x y) 2.0)
t_1
(if (<= (* x y) 4e+74) (* (- z) (/ t a)) (/ x (/ a y)))))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = y / (a / x);
} else if ((x * y) <= -2e-66) {
tmp = t_1;
} else if ((x * y) <= 5e-61) {
tmp = t * (-z / a);
} else if ((x * y) <= 2.0) {
tmp = t_1;
} else if ((x * y) <= 4e+74) {
tmp = -z * (t / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = y / (a / x);
} else if ((x * y) <= -2e-66) {
tmp = t_1;
} else if ((x * y) <= 5e-61) {
tmp = t * (-z / a);
} else if ((x * y) <= 2.0) {
tmp = t_1;
} else if ((x * y) <= 4e+74) {
tmp = -z * (t / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if (x * y) <= -math.inf: tmp = y / (a / x) elif (x * y) <= -2e-66: tmp = t_1 elif (x * y) <= 5e-61: tmp = t * (-z / a) elif (x * y) <= 2.0: tmp = t_1 elif (x * y) <= 4e+74: tmp = -z * (t / a) else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= -2e-66) tmp = t_1; elseif (Float64(x * y) <= 5e-61) tmp = Float64(t * Float64(Float64(-z) / a)); elseif (Float64(x * y) <= 2.0) tmp = t_1; elseif (Float64(x * y) <= 4e+74) tmp = Float64(Float64(-z) * Float64(t / a)); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) / a;
tmp = 0.0;
if ((x * y) <= -Inf)
tmp = y / (a / x);
elseif ((x * y) <= -2e-66)
tmp = t_1;
elseif ((x * y) <= 5e-61)
tmp = t * (-z / a);
elseif ((x * y) <= 2.0)
tmp = t_1;
elseif ((x * y) <= 4e+74)
tmp = -z * (t / a);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e-66], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-61], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4e+74], N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-66}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-61}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{elif}\;x \cdot y \leq 2:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+74}:\\
\;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 64.1%
Taylor expanded in x around inf 64.1%
associate-*l/93.6%
Simplified93.6%
*-commutative93.6%
clear-num93.6%
un-div-inv93.5%
Applied egg-rr93.5%
if -inf.0 < (*.f64 x y) < -2e-66 or 4.9999999999999999e-61 < (*.f64 x y) < 2Initial program 95.5%
Taylor expanded in x around inf 73.3%
if -2e-66 < (*.f64 x y) < 4.9999999999999999e-61Initial program 92.4%
Taylor expanded in x around 0 86.6%
*-commutative86.6%
associate-*l/80.0%
associate-*r*80.0%
neg-mul-180.0%
distribute-frac-neg80.0%
Simplified80.0%
if 2 < (*.f64 x y) < 3.99999999999999981e74Initial program 90.3%
Taylor expanded in x around 0 70.8%
mul-1-neg70.8%
associate-/l*75.5%
associate-/r/75.6%
distribute-rgt-neg-in75.6%
Simplified75.6%
if 3.99999999999999981e74 < (*.f64 x y) Initial program 81.2%
Taylor expanded in x around inf 75.7%
associate-*r/89.1%
Simplified89.1%
associate-*r/75.7%
associate-/l*89.2%
Applied egg-rr89.2%
Final simplification80.7%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) a)))
(if (<= (* x y) (- INFINITY))
(/ y (/ a x))
(if (<= (* x y) -2e-66)
t_1
(if (<= (* x y) 5e-61)
(/ (* t (- z)) a)
(if (<= (* x y) 2.0)
t_1
(if (<= (* x y) 4e+74) (* (- z) (/ t a)) (/ x (/ a y)))))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = y / (a / x);
} else if ((x * y) <= -2e-66) {
tmp = t_1;
} else if ((x * y) <= 5e-61) {
tmp = (t * -z) / a;
} else if ((x * y) <= 2.0) {
tmp = t_1;
} else if ((x * y) <= 4e+74) {
tmp = -z * (t / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = y / (a / x);
} else if ((x * y) <= -2e-66) {
tmp = t_1;
} else if ((x * y) <= 5e-61) {
tmp = (t * -z) / a;
} else if ((x * y) <= 2.0) {
tmp = t_1;
} else if ((x * y) <= 4e+74) {
tmp = -z * (t / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if (x * y) <= -math.inf: tmp = y / (a / x) elif (x * y) <= -2e-66: tmp = t_1 elif (x * y) <= 5e-61: tmp = (t * -z) / a elif (x * y) <= 2.0: tmp = t_1 elif (x * y) <= 4e+74: tmp = -z * (t / a) else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= -2e-66) tmp = t_1; elseif (Float64(x * y) <= 5e-61) tmp = Float64(Float64(t * Float64(-z)) / a); elseif (Float64(x * y) <= 2.0) tmp = t_1; elseif (Float64(x * y) <= 4e+74) tmp = Float64(Float64(-z) * Float64(t / a)); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) / a;
tmp = 0.0;
if ((x * y) <= -Inf)
tmp = y / (a / x);
elseif ((x * y) <= -2e-66)
tmp = t_1;
elseif ((x * y) <= 5e-61)
tmp = (t * -z) / a;
elseif ((x * y) <= 2.0)
tmp = t_1;
elseif ((x * y) <= 4e+74)
tmp = -z * (t / a);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e-66], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-61], N[(N[(t * (-z)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4e+74], N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-66}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-61}:\\
\;\;\;\;\frac{t \cdot \left(-z\right)}{a}\\
\mathbf{elif}\;x \cdot y \leq 2:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+74}:\\
\;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 64.1%
Taylor expanded in x around inf 64.1%
associate-*l/93.6%
Simplified93.6%
*-commutative93.6%
clear-num93.6%
un-div-inv93.5%
Applied egg-rr93.5%
if -inf.0 < (*.f64 x y) < -2e-66 or 4.9999999999999999e-61 < (*.f64 x y) < 2Initial program 95.5%
Taylor expanded in x around inf 73.3%
if -2e-66 < (*.f64 x y) < 4.9999999999999999e-61Initial program 92.4%
Taylor expanded in x around 0 86.6%
associate-*r/86.6%
associate-*r*86.6%
neg-mul-186.6%
Simplified86.6%
if 2 < (*.f64 x y) < 3.99999999999999981e74Initial program 90.3%
Taylor expanded in x around 0 70.8%
mul-1-neg70.8%
associate-/l*75.5%
associate-/r/75.6%
distribute-rgt-neg-in75.6%
Simplified75.6%
if 3.99999999999999981e74 < (*.f64 x y) Initial program 81.2%
Taylor expanded in x around inf 75.7%
associate-*r/89.1%
Simplified89.1%
associate-*r/75.7%
associate-/l*89.2%
Applied egg-rr89.2%
Final simplification83.2%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* z t) (- INFINITY)) (/ (- t) (/ a z)) (if (<= (* z t) 5e+199) (/ (- (* x y) (* z t)) a) (* t (/ (- z) a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = -t / (a / z);
} else if ((z * t) <= 5e+199) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t * (-z / a);
}
return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = -t / (a / z);
} else if ((z * t) <= 5e+199) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t * (-z / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -math.inf: tmp = -t / (a / z) elif (z * t) <= 5e+199: tmp = ((x * y) - (z * t)) / a else: tmp = t * (-z / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = Float64(Float64(-t) / Float64(a / z)); elseif (Float64(z * t) <= 5e+199) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(t * Float64(Float64(-z) / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z * t) <= -Inf)
tmp = -t / (a / z);
elseif ((z * t) <= 5e+199)
tmp = ((x * y) - (z * t)) / a;
else
tmp = t * (-z / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+199], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+199}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 60.2%
Taylor expanded in x around 0 65.4%
*-commutative65.4%
associate-*l/94.9%
associate-*r*94.9%
neg-mul-194.9%
distribute-frac-neg94.9%
Simplified94.9%
distribute-frac-neg94.9%
distribute-lft-neg-out94.9%
clear-num94.9%
associate-/r/94.8%
clear-num94.9%
distribute-neg-frac94.9%
Applied egg-rr94.9%
if -inf.0 < (*.f64 z t) < 4.9999999999999998e199Initial program 92.7%
if 4.9999999999999998e199 < (*.f64 z t) Initial program 80.3%
Taylor expanded in x around 0 83.7%
*-commutative83.7%
associate-*l/99.8%
associate-*r*99.8%
neg-mul-199.8%
distribute-frac-neg99.8%
Simplified99.8%
Final simplification93.6%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return x * (y / a)
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / a);
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t 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] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 88.9%
Taylor expanded in x around inf 51.0%
associate-*r/53.5%
Simplified53.5%
Final simplification53.5%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* y (/ x a)))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return y * (x / a)
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / a);
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t 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] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 88.9%
Taylor expanded in x around inf 51.0%
associate-*l/52.2%
Simplified52.2%
Final simplification52.2%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (/ y (/ a x)))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return y / (a / x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 / (a / x)
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return y / (a / x);
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return y / (a / x)
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(y / Float64(a / x)) end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = y / (a / x);
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\frac{y}{\frac{a}{x}}
\end{array}
Initial program 88.9%
Taylor expanded in x around inf 51.0%
associate-*l/52.2%
Simplified52.2%
*-commutative52.2%
clear-num51.9%
un-div-inv52.2%
Applied egg-rr52.2%
Final simplification52.2%
(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 2023275
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:herbie-target
(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))