
(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 a))) (t_2 (- (* x y) (* z t))))
(if (<= t_2 (- INFINITY))
(- t_1 (/ z (/ a t)))
(if (<= t_2 2e+135) (/ (fma x y (* z (- t))) a) (- t_1 (* z (/ t a)))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = x * (y / a);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1 - (z / (a / t));
} else if (t_2 <= 2e+135) {
tmp = fma(x, y, (z * -t)) / a;
} else {
tmp = t_1 - (z * (t / a));
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(x * Float64(y / a)) t_2 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(t_1 - Float64(z / Float64(a / t))); elseif (t_2 <= 2e+135) tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a); else tmp = Float64(t_1 - Float64(z * Float64(t / a))); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(t$95$1 - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+135], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(t$95$1 - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{a}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1 - \frac{z}{\frac{a}{t}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+135}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1 - z \cdot \frac{t}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 62.5%
div-sub62.5%
associate-/l*77.9%
associate-/l*99.7%
Applied egg-rr99.7%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999992e135Initial program 99.7%
div-sub99.1%
*-commutative99.1%
div-sub99.7%
*-commutative99.7%
fma-neg99.7%
distribute-rgt-neg-out99.7%
Simplified99.7%
if 1.99999999999999992e135 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 77.7%
div-sub75.9%
associate-/l*80.9%
associate-/l*94.5%
Applied egg-rr94.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 (or (<= t_1 -2e+305) (not (<= t_1 2e+135)))
(- (* x (/ y a)) (* z (/ t a)))
(/ t_1 a))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -2e+305) || !(t_1 <= 2e+135)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if ((t_1 <= (-2d+305)) .or. (.not. (t_1 <= 2d+135))) then
tmp = (x * (y / a)) - (z * (t / a))
else
tmp = t_1 / a
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -2e+305) || !(t_1 <= 2e+135)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if (t_1 <= -2e+305) or not (t_1 <= 2e+135): tmp = (x * (y / a)) - (z * (t / a)) else: tmp = t_1 / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if ((t_1 <= -2e+305) || !(t_1 <= 2e+135)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); else tmp = Float64(t_1 / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if ((t_1 <= -2e+305) || ~((t_1 <= 2e+135)))
tmp = (x * (y / a)) - (z * (t / a));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+305], N[Not[LessEqual[t$95$1, 2e+135]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+305} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+135}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -1.9999999999999999e305 or 1.99999999999999992e135 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 73.3%
div-sub72.1%
associate-/l*80.5%
associate-/l*96.5%
Applied egg-rr96.5%
if -1.9999999999999999e305 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999992e135Initial program 99.7%
Final simplification98.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 a))) (t_2 (- (* x y) (* z t))))
(if (<= t_2 (- INFINITY))
(- t_1 (/ z (/ a t)))
(if (<= t_2 2e+135) (/ t_2 a) (- t_1 (* z (/ t a)))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = x * (y / a);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1 - (z / (a / t));
} else if (t_2 <= 2e+135) {
tmp = t_2 / a;
} else {
tmp = t_1 - (z * (t / a));
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x * (y / a);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1 - (z / (a / t));
} else if (t_2 <= 2e+135) {
tmp = t_2 / a;
} else {
tmp = t_1 - (z * (t / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = x * (y / a) t_2 = (x * y) - (z * t) tmp = 0 if t_2 <= -math.inf: tmp = t_1 - (z / (a / t)) elif t_2 <= 2e+135: tmp = t_2 / a else: tmp = t_1 - (z * (t / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(x * Float64(y / a)) t_2 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(t_1 - Float64(z / Float64(a / t))); elseif (t_2 <= 2e+135) tmp = Float64(t_2 / a); else tmp = Float64(t_1 - Float64(z * Float64(t / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = x * (y / a);
t_2 = (x * y) - (z * t);
tmp = 0.0;
if (t_2 <= -Inf)
tmp = t_1 - (z / (a / t));
elseif (t_2 <= 2e+135)
tmp = t_2 / a;
else
tmp = t_1 - (z * (t / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(t$95$1 - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+135], N[(t$95$2 / a), $MachinePrecision], N[(t$95$1 - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{a}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1 - \frac{z}{\frac{a}{t}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+135}:\\
\;\;\;\;\frac{t\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1 - z \cdot \frac{t}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 62.5%
div-sub62.5%
associate-/l*77.9%
associate-/l*99.7%
Applied egg-rr99.7%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999992e135Initial program 99.7%
if 1.99999999999999992e135 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 77.7%
div-sub75.9%
associate-/l*80.9%
associate-/l*94.5%
Applied egg-rr94.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 (if (or (<= (* z t) -2e+278) (not (<= (* z t) 4e+234))) (* (/ t a) (- z)) (/ (- (* x y) (* 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 (((z * t) <= -2e+278) || !((z * t) <= 4e+234)) {
tmp = (t / a) * -z;
} else {
tmp = ((x * y) - (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 (((z * t) <= (-2d+278)) .or. (.not. ((z * t) <= 4d+234))) then
tmp = (t / a) * -z
else
tmp = ((x * y) - (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 (((z * t) <= -2e+278) || !((z * t) <= 4e+234)) {
tmp = (t / a) * -z;
} else {
tmp = ((x * y) - (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 ((z * t) <= -2e+278) or not ((z * t) <= 4e+234): tmp = (t / a) * -z else: tmp = ((x * y) - (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 ((Float64(z * t) <= -2e+278) || !(Float64(z * t) <= 4e+234)) tmp = Float64(Float64(t / a) * Float64(-z)); else tmp = Float64(Float64(Float64(x * y) - Float64(z * 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 (((z * t) <= -2e+278) || ~(((z * t) <= 4e+234)))
tmp = (t / a) * -z;
else
tmp = ((x * y) - (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[Or[LessEqual[N[(z * t), $MachinePrecision], -2e+278], N[Not[LessEqual[N[(z * t), $MachinePrecision], 4e+234]], $MachinePrecision]], N[(N[(t / a), $MachinePrecision] * (-z)), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $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 -2 \cdot 10^{+278} \lor \neg \left(z \cdot t \leq 4 \cdot 10^{+234}\right):\\
\;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999993e278 or 4.00000000000000007e234 < (*.f64 z t) Initial program 58.4%
Taylor expanded in x around 0 58.4%
*-commutative58.4%
associate-*r/89.7%
neg-mul-189.7%
distribute-rgt-neg-in89.7%
distribute-frac-neg89.7%
Simplified89.7%
if -1.99999999999999993e278 < (*.f64 z t) < 4.00000000000000007e234Initial program 96.3%
Final simplification95.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 (if (or (<= (* x y) -2e-33) (not (<= (* x y) 5e+28))) (/ x (/ a y)) (/ 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 (((x * y) <= -2e-33) || !((x * y) <= 5e+28)) {
tmp = x / (a / y);
} else {
tmp = t / (a / -z);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (((x * y) <= (-2d-33)) .or. (.not. ((x * y) <= 5d+28))) then
tmp = x / (a / y)
else
tmp = t / (a / -z)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) <= -2e-33) || !((x * y) <= 5e+28)) {
tmp = x / (a / y);
} 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 ((x * y) <= -2e-33) or not ((x * y) <= 5e+28): tmp = x / (a / y) 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(x * y) <= -2e-33) || !(Float64(x * y) <= 5e+28)) tmp = Float64(x / Float64(a / y)); else tmp = Float64(t / Float64(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 (((x * y) <= -2e-33) || ~(((x * y) <= 5e+28)))
tmp = x / (a / y);
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[Or[LessEqual[N[(x * y), $MachinePrecision], -2e-33], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e+28]], $MachinePrecision]], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], N[(t / N[(a / (-z)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{-33} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+28}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{-z}}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e-33 or 4.99999999999999957e28 < (*.f64 x y) Initial program 89.2%
Taylor expanded in x around inf 72.9%
associate-*r/75.5%
Simplified75.5%
clear-num75.3%
un-div-inv75.5%
Applied egg-rr75.5%
if -2.0000000000000001e-33 < (*.f64 x y) < 4.99999999999999957e28Initial program 92.2%
Taylor expanded in x around inf 70.5%
+-commutative70.5%
mul-1-neg70.5%
unsub-neg70.5%
associate-/l*70.4%
*-commutative70.4%
associate-/r*67.0%
Simplified67.0%
Taylor expanded in a around 0 73.1%
Taylor expanded in x around 0 74.5%
mul-1-neg74.5%
associate-*l/73.8%
associate-/r/70.4%
distribute-neg-frac270.4%
Simplified70.4%
Final simplification73.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 (or (<= (* x y) -2e-33) (not (<= (* x y) 2e+16))) (/ x (/ a y)) (* t (/ (- z) 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) <= -2e-33) || !((x * y) <= 2e+16)) {
tmp = x / (a / y);
} else {
tmp = t * (-z / 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) <= (-2d-33)) .or. (.not. ((x * y) <= 2d+16))) then
tmp = x / (a / y)
else
tmp = t * (-z / 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) <= -2e-33) || !((x * y) <= 2e+16)) {
tmp = x / (a / y);
} else {
tmp = t * (-z / 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) <= -2e-33) or not ((x * y) <= 2e+16): tmp = x / (a / y) else: tmp = t * (-z / 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) <= -2e-33) || !(Float64(x * y) <= 2e+16)) tmp = Float64(x / Float64(a / y)); else tmp = Float64(t * Float64(Float64(-z) / 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) <= -2e-33) || ~(((x * y) <= 2e+16)))
tmp = x / (a / y);
else
tmp = t * (-z / 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[Or[LessEqual[N[(x * y), $MachinePrecision], -2e-33], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+16]], $MachinePrecision]], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], N[(t * N[((-z) / 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 -2 \cdot 10^{-33} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+16}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e-33 or 2e16 < (*.f64 x y) Initial program 89.2%
Taylor expanded in x around inf 73.1%
associate-*r/75.0%
Simplified75.0%
clear-num74.8%
un-div-inv75.0%
Applied egg-rr75.0%
if -2.0000000000000001e-33 < (*.f64 x y) < 2e16Initial program 92.1%
Taylor expanded in x around 0 75.1%
mul-1-neg75.1%
associate-/l*70.9%
distribute-rgt-neg-in70.9%
distribute-neg-frac270.9%
Simplified70.9%
Final simplification73.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) -4e-41) (/ x (/ a y)) (if (<= (* x y) 5e-29) (/ (* z t) (- 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) <= -4e-41) {
tmp = x / (a / y);
} else if ((x * y) <= 5e-29) {
tmp = (z * t) / -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) <= (-4d-41)) then
tmp = x / (a / y)
else if ((x * y) <= 5d-29) then
tmp = (z * t) / -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) <= -4e-41) {
tmp = x / (a / y);
} else if ((x * y) <= 5e-29) {
tmp = (z * t) / -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) <= -4e-41: tmp = x / (a / y) elif (x * y) <= 5e-29: tmp = (z * t) / -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) <= -4e-41) tmp = Float64(x / Float64(a / y)); elseif (Float64(x * y) <= 5e-29) tmp = Float64(Float64(z * t) / Float64(-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) <= -4e-41)
tmp = x / (a / y);
elseif ((x * y) <= 5e-29)
tmp = (z * t) / -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], -4e-41], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-29], N[(N[(z * t), $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}\;x \cdot y \leq -4 \cdot 10^{-41}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\frac{z \cdot t}{-a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.00000000000000002e-41Initial program 85.4%
Taylor expanded in x around inf 69.7%
associate-*r/71.7%
Simplified71.7%
clear-num71.6%
un-div-inv71.8%
Applied egg-rr71.8%
if -4.00000000000000002e-41 < (*.f64 x y) < 4.99999999999999986e-29Initial program 93.2%
Taylor expanded in x around 0 79.2%
associate-*r*79.2%
mul-1-neg79.2%
Simplified79.2%
if 4.99999999999999986e-29 < (*.f64 x y) Initial program 92.8%
Taylor expanded in x around inf 74.2%
associate-*r/75.5%
Simplified75.5%
clear-num75.3%
un-div-inv75.5%
Applied egg-rr75.5%
associate-/r/77.0%
Simplified77.0%
Final simplification76.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 (/ 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 90.5%
Taylor expanded in x around inf 52.5%
associate-*r/53.1%
Simplified53.1%
clear-num53.0%
un-div-inv53.4%
Applied egg-rr53.4%
associate-/r/54.1%
Simplified54.1%
*-commutative54.1%
clear-num54.0%
un-div-inv54.3%
Applied egg-rr54.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 (/ x (/ a y)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return x / (a / y);
}
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 / (a / y)
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 / (a / y);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return x / (a / y)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(x / Float64(a / y)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = x / (a / y);
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[(a / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\frac{x}{\frac{a}{y}}
\end{array}
Initial program 90.5%
Taylor expanded in x around inf 52.5%
associate-*r/53.1%
Simplified53.1%
clear-num53.0%
un-div-inv53.4%
Applied egg-rr53.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.5%
Taylor expanded in x around inf 52.5%
associate-*r/53.1%
Simplified53.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 2024087
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))
(/ (- (* x y) (* z t)) a))