
(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 (<= t_1 (- INFINITY))
(- (* x (/ y a)) (* z (/ t a)))
(if (<= t_1 1e+246)
(/ (fma x y (* z (- 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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 1e+246) {
tmp = fma(x, y, (z * -t)) / a;
} else {
tmp = z * (((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) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); elseif (t_1 <= 1e+246) tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a); else tmp = Float64(z * Float64(Float64(Float64(x * Float64(y / z)) - 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[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+246], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(z * N[(N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] / a), $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 \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+246}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x \cdot \frac{y}{z} - t}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 63.8%
div-sub63.8%
associate-/l*77.1%
associate-/l*99.9%
Applied egg-rr99.9%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000007e246Initial program 98.2%
div-sub97.2%
*-commutative97.2%
div-sub98.2%
*-commutative98.2%
fma-neg98.2%
distribute-rgt-neg-out98.2%
Simplified98.2%
if 1.00000000000000007e246 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 76.0%
div-sub69.7%
associate-/l*69.6%
associate-/l*90.6%
Applied egg-rr90.6%
Taylor expanded in z around inf 84.7%
*-commutative84.7%
associate-/r*87.8%
div-sub91.0%
associate-/l*93.9%
Simplified93.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 (<= (* x y) -5e+28)
(* x (/ y a))
(if (<= (* x y) -0.005)
(* (* z t) (/ -1.0 a))
(if (or (<= (* x y) -5e-109) (not (<= (* x y) 1e-78)))
(/ (* x y) 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 ((x * y) <= -5e+28) {
tmp = x * (y / a);
} else if ((x * y) <= -0.005) {
tmp = (z * t) * (-1.0 / a);
} else if (((x * y) <= -5e-109) || !((x * y) <= 1e-78)) {
tmp = (x * y) / a;
} 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) <= (-5d+28)) then
tmp = x * (y / a)
else if ((x * y) <= (-0.005d0)) then
tmp = (z * t) * ((-1.0d0) / a)
else if (((x * y) <= (-5d-109)) .or. (.not. ((x * y) <= 1d-78))) then
tmp = (x * y) / a
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) <= -5e+28) {
tmp = x * (y / a);
} else if ((x * y) <= -0.005) {
tmp = (z * t) * (-1.0 / a);
} else if (((x * y) <= -5e-109) || !((x * y) <= 1e-78)) {
tmp = (x * y) / 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 (x * y) <= -5e+28: tmp = x * (y / a) elif (x * y) <= -0.005: tmp = (z * t) * (-1.0 / a) elif ((x * y) <= -5e-109) or not ((x * y) <= 1e-78): tmp = (x * y) / 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(x * y) <= -5e+28) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= -0.005) tmp = Float64(Float64(z * t) * Float64(-1.0 / a)); elseif ((Float64(x * y) <= -5e-109) || !(Float64(x * y) <= 1e-78)) tmp = Float64(Float64(x * y) / a); else tmp = Float64(t * Float64(z / Float64(-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) <= -5e+28)
tmp = x * (y / a);
elseif ((x * y) <= -0.005)
tmp = (z * t) * (-1.0 / a);
elseif (((x * y) <= -5e-109) || ~(((x * y) <= 1e-78)))
tmp = (x * y) / 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[(x * y), $MachinePrecision], -5e+28], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -0.005], N[(N[(z * t), $MachinePrecision] * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e-109], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e-78]], $MachinePrecision]], N[(N[(x * y), $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}\;x \cdot y \leq -5 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq -0.005:\\
\;\;\;\;\left(z \cdot t\right) \cdot \frac{-1}{a}\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-109} \lor \neg \left(x \cdot y \leq 10^{-78}\right):\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999957e28Initial program 86.5%
Taylor expanded in x around inf 68.5%
associate-*r/74.2%
Simplified74.2%
if -4.99999999999999957e28 < (*.f64 x y) < -0.0050000000000000001Initial program 99.1%
Taylor expanded in x around 0 76.7%
associate-*r*76.7%
mul-1-neg76.7%
Simplified76.7%
add-sqr-sqrt61.7%
sqrt-unprod63.1%
sqr-neg63.1%
sqrt-unprod0.9%
add-sqr-sqrt1.3%
associate-*l/0.9%
frac-2neg0.9%
Applied egg-rr0.9%
add-sqr-sqrt0.3%
sqrt-unprod29.9%
sqr-neg29.9%
sqrt-unprod43.0%
add-sqr-sqrt63.4%
distribute-rgt-neg-out63.4%
associate-/r/63.9%
clear-num64.1%
distribute-neg-frac64.1%
metadata-eval64.1%
associate-/l/76.7%
Applied egg-rr76.7%
associate-/r/76.9%
Applied egg-rr76.9%
if -0.0050000000000000001 < (*.f64 x y) < -5.0000000000000002e-109 or 9.99999999999999999e-79 < (*.f64 x y) Initial program 96.9%
Taylor expanded in x around inf 70.3%
if -5.0000000000000002e-109 < (*.f64 x y) < 9.99999999999999999e-79Initial program 91.1%
Taylor expanded in x around 0 84.2%
mul-1-neg84.2%
associate-/l*83.2%
distribute-rgt-neg-in83.2%
distribute-neg-frac283.2%
Simplified83.2%
Final simplification76.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 (<= (* x y) -5e+28)
(* x (/ y a))
(if (<= (* x y) -0.005)
(/ (* z t) (- a))
(if (or (<= (* x y) -5e-109) (not (<= (* x y) 1e-78)))
(/ (* x y) 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 ((x * y) <= -5e+28) {
tmp = x * (y / a);
} else if ((x * y) <= -0.005) {
tmp = (z * t) / -a;
} else if (((x * y) <= -5e-109) || !((x * y) <= 1e-78)) {
tmp = (x * y) / a;
} 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) <= (-5d+28)) then
tmp = x * (y / a)
else if ((x * y) <= (-0.005d0)) then
tmp = (z * t) / -a
else if (((x * y) <= (-5d-109)) .or. (.not. ((x * y) <= 1d-78))) then
tmp = (x * y) / a
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) <= -5e+28) {
tmp = x * (y / a);
} else if ((x * y) <= -0.005) {
tmp = (z * t) / -a;
} else if (((x * y) <= -5e-109) || !((x * y) <= 1e-78)) {
tmp = (x * y) / 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 (x * y) <= -5e+28: tmp = x * (y / a) elif (x * y) <= -0.005: tmp = (z * t) / -a elif ((x * y) <= -5e-109) or not ((x * y) <= 1e-78): tmp = (x * y) / 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(x * y) <= -5e+28) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= -0.005) tmp = Float64(Float64(z * t) / Float64(-a)); elseif ((Float64(x * y) <= -5e-109) || !(Float64(x * y) <= 1e-78)) tmp = Float64(Float64(x * y) / a); else tmp = Float64(t * Float64(z / Float64(-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) <= -5e+28)
tmp = x * (y / a);
elseif ((x * y) <= -0.005)
tmp = (z * t) / -a;
elseif (((x * y) <= -5e-109) || ~(((x * y) <= 1e-78)))
tmp = (x * y) / 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[(x * y), $MachinePrecision], -5e+28], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -0.005], N[(N[(z * t), $MachinePrecision] / (-a)), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e-109], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e-78]], $MachinePrecision]], N[(N[(x * y), $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}\;x \cdot y \leq -5 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq -0.005:\\
\;\;\;\;\frac{z \cdot t}{-a}\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-109} \lor \neg \left(x \cdot y \leq 10^{-78}\right):\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999957e28Initial program 86.5%
Taylor expanded in x around inf 68.5%
associate-*r/74.2%
Simplified74.2%
if -4.99999999999999957e28 < (*.f64 x y) < -0.0050000000000000001Initial program 99.1%
Taylor expanded in x around 0 76.7%
associate-*r*76.7%
mul-1-neg76.7%
Simplified76.7%
if -0.0050000000000000001 < (*.f64 x y) < -5.0000000000000002e-109 or 9.99999999999999999e-79 < (*.f64 x y) Initial program 96.9%
Taylor expanded in x around inf 70.3%
if -5.0000000000000002e-109 < (*.f64 x y) < 9.99999999999999999e-79Initial program 91.1%
Taylor expanded in x around 0 84.2%
mul-1-neg84.2%
associate-/l*83.2%
distribute-rgt-neg-in83.2%
distribute-neg-frac283.2%
Simplified83.2%
Final simplification76.3%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+246)))
(* z (/ (- (* x (/ y 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 <= 1e+246)) {
tmp = z * (((x * (y / z)) - t) / 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 <= 1e+246)) {
tmp = z * (((x * (y / 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 <= -math.inf) or not (t_1 <= 1e+246): tmp = z * (((x * (y / 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 <= 1e+246)) tmp = Float64(z * Float64(Float64(Float64(x * Float64(y / z)) - 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 <= -Inf) || ~((t_1 <= 1e+246)))
tmp = z * (((x * (y / 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, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+246]], $MachinePrecision]], N[(z * N[(N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - t), $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 -\infty \lor \neg \left(t\_1 \leq 10^{+246}\right):\\
\;\;\;\;z \cdot \frac{x \cdot \frac{y}{z} - t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 1.00000000000000007e246 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 71.3%
div-sub67.5%
associate-/l*72.5%
associate-/l*94.2%
Applied egg-rr94.2%
Taylor expanded in z around inf 85.4%
*-commutative85.4%
associate-/r*87.4%
div-sub89.3%
associate-/l*91.1%
Simplified91.1%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000007e246Initial program 98.2%
Final simplification96.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
(let* ((t_1 (- (* x y) (* z t))))
(if (<= t_1 (- INFINITY))
(- (* x (/ y a)) (* z (/ t a)))
(if (<= t_1 1e+246) (/ t_1 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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 1e+246) {
tmp = t_1 / a;
} else {
tmp = z * (((x * (y / 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) - (z * t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 1e+246) {
tmp = t_1 / a;
} else {
tmp = z * (((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): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= -math.inf: tmp = (x * (y / a)) - (z * (t / a)) elif t_1 <= 1e+246: tmp = t_1 / a else: tmp = z * (((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) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); elseif (t_1 <= 1e+246) tmp = Float64(t_1 / a); else tmp = Float64(z * Float64(Float64(Float64(x * Float64(y / 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)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -Inf)
tmp = (x * (y / a)) - (z * (t / a));
elseif (t_1 <= 1e+246)
tmp = t_1 / a;
else
tmp = z * (((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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+246], N[(t$95$1 / a), $MachinePrecision], N[(z * N[(N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] / a), $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 \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+246}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x \cdot \frac{y}{z} - t}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 63.8%
div-sub63.8%
associate-/l*77.1%
associate-/l*99.9%
Applied egg-rr99.9%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000007e246Initial program 98.2%
if 1.00000000000000007e246 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 76.0%
div-sub69.7%
associate-/l*69.6%
associate-/l*90.6%
Applied egg-rr90.6%
Taylor expanded in z around inf 84.7%
*-commutative84.7%
associate-/r*87.8%
div-sub91.0%
associate-/l*93.9%
Simplified93.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)) (* t (/ z (- a))) (if (<= (* z t) 5e+284) (/ (- (* 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) <= 5e+284) {
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) <= 5e+284) {
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) <= 5e+284: 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(z / Float64(-a))); elseif (Float64(z * t) <= 5e+284) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); 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 ((z * t) <= -Inf)
tmp = t * (z / -a);
elseif ((z * t) <= 5e+284)
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], 5e+284], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $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}\;z \cdot t \leq -\infty:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+284}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{-z}}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 39.2%
Taylor expanded in x around 0 39.2%
mul-1-neg39.2%
associate-/l*90.8%
distribute-rgt-neg-in90.8%
distribute-neg-frac290.8%
Simplified90.8%
if -inf.0 < (*.f64 z t) < 4.9999999999999999e284Initial program 96.8%
if 4.9999999999999999e284 < (*.f64 z t) Initial program 67.3%
Taylor expanded in x around 0 67.3%
associate-*r*67.3%
mul-1-neg67.3%
Simplified67.3%
add-sqr-sqrt43.1%
sqrt-unprod42.9%
sqr-neg42.9%
sqrt-unprod0.1%
add-sqr-sqrt0.1%
associate-*l/0.2%
frac-2neg0.2%
Applied egg-rr0.2%
add-sqr-sqrt0.1%
sqrt-unprod43.6%
sqr-neg43.6%
sqrt-unprod57.0%
add-sqr-sqrt99.8%
distribute-rgt-neg-out99.8%
associate-/r/99.8%
distribute-neg-frac99.8%
Applied egg-rr99.8%
Final simplification96.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-109) (* x (/ y a)) (if (<= (* x y) 1e-78) (* t (/ z (- 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) <= -5e-109) {
tmp = x * (y / a);
} else if ((x * y) <= 1e-78) {
tmp = t * (z / -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) <= (-5d-109)) then
tmp = x * (y / a)
else if ((x * y) <= 1d-78) then
tmp = t * (z / -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) <= -5e-109) {
tmp = x * (y / a);
} else if ((x * y) <= 1e-78) {
tmp = t * (z / -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) <= -5e-109: tmp = x * (y / a) elif (x * y) <= 1e-78: tmp = t * (z / -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) <= -5e-109) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= 1e-78) tmp = Float64(t * Float64(z / Float64(-a))); else tmp = Float64(Float64(x * 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) <= -5e-109)
tmp = x * (y / a);
elseif ((x * y) <= 1e-78)
tmp = t * (z / -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], -5e-109], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-78], N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $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^{-109}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{-78}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.0000000000000002e-109Initial program 90.9%
Taylor expanded in x around inf 62.3%
associate-*r/62.5%
Simplified62.5%
if -5.0000000000000002e-109 < (*.f64 x y) < 9.99999999999999999e-79Initial program 91.1%
Taylor expanded in x around 0 84.2%
mul-1-neg84.2%
associate-/l*83.2%
distribute-rgt-neg-in83.2%
distribute-neg-frac283.2%
Simplified83.2%
if 9.99999999999999999e-79 < (*.f64 x y) Initial program 96.3%
Taylor expanded in x around inf 71.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 (* 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 92.7%
Taylor expanded in x around inf 50.4%
associate-*r/50.2%
Simplified50.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024091
(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))