
(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 11 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}
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= a_m 7e+38)
(/ (fma x y (* z (- t))) a_m)
(fma (/ y (sqrt a_m)) (/ x (sqrt a_m)) (* (/ t a_m) (- z))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (a_m <= 7e+38) {
tmp = fma(x, y, (z * -t)) / a_m;
} else {
tmp = fma((y / sqrt(a_m)), (x / sqrt(a_m)), ((t / a_m) * -z));
}
return a_s * tmp;
}
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (a_m <= 7e+38) tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m); else tmp = fma(Float64(y / sqrt(a_m)), Float64(x / sqrt(a_m)), Float64(Float64(t / a_m) * Float64(-z))); end return Float64(a_s * tmp) end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 7e+38], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(y / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision] * N[(x / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision] + N[(N[(t / a$95$m), $MachinePrecision] * (-z)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 7 \cdot 10^{+38}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{\sqrt{a\_m}}, \frac{x}{\sqrt{a\_m}}, \frac{t}{a\_m} \cdot \left(-z\right)\right)\\
\end{array}
\end{array}
if a < 7.00000000000000003e38Initial program 93.4%
div-sub91.0%
*-commutative91.0%
div-sub93.4%
*-commutative93.4%
fma-neg93.9%
distribute-rgt-neg-out93.9%
Simplified93.9%
if 7.00000000000000003e38 < a Initial program 79.0%
div-sub79.0%
*-commutative79.0%
add-sqr-sqrt78.9%
times-frac88.2%
fma-neg88.2%
associate-/l*95.3%
Applied egg-rr95.3%
Final simplification94.1%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= a_m 1e+44)
(/ (fma x y (* z (- t))) a_m)
(- (* x (/ y a_m)) (* z (/ t a_m))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (a_m <= 1e+44) {
tmp = fma(x, y, (z * -t)) / a_m;
} else {
tmp = (x * (y / a_m)) - (z * (t / a_m));
}
return a_s * tmp;
}
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (a_m <= 1e+44) tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m); else tmp = Float64(Float64(x * Float64(y / a_m)) - Float64(z * Float64(t / a_m))); end return Float64(a_s * tmp) end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 1e+44], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 10^{+44}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m} - z \cdot \frac{t}{a\_m}\\
\end{array}
\end{array}
if a < 1.0000000000000001e44Initial program 93.4%
div-sub91.0%
*-commutative91.0%
div-sub93.4%
*-commutative93.4%
fma-neg93.9%
distribute-rgt-neg-out93.9%
Simplified93.9%
if 1.0000000000000001e44 < a Initial program 79.0%
div-sub79.0%
associate-/l*91.6%
associate-/l*98.7%
Applied egg-rr98.7%
Final simplification94.8%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(let* ((t_1 (/ t (/ a_m (- z)))))
(*
a_s
(if (<= (* x y) -4e+72)
(* y (/ x a_m))
(if (<= (* x y) 5e-57)
t_1
(if (<= (* x y) 1e+79)
(/ (* x y) a_m)
(if (<= (* x y) 2e+148) t_1 (/ y (/ a_m x)))))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double t_1 = t / (a_m / -z);
double tmp;
if ((x * y) <= -4e+72) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-57) {
tmp = t_1;
} else if ((x * y) <= 1e+79) {
tmp = (x * y) / a_m;
} else if ((x * y) <= 2e+148) {
tmp = t_1;
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: t_1
real(8) :: tmp
t_1 = t / (a_m / -z)
if ((x * y) <= (-4d+72)) then
tmp = y * (x / a_m)
else if ((x * y) <= 5d-57) then
tmp = t_1
else if ((x * y) <= 1d+79) then
tmp = (x * y) / a_m
else if ((x * y) <= 2d+148) then
tmp = t_1
else
tmp = y / (a_m / x)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double t_1 = t / (a_m / -z);
double tmp;
if ((x * y) <= -4e+72) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-57) {
tmp = t_1;
} else if ((x * y) <= 1e+79) {
tmp = (x * y) / a_m;
} else if ((x * y) <= 2e+148) {
tmp = t_1;
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): t_1 = t / (a_m / -z) tmp = 0 if (x * y) <= -4e+72: tmp = y * (x / a_m) elif (x * y) <= 5e-57: tmp = t_1 elif (x * y) <= 1e+79: tmp = (x * y) / a_m elif (x * y) <= 2e+148: tmp = t_1 else: tmp = y / (a_m / x) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) t_1 = Float64(t / Float64(a_m / Float64(-z))) tmp = 0.0 if (Float64(x * y) <= -4e+72) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 5e-57) tmp = t_1; elseif (Float64(x * y) <= 1e+79) tmp = Float64(Float64(x * y) / a_m); elseif (Float64(x * y) <= 2e+148) tmp = t_1; else tmp = Float64(y / Float64(a_m / x)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
t_1 = t / (a_m / -z);
tmp = 0.0;
if ((x * y) <= -4e+72)
tmp = y * (x / a_m);
elseif ((x * y) <= 5e-57)
tmp = t_1;
elseif ((x * y) <= 1e+79)
tmp = (x * y) / a_m;
elseif ((x * y) <= 2e+148)
tmp = t_1;
else
tmp = y / (a_m / x);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := Block[{t$95$1 = N[(t / N[(a$95$m / (-z)), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -4e+72], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-57], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e+79], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+148], t$95$1, N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := \frac{t}{\frac{a\_m}{-z}}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+72}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{+79}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+148}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\end{array}
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999978e72Initial program 88.6%
Taylor expanded in x around inf 75.0%
associate-*r/78.7%
Simplified78.7%
clear-num78.7%
un-div-inv78.8%
Applied egg-rr78.8%
associate-/r/79.1%
Simplified79.1%
if -3.99999999999999978e72 < (*.f64 x y) < 5.0000000000000002e-57 or 9.99999999999999967e78 < (*.f64 x y) < 2.0000000000000001e148Initial program 94.3%
Taylor expanded in x around 0 80.6%
mul-1-neg80.6%
associate-/l*80.8%
distribute-rgt-neg-in80.8%
distribute-neg-frac280.8%
Simplified80.8%
distribute-frac-neg280.8%
distribute-rgt-neg-out80.8%
add-sqr-sqrt38.6%
sqrt-unprod36.3%
sqr-neg36.3%
sqrt-unprod5.6%
add-sqr-sqrt9.1%
clear-num9.1%
un-div-inv9.1%
add-sqr-sqrt5.6%
sqrt-unprod36.4%
sqr-neg36.4%
sqrt-unprod38.7%
add-sqr-sqrt80.7%
Applied egg-rr80.7%
if 5.0000000000000002e-57 < (*.f64 x y) < 9.99999999999999967e78Initial program 99.8%
Taylor expanded in x around inf 63.0%
if 2.0000000000000001e148 < (*.f64 x y) Initial program 75.4%
Taylor expanded in x around inf 64.9%
associate-*r/89.3%
Simplified89.3%
associate-*r/64.9%
*-commutative64.9%
add-sqr-sqrt37.6%
frac-times48.7%
clear-num48.6%
un-div-inv48.7%
Applied egg-rr48.7%
associate-/r*48.8%
associate-*r/48.8%
rem-square-sqrt89.4%
Simplified89.4%
Final simplification80.1%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* x y) -4e+72)
(* y (/ x a_m))
(if (<= (* x y) 5e-57)
(/ t (/ a_m (- z)))
(if (<= (* x y) 2e+44)
(/ (* x y) a_m)
(if (<= (* x y) 2e+148) (* (/ t a_m) (- z)) (/ y (/ a_m x))))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -4e+72) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-57) {
tmp = t / (a_m / -z);
} else if ((x * y) <= 2e+44) {
tmp = (x * y) / a_m;
} else if ((x * y) <= 2e+148) {
tmp = (t / a_m) * -z;
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if ((x * y) <= (-4d+72)) then
tmp = y * (x / a_m)
else if ((x * y) <= 5d-57) then
tmp = t / (a_m / -z)
else if ((x * y) <= 2d+44) then
tmp = (x * y) / a_m
else if ((x * y) <= 2d+148) then
tmp = (t / a_m) * -z
else
tmp = y / (a_m / x)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -4e+72) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-57) {
tmp = t / (a_m / -z);
} else if ((x * y) <= 2e+44) {
tmp = (x * y) / a_m;
} else if ((x * y) <= 2e+148) {
tmp = (t / a_m) * -z;
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= -4e+72: tmp = y * (x / a_m) elif (x * y) <= 5e-57: tmp = t / (a_m / -z) elif (x * y) <= 2e+44: tmp = (x * y) / a_m elif (x * y) <= 2e+148: tmp = (t / a_m) * -z else: tmp = y / (a_m / x) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= -4e+72) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 5e-57) tmp = Float64(t / Float64(a_m / Float64(-z))); elseif (Float64(x * y) <= 2e+44) tmp = Float64(Float64(x * y) / a_m); elseif (Float64(x * y) <= 2e+148) tmp = Float64(Float64(t / a_m) * Float64(-z)); else tmp = Float64(y / Float64(a_m / x)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= -4e+72)
tmp = y * (x / a_m);
elseif ((x * y) <= 5e-57)
tmp = t / (a_m / -z);
elseif ((x * y) <= 2e+44)
tmp = (x * y) / a_m;
elseif ((x * y) <= 2e+148)
tmp = (t / a_m) * -z;
else
tmp = y / (a_m / x);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -4e+72], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-57], N[(t / N[(a$95$m / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+44], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+148], N[(N[(t / a$95$m), $MachinePrecision] * (-z)), $MachinePrecision], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+72}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-57}:\\
\;\;\;\;\frac{t}{\frac{a\_m}{-z}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+44}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+148}:\\
\;\;\;\;\frac{t}{a\_m} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999978e72Initial program 88.6%
Taylor expanded in x around inf 75.0%
associate-*r/78.7%
Simplified78.7%
clear-num78.7%
un-div-inv78.8%
Applied egg-rr78.8%
associate-/r/79.1%
Simplified79.1%
if -3.99999999999999978e72 < (*.f64 x y) < 5.0000000000000002e-57Initial program 94.8%
Taylor expanded in x around 0 81.2%
mul-1-neg81.2%
associate-/l*80.7%
distribute-rgt-neg-in80.7%
distribute-neg-frac280.7%
Simplified80.7%
distribute-frac-neg280.7%
distribute-rgt-neg-out80.7%
add-sqr-sqrt38.1%
sqrt-unprod36.4%
sqr-neg36.4%
sqrt-unprod5.8%
add-sqr-sqrt9.4%
clear-num9.5%
un-div-inv9.5%
add-sqr-sqrt5.8%
sqrt-unprod36.4%
sqr-neg36.4%
sqrt-unprod38.2%
add-sqr-sqrt80.6%
Applied egg-rr80.6%
if 5.0000000000000002e-57 < (*.f64 x y) < 2.0000000000000002e44Initial program 99.8%
Taylor expanded in x around inf 65.6%
if 2.0000000000000002e44 < (*.f64 x y) < 2.0000000000000001e148Initial program 90.4%
Taylor expanded in x around 0 61.3%
*-commutative61.3%
associate-*r/71.0%
neg-mul-171.0%
distribute-rgt-neg-in71.0%
distribute-frac-neg71.0%
Simplified71.0%
if 2.0000000000000001e148 < (*.f64 x y) Initial program 75.4%
Taylor expanded in x around inf 64.9%
associate-*r/89.3%
Simplified89.3%
associate-*r/64.9%
*-commutative64.9%
add-sqr-sqrt37.6%
frac-times48.7%
clear-num48.6%
un-div-inv48.7%
Applied egg-rr48.7%
associate-/r*48.8%
associate-*r/48.8%
rem-square-sqrt89.4%
Simplified89.4%
Final simplification80.2%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* x y) -4e+72)
(* y (/ x a_m))
(if (<= (* x y) 5e-57)
(/ (* z (- t)) a_m)
(if (<= (* x y) 2e+44)
(/ (* x y) a_m)
(if (<= (* x y) 2e+148) (* (/ t a_m) (- z)) (/ y (/ a_m x))))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -4e+72) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-57) {
tmp = (z * -t) / a_m;
} else if ((x * y) <= 2e+44) {
tmp = (x * y) / a_m;
} else if ((x * y) <= 2e+148) {
tmp = (t / a_m) * -z;
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if ((x * y) <= (-4d+72)) then
tmp = y * (x / a_m)
else if ((x * y) <= 5d-57) then
tmp = (z * -t) / a_m
else if ((x * y) <= 2d+44) then
tmp = (x * y) / a_m
else if ((x * y) <= 2d+148) then
tmp = (t / a_m) * -z
else
tmp = y / (a_m / x)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -4e+72) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-57) {
tmp = (z * -t) / a_m;
} else if ((x * y) <= 2e+44) {
tmp = (x * y) / a_m;
} else if ((x * y) <= 2e+148) {
tmp = (t / a_m) * -z;
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= -4e+72: tmp = y * (x / a_m) elif (x * y) <= 5e-57: tmp = (z * -t) / a_m elif (x * y) <= 2e+44: tmp = (x * y) / a_m elif (x * y) <= 2e+148: tmp = (t / a_m) * -z else: tmp = y / (a_m / x) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= -4e+72) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 5e-57) tmp = Float64(Float64(z * Float64(-t)) / a_m); elseif (Float64(x * y) <= 2e+44) tmp = Float64(Float64(x * y) / a_m); elseif (Float64(x * y) <= 2e+148) tmp = Float64(Float64(t / a_m) * Float64(-z)); else tmp = Float64(y / Float64(a_m / x)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= -4e+72)
tmp = y * (x / a_m);
elseif ((x * y) <= 5e-57)
tmp = (z * -t) / a_m;
elseif ((x * y) <= 2e+44)
tmp = (x * y) / a_m;
elseif ((x * y) <= 2e+148)
tmp = (t / a_m) * -z;
else
tmp = y / (a_m / x);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -4e+72], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-57], N[(N[(z * (-t)), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+44], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+148], N[(N[(t / a$95$m), $MachinePrecision] * (-z)), $MachinePrecision], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+72}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-57}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+44}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+148}:\\
\;\;\;\;\frac{t}{a\_m} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999978e72Initial program 88.6%
Taylor expanded in x around inf 75.0%
associate-*r/78.7%
Simplified78.7%
clear-num78.7%
un-div-inv78.8%
Applied egg-rr78.8%
associate-/r/79.1%
Simplified79.1%
if -3.99999999999999978e72 < (*.f64 x y) < 5.0000000000000002e-57Initial program 94.8%
Taylor expanded in x around 0 81.2%
associate-*r*81.2%
mul-1-neg81.2%
Simplified81.2%
if 5.0000000000000002e-57 < (*.f64 x y) < 2.0000000000000002e44Initial program 99.8%
Taylor expanded in x around inf 65.6%
if 2.0000000000000002e44 < (*.f64 x y) < 2.0000000000000001e148Initial program 90.4%
Taylor expanded in x around 0 61.3%
*-commutative61.3%
associate-*r/71.0%
neg-mul-171.0%
distribute-rgt-neg-in71.0%
distribute-frac-neg71.0%
Simplified71.0%
if 2.0000000000000001e148 < (*.f64 x y) Initial program 75.4%
Taylor expanded in x around inf 64.9%
associate-*r/89.3%
Simplified89.3%
associate-*r/64.9%
*-commutative64.9%
add-sqr-sqrt37.6%
frac-times48.7%
clear-num48.6%
un-div-inv48.7%
Applied egg-rr48.7%
associate-/r*48.8%
associate-*r/48.8%
rem-square-sqrt89.4%
Simplified89.4%
Final simplification80.5%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (let* ((t_1 (- (* x y) (* z t)))) (* a_s (if (<= t_1 2e+286) (/ t_1 a_m) (* y (/ (- x (/ (* z t) y)) a_m))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= 2e+286) {
tmp = t_1 / a_m;
} else {
tmp = y * ((x - ((z * t) / y)) / a_m);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if (t_1 <= 2d+286) then
tmp = t_1 / a_m
else
tmp = y * ((x - ((z * t) / y)) / a_m)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= 2e+286) {
tmp = t_1 / a_m;
} else {
tmp = y * ((x - ((z * t) / y)) / a_m);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= 2e+286: tmp = t_1 / a_m else: tmp = y * ((x - ((z * t) / y)) / a_m) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= 2e+286) tmp = Float64(t_1 / a_m); else tmp = Float64(y * Float64(Float64(x - Float64(Float64(z * t) / y)) / a_m)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= 2e+286)
tmp = t_1 / a_m;
else
tmp = y * ((x - ((z * t) / y)) / a_m);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 2e+286], N[(t$95$1 / a$95$m), $MachinePrecision], N[(y * N[(N[(x - N[(N[(z * t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+286}:\\
\;\;\;\;\frac{t\_1}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x - \frac{z \cdot t}{y}}{a\_m}\\
\end{array}
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < 2.00000000000000007e286Initial program 95.0%
if 2.00000000000000007e286 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 62.3%
div-sub59.5%
*-commutative59.5%
add-sqr-sqrt32.5%
times-frac45.8%
fma-neg45.8%
associate-/l*48.5%
Applied egg-rr48.5%
Taylor expanded in y around inf 91.5%
+-commutative91.5%
mul-1-neg91.5%
*-commutative91.5%
times-frac91.4%
sub-neg91.4%
associate-*l/97.1%
/-rgt-identity97.1%
times-frac94.5%
*-commutative94.5%
*-lft-identity94.5%
div-sub94.5%
Simplified94.5%
Final simplification95.0%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (if (<= (* x y) 2e+277) (/ (- (* x y) (* z t)) a_m) (/ x (/ a_m y)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= 2e+277) {
tmp = ((x * y) - (z * t)) / a_m;
} else {
tmp = x / (a_m / y);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if ((x * y) <= 2d+277) then
tmp = ((x * y) - (z * t)) / a_m
else
tmp = x / (a_m / y)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= 2e+277) {
tmp = ((x * y) - (z * t)) / a_m;
} else {
tmp = x / (a_m / y);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= 2e+277: tmp = ((x * y) - (z * t)) / a_m else: tmp = x / (a_m / y) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= 2e+277) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m); else tmp = Float64(x / Float64(a_m / y)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= 2e+277)
tmp = ((x * y) - (z * t)) / a_m;
else
tmp = x / (a_m / y);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], 2e+277], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq 2 \cdot 10^{+277}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < 2.00000000000000001e277Initial program 94.1%
if 2.00000000000000001e277 < (*.f64 x y) Initial program 50.9%
Taylor expanded in x around inf 50.9%
associate-*r/99.8%
Simplified99.8%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification94.6%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= a_m 2e+37)
(/ (- (* x y) (* z t)) a_m)
(- (* x (/ y a_m)) (* z (/ t a_m))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (a_m <= 2e+37) {
tmp = ((x * y) - (z * t)) / a_m;
} else {
tmp = (x * (y / a_m)) - (z * (t / a_m));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if (a_m <= 2d+37) then
tmp = ((x * y) - (z * t)) / a_m
else
tmp = (x * (y / a_m)) - (z * (t / a_m))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (a_m <= 2e+37) {
tmp = ((x * y) - (z * t)) / a_m;
} else {
tmp = (x * (y / a_m)) - (z * (t / a_m));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if a_m <= 2e+37: tmp = ((x * y) - (z * t)) / a_m else: tmp = (x * (y / a_m)) - (z * (t / a_m)) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (a_m <= 2e+37) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m); else tmp = Float64(Float64(x * Float64(y / a_m)) - Float64(z * Float64(t / a_m))); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if (a_m <= 2e+37)
tmp = ((x * y) - (z * t)) / a_m;
else
tmp = (x * (y / a_m)) - (z * (t / a_m));
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 2e+37], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 2 \cdot 10^{+37}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m} - z \cdot \frac{t}{a\_m}\\
\end{array}
\end{array}
if a < 1.99999999999999991e37Initial program 93.4%
if 1.99999999999999991e37 < a Initial program 79.0%
div-sub79.0%
associate-/l*91.6%
associate-/l*98.7%
Applied egg-rr98.7%
Final simplification94.4%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (if (<= z -5000.0) (* x (/ y a_m)) (* y (/ x a_m)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (z <= -5000.0) {
tmp = x * (y / a_m);
} else {
tmp = y * (x / a_m);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if (z <= (-5000.0d0)) then
tmp = x * (y / a_m)
else
tmp = y * (x / a_m)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (z <= -5000.0) {
tmp = x * (y / a_m);
} else {
tmp = y * (x / a_m);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if z <= -5000.0: tmp = x * (y / a_m) else: tmp = y * (x / a_m) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (z <= -5000.0) tmp = Float64(x * Float64(y / a_m)); else tmp = Float64(y * Float64(x / a_m)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if (z <= -5000.0)
tmp = x * (y / a_m);
else
tmp = y * (x / a_m);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[z, -5000.0], N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -5000:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\end{array}
\end{array}
if z < -5e3Initial program 88.3%
Taylor expanded in x around inf 31.7%
associate-*r/34.5%
Simplified34.5%
if -5e3 < z Initial program 91.3%
Taylor expanded in x around inf 48.4%
associate-*r/53.8%
Simplified53.8%
clear-num53.5%
un-div-inv53.5%
Applied egg-rr53.5%
associate-/r/51.0%
Simplified51.0%
Final simplification46.8%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (if (<= z -205000.0) (* x (/ y a_m)) (/ y (/ a_m x)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (z <= -205000.0) {
tmp = x * (y / a_m);
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if (z <= (-205000.0d0)) then
tmp = x * (y / a_m)
else
tmp = y / (a_m / x)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (z <= -205000.0) {
tmp = x * (y / a_m);
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if z <= -205000.0: tmp = x * (y / a_m) else: tmp = y / (a_m / x) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (z <= -205000.0) tmp = Float64(x * Float64(y / a_m)); else tmp = Float64(y / Float64(a_m / x)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if (z <= -205000.0)
tmp = x * (y / a_m);
else
tmp = y / (a_m / x);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[z, -205000.0], N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -205000:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\end{array}
\end{array}
if z < -205000Initial program 88.3%
Taylor expanded in x around inf 31.7%
associate-*r/34.5%
Simplified34.5%
if -205000 < z Initial program 91.3%
Taylor expanded in x around inf 48.4%
associate-*r/53.8%
Simplified53.8%
associate-*r/48.4%
*-commutative48.4%
add-sqr-sqrt24.6%
frac-times26.5%
clear-num26.5%
un-div-inv26.5%
Applied egg-rr26.5%
associate-/r*25.6%
associate-*r/25.6%
rem-square-sqrt51.0%
Simplified51.0%
Final simplification46.8%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (* x (/ y a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
return a_s * (x * (y / a_m));
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
code = a_s * (x * (y / a_m))
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
return a_s * (x * (y / a_m));
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): return a_s * (x * (y / a_m))
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) return Float64(a_s * Float64(x * Float64(y / a_m))) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp = code(a_s, x, y, z, t, a_m)
tmp = a_s * (x * (y / a_m));
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(x \cdot \frac{y}{a\_m}\right)
\end{array}
Initial program 90.6%
Taylor expanded in x around inf 44.2%
associate-*r/48.9%
Simplified48.9%
Final simplification48.9%
(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 2024071
(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))