
(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))
(* z (- (* x (/ y (* z a))) (/ t a)))
(if (<= t_1 5e+268)
(/ (fma x y (* t (- z))) a)
(* y (- (/ x a) (* (/ t a) (/ z y))))))))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 = z * ((x * (y / (z * a))) - (t / a));
} else if (t_1 <= 5e+268) {
tmp = fma(x, y, (t * -z)) / a;
} else {
tmp = y * ((x / a) - ((t / a) * (z / y)));
}
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(z * Float64(Float64(x * Float64(y / Float64(z * a))) - Float64(t / a))); elseif (t_1 <= 5e+268) tmp = Float64(fma(x, y, Float64(t * Float64(-z))) / a); else tmp = Float64(y * Float64(Float64(x / a) - Float64(Float64(t / a) * Float64(z / y)))); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(z * N[(N[(x * N[(y / N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+268], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(y * N[(N[(x / a), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z / y), $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:\\
\;\;\;\;z \cdot \left(x \cdot \frac{y}{z \cdot a} - \frac{t}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+268}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - \frac{t}{a} \cdot \frac{z}{y}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 70.3%
Taylor expanded in z around inf 90.2%
+-commutative90.2%
mul-1-neg90.2%
unsub-neg90.2%
associate-/l*93.8%
*-commutative93.8%
Simplified93.8%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000002e268Initial program 98.7%
div-sub97.2%
*-commutative97.2%
div-sub98.7%
*-commutative98.7%
fmm-def98.7%
distribute-rgt-neg-out98.7%
Simplified98.7%
if 5.0000000000000002e268 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 58.7%
Taylor expanded in y around inf 76.2%
+-commutative76.2%
mul-1-neg76.2%
unsub-neg76.2%
times-frac94.1%
Simplified94.1%
Final simplification97.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
(let* ((t_1 (- (* x y) (* z t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+256)))
(* 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 <= 2e+256)) {
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 <= 2e+256)) {
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 <= 2e+256): 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 <= 2e+256)) 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 <= 2e+256)))
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, 2e+256]], $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 2 \cdot 10^{+256}\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 2.0000000000000001e256 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 66.8%
Taylor expanded in x around inf 71.3%
+-commutative71.3%
mul-1-neg71.3%
unsub-neg71.3%
associate-/l*80.4%
*-commutative80.4%
associate-/r*89.9%
Simplified89.9%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 2.0000000000000001e256Initial program 98.7%
Final simplification96.5%
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))
(* z (- (* x (/ y (* z a))) (/ t a)))
(if (<= t_1 5e+268) (/ t_1 a) (* y (- (/ x a) (* (/ t a) (/ z y))))))))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 = z * ((x * (y / (z * a))) - (t / a));
} else if (t_1 <= 5e+268) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - ((t / a) * (z / y)));
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = z * ((x * (y / (z * a))) - (t / a));
} else if (t_1 <= 5e+268) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - ((t / a) * (z / y)));
}
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 = z * ((x * (y / (z * a))) - (t / a)) elif t_1 <= 5e+268: tmp = t_1 / a else: tmp = y * ((x / a) - ((t / a) * (z / y))) 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(z * Float64(Float64(x * Float64(y / Float64(z * a))) - Float64(t / a))); elseif (t_1 <= 5e+268) tmp = Float64(t_1 / a); else tmp = Float64(y * Float64(Float64(x / a) - Float64(Float64(t / a) * Float64(z / y)))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -Inf)
tmp = z * ((x * (y / (z * a))) - (t / a));
elseif (t_1 <= 5e+268)
tmp = t_1 / a;
else
tmp = y * ((x / a) - ((t / a) * (z / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(z * N[(N[(x * N[(y / N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+268], N[(t$95$1 / a), $MachinePrecision], N[(y * N[(N[(x / a), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z / y), $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:\\
\;\;\;\;z \cdot \left(x \cdot \frac{y}{z \cdot a} - \frac{t}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+268}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - \frac{t}{a} \cdot \frac{z}{y}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 70.3%
Taylor expanded in z around inf 90.2%
+-commutative90.2%
mul-1-neg90.2%
unsub-neg90.2%
associate-/l*93.8%
*-commutative93.8%
Simplified93.8%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000002e268Initial program 98.7%
if 5.0000000000000002e268 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 58.7%
Taylor expanded in y around inf 76.2%
+-commutative76.2%
mul-1-neg76.2%
unsub-neg76.2%
times-frac94.1%
Simplified94.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 (<= t_1 (- INFINITY))
(* x (- (/ y a) (* t (/ (/ z x) a))))
(if (<= t_1 5e+268) (/ t_1 a) (* y (- (/ x a) (* (/ t a) (/ z y))))))))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 * ((z / x) / a)));
} else if (t_1 <= 5e+268) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - ((t / a) * (z / y)));
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x * ((y / a) - (t * ((z / x) / a)));
} else if (t_1 <= 5e+268) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - ((t / a) * (z / y)));
}
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 * ((z / x) / a))) elif t_1 <= 5e+268: tmp = t_1 / a else: tmp = y * ((x / a) - ((t / a) * (z / y))) 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(x * Float64(Float64(y / a) - Float64(t * Float64(Float64(z / x) / a)))); elseif (t_1 <= 5e+268) tmp = Float64(t_1 / a); else tmp = Float64(y * Float64(Float64(x / a) - Float64(Float64(t / a) * Float64(z / y)))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -Inf)
tmp = x * ((y / a) - (t * ((z / x) / a)));
elseif (t_1 <= 5e+268)
tmp = t_1 / a;
else
tmp = y * ((x / a) - ((t / a) * (z / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x * N[(N[(y / a), $MachinePrecision] - N[(t * N[(N[(z / x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+268], N[(t$95$1 / a), $MachinePrecision], N[(y * N[(N[(x / a), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z / y), $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 \left(\frac{y}{a} - t \cdot \frac{\frac{z}{x}}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+268}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - \frac{t}{a} \cdot \frac{z}{y}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 70.3%
Taylor expanded in x around inf 72.2%
+-commutative72.2%
mul-1-neg72.2%
unsub-neg72.2%
associate-/l*82.7%
*-commutative82.7%
associate-/r*90.7%
Simplified90.7%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000002e268Initial program 98.7%
if 5.0000000000000002e268 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 58.7%
Taylor expanded in y around inf 76.2%
+-commutative76.2%
mul-1-neg76.2%
unsub-neg76.2%
times-frac94.1%
Simplified94.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -5e+31)
(/ y (/ a x))
(if (<= (* x y) 2e-68)
(/ (* t (- z)) a)
(if (<= (* x y) 1e+166) (/ (* x y) a) (/ x (/ a y))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e+31) {
tmp = y / (a / x);
} else if ((x * y) <= 2e-68) {
tmp = (t * -z) / a;
} else if ((x * y) <= 1e+166) {
tmp = (x * y) / a;
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-5d+31)) then
tmp = y / (a / x)
else if ((x * y) <= 2d-68) then
tmp = (t * -z) / a
else if ((x * y) <= 1d+166) then
tmp = (x * y) / a
else
tmp = x / (a / y)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e+31) {
tmp = y / (a / x);
} else if ((x * y) <= 2e-68) {
tmp = (t * -z) / a;
} else if ((x * y) <= 1e+166) {
tmp = (x * y) / a;
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e+31: tmp = y / (a / x) elif (x * y) <= 2e-68: tmp = (t * -z) / a elif (x * y) <= 1e+166: tmp = (x * y) / a else: tmp = x / (a / y) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e+31) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= 2e-68) tmp = Float64(Float64(t * Float64(-z)) / a); elseif (Float64(x * y) <= 1e+166) tmp = Float64(Float64(x * y) / a); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -5e+31)
tmp = y / (a / x);
elseif ((x * y) <= 2e-68)
tmp = (t * -z) / a;
elseif ((x * y) <= 1e+166)
tmp = (x * y) / a;
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+31], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-68], N[(N[(t * (-z)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+166], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+31}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\frac{t \cdot \left(-z\right)}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+166}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000027e31Initial program 92.9%
Taylor expanded in x around inf 76.3%
associate-*r/77.6%
Simplified77.6%
*-commutative77.6%
associate-*l/76.3%
Applied egg-rr76.3%
associate-/l*74.1%
*-commutative74.1%
Applied egg-rr74.1%
*-commutative74.1%
clear-num74.0%
un-div-inv74.7%
Applied egg-rr74.7%
if -5.00000000000000027e31 < (*.f64 x y) < 2.00000000000000013e-68Initial program 94.3%
Taylor expanded in x around 0 84.6%
mul-1-neg84.6%
*-commutative84.6%
distribute-rgt-neg-in84.6%
Simplified84.6%
if 2.00000000000000013e-68 < (*.f64 x y) < 9.9999999999999994e165Initial program 86.5%
Taylor expanded in x around inf 59.9%
if 9.9999999999999994e165 < (*.f64 x y) Initial program 79.7%
Taylor expanded in x around inf 76.9%
associate-*r/93.9%
Simplified93.9%
clear-num93.9%
un-div-inv94.0%
Applied egg-rr94.0%
Final simplification79.0%
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) (- INFINITY)) (* t (/ (- z) a)) (if (<= (* z t) 2e+232) (/ (- (* 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) <= -((double) INFINITY)) {
tmp = t * (-z / a);
} else if ((z * t) <= 2e+232) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = (t / a) * -z;
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = t * (-z / a);
} else if ((z * t) <= 2e+232) {
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) <= -math.inf: tmp = t * (-z / a) elif (z * t) <= 2e+232: 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) <= Float64(-Inf)) tmp = Float64(t * Float64(Float64(-z) / a)); elseif (Float64(z * t) <= 2e+232) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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) <= -Inf)
tmp = t * (-z / a);
elseif ((z * t) <= 2e+232)
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], (-Infinity)], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+232], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $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 -\infty:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+232}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 53.1%
Taylor expanded in x around 0 53.1%
mul-1-neg53.1%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-neg-frac299.9%
Simplified99.9%
if -inf.0 < (*.f64 z t) < 2.00000000000000011e232Initial program 95.4%
if 2.00000000000000011e232 < (*.f64 z t) Initial program 73.7%
Taylor expanded in x around 0 73.7%
mul-1-neg73.7%
*-commutative73.7%
associate-*r/96.5%
distribute-rgt-neg-in96.5%
distribute-frac-neg96.5%
Simplified96.5%
Final simplification95.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 (<= (* x y) -5e+31) (/ y (/ a x)) (if (<= (* x y) 2e+70) (* (/ t a) (- z)) (/ x (/ a y)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e+31) {
tmp = y / (a / x);
} else if ((x * y) <= 2e+70) {
tmp = (t / a) * -z;
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-5d+31)) then
tmp = y / (a / x)
else if ((x * y) <= 2d+70) then
tmp = (t / a) * -z
else
tmp = x / (a / y)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e+31) {
tmp = y / (a / x);
} else if ((x * y) <= 2e+70) {
tmp = (t / a) * -z;
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e+31: tmp = y / (a / x) elif (x * y) <= 2e+70: tmp = (t / a) * -z else: tmp = x / (a / y) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e+31) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= 2e+70) tmp = Float64(Float64(t / a) * Float64(-z)); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -5e+31)
tmp = y / (a / x);
elseif ((x * y) <= 2e+70)
tmp = (t / a) * -z;
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+31], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+70], N[(N[(t / a), $MachinePrecision] * (-z)), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+31}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+70}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000027e31Initial program 92.9%
Taylor expanded in x around inf 76.3%
associate-*r/77.6%
Simplified77.6%
*-commutative77.6%
associate-*l/76.3%
Applied egg-rr76.3%
associate-/l*74.1%
*-commutative74.1%
Applied egg-rr74.1%
*-commutative74.1%
clear-num74.0%
un-div-inv74.7%
Applied egg-rr74.7%
if -5.00000000000000027e31 < (*.f64 x y) < 2.00000000000000015e70Initial program 92.9%
Taylor expanded in x around 0 75.0%
mul-1-neg75.0%
*-commutative75.0%
associate-*r/73.9%
distribute-rgt-neg-in73.9%
distribute-frac-neg73.9%
Simplified73.9%
if 2.00000000000000015e70 < (*.f64 x y) Initial program 81.9%
Taylor expanded in x around inf 74.6%
associate-*r/76.4%
Simplified76.4%
clear-num76.4%
un-div-inv77.4%
Applied egg-rr77.4%
Final simplification74.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 (<= (* x y) -2e-49) (/ y (/ a x)) (if (<= (* x y) 2e+70) (* t (/ (- z) a)) (/ x (/ a y)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-49) {
tmp = y / (a / x);
} else if ((x * y) <= 2e+70) {
tmp = t * (-z / a);
} else {
tmp = x / (a / y);
}
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) <= (-2d-49)) then
tmp = y / (a / x)
else if ((x * y) <= 2d+70) then
tmp = t * (-z / a)
else
tmp = x / (a / y)
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) <= -2e-49) {
tmp = y / (a / x);
} else if ((x * y) <= 2e+70) {
tmp = t * (-z / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e-49: tmp = y / (a / x) elif (x * y) <= 2e+70: tmp = t * (-z / a) else: tmp = x / (a / y) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e-49) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= 2e+70) tmp = Float64(t * Float64(Float64(-z) / a)); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e-49)
tmp = y / (a / x);
elseif ((x * y) <= 2e+70)
tmp = t * (-z / a);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e-49], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+70], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{-49}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+70}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999987e-49Initial program 92.4%
Taylor expanded in x around inf 70.5%
associate-*r/71.5%
Simplified71.5%
*-commutative71.5%
associate-*l/70.5%
Applied egg-rr70.5%
associate-/l*68.6%
*-commutative68.6%
Applied egg-rr68.6%
*-commutative68.6%
clear-num68.5%
un-div-inv69.1%
Applied egg-rr69.1%
if -1.99999999999999987e-49 < (*.f64 x y) < 2.00000000000000015e70Initial program 93.1%
Taylor expanded in x around 0 76.1%
mul-1-neg76.1%
associate-/l*76.0%
distribute-rgt-neg-in76.0%
distribute-neg-frac276.0%
Simplified76.0%
if 2.00000000000000015e70 < (*.f64 x y) Initial program 81.9%
Taylor expanded in x around inf 74.6%
associate-*r/76.4%
Simplified76.4%
clear-num76.4%
un-div-inv77.4%
Applied egg-rr77.4%
Final simplification74.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) 0.0) (* y (/ x a)) (* x (/ y a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 0.0) {
tmp = y * (x / a);
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= 0.0d0) then
tmp = y * (x / a)
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 0.0) {
tmp = y * (x / a);
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= 0.0: tmp = y * (x / a) else: tmp = x * (y / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 0.0) tmp = Float64(y * Float64(x / a)); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= 0.0)
tmp = y * (x / a);
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], 0.0], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 0:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < 0.0Initial program 93.1%
Taylor expanded in x around inf 45.6%
associate-*r/47.3%
Simplified47.3%
*-commutative47.3%
associate-*l/45.6%
Applied egg-rr45.6%
associate-/l*45.5%
*-commutative45.5%
Applied egg-rr45.5%
if 0.0 < (*.f64 x y) Initial program 87.6%
Taylor expanded in x around inf 50.9%
associate-*r/47.6%
Simplified47.6%
Final simplification46.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 (* 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.6%
Taylor expanded in x around inf 48.0%
associate-*r/47.4%
Simplified47.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024180
(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))