
(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 12 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))
(* y (- (/ x a) (* (/ t a) (/ z y))))
(if (<= t_1 5e+292)
(/ (fma x y (* t (- z))) a)
(* x (- (/ y a) (* t (/ (/ z 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 = (x * y) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y * ((x / a) - ((t / a) * (z / y)));
} else if (t_1 <= 5e+292) {
tmp = fma(x, y, (t * -z)) / a;
} else {
tmp = x * ((y / a) - (t * ((z / 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(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y * Float64(Float64(x / a) - Float64(Float64(t / a) * Float64(z / y)))); elseif (t_1 <= 5e+292) tmp = Float64(fma(x, y, Float64(t * Float64(-z))) / a); else tmp = Float64(x * Float64(Float64(y / a) - Float64(t * Float64(Float64(z / x) / 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[(N[(x / a), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+292], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(N[(y / a), $MachinePrecision] - N[(t * N[(N[(z / x), $MachinePrecision] / a), $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:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - \frac{t}{a} \cdot \frac{z}{y}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+292}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{a} - t \cdot \frac{\frac{z}{x}}{a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 53.4%
Taylor expanded in y around inf 78.0%
+-commutative78.0%
mul-1-neg78.0%
unsub-neg78.0%
times-frac93.1%
Simplified93.1%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.9999999999999996e292Initial program 98.7%
div-sub97.1%
*-commutative97.1%
div-sub98.7%
*-commutative98.7%
fmm-def98.7%
distribute-rgt-neg-out98.7%
Simplified98.7%
if 4.9999999999999996e292 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 58.3%
Taylor expanded in x around inf 74.1%
+-commutative74.1%
mul-1-neg74.1%
unsub-neg74.1%
associate-/l*85.6%
*-commutative85.6%
associate-/r*85.6%
Simplified85.6%
Final simplification96.3%
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 5e+292)))
(* x (- (/ y a) (* t (/ (/ z x) 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 <= 5e+292)) {
tmp = x * ((y / a) - (t * ((z / x) / 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 <= 5e+292)) {
tmp = x * ((y / a) - (t * ((z / x) / 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 <= 5e+292): tmp = x * ((y / a) - (t * ((z / x) / 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 <= 5e+292)) tmp = Float64(x * Float64(Float64(y / a) - Float64(t * Float64(Float64(z / x) / 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 <= 5e+292)))
tmp = x * ((y / a) - (t * ((z / x) / 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, 5e+292]], $MachinePrecision]], N[(x * N[(N[(y / a), $MachinePrecision] - N[(t * N[(N[(z / x), $MachinePrecision] / a), $MachinePrecision]), $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 5 \cdot 10^{+292}\right):\\
\;\;\;\;x \cdot \left(\frac{y}{a} - t \cdot \frac{\frac{z}{x}}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 4.9999999999999996e292 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 56.0%
Taylor expanded in x around inf 75.8%
+-commutative75.8%
mul-1-neg75.8%
unsub-neg75.8%
associate-/l*84.9%
*-commutative84.9%
associate-/r*89.5%
Simplified89.5%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.9999999999999996e292Initial program 98.7%
Final simplification96.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
(let* ((t_1 (- (* x y) (* z t))))
(if (<= t_1 (- INFINITY))
(* y (- (/ x a) (* (/ t a) (/ z y))))
(if (<= t_1 5e+292) (/ t_1 a) (* x (- (/ y a) (* t (/ (/ z 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 = (x * y) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y * ((x / a) - ((t / a) * (z / y)));
} else if (t_1 <= 5e+292) {
tmp = t_1 / a;
} else {
tmp = x * ((y / a) - (t * ((z / x) / 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 = y * ((x / a) - ((t / a) * (z / y)));
} else if (t_1 <= 5e+292) {
tmp = t_1 / a;
} else {
tmp = x * ((y / a) - (t * ((z / x) / 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 = y * ((x / a) - ((t / a) * (z / y))) elif t_1 <= 5e+292: tmp = t_1 / a else: tmp = x * ((y / a) - (t * ((z / 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(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y * Float64(Float64(x / a) - Float64(Float64(t / a) * Float64(z / y)))); elseif (t_1 <= 5e+292) tmp = Float64(t_1 / a); else tmp = Float64(x * Float64(Float64(y / a) - Float64(t * Float64(Float64(z / 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 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -Inf)
tmp = y * ((x / a) - ((t / a) * (z / y)));
elseif (t_1 <= 5e+292)
tmp = t_1 / a;
else
tmp = x * ((y / a) - (t * ((z / 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[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(N[(x / a), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+292], N[(t$95$1 / a), $MachinePrecision], N[(x * N[(N[(y / a), $MachinePrecision] - N[(t * N[(N[(z / x), $MachinePrecision] / a), $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:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - \frac{t}{a} \cdot \frac{z}{y}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+292}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{a} - t \cdot \frac{\frac{z}{x}}{a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 53.4%
Taylor expanded in y around inf 78.0%
+-commutative78.0%
mul-1-neg78.0%
unsub-neg78.0%
times-frac93.1%
Simplified93.1%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.9999999999999996e292Initial program 98.7%
if 4.9999999999999996e292 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 58.3%
Taylor expanded in x around inf 74.1%
+-commutative74.1%
mul-1-neg74.1%
unsub-neg74.1%
associate-/l*85.6%
*-commutative85.6%
associate-/r*85.6%
Simplified85.6%
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+209) (* y (/ (- x (/ (* z t) y)) a)) (if (<= (* x y) 2e+301) (/ (- (* x y) (* z t)) a) (* x (* y (/ 1.0 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+209) {
tmp = y * ((x - ((z * t) / y)) / a);
} else if ((x * y) <= 2e+301) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y * (1.0 / 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+209)) then
tmp = y * ((x - ((z * t) / y)) / a)
else if ((x * y) <= 2d+301) then
tmp = ((x * y) - (z * t)) / a
else
tmp = x * (y * (1.0d0 / 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+209) {
tmp = y * ((x - ((z * t) / y)) / a);
} else if ((x * y) <= 2e+301) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y * (1.0 / 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+209: tmp = y * ((x - ((z * t) / y)) / a) elif (x * y) <= 2e+301: tmp = ((x * y) - (z * t)) / a else: tmp = x * (y * (1.0 / 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+209) tmp = Float64(y * Float64(Float64(x - Float64(Float64(z * t) / y)) / a)); elseif (Float64(x * y) <= 2e+301) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(x * Float64(y * Float64(1.0 / 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+209)
tmp = y * ((x - ((z * t) / y)) / a);
elseif ((x * y) <= 2e+301)
tmp = ((x * y) - (z * t)) / a;
else
tmp = x * (y * (1.0 / 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+209], N[(y * N[(N[(x - N[(N[(z * t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+301], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y * N[(1.0 / a), $MachinePrecision]), $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^{+209}:\\
\;\;\;\;y \cdot \frac{x - \frac{z \cdot t}{y}}{a}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+301}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{1}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0000000000000001e209Initial program 53.7%
Taylor expanded in y around inf 86.1%
+-commutative86.1%
mul-1-neg86.1%
unsub-neg86.1%
times-frac96.2%
Simplified96.2%
Taylor expanded in a around 0 86.6%
if -1.0000000000000001e209 < (*.f64 x y) < 2.00000000000000011e301Initial program 96.1%
if 2.00000000000000011e301 < (*.f64 x y) Initial program 55.5%
Taylor expanded in x around inf 60.5%
associate-*r/98.4%
Simplified98.4%
div-inv98.4%
Applied egg-rr98.4%
Final simplification95.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 (<= (* x y) -1e+209) (* y (/ x a)) (if (<= (* x y) 2e+301) (/ (- (* x y) (* z t)) a) (* x (* y (/ 1.0 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+209) {
tmp = y * (x / a);
} else if ((x * y) <= 2e+301) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y * (1.0 / 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+209)) then
tmp = y * (x / a)
else if ((x * y) <= 2d+301) then
tmp = ((x * y) - (z * t)) / a
else
tmp = x * (y * (1.0d0 / 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+209) {
tmp = y * (x / a);
} else if ((x * y) <= 2e+301) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y * (1.0 / 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+209: tmp = y * (x / a) elif (x * y) <= 2e+301: tmp = ((x * y) - (z * t)) / a else: tmp = x * (y * (1.0 / 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+209) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 2e+301) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(x * Float64(y * Float64(1.0 / 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+209)
tmp = y * (x / a);
elseif ((x * y) <= 2e+301)
tmp = ((x * y) - (z * t)) / a;
else
tmp = x * (y * (1.0 / 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+209], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+301], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y * N[(1.0 / a), $MachinePrecision]), $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^{+209}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+301}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{1}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0000000000000001e209Initial program 53.7%
Taylor expanded in y around inf 86.1%
+-commutative86.1%
mul-1-neg86.1%
unsub-neg86.1%
times-frac96.2%
Simplified96.2%
Taylor expanded in x around inf 86.3%
if -1.0000000000000001e209 < (*.f64 x y) < 2.00000000000000011e301Initial program 96.1%
if 2.00000000000000011e301 < (*.f64 x y) Initial program 55.5%
Taylor expanded in x around inf 60.5%
associate-*r/98.4%
Simplified98.4%
div-inv98.4%
Applied egg-rr98.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 (<= (* x y) -1e+47) (/ y (/ a x)) (if (<= (* x y) 5e-77) (* t (/ (- z) 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+47) {
tmp = y / (a / x);
} else if ((x * y) <= 5e-77) {
tmp = t * (-z / 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+47)) then
tmp = y / (a / x)
else if ((x * y) <= 5d-77) then
tmp = t * (-z / 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+47) {
tmp = y / (a / x);
} else if ((x * y) <= 5e-77) {
tmp = t * (-z / 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+47: tmp = y / (a / x) elif (x * y) <= 5e-77: tmp = t * (-z / 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+47) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= 5e-77) tmp = Float64(t * Float64(Float64(-z) / 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+47)
tmp = y / (a / x);
elseif ((x * y) <= 5e-77)
tmp = t * (-z / 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+47], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-77], N[(t * N[((-z) / 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^{+47}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-77}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1e47Initial program 74.1%
Taylor expanded in y around inf 88.3%
+-commutative88.3%
mul-1-neg88.3%
unsub-neg88.3%
times-frac93.9%
Simplified93.9%
Taylor expanded in x around inf 81.1%
clear-num81.1%
un-div-inv81.3%
Applied egg-rr81.3%
if -1e47 < (*.f64 x y) < 4.99999999999999963e-77Initial program 95.5%
Taylor expanded in x around 0 79.8%
mul-1-neg79.8%
associate-/l*78.4%
distribute-rgt-neg-in78.4%
distribute-neg-frac278.4%
Simplified78.4%
if 4.99999999999999963e-77 < (*.f64 x y) Initial program 86.4%
Taylor expanded in y around inf 79.8%
+-commutative79.8%
mul-1-neg79.8%
unsub-neg79.8%
times-frac84.7%
Simplified84.7%
Taylor expanded in x around inf 68.2%
Final simplification75.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 (<= a 4.5e-66) (/ (* x (- y (/ (* z t) x))) a) (- (* x (/ y 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 tmp;
if (a <= 4.5e-66) {
tmp = (x * (y - ((z * t) / x))) / a;
} else {
tmp = (x * (y / a)) - (z * (t / 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 (a <= 4.5d-66) then
tmp = (x * (y - ((z * t) / x))) / a
else
tmp = (x * (y / a)) - (z * (t / 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 (a <= 4.5e-66) {
tmp = (x * (y - ((z * t) / x))) / a;
} else {
tmp = (x * (y / a)) - (z * (t / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if a <= 4.5e-66: tmp = (x * (y - ((z * t) / x))) / a else: tmp = (x * (y / a)) - (z * (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 <= 4.5e-66) tmp = Float64(Float64(x * Float64(y - Float64(Float64(z * t) / x))) / a); else tmp = Float64(Float64(x * Float64(y / 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)
tmp = 0.0;
if (a <= 4.5e-66)
tmp = (x * (y - ((z * t) / x))) / a;
else
tmp = (x * (y / 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_] := If[LessEqual[a, 4.5e-66], N[(N[(x * N[(y - N[(N[(z * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x * N[(y / 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}
\mathbf{if}\;a \leq 4.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{x \cdot \left(y - \frac{z \cdot t}{x}\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\end{array}
\end{array}
if a < 4.4999999999999998e-66Initial program 91.4%
Taylor expanded in x around inf 88.0%
mul-1-neg88.0%
unsub-neg88.0%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in a around 0 88.0%
if 4.4999999999999998e-66 < a Initial program 81.6%
div-sub81.7%
associate-/l*89.3%
associate-/l*95.8%
Applied egg-rr95.8%
Final simplification90.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 (if (<= a 10000000.0) (/ (- (* x y) (* z t)) a) (- (* x (/ y 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 tmp;
if (a <= 10000000.0) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = (x * (y / a)) - (z * (t / 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 (a <= 10000000.0d0) then
tmp = ((x * y) - (z * t)) / a
else
tmp = (x * (y / a)) - (z * (t / 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 (a <= 10000000.0) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = (x * (y / a)) - (z * (t / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if a <= 10000000.0: tmp = ((x * y) - (z * t)) / a else: tmp = (x * (y / a)) - (z * (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 <= 10000000.0) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(Float64(x * Float64(y / 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)
tmp = 0.0;
if (a <= 10000000.0)
tmp = ((x * y) - (z * t)) / a;
else
tmp = (x * (y / 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_] := If[LessEqual[a, 10000000.0], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x * N[(y / 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}
\mathbf{if}\;a \leq 10000000:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\end{array}
\end{array}
if a < 1e7Initial program 91.5%
if 1e7 < a Initial program 79.5%
div-sub79.5%
associate-/l*88.6%
associate-/l*95.2%
Applied egg-rr95.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 5.8e-13) (/ (* 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 (a <= 5.8e-13) {
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 (a <= 5.8d-13) 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 (a <= 5.8e-13) {
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 a <= 5.8e-13: 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 (a <= 5.8e-13) tmp = Float64(Float64(x * 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 (a <= 5.8e-13)
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[a, 5.8e-13], N[(N[(x * y), $MachinePrecision] / a), $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}\;a \leq 5.8 \cdot 10^{-13}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if a < 5.7999999999999995e-13Initial program 91.4%
Taylor expanded in x around inf 50.8%
if 5.7999999999999995e-13 < a Initial program 80.3%
Taylor expanded in y around inf 80.2%
+-commutative80.2%
mul-1-neg80.2%
unsub-neg80.2%
times-frac82.8%
Simplified82.8%
Taylor expanded in x around inf 55.3%
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 (/ a x)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return y / (a / x);
}
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 / (a / x)
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 / (a / x);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return y / (a / x)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(y / Float64(a / x)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = y / (a / x);
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[(a / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\frac{y}{\frac{a}{x}}
\end{array}
Initial program 88.0%
Taylor expanded in y around inf 77.2%
+-commutative77.2%
mul-1-neg77.2%
unsub-neg77.2%
times-frac80.3%
Simplified80.3%
Taylor expanded in x around inf 52.2%
clear-num52.1%
un-div-inv52.3%
Applied egg-rr52.3%
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 88.0%
Taylor expanded in y around inf 77.2%
+-commutative77.2%
mul-1-neg77.2%
unsub-neg77.2%
times-frac80.3%
Simplified80.3%
Taylor expanded in x around inf 52.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 88.0%
Taylor expanded in x around inf 49.1%
associate-*r/51.1%
Simplified51.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 2024185
(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))