
(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 8 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 (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+278)))
(fma (/ y (pow (cbrt a) 2.0)) (/ x (cbrt a)) (* z (/ (- t) a)))
(/ t_1 a))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+278)) {
tmp = fma((y / pow(cbrt(a), 2.0)), (x / cbrt(a)), (z * (-t / a)));
} else {
tmp = t_1 / a;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+278)) tmp = fma(Float64(y / (cbrt(a) ^ 2.0)), Float64(x / cbrt(a)), Float64(z * Float64(Float64(-t) / a))); else tmp = Float64(t_1 / 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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+278]], $MachinePrecision]], N[(N[(y / N[Power[N[Power[a, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(x / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+278}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{x}{\sqrt[3]{a}}, z \cdot \frac{-t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 5.00000000000000029e278 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 62.9%
div-sub57.6%
*-commutative57.6%
add-cube-cbrt57.6%
times-frac70.7%
fma-neg74.3%
pow274.3%
associate-/l*94.3%
Applied egg-rr94.3%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000029e278Initial program 98.5%
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
(if (<= (* x y) -1000000000000.0)
(/ x (/ a y))
(if (or (<= (* x y) 2e-131)
(and (not (<= (* x y) 5e-92)) (<= (* x y) 3e+18)))
(* 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) <= -1000000000000.0) {
tmp = x / (a / y);
} else if (((x * y) <= 2e-131) || (!((x * y) <= 5e-92) && ((x * y) <= 3e+18))) {
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) <= (-1000000000000.0d0)) then
tmp = x / (a / y)
else if (((x * y) <= 2d-131) .or. (.not. ((x * y) <= 5d-92)) .and. ((x * y) <= 3d+18)) 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) <= -1000000000000.0) {
tmp = x / (a / y);
} else if (((x * y) <= 2e-131) || (!((x * y) <= 5e-92) && ((x * y) <= 3e+18))) {
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) <= -1000000000000.0: tmp = x / (a / y) elif ((x * y) <= 2e-131) or (not ((x * y) <= 5e-92) and ((x * y) <= 3e+18)): 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) <= -1000000000000.0) tmp = Float64(x / Float64(a / y)); elseif ((Float64(x * y) <= 2e-131) || (!(Float64(x * y) <= 5e-92) && (Float64(x * y) <= 3e+18))) 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) <= -1000000000000.0)
tmp = x / (a / y);
elseif (((x * y) <= 2e-131) || (~(((x * y) <= 5e-92)) && ((x * y) <= 3e+18)))
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], -1000000000000.0], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], 2e-131], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e-92]], $MachinePrecision], LessEqual[N[(x * y), $MachinePrecision], 3e+18]]], 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 -1000000000000:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-131} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{-92}\right) \land x \cdot y \leq 3 \cdot 10^{+18}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1e12Initial program 89.1%
Taylor expanded in x around inf 78.7%
associate-*r/80.0%
Simplified80.0%
clear-num80.0%
un-div-inv80.1%
Applied egg-rr80.1%
if -1e12 < (*.f64 x y) < 2e-131 or 5.00000000000000011e-92 < (*.f64 x y) < 3e18Initial program 91.4%
Taylor expanded in x around 0 74.4%
mul-1-neg74.4%
associate-/l*77.1%
distribute-rgt-neg-in77.1%
distribute-neg-frac277.1%
Simplified77.1%
if 2e-131 < (*.f64 x y) < 5.00000000000000011e-92 or 3e18 < (*.f64 x y) Initial program 91.0%
Taylor expanded in x around inf 82.0%
associate-*r/83.2%
Simplified83.2%
clear-num82.1%
un-div-inv82.1%
Applied egg-rr82.1%
associate-/r/86.2%
Applied egg-rr86.2%
Final simplification80.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) -1000000000000.0)
(/ x (/ a y))
(if (<= (* x y) 2e-131)
(* t (/ (- z) a))
(if (or (<= (* x y) 5e-92) (not (<= (* x y) 3e+18)))
(* y (/ x a))
(* z (/ (- t) a))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1000000000000.0) {
tmp = x / (a / y);
} else if ((x * y) <= 2e-131) {
tmp = t * (-z / a);
} else if (((x * y) <= 5e-92) || !((x * y) <= 3e+18)) {
tmp = y * (x / a);
} else {
tmp = 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 ((x * y) <= (-1000000000000.0d0)) then
tmp = x / (a / y)
else if ((x * y) <= 2d-131) then
tmp = t * (-z / a)
else if (((x * y) <= 5d-92) .or. (.not. ((x * y) <= 3d+18))) then
tmp = y * (x / a)
else
tmp = 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 ((x * y) <= -1000000000000.0) {
tmp = x / (a / y);
} else if ((x * y) <= 2e-131) {
tmp = t * (-z / a);
} else if (((x * y) <= 5e-92) || !((x * y) <= 3e+18)) {
tmp = y * (x / a);
} else {
tmp = 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 (x * y) <= -1000000000000.0: tmp = x / (a / y) elif (x * y) <= 2e-131: tmp = t * (-z / a) elif ((x * y) <= 5e-92) or not ((x * y) <= 3e+18): tmp = y * (x / a) else: tmp = 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(x * y) <= -1000000000000.0) tmp = Float64(x / Float64(a / y)); elseif (Float64(x * y) <= 2e-131) tmp = Float64(t * Float64(Float64(-z) / a)); elseif ((Float64(x * y) <= 5e-92) || !(Float64(x * y) <= 3e+18)) tmp = Float64(y * Float64(x / a)); else tmp = Float64(z * Float64(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 ((x * y) <= -1000000000000.0)
tmp = x / (a / y);
elseif ((x * y) <= 2e-131)
tmp = t * (-z / a);
elseif (((x * y) <= 5e-92) || ~(((x * y) <= 3e+18)))
tmp = y * (x / a);
else
tmp = 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[N[(x * y), $MachinePrecision], -1000000000000.0], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-131], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], 5e-92], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3e+18]], $MachinePrecision]], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(z * N[((-t) / 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 -1000000000000:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-131}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-92} \lor \neg \left(x \cdot y \leq 3 \cdot 10^{+18}\right):\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1e12Initial program 89.1%
Taylor expanded in x around inf 78.7%
associate-*r/80.0%
Simplified80.0%
clear-num80.0%
un-div-inv80.1%
Applied egg-rr80.1%
if -1e12 < (*.f64 x y) < 2e-131Initial program 91.0%
Taylor expanded in x around 0 77.6%
mul-1-neg77.6%
associate-/l*81.3%
distribute-rgt-neg-in81.3%
distribute-neg-frac281.3%
Simplified81.3%
if 2e-131 < (*.f64 x y) < 5.00000000000000011e-92 or 3e18 < (*.f64 x y) Initial program 91.0%
Taylor expanded in x around inf 82.0%
associate-*r/83.2%
Simplified83.2%
clear-num82.1%
un-div-inv82.1%
Applied egg-rr82.1%
associate-/r/86.2%
Applied egg-rr86.2%
if 5.00000000000000011e-92 < (*.f64 x y) < 3e18Initial program 92.9%
Taylor expanded in x around 0 62.2%
*-commutative62.2%
associate-*r/69.0%
neg-mul-169.0%
distribute-rgt-neg-in69.0%
distribute-frac-neg69.0%
Simplified69.0%
Final simplification81.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
(let* ((t_1 (- (* x y) (* z t))))
(if (or (<= t_1 -2e+291) (not (<= t_1 1.2e+255)))
(* y (/ (- x (* t (/ z y))) 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+291) || !(t_1 <= 1.2e+255)) {
tmp = y * ((x - (t * (z / y))) / 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+291)) .or. (.not. (t_1 <= 1.2d+255))) then
tmp = y * ((x - (t * (z / y))) / 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+291) || !(t_1 <= 1.2e+255)) {
tmp = y * ((x - (t * (z / y))) / 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+291) or not (t_1 <= 1.2e+255): tmp = y * ((x - (t * (z / y))) / 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+291) || !(t_1 <= 1.2e+255)) tmp = Float64(y * Float64(Float64(x - Float64(t * Float64(z / y))) / 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+291) || ~((t_1 <= 1.2e+255)))
tmp = y * ((x - (t * (z / y))) / 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+291], N[Not[LessEqual[t$95$1, 1.2e+255]], $MachinePrecision]], N[(y * N[(N[(x - N[(t * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $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^{+291} \lor \neg \left(t\_1 \leq 1.2 \cdot 10^{+255}\right):\\
\;\;\;\;y \cdot \frac{x - t \cdot \frac{z}{y}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -1.9999999999999999e291 or 1.20000000000000003e255 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 69.0%
Taylor expanded in y around inf 66.2%
mul-1-neg66.2%
unsub-neg66.2%
associate-/l*67.7%
Simplified67.7%
Taylor expanded in x around inf 69.0%
mul-1-neg69.0%
unsub-neg69.0%
associate-/l*70.4%
Simplified70.4%
Taylor expanded in y around inf 71.1%
+-commutative71.1%
mul-1-neg71.1%
sub-neg71.1%
associate-/l/72.9%
div-sub77.4%
associate-/l*84.4%
Simplified84.4%
if -1.9999999999999999e291 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.20000000000000003e255Initial program 98.4%
Final simplification94.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (<= t_1 -2e+291)
(* y (/ (- x (* t (/ z y))) a))
(if (<= t_1 5e+278) (/ t_1 a) (* (/ t a) (- (* x (/ y t)) z))))))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+291) {
tmp = y * ((x - (t * (z / y))) / a);
} else if (t_1 <= 5e+278) {
tmp = t_1 / a;
} else {
tmp = (t / a) * ((x * (y / t)) - 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) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if (t_1 <= (-2d+291)) then
tmp = y * ((x - (t * (z / y))) / a)
else if (t_1 <= 5d+278) then
tmp = t_1 / a
else
tmp = (t / a) * ((x * (y / t)) - 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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -2e+291) {
tmp = y * ((x - (t * (z / y))) / a);
} else if (t_1 <= 5e+278) {
tmp = t_1 / a;
} else {
tmp = (t / a) * ((x * (y / t)) - z);
}
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+291: tmp = y * ((x - (t * (z / y))) / a) elif t_1 <= 5e+278: tmp = t_1 / a else: tmp = (t / a) * ((x * (y / t)) - z) 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+291) tmp = Float64(y * Float64(Float64(x - Float64(t * Float64(z / y))) / a)); elseif (t_1 <= 5e+278) tmp = Float64(t_1 / a); else tmp = Float64(Float64(t / a) * Float64(Float64(x * Float64(y / t)) - 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)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -2e+291)
tmp = y * ((x - (t * (z / y))) / a);
elseif (t_1 <= 5e+278)
tmp = t_1 / a;
else
tmp = (t / a) * ((x * (y / t)) - 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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+291], N[(y * N[(N[(x - N[(t * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+278], N[(t$95$1 / a), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] - z), $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 -2 \cdot 10^{+291}:\\
\;\;\;\;y \cdot \frac{x - t \cdot \frac{z}{y}}{a}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+278}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(x \cdot \frac{y}{t} - z\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -1.9999999999999999e291Initial program 68.7%
Taylor expanded in y around inf 68.7%
mul-1-neg68.7%
unsub-neg68.7%
associate-/l*68.7%
Simplified68.7%
Taylor expanded in x around inf 68.7%
mul-1-neg68.7%
unsub-neg68.7%
associate-/l*68.7%
Simplified68.7%
Taylor expanded in y around inf 77.8%
+-commutative77.8%
mul-1-neg77.8%
sub-neg77.8%
associate-/l/77.8%
div-sub81.1%
associate-/l*84.2%
Simplified84.2%
if -1.9999999999999999e291 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000029e278Initial program 98.5%
if 5.00000000000000029e278 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 63.3%
div-sub56.9%
*-commutative56.9%
add-cube-cbrt56.9%
times-frac68.9%
fma-neg72.1%
pow272.1%
associate-/l*93.3%
Applied egg-rr93.3%
Taylor expanded in t around inf 81.4%
times-frac87.3%
associate-*l/90.9%
div-sub90.9%
fma-neg90.9%
associate-*r/66.5%
associate-*l/90.5%
fma-define90.5%
unsub-neg90.5%
Simplified90.5%
Final simplification95.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (<= t_1 -2e+291)
(- (* x (/ y a)) (* z (/ t a)))
(if (<= t_1 5e+278) (/ t_1 a) (* (/ t a) (- (* x (/ y t)) z))))))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+291) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 5e+278) {
tmp = t_1 / a;
} else {
tmp = (t / a) * ((x * (y / t)) - 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) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if (t_1 <= (-2d+291)) then
tmp = (x * (y / a)) - (z * (t / a))
else if (t_1 <= 5d+278) then
tmp = t_1 / a
else
tmp = (t / a) * ((x * (y / t)) - 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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -2e+291) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 5e+278) {
tmp = t_1 / a;
} else {
tmp = (t / a) * ((x * (y / t)) - z);
}
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+291: tmp = (x * (y / a)) - (z * (t / a)) elif t_1 <= 5e+278: tmp = t_1 / a else: tmp = (t / a) * ((x * (y / t)) - z) 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+291) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); elseif (t_1 <= 5e+278) tmp = Float64(t_1 / a); else tmp = Float64(Float64(t / a) * Float64(Float64(x * Float64(y / t)) - 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)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -2e+291)
tmp = (x * (y / a)) - (z * (t / a));
elseif (t_1 <= 5e+278)
tmp = t_1 / a;
else
tmp = (t / a) * ((x * (y / t)) - 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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+291], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+278], N[(t$95$1 / a), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] - z), $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 -2 \cdot 10^{+291}:\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+278}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(x \cdot \frac{y}{t} - z\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -1.9999999999999999e291Initial program 68.7%
div-sub65.3%
associate-/l*77.8%
associate-/l*93.2%
Applied egg-rr93.2%
if -1.9999999999999999e291 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000029e278Initial program 98.5%
if 5.00000000000000029e278 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 63.3%
div-sub56.9%
*-commutative56.9%
add-cube-cbrt56.9%
times-frac68.9%
fma-neg72.1%
pow272.1%
associate-/l*93.3%
Applied egg-rr93.3%
Taylor expanded in t around inf 81.4%
times-frac87.3%
associate-*l/90.9%
div-sub90.9%
fma-neg90.9%
associate-*r/66.5%
associate-*l/90.5%
fma-define90.5%
unsub-neg90.5%
Simplified90.5%
Final simplification96.9%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* z t) (- INFINITY)) (* z (/ (- t) a)) (if (<= (* z t) 5e+280) (/ (- (* x y) (* z t)) a) (* 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 ((z * t) <= -((double) INFINITY)) {
tmp = z * (-t / a);
} else if ((z * t) <= 5e+280) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t * (-z / 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 tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = z * (-t / a);
} else if ((z * t) <= 5e+280) {
tmp = ((x * y) - (z * t)) / a;
} 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 (z * t) <= -math.inf: tmp = z * (-t / a) elif (z * t) <= 5e+280: tmp = ((x * y) - (z * t)) / a 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(z * t) <= Float64(-Inf)) tmp = Float64(z * Float64(Float64(-t) / a)); elseif (Float64(z * t) <= 5e+280) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); 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 ((z * t) <= -Inf)
tmp = z * (-t / a);
elseif ((z * t) <= 5e+280)
tmp = ((x * y) - (z * t)) / a;
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[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+280], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+280}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 52.5%
Taylor expanded in x around 0 52.5%
*-commutative52.5%
associate-*r/93.6%
neg-mul-193.6%
distribute-rgt-neg-in93.6%
distribute-frac-neg93.6%
Simplified93.6%
if -inf.0 < (*.f64 z t) < 5.0000000000000002e280Initial program 95.3%
if 5.0000000000000002e280 < (*.f64 z t) Initial program 59.8%
Taylor expanded in x around 0 59.8%
mul-1-neg59.8%
associate-/l*99.8%
distribute-rgt-neg-in99.8%
distribute-neg-frac299.8%
Simplified99.8%
Final simplification95.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 (* 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.7%
Taylor expanded in x around inf 53.9%
associate-*r/53.0%
Simplified53.0%
Final simplification53.0%
(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 2024054
(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))