
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))) (t_2 (fma (/ y a) x (- (* z (/ t a))))))
(if (<= t_1 -2e+278)
t_2
(if (<= t_1 4e+292) (/ (fma y x (* z (- t))) a) t_2))))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 t_2 = fma((y / a), x, -(z * (t / a)));
double tmp;
if (t_1 <= -2e+278) {
tmp = t_2;
} else if (t_1 <= 4e+292) {
tmp = fma(y, x, (z * -t)) / a;
} else {
tmp = t_2;
}
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)) t_2 = fma(Float64(y / a), x, Float64(-Float64(z * Float64(t / a)))) tmp = 0.0 if (t_1 <= -2e+278) tmp = t_2; elseif (t_1 <= 4e+292) tmp = Float64(fma(y, x, Float64(z * Float64(-t))) / a); else tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * x + (-N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+278], t$95$2, If[LessEqual[t$95$1, 4e+292], N[(N[(y * x + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$2]]]]
\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\\
t_2 := \mathsf{fma}\left(\frac{y}{a}, x, -z \cdot \frac{t}{a}\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+278}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+292}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, z \cdot \left(-t\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -1.99999999999999993e278 or 4.0000000000000001e292 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 63.6%
sub-negN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
*-lowering-*.f6465.2
Applied egg-rr65.2%
unsub-negN/A
*-commutativeN/A
sub-divN/A
associate-*l/N/A
unsub-negN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
distribute-neg-fracN/A
distribute-rgt-neg-inN/A
associate-*l/N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
distribute-frac-negN/A
distribute-frac-neg2N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6491.7
Applied egg-rr91.7%
if -1.99999999999999993e278 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.0000000000000001e292Initial program 98.8%
sub-negN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
*-lowering-*.f6498.8
Applied egg-rr98.8%
Final simplification97.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- (* x y) (* z t)) a)))
(if (<= t_1 -2e+169)
(* x (/ y a))
(if (<= t_1 1e+298) (/ (* x y) a) (* y (/ x a))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x * y) - (z * t)) / a;
double tmp;
if (t_1 <= -2e+169) {
tmp = x * (y / a);
} else if (t_1 <= 1e+298) {
tmp = (x * y) / a;
} else {
tmp = y * (x / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = ((x * y) - (z * t)) / a
if (t_1 <= (-2d+169)) then
tmp = x * (y / a)
else if (t_1 <= 1d+298) then
tmp = (x * y) / a
else
tmp = y * (x / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((x * y) - (z * t)) / a;
double tmp;
if (t_1 <= -2e+169) {
tmp = x * (y / a);
} else if (t_1 <= 1e+298) {
tmp = (x * y) / a;
} else {
tmp = y * (x / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = ((x * y) - (z * t)) / a tmp = 0 if t_1 <= -2e+169: tmp = x * (y / a) elif t_1 <= 1e+298: tmp = (x * y) / a else: tmp = y * (x / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a) tmp = 0.0 if (t_1 <= -2e+169) tmp = Float64(x * Float64(y / a)); elseif (t_1 <= 1e+298) tmp = Float64(Float64(x * y) / a); else tmp = Float64(y * Float64(x / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = ((x * y) - (z * t)) / a;
tmp = 0.0;
if (t_1 <= -2e+169)
tmp = x * (y / a);
elseif (t_1 <= 1e+298)
tmp = (x * y) / a;
else
tmp = y * (x / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+169], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+298], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y - z \cdot t}{a}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+169}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+298}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < -1.99999999999999987e169Initial program 80.4%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6449.3
Simplified49.3%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6450.8
Applied egg-rr50.8%
if -1.99999999999999987e169 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 9.9999999999999996e297Initial program 98.3%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6454.6
Simplified54.6%
if 9.9999999999999996e297 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 81.0%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6433.7
Simplified33.7%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6444.9
Applied egg-rr44.9%
Final simplification51.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 (* t (* z (/ -1.0 a)))))
(if (<= (* z t) (- INFINITY))
t_1
(if (<= (* z t) 1e+263) (/ (fma (- z) t (* x y)) a) t_1))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (z * (-1.0 / a));
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = t_1;
} else if ((z * t) <= 1e+263) {
tmp = fma(-z, t, (x * y)) / a;
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(t * Float64(z * Float64(-1.0 / a))) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = t_1; elseif (Float64(z * t) <= 1e+263) tmp = Float64(fma(Float64(-z), t, Float64(x * y)) / a); else tmp = t_1; 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[(t * N[(z * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e+263], N[(N[((-z) * t + N[(x * y), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(z \cdot \frac{-1}{a}\right)\\
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 10^{+263}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, t, x \cdot y\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0 or 1.00000000000000002e263 < (*.f64 z t) Initial program 61.3%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6463.8
Simplified63.8%
frac-2negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
associate-*l/N/A
div-invN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
frac-2negN/A
/-lowering-/.f6497.6
Applied egg-rr97.6%
if -inf.0 < (*.f64 z t) < 1.00000000000000002e263Initial program 95.5%
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
*-lowering-*.f6495.5
Applied egg-rr95.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 (* t (* z (/ -1.0 a)))))
(if (<= (* z t) (- INFINITY))
t_1
(if (<= (* z t) 1e+263) (/ (fma y x (* z (- t))) a) t_1))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (z * (-1.0 / a));
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = t_1;
} else if ((z * t) <= 1e+263) {
tmp = fma(y, x, (z * -t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(t * Float64(z * Float64(-1.0 / a))) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = t_1; elseif (Float64(z * t) <= 1e+263) tmp = Float64(fma(y, x, Float64(z * Float64(-t))) / a); else tmp = t_1; 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[(t * N[(z * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e+263], N[(N[(y * x + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(z \cdot \frac{-1}{a}\right)\\
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 10^{+263}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, z \cdot \left(-t\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0 or 1.00000000000000002e263 < (*.f64 z t) Initial program 61.3%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6463.8
Simplified63.8%
frac-2negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
associate-*l/N/A
div-invN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
frac-2negN/A
/-lowering-/.f6497.6
Applied egg-rr97.6%
if -inf.0 < (*.f64 z t) < 1.00000000000000002e263Initial program 95.5%
sub-negN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
*-lowering-*.f6495.5
Applied egg-rr95.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 (* t (* z (/ -1.0 a)))))
(if (<= (* z t) (- INFINITY))
t_1
(if (<= (* z t) 1e+263) (/ (- (* x y) (* z t)) a) t_1))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (z * (-1.0 / a));
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = t_1;
} else if ((z * t) <= 1e+263) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
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 = t * (z * (-1.0 / a));
double tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if ((z * t) <= 1e+263) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = t * (z * (-1.0 / a)) tmp = 0 if (z * t) <= -math.inf: tmp = t_1 elif (z * t) <= 1e+263: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(t * Float64(z * Float64(-1.0 / a))) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = t_1; elseif (Float64(z * t) <= 1e+263) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; 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 = t * (z * (-1.0 / a));
tmp = 0.0;
if ((z * t) <= -Inf)
tmp = t_1;
elseif ((z * t) <= 1e+263)
tmp = ((x * y) - (z * t)) / a;
else
tmp = t_1;
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[(t * N[(z * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e+263], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(z \cdot \frac{-1}{a}\right)\\
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 10^{+263}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0 or 1.00000000000000002e263 < (*.f64 z t) Initial program 61.3%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6463.8
Simplified63.8%
frac-2negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
associate-*l/N/A
div-invN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
frac-2negN/A
/-lowering-/.f6497.6
Applied egg-rr97.6%
if -inf.0 < (*.f64 z t) < 1.00000000000000002e263Initial program 95.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 (if (<= a 3.7e-63) (/ (fma y x (* z (- t))) a) (fma (- 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 (a <= 3.7e-63) {
tmp = fma(y, x, (z * -t)) / a;
} else {
tmp = fma(-t, (z / a), ((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 (a <= 3.7e-63) tmp = Float64(fma(y, x, Float64(z * Float64(-t))) / a); else tmp = fma(Float64(-t), Float64(z / a), Float64(Float64(x * y) / 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_] := If[LessEqual[a, 3.7e-63], N[(N[(y * x + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-t) * N[(z / a), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.7 \cdot 10^{-63}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, z \cdot \left(-t\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{z}{a}, \frac{x \cdot y}{a}\right)\\
\end{array}
\end{array}
if a < 3.70000000000000012e-63Initial program 92.3%
sub-negN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
*-lowering-*.f6492.8
Applied egg-rr92.8%
if 3.70000000000000012e-63 < a Initial program 84.8%
div-subN/A
sub-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6484.4
Applied egg-rr84.4%
Final simplification90.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 (<= (* x y) -5e-29) (* x (/ y a)) (if (<= (* x y) 1e-20) (- (* 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) <= -5e-29) {
tmp = x * (y / a);
} else if ((x * y) <= 1e-20) {
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) <= (-5d-29)) then
tmp = x * (y / a)
else if ((x * y) <= 1d-20) 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) <= -5e-29) {
tmp = x * (y / a);
} else if ((x * y) <= 1e-20) {
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) <= -5e-29: tmp = x * (y / a) elif (x * y) <= 1e-20: 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) <= -5e-29) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= 1e-20) tmp = Float64(-Float64(t * 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) <= -5e-29)
tmp = x * (y / a);
elseif ((x * y) <= 1e-20)
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], -5e-29], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-20], (-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 -5 \cdot 10^{-29}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{-20}:\\
\;\;\;\;-t \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999986e-29Initial program 91.3%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6476.1
Simplified76.1%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6479.7
Applied egg-rr79.7%
if -4.99999999999999986e-29 < (*.f64 x y) < 9.99999999999999945e-21Initial program 87.9%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6478.0
Simplified78.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6480.9
Applied egg-rr80.9%
if 9.99999999999999945e-21 < (*.f64 x y) Initial program 93.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6475.4
Simplified75.4%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6479.2
Applied egg-rr79.2%
Final simplification80.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -5e-29) (* x (/ y a)) (if (<= (* x y) 1e-20) (- (* 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) <= -5e-29) {
tmp = x * (y / a);
} else if ((x * y) <= 1e-20) {
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) <= (-5d-29)) then
tmp = x * (y / a)
else if ((x * y) <= 1d-20) 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) <= -5e-29) {
tmp = x * (y / a);
} else if ((x * y) <= 1e-20) {
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) <= -5e-29: tmp = x * (y / a) elif (x * y) <= 1e-20: 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) <= -5e-29) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= 1e-20) tmp = Float64(-Float64(z * Float64(t / 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) <= -5e-29)
tmp = x * (y / a);
elseif ((x * y) <= 1e-20)
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], -5e-29], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-20], (-N[(z * N[(t / 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 -5 \cdot 10^{-29}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{-20}:\\
\;\;\;\;-z \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999986e-29Initial program 91.3%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6476.1
Simplified76.1%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6479.7
Applied egg-rr79.7%
if -4.99999999999999986e-29 < (*.f64 x y) < 9.99999999999999945e-21Initial program 87.9%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6478.0
Simplified78.0%
frac-2negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6483.2
Applied egg-rr83.2%
if 9.99999999999999945e-21 < (*.f64 x y) Initial program 93.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6475.4
Simplified75.4%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6479.2
Applied egg-rr79.2%
Final simplification81.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) (* z t)) -1e-24) (* x (/ y a)) (* y (/ x a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) - (z * t)) <= -1e-24) {
tmp = x * (y / a);
} else {
tmp = y * (x / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (((x * y) - (z * t)) <= (-1d-24)) then
tmp = x * (y / a)
else
tmp = y * (x / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) - (z * t)) <= -1e-24) {
tmp = x * (y / a);
} else {
tmp = y * (x / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if ((x * y) - (z * t)) <= -1e-24: tmp = x * (y / a) else: tmp = y * (x / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(x * y) - Float64(z * t)) <= -1e-24) tmp = Float64(x * Float64(y / a)); else tmp = Float64(y * Float64(x / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (((x * y) - (z * t)) <= -1e-24)
tmp = x * (y / a);
else
tmp = y * (x / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision], -1e-24], N[(x * N[(y / 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 - z \cdot t \leq -1 \cdot 10^{-24}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -9.99999999999999924e-25Initial program 88.7%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6441.3
Simplified41.3%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6444.2
Applied egg-rr44.2%
if -9.99999999999999924e-25 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 91.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6454.3
Simplified54.3%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6456.9
Applied egg-rr56.9%
Final simplification51.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 (* y (/ x a)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = y * (x / a)
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return y * (x / a)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / a);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 90.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6449.2
Simplified49.2%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6449.7
Applied egg-rr49.7%
Final simplification49.7%
(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 2024205
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))
(/ (- (* x y) (* z t)) a))