
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
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 3e+15)
(/ (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 <= 3e+15) {
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 <= 3e+15) 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, 3e+15], 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 3 \cdot 10^{+15}:\\
\;\;\;\;\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 < 3e15Initial program 94.3%
div-sub90.2%
*-commutative90.2%
div-sub94.3%
*-commutative94.3%
fma-neg94.9%
distribute-rgt-neg-out94.9%
Simplified94.9%
if 3e15 < a Initial program 76.7%
div-sub76.8%
associate-/l*80.5%
associate-/l*92.9%
Applied egg-rr92.9%
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
(let* ((t_1 (* z (/ t (- a_m)))) (t_2 (/ y (/ a_m x))))
(*
a_s
(if (<= (* x y) -1e+37)
t_2
(if (<= (* x y) 5e-135)
t_1
(if (<= (* x y) 5e-90)
(* y (/ x a_m))
(if (<= (* x y) 1e-6)
(* t (/ z (- a_m)))
(if (<= (* x y) 2e+26)
(/ x (/ a_m y))
(if (<= (* x y) 5e+112) t_1 t_2)))))))))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 = z * (t / -a_m);
double t_2 = y / (a_m / x);
double tmp;
if ((x * y) <= -1e+37) {
tmp = t_2;
} else if ((x * y) <= 5e-135) {
tmp = t_1;
} else if ((x * y) <= 5e-90) {
tmp = y * (x / a_m);
} else if ((x * y) <= 1e-6) {
tmp = t * (z / -a_m);
} else if ((x * y) <= 2e+26) {
tmp = x / (a_m / y);
} else if ((x * y) <= 5e+112) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = z * (t / -a_m)
t_2 = y / (a_m / x)
if ((x * y) <= (-1d+37)) then
tmp = t_2
else if ((x * y) <= 5d-135) then
tmp = t_1
else if ((x * y) <= 5d-90) then
tmp = y * (x / a_m)
else if ((x * y) <= 1d-6) then
tmp = t * (z / -a_m)
else if ((x * y) <= 2d+26) then
tmp = x / (a_m / y)
else if ((x * y) <= 5d+112) then
tmp = t_1
else
tmp = t_2
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 = z * (t / -a_m);
double t_2 = y / (a_m / x);
double tmp;
if ((x * y) <= -1e+37) {
tmp = t_2;
} else if ((x * y) <= 5e-135) {
tmp = t_1;
} else if ((x * y) <= 5e-90) {
tmp = y * (x / a_m);
} else if ((x * y) <= 1e-6) {
tmp = t * (z / -a_m);
} else if ((x * y) <= 2e+26) {
tmp = x / (a_m / y);
} else if ((x * y) <= 5e+112) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = z * (t / -a_m) t_2 = y / (a_m / x) tmp = 0 if (x * y) <= -1e+37: tmp = t_2 elif (x * y) <= 5e-135: tmp = t_1 elif (x * y) <= 5e-90: tmp = y * (x / a_m) elif (x * y) <= 1e-6: tmp = t * (z / -a_m) elif (x * y) <= 2e+26: tmp = x / (a_m / y) elif (x * y) <= 5e+112: tmp = t_1 else: tmp = t_2 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(z * Float64(t / Float64(-a_m))) t_2 = Float64(y / Float64(a_m / x)) tmp = 0.0 if (Float64(x * y) <= -1e+37) tmp = t_2; elseif (Float64(x * y) <= 5e-135) tmp = t_1; elseif (Float64(x * y) <= 5e-90) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 1e-6) tmp = Float64(t * Float64(z / Float64(-a_m))); elseif (Float64(x * y) <= 2e+26) tmp = Float64(x / Float64(a_m / y)); elseif (Float64(x * y) <= 5e+112) tmp = t_1; else tmp = t_2; 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 = z * (t / -a_m);
t_2 = y / (a_m / x);
tmp = 0.0;
if ((x * y) <= -1e+37)
tmp = t_2;
elseif ((x * y) <= 5e-135)
tmp = t_1;
elseif ((x * y) <= 5e-90)
tmp = y * (x / a_m);
elseif ((x * y) <= 1e-6)
tmp = t * (z / -a_m);
elseif ((x * y) <= 2e+26)
tmp = x / (a_m / y);
elseif ((x * y) <= 5e+112)
tmp = t_1;
else
tmp = t_2;
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[(z * N[(t / (-a$95$m)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+37], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 5e-135], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-90], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-6], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+26], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+112], t$95$1, t$95$2]]]]]]), $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 := z \cdot \frac{t}{-a\_m}\\
t_2 := \frac{y}{\frac{a\_m}{x}}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+37}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-90}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 10^{-6}:\\
\;\;\;\;t \cdot \frac{z}{-a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+112}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999954e36 or 5e112 < (*.f64 x y) Initial program 82.1%
div-sub74.9%
associate-/l*82.6%
associate-/l*87.5%
Applied egg-rr87.5%
Taylor expanded in x around 0 74.9%
Taylor expanded in x around inf 74.1%
associate-*r/84.8%
*-commutative84.8%
associate-/r/81.3%
Simplified81.3%
if -9.99999999999999954e36 < (*.f64 x y) < 5.0000000000000002e-135 or 2.0000000000000001e26 < (*.f64 x y) < 5e112Initial program 94.6%
Taylor expanded in x around 0 78.7%
*-commutative78.7%
associate-*r/75.7%
neg-mul-175.7%
distribute-rgt-neg-in75.7%
distribute-frac-neg75.7%
Simplified75.7%
if 5.0000000000000002e-135 < (*.f64 x y) < 5.00000000000000019e-90Initial program 99.7%
Taylor expanded in x around inf 79.6%
associate-*r/79.5%
Simplified79.5%
clear-num79.5%
un-div-inv69.2%
Applied egg-rr69.2%
associate-/r/79.4%
Applied egg-rr79.4%
if 5.00000000000000019e-90 < (*.f64 x y) < 9.99999999999999955e-7Initial program 93.0%
Taylor expanded in x around 0 74.8%
mul-1-neg74.8%
associate-/l*73.7%
distribute-rgt-neg-in73.7%
distribute-neg-frac273.7%
Simplified73.7%
if 9.99999999999999955e-7 < (*.f64 x y) < 2.0000000000000001e26Initial program 99.7%
Taylor expanded in x around inf 84.0%
associate-*r/99.5%
Simplified99.5%
clear-num99.7%
un-div-inv100.0%
Applied egg-rr100.0%
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.
(FPCore (a_s x y z t a_m)
:precision binary64
(let* ((t_1 (* t (/ z (- a_m)))) (t_2 (/ y (/ a_m x))))
(*
a_s
(if (<= (* x y) -1e+37)
t_2
(if (<= (* x y) 5e-135)
t_1
(if (<= (* x y) 5e-90)
(* y (/ x a_m))
(if (<= (* x y) 5e+112) t_1 t_2)))))))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 * (z / -a_m);
double t_2 = y / (a_m / x);
double tmp;
if ((x * y) <= -1e+37) {
tmp = t_2;
} else if ((x * y) <= 5e-135) {
tmp = t_1;
} else if ((x * y) <= 5e-90) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e+112) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = t * (z / -a_m)
t_2 = y / (a_m / x)
if ((x * y) <= (-1d+37)) then
tmp = t_2
else if ((x * y) <= 5d-135) then
tmp = t_1
else if ((x * y) <= 5d-90) then
tmp = y * (x / a_m)
else if ((x * y) <= 5d+112) then
tmp = t_1
else
tmp = t_2
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 * (z / -a_m);
double t_2 = y / (a_m / x);
double tmp;
if ((x * y) <= -1e+37) {
tmp = t_2;
} else if ((x * y) <= 5e-135) {
tmp = t_1;
} else if ((x * y) <= 5e-90) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e+112) {
tmp = t_1;
} else {
tmp = t_2;
}
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 * (z / -a_m) t_2 = y / (a_m / x) tmp = 0 if (x * y) <= -1e+37: tmp = t_2 elif (x * y) <= 5e-135: tmp = t_1 elif (x * y) <= 5e-90: tmp = y * (x / a_m) elif (x * y) <= 5e+112: tmp = t_1 else: tmp = t_2 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(z / Float64(-a_m))) t_2 = Float64(y / Float64(a_m / x)) tmp = 0.0 if (Float64(x * y) <= -1e+37) tmp = t_2; elseif (Float64(x * y) <= 5e-135) tmp = t_1; elseif (Float64(x * y) <= 5e-90) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 5e+112) tmp = t_1; else tmp = t_2; 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 * (z / -a_m);
t_2 = y / (a_m / x);
tmp = 0.0;
if ((x * y) <= -1e+37)
tmp = t_2;
elseif ((x * y) <= 5e-135)
tmp = t_1;
elseif ((x * y) <= 5e-90)
tmp = y * (x / a_m);
elseif ((x * y) <= 5e+112)
tmp = t_1;
else
tmp = t_2;
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[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+37], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 5e-135], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-90], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+112], t$95$1, t$95$2]]]]), $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 := t \cdot \frac{z}{-a\_m}\\
t_2 := \frac{y}{\frac{a\_m}{x}}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+37}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-90}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+112}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999954e36 or 5e112 < (*.f64 x y) Initial program 82.1%
div-sub74.9%
associate-/l*82.6%
associate-/l*87.5%
Applied egg-rr87.5%
Taylor expanded in x around 0 74.9%
Taylor expanded in x around inf 74.1%
associate-*r/84.8%
*-commutative84.8%
associate-/r/81.3%
Simplified81.3%
if -9.99999999999999954e36 < (*.f64 x y) < 5.0000000000000002e-135 or 5.00000000000000019e-90 < (*.f64 x y) < 5e112Initial program 94.7%
Taylor expanded in x around 0 76.0%
mul-1-neg76.0%
associate-/l*76.0%
distribute-rgt-neg-in76.0%
distribute-neg-frac276.0%
Simplified76.0%
if 5.0000000000000002e-135 < (*.f64 x y) < 5.00000000000000019e-90Initial program 99.7%
Taylor expanded in x around inf 79.6%
associate-*r/79.5%
Simplified79.5%
clear-num79.5%
un-div-inv69.2%
Applied egg-rr69.2%
associate-/r/79.4%
Applied egg-rr79.4%
Final simplification78.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
(let* ((t_1 (/ y (/ a_m x))))
(*
a_s
(if (<= (* x y) -1e+37)
t_1
(if (<= (* x y) 5e-135)
(* z (/ t (- a_m)))
(if (<= (* x y) 5e-90)
(* y (/ x a_m))
(if (<= (* x y) 5e+112) (/ z (/ a_m (- t))) t_1)))))))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 = y / (a_m / x);
double tmp;
if ((x * y) <= -1e+37) {
tmp = t_1;
} else if ((x * y) <= 5e-135) {
tmp = z * (t / -a_m);
} else if ((x * y) <= 5e-90) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e+112) {
tmp = z / (a_m / -t);
} else {
tmp = t_1;
}
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 = y / (a_m / x)
if ((x * y) <= (-1d+37)) then
tmp = t_1
else if ((x * y) <= 5d-135) then
tmp = z * (t / -a_m)
else if ((x * y) <= 5d-90) then
tmp = y * (x / a_m)
else if ((x * y) <= 5d+112) then
tmp = z / (a_m / -t)
else
tmp = t_1
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 = y / (a_m / x);
double tmp;
if ((x * y) <= -1e+37) {
tmp = t_1;
} else if ((x * y) <= 5e-135) {
tmp = z * (t / -a_m);
} else if ((x * y) <= 5e-90) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e+112) {
tmp = z / (a_m / -t);
} else {
tmp = t_1;
}
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 = y / (a_m / x) tmp = 0 if (x * y) <= -1e+37: tmp = t_1 elif (x * y) <= 5e-135: tmp = z * (t / -a_m) elif (x * y) <= 5e-90: tmp = y * (x / a_m) elif (x * y) <= 5e+112: tmp = z / (a_m / -t) else: tmp = t_1 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(y / Float64(a_m / x)) tmp = 0.0 if (Float64(x * y) <= -1e+37) tmp = t_1; elseif (Float64(x * y) <= 5e-135) tmp = Float64(z * Float64(t / Float64(-a_m))); elseif (Float64(x * y) <= 5e-90) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 5e+112) tmp = Float64(z / Float64(a_m / Float64(-t))); else tmp = t_1; 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 = y / (a_m / x);
tmp = 0.0;
if ((x * y) <= -1e+37)
tmp = t_1;
elseif ((x * y) <= 5e-135)
tmp = z * (t / -a_m);
elseif ((x * y) <= 5e-90)
tmp = y * (x / a_m);
elseif ((x * y) <= 5e+112)
tmp = z / (a_m / -t);
else
tmp = t_1;
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[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+37], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-135], N[(z * N[(t / (-a$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-90], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+112], N[(z / N[(a$95$m / (-t)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]), $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{y}{\frac{a\_m}{x}}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-135}:\\
\;\;\;\;z \cdot \frac{t}{-a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-90}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+112}:\\
\;\;\;\;\frac{z}{\frac{a\_m}{-t}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999954e36 or 5e112 < (*.f64 x y) Initial program 82.1%
div-sub74.9%
associate-/l*82.6%
associate-/l*87.5%
Applied egg-rr87.5%
Taylor expanded in x around 0 74.9%
Taylor expanded in x around inf 74.1%
associate-*r/84.8%
*-commutative84.8%
associate-/r/81.3%
Simplified81.3%
if -9.99999999999999954e36 < (*.f64 x y) < 5.0000000000000002e-135Initial program 94.0%
Taylor expanded in x around 0 79.3%
*-commutative79.3%
associate-*r/77.5%
neg-mul-177.5%
distribute-rgt-neg-in77.5%
distribute-frac-neg77.5%
Simplified77.5%
if 5.0000000000000002e-135 < (*.f64 x y) < 5.00000000000000019e-90Initial program 99.7%
Taylor expanded in x around inf 79.6%
associate-*r/79.5%
Simplified79.5%
clear-num79.5%
un-div-inv69.2%
Applied egg-rr69.2%
associate-/r/79.4%
Applied egg-rr79.4%
if 5.00000000000000019e-90 < (*.f64 x y) < 5e112Initial program 96.8%
Taylor expanded in x around 0 64.9%
mul-1-neg64.9%
associate-/l*64.5%
distribute-rgt-neg-in64.5%
distribute-neg-frac264.5%
Simplified64.5%
*-commutative64.5%
distribute-frac-neg264.5%
distribute-lft-neg-in64.5%
associate-/r/62.2%
distribute-neg-frac62.2%
Applied egg-rr62.2%
Final simplification77.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
(let* ((t_1 (/ y (/ a_m x))))
(*
a_s
(if (<= (* x y) -1e+37)
t_1
(if (<= (* x y) 5e-135)
(/ (* z (- t)) a_m)
(if (<= (* x y) 5e-90)
(* y (/ x a_m))
(if (<= (* x y) 5e+112) (/ z (/ a_m (- t))) t_1)))))))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 = y / (a_m / x);
double tmp;
if ((x * y) <= -1e+37) {
tmp = t_1;
} else if ((x * y) <= 5e-135) {
tmp = (z * -t) / a_m;
} else if ((x * y) <= 5e-90) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e+112) {
tmp = z / (a_m / -t);
} else {
tmp = t_1;
}
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 = y / (a_m / x)
if ((x * y) <= (-1d+37)) then
tmp = t_1
else if ((x * y) <= 5d-135) then
tmp = (z * -t) / a_m
else if ((x * y) <= 5d-90) then
tmp = y * (x / a_m)
else if ((x * y) <= 5d+112) then
tmp = z / (a_m / -t)
else
tmp = t_1
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 = y / (a_m / x);
double tmp;
if ((x * y) <= -1e+37) {
tmp = t_1;
} else if ((x * y) <= 5e-135) {
tmp = (z * -t) / a_m;
} else if ((x * y) <= 5e-90) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e+112) {
tmp = z / (a_m / -t);
} else {
tmp = t_1;
}
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 = y / (a_m / x) tmp = 0 if (x * y) <= -1e+37: tmp = t_1 elif (x * y) <= 5e-135: tmp = (z * -t) / a_m elif (x * y) <= 5e-90: tmp = y * (x / a_m) elif (x * y) <= 5e+112: tmp = z / (a_m / -t) else: tmp = t_1 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(y / Float64(a_m / x)) tmp = 0.0 if (Float64(x * y) <= -1e+37) tmp = t_1; elseif (Float64(x * y) <= 5e-135) tmp = Float64(Float64(z * Float64(-t)) / a_m); elseif (Float64(x * y) <= 5e-90) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 5e+112) tmp = Float64(z / Float64(a_m / Float64(-t))); else tmp = t_1; 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 = y / (a_m / x);
tmp = 0.0;
if ((x * y) <= -1e+37)
tmp = t_1;
elseif ((x * y) <= 5e-135)
tmp = (z * -t) / a_m;
elseif ((x * y) <= 5e-90)
tmp = y * (x / a_m);
elseif ((x * y) <= 5e+112)
tmp = z / (a_m / -t);
else
tmp = t_1;
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[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+37], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-135], N[(N[(z * (-t)), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-90], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+112], N[(z / N[(a$95$m / (-t)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]), $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{y}{\frac{a\_m}{x}}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-135}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-90}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+112}:\\
\;\;\;\;\frac{z}{\frac{a\_m}{-t}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999954e36 or 5e112 < (*.f64 x y) Initial program 82.1%
div-sub74.9%
associate-/l*82.6%
associate-/l*87.5%
Applied egg-rr87.5%
Taylor expanded in x around 0 74.9%
Taylor expanded in x around inf 74.1%
associate-*r/84.8%
*-commutative84.8%
associate-/r/81.3%
Simplified81.3%
if -9.99999999999999954e36 < (*.f64 x y) < 5.0000000000000002e-135Initial program 94.0%
Taylor expanded in x around 0 79.3%
associate-*r*79.3%
mul-1-neg79.3%
Simplified79.3%
if 5.0000000000000002e-135 < (*.f64 x y) < 5.00000000000000019e-90Initial program 99.7%
Taylor expanded in x around inf 79.6%
associate-*r/79.5%
Simplified79.5%
clear-num79.5%
un-div-inv69.2%
Applied egg-rr69.2%
associate-/r/79.4%
Applied egg-rr79.4%
if 5.00000000000000019e-90 < (*.f64 x y) < 5e112Initial program 96.8%
Taylor expanded in x around 0 64.9%
mul-1-neg64.9%
associate-/l*64.5%
distribute-rgt-neg-in64.5%
distribute-neg-frac264.5%
Simplified64.5%
*-commutative64.5%
distribute-frac-neg264.5%
distribute-lft-neg-in64.5%
associate-/r/62.2%
distribute-neg-frac62.2%
Applied egg-rr62.2%
Final simplification77.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 (<= (* x y) -5e+303)
(* y (/ x a_m))
(if (<= (* x y) 5e+258) (/ (- (* x y) (* 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);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -5e+303) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e+258) {
tmp = ((x * y) - (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.
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) <= (-5d+303)) then
tmp = y * (x / a_m)
else if ((x * y) <= 5d+258) then
tmp = ((x * y) - (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;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -5e+303) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e+258) {
tmp = ((x * y) - (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]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= -5e+303: tmp = y * (x / a_m) elif (x * y) <= 5e+258: tmp = ((x * y) - (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]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= -5e+303) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 5e+258) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= -5e+303)
tmp = y * (x / a_m);
elseif ((x * y) <= 5e+258)
tmp = ((x * y) - (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.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -5e+303], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+258], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $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])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+303}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+258}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999997e303Initial program 62.4%
Taylor expanded in x around inf 67.5%
associate-*r/96.0%
Simplified96.0%
clear-num96.0%
un-div-inv95.9%
Applied egg-rr95.9%
associate-/r/96.1%
Applied egg-rr96.1%
if -4.9999999999999997e303 < (*.f64 x y) < 5e258Initial program 95.0%
if 5e258 < (*.f64 x y) Initial program 61.7%
Taylor expanded in x around inf 62.0%
associate-*r/93.3%
Simplified93.3%
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 (let* ((t_1 (- (* x y) (* z t)))) (* a_s (if (<= t_1 5e+269) (/ t_1 a_m) (* z (/ (- (/ (* x y) 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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= 5e+269) {
tmp = t_1 / a_m;
} else {
tmp = z * ((((x * y) / 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) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if (t_1 <= 5d+269) then
tmp = t_1 / a_m
else
tmp = z * ((((x * y) / 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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= 5e+269) {
tmp = t_1 / a_m;
} else {
tmp = z * ((((x * y) / 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): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= 5e+269: tmp = t_1 / a_m else: tmp = z * ((((x * y) / 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) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= 5e+269) tmp = Float64(t_1 / a_m); else tmp = Float64(z * Float64(Float64(Float64(Float64(x * y) / z) - 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)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= 5e+269)
tmp = t_1 / a_m;
else
tmp = z * ((((x * y) / 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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 5e+269], N[(t$95$1 / a$95$m), $MachinePrecision], N[(z * N[(N[(N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision] - t), $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 5 \cdot 10^{+269}:\\
\;\;\;\;\frac{t\_1}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{\frac{x \cdot y}{z} - t}{a\_m}\\
\end{array}
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000002e269Initial program 95.8%
if 5.0000000000000002e269 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 58.3%
div-sub50.7%
associate-/l*60.3%
associate-/l*87.1%
Applied egg-rr87.1%
clear-num87.0%
un-div-inv87.1%
Applied egg-rr87.1%
Taylor expanded in z around inf 72.6%
times-frac77.5%
Simplified77.5%
Taylor expanded in a around 0 80.6%
Final simplification93.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
(*
a_s
(if (<= a_m 9e+14)
(/ (- (* 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 <= 9e+14) {
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 <= 9d+14) 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 <= 9e+14) {
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 <= 9e+14: 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 <= 9e+14) 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 <= 9e+14)
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, 9e+14], 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 9 \cdot 10^{+14}:\\
\;\;\;\;\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 < 9e14Initial program 94.3%
if 9e14 < a Initial program 76.7%
div-sub76.8%
associate-/l*80.5%
associate-/l*92.9%
Applied egg-rr92.9%
Final simplification94.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 (<= z -4.6e-122) (* 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 <= -4.6e-122) {
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 <= (-4.6d-122)) 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 <= -4.6e-122) {
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 <= -4.6e-122: 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 <= -4.6e-122) 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 <= -4.6e-122)
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, -4.6e-122], 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 -4.6 \cdot 10^{-122}:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\end{array}
\end{array}
if z < -4.60000000000000014e-122Initial program 88.9%
Taylor expanded in x around inf 41.4%
associate-*r/45.3%
Simplified45.3%
if -4.60000000000000014e-122 < z Initial program 90.8%
Taylor expanded in x around inf 53.1%
associate-*r/56.6%
Simplified56.6%
clear-num56.6%
un-div-inv55.3%
Applied egg-rr55.3%
associate-/r/56.2%
Applied egg-rr56.2%
Final simplification52.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 (* 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.1%
Taylor expanded in x around inf 48.7%
associate-*r/52.3%
Simplified52.3%
Final simplification52.3%
(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 2024073
(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))