
(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 (/ z (/ a (- (/ x (/ z y)) t)))) (t_2 (/ (- (* x y) (* z t)) a)))
(if (<= t_2 -2e+301)
t_1
(if (<= t_2 2e+295) (- (/ (* x y) a) (/ (* 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 = z / (a / ((x / (z / y)) - t));
double t_2 = ((x * y) - (z * t)) / a;
double tmp;
if (t_2 <= -2e+301) {
tmp = t_1;
} else if (t_2 <= 2e+295) {
tmp = ((x * y) / a) - ((z * t) / a);
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_1 = z / (a / ((x / (z / y)) - t))
t_2 = ((x * y) - (z * t)) / a
if (t_2 <= (-2d+301)) then
tmp = t_1
else if (t_2 <= 2d+295) then
tmp = ((x * y) / a) - ((z * t) / a)
else
tmp = t_1
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 = z / (a / ((x / (z / y)) - t));
double t_2 = ((x * y) - (z * t)) / a;
double tmp;
if (t_2 <= -2e+301) {
tmp = t_1;
} else if (t_2 <= 2e+295) {
tmp = ((x * y) / a) - ((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 = z / (a / ((x / (z / y)) - t)) t_2 = ((x * y) - (z * t)) / a tmp = 0 if t_2 <= -2e+301: tmp = t_1 elif t_2 <= 2e+295: tmp = ((x * y) / a) - ((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(z / Float64(a / Float64(Float64(x / Float64(z / y)) - t))) t_2 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a) tmp = 0.0 if (t_2 <= -2e+301) tmp = t_1; elseif (t_2 <= 2e+295) tmp = Float64(Float64(Float64(x * y) / a) - Float64(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 = z / (a / ((x / (z / y)) - t));
t_2 = ((x * y) - (z * t)) / a;
tmp = 0.0;
if (t_2 <= -2e+301)
tmp = t_1;
elseif (t_2 <= 2e+295)
tmp = ((x * y) / a) - ((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[(z / N[(a / N[(N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+301], t$95$1, If[LessEqual[t$95$2, 2e+295], N[(N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision] - N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{z}{\frac{a}{\frac{x}{\frac{z}{y}} - t}}\\
t_2 := \frac{x \cdot y - z \cdot t}{a}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+301}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+295}:\\
\;\;\;\;\frac{x \cdot y}{a} - \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < -2.00000000000000011e301 or 2e295 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 77.4%
Taylor expanded in z around inf
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6479.4%
Simplified79.4%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6485.6%
Applied egg-rr85.6%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6491.9%
Applied egg-rr91.9%
if -2.00000000000000011e301 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 2e295Initial program 99.1%
div-subN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6499.1%
Applied egg-rr99.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 (/ z y)) t) (/ z a))) (t_2 (/ (- (* x y) (* z t)) a)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 2e+295) (- (/ (* x y) a) (/ (* 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 = ((x / (z / y)) - t) * (z / a);
double t_2 = ((x * y) - (z * t)) / a;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2e+295) {
tmp = ((x * y) / a) - ((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 = ((x / (z / y)) - t) * (z / a);
double t_2 = ((x * y) - (z * t)) / a;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 2e+295) {
tmp = ((x * y) / a) - ((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 = ((x / (z / y)) - t) * (z / a) t_2 = ((x * y) - (z * t)) / a tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 2e+295: tmp = ((x * y) / a) - ((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(Float64(Float64(x / Float64(z / y)) - t) * Float64(z / a)) t_2 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2e+295) tmp = Float64(Float64(Float64(x * y) / a) - Float64(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 = ((x / (z / y)) - t) * (z / a);
t_2 = ((x * y) - (z * t)) / a;
tmp = 0.0;
if (t_2 <= -Inf)
tmp = t_1;
elseif (t_2 <= 2e+295)
tmp = ((x * y) / a) - ((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[(N[(N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+295], N[(N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision] - N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(\frac{x}{\frac{z}{y}} - t\right) \cdot \frac{z}{a}\\
t_2 := \frac{x \cdot y - z \cdot t}{a}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+295}:\\
\;\;\;\;\frac{x \cdot y}{a} - \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < -inf.0 or 2e295 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 77.4%
Taylor expanded in z around inf
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6479.4%
Simplified79.4%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6484.4%
Applied egg-rr84.4%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6490.7%
Applied egg-rr90.7%
if -inf.0 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 2e295Initial program 99.1%
div-subN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6499.1%
Applied egg-rr99.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 (/ z y)) t) (/ z a))) (t_2 (/ (- (* x y) (* z t)) a))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 2e+295) t_2 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 = ((x / (z / y)) - t) * (z / a);
double t_2 = ((x * y) - (z * t)) / a;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2e+295) {
tmp = t_2;
} 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 = ((x / (z / y)) - t) * (z / a);
double t_2 = ((x * y) - (z * t)) / a;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 2e+295) {
tmp = t_2;
} 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 = ((x / (z / y)) - t) * (z / a) t_2 = ((x * y) - (z * t)) / a tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 2e+295: tmp = t_2 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(Float64(Float64(x / Float64(z / y)) - t) * Float64(z / a)) t_2 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2e+295) tmp = t_2; 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 = ((x / (z / y)) - t) * (z / a);
t_2 = ((x * y) - (z * t)) / a;
tmp = 0.0;
if (t_2 <= -Inf)
tmp = t_1;
elseif (t_2 <= 2e+295)
tmp = t_2;
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[(N[(N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+295], t$95$2, t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(\frac{x}{\frac{z}{y}} - t\right) \cdot \frac{z}{a}\\
t_2 := \frac{x \cdot y - z \cdot t}{a}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+295}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < -inf.0 or 2e295 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 77.4%
Taylor expanded in z around inf
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6479.4%
Simplified79.4%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6484.4%
Applied egg-rr84.4%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6490.7%
Applied egg-rr90.7%
if -inf.0 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 2e295Initial program 99.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) (- INFINITY)) (* x (/ y a)) (if (<= (* x y) 1e+263) (/ (- (* x y) (* z t)) a) (/ x (/ a y)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = x * (y / a);
} else if ((x * y) <= 1e+263) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x / (a / y);
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = x * (y / a);
} else if ((x * y) <= 1e+263) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = x * (y / a) elif (x * y) <= 1e+263: tmp = ((x * y) - (z * t)) / a else: tmp = x / (a / y) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= 1e+263) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -Inf)
tmp = x * (y / a);
elseif ((x * y) <= 1e+263)
tmp = ((x * y) - (z * t)) / a;
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+263], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+263}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 66.0%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6471.9%
Simplified71.9%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6494.0%
Applied egg-rr94.0%
if -inf.0 < (*.f64 x y) < 1.00000000000000002e263Initial program 96.2%
if 1.00000000000000002e263 < (*.f64 x y) Initial program 59.3%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6463.1%
Simplified63.1%
clear-numN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
*-lowering-*.f64N/A
/-lowering-/.f6488.6%
Applied egg-rr88.6%
associate-*l/N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6491.8%
Applied egg-rr91.8%
Final simplification95.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) -5e-48) (* y (/ x a)) (if (<= (* x y) 4e-41) (/ (* z t) (- 0.0 a)) (/ y (/ a x)))))
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-48) {
tmp = y * (x / a);
} else if ((x * y) <= 4e-41) {
tmp = (z * t) / (0.0 - a);
} else {
tmp = y / (a / x);
}
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-48)) then
tmp = y * (x / a)
else if ((x * y) <= 4d-41) then
tmp = (z * t) / (0.0d0 - a)
else
tmp = y / (a / x)
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-48) {
tmp = y * (x / a);
} else if ((x * y) <= 4e-41) {
tmp = (z * t) / (0.0 - a);
} else {
tmp = y / (a / x);
}
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-48: tmp = y * (x / a) elif (x * y) <= 4e-41: tmp = (z * t) / (0.0 - a) else: tmp = y / (a / x) 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-48) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 4e-41) tmp = Float64(Float64(z * t) / Float64(0.0 - a)); else tmp = Float64(y / Float64(a / x)); 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-48)
tmp = y * (x / a);
elseif ((x * y) <= 4e-41)
tmp = (z * t) / (0.0 - a);
else
tmp = y / (a / x);
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-48], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e-41], N[(N[(z * t), $MachinePrecision] / N[(0.0 - a), $MachinePrecision]), $MachinePrecision], N[(y / N[(a / x), $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^{-48}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-41}:\\
\;\;\;\;\frac{z \cdot t}{0 - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999999e-48Initial program 89.0%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6469.8%
Simplified69.8%
clear-numN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
*-lowering-*.f64N/A
/-lowering-/.f6473.8%
Applied egg-rr73.8%
if -4.9999999999999999e-48 < (*.f64 x y) < 4.00000000000000002e-41Initial program 95.8%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6495.6%
Applied egg-rr95.6%
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-sub0N/A
--lowering--.f6488.4%
Simplified88.4%
sub0-negN/A
associate-*r*N/A
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
un-div-invN/A
/-lowering-/.f6487.7%
Applied egg-rr87.7%
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6488.5%
Applied egg-rr88.5%
if 4.00000000000000002e-41 < (*.f64 x y) Initial program 82.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6470.4%
Simplified70.4%
clear-numN/A
associate-/r*N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f6480.6%
Applied egg-rr80.6%
Final simplification82.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) -5e-48) (* y (/ x a)) (if (<= (* x y) 4e-41) (- 0.0 (* z (/ t a))) (/ y (/ a x)))))
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-48) {
tmp = y * (x / a);
} else if ((x * y) <= 4e-41) {
tmp = 0.0 - (z * (t / a));
} else {
tmp = y / (a / x);
}
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-48)) then
tmp = y * (x / a)
else if ((x * y) <= 4d-41) then
tmp = 0.0d0 - (z * (t / a))
else
tmp = y / (a / x)
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-48) {
tmp = y * (x / a);
} else if ((x * y) <= 4e-41) {
tmp = 0.0 - (z * (t / a));
} else {
tmp = y / (a / x);
}
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-48: tmp = y * (x / a) elif (x * y) <= 4e-41: tmp = 0.0 - (z * (t / a)) else: tmp = y / (a / x) 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-48) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 4e-41) tmp = Float64(0.0 - Float64(z * Float64(t / a))); else tmp = Float64(y / Float64(a / x)); 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-48)
tmp = y * (x / a);
elseif ((x * y) <= 4e-41)
tmp = 0.0 - (z * (t / a));
else
tmp = y / (a / x);
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-48], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e-41], N[(0.0 - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(a / x), $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^{-48}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-41}:\\
\;\;\;\;0 - z \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999999e-48Initial program 89.0%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6469.8%
Simplified69.8%
clear-numN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
*-lowering-*.f64N/A
/-lowering-/.f6473.8%
Applied egg-rr73.8%
if -4.9999999999999999e-48 < (*.f64 x y) < 4.00000000000000002e-41Initial program 95.8%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6495.6%
Applied egg-rr95.6%
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-sub0N/A
--lowering--.f6488.4%
Simplified88.4%
sub0-negN/A
associate-*r*N/A
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
un-div-invN/A
/-lowering-/.f6487.7%
Applied egg-rr87.7%
if 4.00000000000000002e-41 < (*.f64 x y) Initial program 82.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6470.4%
Simplified70.4%
clear-numN/A
associate-/r*N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f6480.6%
Applied egg-rr80.6%
Final simplification81.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 (/ a x)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return y / (a / x);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = y / (a / x)
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return y / (a / x);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return y / (a / x)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(y / Float64(a / x)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = y / (a / x);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\frac{y}{\frac{a}{x}}
\end{array}
Initial program 90.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
*-lowering-*.f6449.7%
Simplified49.7%
clear-numN/A
associate-/r*N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f6453.7%
Applied egg-rr53.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 (* 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.7%
Simplified49.7%
clear-numN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
*-lowering-*.f64N/A
/-lowering-/.f6453.4%
Applied egg-rr53.4%
Final simplification53.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024155
(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))