
(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.
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 8.4e+68)
(/ (- (* x y) (* z t)) a_m)
(fma (/ y a_m) x (* z (/ t (- a_m)))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 <= 8.4e+68) {
tmp = ((x * y) - (z * t)) / a_m;
} else {
tmp = fma((y / a_m), x, (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]) 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 <= 8.4e+68) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m); else tmp = fma(Float64(y / a_m), x, Float64(z * Float64(t / Float64(-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.
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, 8.4e+68], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(y / a$95$m), $MachinePrecision] * x + 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])\\\\
[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 8.4 \cdot 10^{+68}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a\_m}, x, z \cdot \frac{t}{-a\_m}\right)\\
\end{array}
\end{array}
if a < 8.40000000000000003e68Initial program 91.7%
if 8.40000000000000003e68 < a Initial program 86.2%
lift-*.f64N/A
lift-*.f64N/A
div-subN/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-/.f6490.4
Applied egg-rr90.4%
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
+-commutativeN/A
lift-neg.f64N/A
cancel-sign-sub-invN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
cancel-sign-sub-invN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6497.4
Applied egg-rr97.4%
Final simplification92.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.
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 t) (- INFINITY))
(- (/ z (/ a_m t)))
(if (<= (* z t) 2e+188) (/ (- (* x y) (* z t)) a_m) (* t (/ z (- a_m)))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 * t) <= -((double) INFINITY)) {
tmp = -(z / (a_m / t));
} else if ((z * t) <= 2e+188) {
tmp = ((x * y) - (z * t)) / a_m;
} else {
tmp = t * (z / -a_m);
}
return a_s * tmp;
}
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
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 * t) <= -Double.POSITIVE_INFINITY) {
tmp = -(z / (a_m / t));
} else if ((z * t) <= 2e+188) {
tmp = ((x * y) - (z * t)) / a_m;
} else {
tmp = t * (z / -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]) [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 * t) <= -math.inf: tmp = -(z / (a_m / t)) elif (z * t) <= 2e+188: tmp = ((x * y) - (z * t)) / a_m else: tmp = t * (z / -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]) 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(z * t) <= Float64(-Inf)) tmp = Float64(-Float64(z / Float64(a_m / t))); elseif (Float64(z * t) <= 2e+188) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m); else tmp = Float64(t * Float64(z / Float64(-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])){:}
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 * t) <= -Inf)
tmp = -(z / (a_m / t));
elseif ((z * t) <= 2e+188)
tmp = ((x * y) - (z * t)) / a_m;
else
tmp = t * (z / -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.
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[(z * t), $MachinePrecision], (-Infinity)], (-N[(z / N[(a$95$m / t), $MachinePrecision]), $MachinePrecision]), If[LessEqual[N[(z * t), $MachinePrecision], 2e+188], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(t * N[(z / (-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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;-\frac{z}{\frac{a\_m}{t}}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+188}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{z}{-a\_m}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 57.0%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6457.0
Simplified57.0%
lift-neg.f64N/A
*-commutativeN/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied egg-rr99.9%
if -inf.0 < (*.f64 z t) < 2e188Initial program 95.2%
if 2e188 < (*.f64 z t) Initial program 75.0%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6475.0
Simplified75.0%
lift-neg.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
lower-neg.f64N/A
lower-/.f6492.6
Applied egg-rr92.6%
Final simplification95.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.
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) -50000000000000.0)
(* y (/ x a_m))
(if (<= (* x y) 2e-23) (- (/ z (/ a_m t))) (/ x (/ a_m y))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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) <= -50000000000000.0) {
tmp = y * (x / a_m);
} else if ((x * y) <= 2e-23) {
tmp = -(z / (a_m / t));
} 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.
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) <= (-50000000000000.0d0)) then
tmp = y * (x / a_m)
else if ((x * y) <= 2d-23) then
tmp = -(z / (a_m / t))
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;
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) <= -50000000000000.0) {
tmp = y * (x / a_m);
} else if ((x * y) <= 2e-23) {
tmp = -(z / (a_m / t));
} 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]) [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) <= -50000000000000.0: tmp = y * (x / a_m) elif (x * y) <= 2e-23: tmp = -(z / (a_m / t)) 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]) 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) <= -50000000000000.0) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 2e-23) tmp = Float64(-Float64(z / Float64(a_m / t))); 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])){:}
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) <= -50000000000000.0)
tmp = y * (x / a_m);
elseif ((x * y) <= 2e-23)
tmp = -(z / (a_m / t));
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.
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], -50000000000000.0], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-23], (-N[(z / N[(a$95$m / t), $MachinePrecision]), $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])\\\\
[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 -50000000000000:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-23}:\\
\;\;\;\;-\frac{z}{\frac{a\_m}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -5e13Initial program 88.9%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6481.3
Simplified81.3%
associate-*l/N/A
lift-/.f64N/A
lower-*.f6484.3
Applied egg-rr84.3%
if -5e13 < (*.f64 x y) < 1.99999999999999992e-23Initial program 90.8%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6474.2
Simplified74.2%
lift-neg.f64N/A
*-commutativeN/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6477.6
Applied egg-rr77.6%
if 1.99999999999999992e-23 < (*.f64 x y) Initial program 92.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6479.6
Simplified79.6%
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6474.3
Applied egg-rr74.3%
Final simplification78.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.
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) (- INFINITY))
(* x (* y (/ 1.0 a_m)))
(fma (- t) (/ z a_m) (/ (* x y) a_m)))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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) <= -((double) INFINITY)) {
tmp = x * (y * (1.0 / a_m));
} else {
tmp = fma(-t, (z / a_m), ((x * 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]) 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) <= Float64(-Inf)) tmp = Float64(x * Float64(y * Float64(1.0 / a_m))); else tmp = fma(Float64(-t), Float64(z / a_m), Float64(Float64(x * y) / 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.
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], (-Infinity)], N[(x * N[(y * N[(1.0 / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-t) * N[(z / a$95$m), $MachinePrecision] + N[(N[(x * y), $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])\\\\
[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 -\infty:\\
\;\;\;\;x \cdot \left(y \cdot \frac{1}{a\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{z}{a\_m}, \frac{x \cdot y}{a\_m}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 71.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6471.8
Simplified71.8%
associate-*l/N/A
div-invN/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6499.8
Applied egg-rr99.8%
if -inf.0 < (*.f64 x y) Initial program 92.5%
lift-*.f64N/A
lift-*.f64N/A
div-subN/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-/.f6494.4
Applied egg-rr94.4%
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.
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) -50000000000000.0)
(* y (/ x a_m))
(if (<= (* x y) 2e-23) (* 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);
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) <= -50000000000000.0) {
tmp = y * (x / a_m);
} else if ((x * y) <= 2e-23) {
tmp = 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.
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) <= (-50000000000000.0d0)) then
tmp = y * (x / a_m)
else if ((x * y) <= 2d-23) then
tmp = 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;
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) <= -50000000000000.0) {
tmp = y * (x / a_m);
} else if ((x * y) <= 2e-23) {
tmp = 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]) [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) <= -50000000000000.0: tmp = y * (x / a_m) elif (x * y) <= 2e-23: tmp = 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]) 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) <= -50000000000000.0) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 2e-23) tmp = Float64(z * Float64(t / Float64(-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])){:}
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) <= -50000000000000.0)
tmp = y * (x / a_m);
elseif ((x * y) <= 2e-23)
tmp = 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.
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], -50000000000000.0], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-23], N[(z * N[(t / (-a$95$m)), $MachinePrecision]), $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])\\\\
[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 -50000000000000:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-23}:\\
\;\;\;\;z \cdot \frac{t}{-a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -5e13Initial program 88.9%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6481.3
Simplified81.3%
associate-*l/N/A
lift-/.f64N/A
lower-*.f6484.3
Applied egg-rr84.3%
if -5e13 < (*.f64 x y) < 1.99999999999999992e-23Initial program 90.8%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6474.2
Simplified74.2%
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
associate-*l/N/A
distribute-neg-fracN/A
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f6477.7
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-neg.f6477.7
Applied egg-rr77.7%
if 1.99999999999999992e-23 < (*.f64 x y) Initial program 92.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6479.6
Simplified79.6%
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6474.3
Applied egg-rr74.3%
Final simplification78.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.
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 (<= t 7.2e-50)
(fma (/ y a_m) x (- (/ (* z t) a_m)))
(fma (- t) (/ z a_m) (/ (* x y) a_m)))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 (t <= 7.2e-50) {
tmp = fma((y / a_m), x, -((z * t) / a_m));
} else {
tmp = fma(-t, (z / a_m), ((x * 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]) 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 (t <= 7.2e-50) tmp = fma(Float64(y / a_m), x, Float64(-Float64(Float64(z * t) / a_m))); else tmp = fma(Float64(-t), Float64(z / a_m), Float64(Float64(x * y) / 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.
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[t, 7.2e-50], N[(N[(y / a$95$m), $MachinePrecision] * x + (-N[(N[(z * t), $MachinePrecision] / a$95$m), $MachinePrecision])), $MachinePrecision], N[((-t) * N[(z / a$95$m), $MachinePrecision] + N[(N[(x * y), $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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 7.2 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a\_m}, x, -\frac{z \cdot t}{a\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{z}{a\_m}, \frac{x \cdot y}{a\_m}\right)\\
\end{array}
\end{array}
if t < 7.19999999999999958e-50Initial program 92.7%
lift-*.f64N/A
lift-*.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6491.0
Applied egg-rr91.0%
if 7.19999999999999958e-50 < t Initial program 86.6%
lift-*.f64N/A
lift-*.f64N/A
div-subN/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-/.f6492.6
Applied egg-rr92.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.
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 5e-114)
(/ (- (* x y) (* z t)) a_m)
(fma (- z) (/ t a_m) (/ (* x y) a_m)))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 <= 5e-114) {
tmp = ((x * y) - (z * t)) / a_m;
} else {
tmp = fma(-z, (t / a_m), ((x * 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]) 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 <= 5e-114) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m); else tmp = fma(Float64(-z), Float64(t / a_m), Float64(Float64(x * y) / 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.
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, 5e-114], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[((-z) * N[(t / a$95$m), $MachinePrecision] + N[(N[(x * y), $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])\\\\
[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 5 \cdot 10^{-114}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{t}{a\_m}, \frac{x \cdot y}{a\_m}\right)\\
\end{array}
\end{array}
if a < 4.99999999999999989e-114Initial program 90.3%
if 4.99999999999999989e-114 < a Initial program 91.9%
lift-*.f64N/A
lift-*.f64N/A
div-subN/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-/.f6497.4
Applied egg-rr97.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.
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) -50000000000000.0)
(* y (/ x a_m))
(if (<= (* x y) 2e-23) (* z (/ t (- a_m))) (* x (/ y a_m))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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) <= -50000000000000.0) {
tmp = y * (x / a_m);
} else if ((x * y) <= 2e-23) {
tmp = z * (t / -a_m);
} else {
tmp = x * (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.
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) <= (-50000000000000.0d0)) then
tmp = y * (x / a_m)
else if ((x * y) <= 2d-23) then
tmp = z * (t / -a_m)
else
tmp = x * (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;
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) <= -50000000000000.0) {
tmp = y * (x / a_m);
} else if ((x * y) <= 2e-23) {
tmp = z * (t / -a_m);
} else {
tmp = x * (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]) [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) <= -50000000000000.0: tmp = y * (x / a_m) elif (x * y) <= 2e-23: tmp = z * (t / -a_m) else: tmp = x * (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]) 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) <= -50000000000000.0) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 2e-23) tmp = Float64(z * Float64(t / Float64(-a_m))); else tmp = Float64(x * Float64(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])){:}
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) <= -50000000000000.0)
tmp = y * (x / a_m);
elseif ((x * y) <= 2e-23)
tmp = z * (t / -a_m);
else
tmp = x * (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.
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], -50000000000000.0], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-23], N[(z * N[(t / (-a$95$m)), $MachinePrecision]), $MachinePrecision], 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])\\\\
[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 -50000000000000:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-23}:\\
\;\;\;\;z \cdot \frac{t}{-a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\end{array}
\end{array}
if (*.f64 x y) < -5e13Initial program 88.9%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6481.3
Simplified81.3%
associate-*l/N/A
lift-/.f64N/A
lower-*.f6484.3
Applied egg-rr84.3%
if -5e13 < (*.f64 x y) < 1.99999999999999992e-23Initial program 90.8%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6474.2
Simplified74.2%
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
associate-*l/N/A
distribute-neg-fracN/A
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f6477.7
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-neg.f6477.7
Applied egg-rr77.7%
if 1.99999999999999992e-23 < (*.f64 x y) Initial program 92.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6479.6
Simplified79.6%
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.3
Applied egg-rr75.3%
Final simplification78.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.
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) -50000000000000.0)
(* y (/ x a_m))
(if (<= (* x y) 2e-23) (* t (/ z (- a_m))) (* x (/ y a_m))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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) <= -50000000000000.0) {
tmp = y * (x / a_m);
} else if ((x * y) <= 2e-23) {
tmp = t * (z / -a_m);
} else {
tmp = x * (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.
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) <= (-50000000000000.0d0)) then
tmp = y * (x / a_m)
else if ((x * y) <= 2d-23) then
tmp = t * (z / -a_m)
else
tmp = x * (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;
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) <= -50000000000000.0) {
tmp = y * (x / a_m);
} else if ((x * y) <= 2e-23) {
tmp = t * (z / -a_m);
} else {
tmp = x * (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]) [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) <= -50000000000000.0: tmp = y * (x / a_m) elif (x * y) <= 2e-23: tmp = t * (z / -a_m) else: tmp = x * (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]) 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) <= -50000000000000.0) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 2e-23) tmp = Float64(t * Float64(z / Float64(-a_m))); else tmp = Float64(x * Float64(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])){:}
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) <= -50000000000000.0)
tmp = y * (x / a_m);
elseif ((x * y) <= 2e-23)
tmp = t * (z / -a_m);
else
tmp = x * (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.
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], -50000000000000.0], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-23], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision], 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])\\\\
[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 -50000000000000:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-23}:\\
\;\;\;\;t \cdot \frac{z}{-a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\end{array}
\end{array}
if (*.f64 x y) < -5e13Initial program 88.9%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6481.3
Simplified81.3%
associate-*l/N/A
lift-/.f64N/A
lower-*.f6484.3
Applied egg-rr84.3%
if -5e13 < (*.f64 x y) < 1.99999999999999992e-23Initial program 90.8%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6474.2
Simplified74.2%
lift-neg.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
lower-neg.f64N/A
lower-/.f6476.8
Applied egg-rr76.8%
if 1.99999999999999992e-23 < (*.f64 x y) Initial program 92.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6479.6
Simplified79.6%
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.3
Applied egg-rr75.3%
Final simplification78.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. 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);
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.
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;
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]) [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]) 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])){:}
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.
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])\\\\
[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.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6456.9
Simplified56.9%
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6457.9
Applied egg-rr57.9%
Final simplification57.9%
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. 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 (* y (/ x a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 * (y * (x / 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.
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 * (y * (x / 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;
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 * (y * (x / 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]) [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 * (y * (x / 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]) 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(y * Float64(x / 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])){:}
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 * (y * (x / 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.
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[(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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(y \cdot \frac{x}{a\_m}\right)
\end{array}
Initial program 90.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6456.9
Simplified56.9%
associate-*l/N/A
lift-/.f64N/A
lower-*.f6458.8
Applied egg-rr58.8%
Final simplification58.8%
(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 2024207
(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))