
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= a_m 2.9e+80)
(/ (fma x y (* z (- t))) a_m)
(- (* (/ x (sqrt a_m)) (/ y (sqrt 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);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (a_m <= 2.9e+80) {
tmp = fma(x, y, (z * -t)) / a_m;
} else {
tmp = ((x / sqrt(a_m)) * (y / sqrt(a_m))) - (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]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (a_m <= 2.9e+80) tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m); else tmp = Float64(Float64(Float64(x / sqrt(a_m)) * Float64(y / sqrt(a_m))) - Float64(t * Float64(z / 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, 2.9e+80], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(N[(x / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision] * N[(y / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 2.9 \cdot 10^{+80}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\sqrt{a\_m}} \cdot \frac{y}{\sqrt{a\_m}} - t \cdot \frac{z}{a\_m}\\
\end{array}
\end{array}
if a < 2.89999999999999986e80Initial program 94.8%
div-sub91.5%
*-commutative91.5%
div-sub94.8%
*-commutative94.8%
fma-neg95.3%
distribute-rgt-neg-out95.3%
Simplified95.3%
if 2.89999999999999986e80 < a Initial program 75.7%
div-sub75.7%
*-un-lft-identity75.7%
add-sqr-sqrt75.5%
times-frac75.5%
fma-neg75.5%
associate-/l*83.3%
Applied egg-rr83.3%
associate-*r/75.5%
*-commutative75.5%
fma-neg75.5%
associate-*l/75.5%
*-lft-identity75.5%
associate-/l*84.4%
associate-*l/88.7%
associate-/l*97.5%
Simplified97.5%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(*
a_s
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+305)))
(* x (- (/ y a_m) (/ (* t (/ z x)) a_m)))
(/ t_1 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 <= -((double) INFINITY)) || !(t_1 <= 5e+305)) {
tmp = x * ((y / a_m) - ((t * (z / x)) / a_m));
} else {
tmp = t_1 / 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;
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 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+305)) {
tmp = x * ((y / a_m) - ((t * (z / x)) / a_m));
} else {
tmp = t_1 / 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 <= -math.inf) or not (t_1 <= 5e+305): tmp = x * ((y / a_m) - ((t * (z / x)) / a_m)) else: tmp = t_1 / 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 <= Float64(-Inf)) || !(t_1 <= 5e+305)) tmp = Float64(x * Float64(Float64(y / a_m) - Float64(Float64(t * Float64(z / x)) / a_m))); else tmp = Float64(t_1 / 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 <= -Inf) || ~((t_1 <= 5e+305)))
tmp = x * ((y / a_m) - ((t * (z / x)) / a_m));
else
tmp = t_1 / 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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+305]], $MachinePrecision]], N[(x * N[(N[(y / a$95$m), $MachinePrecision] - N[(N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a$95$m), $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 -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+305}\right):\\
\;\;\;\;x \cdot \left(\frac{y}{a\_m} - \frac{t \cdot \frac{z}{x}}{a\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a\_m}\\
\end{array}
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 5.00000000000000009e305 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 67.5%
Taylor expanded in x around inf 80.1%
+-commutative80.1%
mul-1-neg80.1%
unsub-neg80.1%
times-frac90.7%
associate-*l/91.0%
Simplified91.0%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000009e305Initial program 99.6%
Final simplification97.5%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(*
a_s
(if (<= t_1 -5e+299)
(* x (* z (- (/ y (* a_m z)) (/ t (* a_m x)))))
(if (<= t_1 5e+305)
(/ t_1 a_m)
(* x (- (/ y a_m) (/ (* t (/ z 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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -5e+299) {
tmp = x * (z * ((y / (a_m * z)) - (t / (a_m * x))));
} else if (t_1 <= 5e+305) {
tmp = t_1 / a_m;
} else {
tmp = x * ((y / a_m) - ((t * (z / 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) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if (t_1 <= (-5d+299)) then
tmp = x * (z * ((y / (a_m * z)) - (t / (a_m * x))))
else if (t_1 <= 5d+305) then
tmp = t_1 / a_m
else
tmp = x * ((y / a_m) - ((t * (z / 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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -5e+299) {
tmp = x * (z * ((y / (a_m * z)) - (t / (a_m * x))));
} else if (t_1 <= 5e+305) {
tmp = t_1 / a_m;
} else {
tmp = x * ((y / a_m) - ((t * (z / 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): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= -5e+299: tmp = x * (z * ((y / (a_m * z)) - (t / (a_m * x)))) elif t_1 <= 5e+305: tmp = t_1 / a_m else: tmp = x * ((y / a_m) - ((t * (z / 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) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= -5e+299) tmp = Float64(x * Float64(z * Float64(Float64(y / Float64(a_m * z)) - Float64(t / Float64(a_m * x))))); elseif (t_1 <= 5e+305) tmp = Float64(t_1 / a_m); else tmp = Float64(x * Float64(Float64(y / a_m) - Float64(Float64(t * Float64(z / 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)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -5e+299)
tmp = x * (z * ((y / (a_m * z)) - (t / (a_m * x))));
elseif (t_1 <= 5e+305)
tmp = t_1 / a_m;
else
tmp = x * ((y / a_m) - ((t * (z / 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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, -5e+299], N[(x * N[(z * N[(N[(y / N[(a$95$m * z), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+305], N[(t$95$1 / a$95$m), $MachinePrecision], N[(x * N[(N[(y / a$95$m), $MachinePrecision] - N[(N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision] / 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])\\
\\
\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^{+299}:\\
\;\;\;\;x \cdot \left(z \cdot \left(\frac{y}{a\_m \cdot z} - \frac{t}{a\_m \cdot x}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\frac{t\_1}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{a\_m} - \frac{t \cdot \frac{z}{x}}{a\_m}\right)\\
\end{array}
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -5.0000000000000003e299Initial program 67.6%
Taylor expanded in x around inf 83.1%
+-commutative83.1%
mul-1-neg83.1%
unsub-neg83.1%
times-frac96.3%
associate-*l/93.1%
Simplified93.1%
Taylor expanded in z around inf 92.9%
*-commutative92.9%
Simplified92.9%
if -5.0000000000000003e299 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000009e305Initial program 99.6%
if 5.00000000000000009e305 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 70.7%
Taylor expanded in x around inf 77.4%
+-commutative77.4%
mul-1-neg77.4%
unsub-neg77.4%
times-frac87.4%
associate-*l/90.3%
Simplified90.3%
Final simplification97.4%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* x y) -2e-41)
(/ x (/ a_m y))
(if (<= (* x y) 1e-30) (/ (* z (- t)) a_m) (/ y (/ a_m x))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -2e-41) {
tmp = x / (a_m / y);
} else if ((x * y) <= 1e-30) {
tmp = (z * -t) / a_m;
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
real(8) :: tmp
if ((x * y) <= (-2d-41)) then
tmp = x / (a_m / y)
else if ((x * y) <= 1d-30) then
tmp = (z * -t) / a_m
else
tmp = y / (a_m / x)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -2e-41) {
tmp = x / (a_m / y);
} else if ((x * y) <= 1e-30) {
tmp = (z * -t) / a_m;
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= -2e-41: tmp = x / (a_m / y) elif (x * y) <= 1e-30: tmp = (z * -t) / a_m else: tmp = y / (a_m / x) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= -2e-41) tmp = Float64(x / Float64(a_m / y)); elseif (Float64(x * y) <= 1e-30) tmp = Float64(Float64(z * Float64(-t)) / a_m); else tmp = Float64(y / Float64(a_m / x)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= -2e-41)
tmp = x / (a_m / y);
elseif ((x * y) <= 1e-30)
tmp = (z * -t) / a_m;
else
tmp = y / (a_m / x);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -2e-41], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-30], N[(N[(z * (-t)), $MachinePrecision] / a$95$m), $MachinePrecision], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{-41}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\
\mathbf{elif}\;x \cdot y \leq 10^{-30}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000001e-41Initial program 87.8%
Taylor expanded in x around inf 68.0%
associate-*r/74.4%
Simplified74.4%
clear-num74.4%
un-div-inv75.0%
Applied egg-rr75.0%
if -2.00000000000000001e-41 < (*.f64 x y) < 1e-30Initial program 98.0%
Taylor expanded in x around 0 84.5%
mul-1-neg84.5%
*-commutative84.5%
distribute-rgt-neg-in84.5%
Simplified84.5%
if 1e-30 < (*.f64 x y) Initial program 86.2%
div-sub83.6%
*-un-lft-identity83.6%
add-sqr-sqrt34.0%
times-frac34.1%
fma-neg35.4%
associate-/l*37.9%
Applied egg-rr37.9%
associate-/l*36.7%
distribute-rgt-neg-in36.7%
distribute-frac-neg36.7%
Simplified36.7%
Taylor expanded in x around inf 67.7%
*-commutative67.7%
associate-*r/69.0%
Simplified69.0%
clear-num69.0%
un-div-inv69.1%
Applied egg-rr69.1%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* x y) -20000000.0)
(/ x (/ a_m y))
(if (<= (* x y) 1e-30) (* z (/ t (- a_m))) (/ y (/ a_m x))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -20000000.0) {
tmp = x / (a_m / y);
} else if ((x * y) <= 1e-30) {
tmp = z * (t / -a_m);
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
real(8) :: tmp
if ((x * y) <= (-20000000.0d0)) then
tmp = x / (a_m / y)
else if ((x * y) <= 1d-30) then
tmp = z * (t / -a_m)
else
tmp = y / (a_m / x)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -20000000.0) {
tmp = x / (a_m / y);
} else if ((x * y) <= 1e-30) {
tmp = z * (t / -a_m);
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= -20000000.0: tmp = x / (a_m / y) elif (x * y) <= 1e-30: tmp = z * (t / -a_m) else: tmp = y / (a_m / x) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= -20000000.0) tmp = Float64(x / Float64(a_m / y)); elseif (Float64(x * y) <= 1e-30) tmp = Float64(z * Float64(t / Float64(-a_m))); else tmp = Float64(y / Float64(a_m / x)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= -20000000.0)
tmp = x / (a_m / y);
elseif ((x * y) <= 1e-30)
tmp = z * (t / -a_m);
else
tmp = y / (a_m / x);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -20000000.0], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-30], N[(z * N[(t / (-a$95$m)), $MachinePrecision]), $MachinePrecision], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -20000000:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\
\mathbf{elif}\;x \cdot y \leq 10^{-30}:\\
\;\;\;\;z \cdot \frac{t}{-a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -2e7Initial program 87.9%
Taylor expanded in x around inf 70.5%
associate-*r/76.2%
Simplified76.2%
clear-num76.2%
un-div-inv76.9%
Applied egg-rr76.9%
if -2e7 < (*.f64 x y) < 1e-30Initial program 97.3%
Taylor expanded in x around 0 82.0%
*-commutative82.0%
associate-*r/78.5%
neg-mul-178.5%
distribute-rgt-neg-in78.5%
distribute-frac-neg78.5%
Simplified78.5%
if 1e-30 < (*.f64 x y) Initial program 86.2%
div-sub83.6%
*-un-lft-identity83.6%
add-sqr-sqrt34.0%
times-frac34.1%
fma-neg35.4%
associate-/l*37.9%
Applied egg-rr37.9%
associate-/l*36.7%
distribute-rgt-neg-in36.7%
distribute-frac-neg36.7%
Simplified36.7%
Taylor expanded in x around inf 67.7%
*-commutative67.7%
associate-*r/69.0%
Simplified69.0%
clear-num69.0%
un-div-inv69.1%
Applied egg-rr69.1%
Final simplification75.3%
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) -0.0001)
(/ x (/ a_m y))
(if (<= (* x y) 1e-30) (* t (/ z (- a_m))) (/ y (/ a_m x))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -0.0001) {
tmp = x / (a_m / y);
} else if ((x * y) <= 1e-30) {
tmp = t * (z / -a_m);
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a_m
real(8) :: tmp
if ((x * y) <= (-0.0001d0)) then
tmp = x / (a_m / y)
else if ((x * y) <= 1d-30) then
tmp = t * (z / -a_m)
else
tmp = y / (a_m / x)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -0.0001) {
tmp = x / (a_m / y);
} else if ((x * y) <= 1e-30) {
tmp = t * (z / -a_m);
} else {
tmp = y / (a_m / x);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= -0.0001: tmp = x / (a_m / y) elif (x * y) <= 1e-30: tmp = t * (z / -a_m) else: tmp = y / (a_m / x) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= -0.0001) tmp = Float64(x / Float64(a_m / y)); elseif (Float64(x * y) <= 1e-30) tmp = Float64(t * Float64(z / Float64(-a_m))); else tmp = Float64(y / Float64(a_m / x)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= -0.0001)
tmp = x / (a_m / y);
elseif ((x * y) <= 1e-30)
tmp = t * (z / -a_m);
else
tmp = y / (a_m / x);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -0.0001], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-30], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -0.0001:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\
\mathbf{elif}\;x \cdot y \leq 10^{-30}:\\
\;\;\;\;t \cdot \frac{z}{-a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000005e-4Initial program 88.3%
Taylor expanded in x around inf 69.9%
associate-*r/75.4%
Simplified75.4%
clear-num75.4%
un-div-inv76.1%
Applied egg-rr76.1%
if -1.00000000000000005e-4 < (*.f64 x y) < 1e-30Initial program 97.2%
Taylor expanded in x around 0 82.6%
mul-1-neg82.6%
associate-/l*78.3%
distribute-rgt-neg-in78.3%
distribute-neg-frac278.3%
Simplified78.3%
if 1e-30 < (*.f64 x y) Initial program 86.2%
div-sub83.6%
*-un-lft-identity83.6%
add-sqr-sqrt34.0%
times-frac34.1%
fma-neg35.4%
associate-/l*37.9%
Applied egg-rr37.9%
associate-/l*36.7%
distribute-rgt-neg-in36.7%
distribute-frac-neg36.7%
Simplified36.7%
Taylor expanded in x around inf 67.7%
*-commutative67.7%
associate-*r/69.0%
Simplified69.0%
clear-num69.0%
un-div-inv69.1%
Applied egg-rr69.1%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (if (<= (* x y) -5e+180) (* y (/ x a_m)) (/ (- (* 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 tmp;
if ((x * y) <= -5e+180) {
tmp = y * (x / a_m);
} else {
tmp = ((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) :: tmp
if ((x * y) <= (-5d+180)) then
tmp = y * (x / a_m)
else
tmp = ((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 tmp;
if ((x * y) <= -5e+180) {
tmp = y * (x / a_m);
} else {
tmp = ((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): tmp = 0 if (x * y) <= -5e+180: tmp = y * (x / a_m) else: tmp = ((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) tmp = 0.0 if (Float64(x * y) <= -5e+180) tmp = Float64(y * Float64(x / a_m)); else tmp = Float64(Float64(Float64(x * y) - Float64(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)
tmp = 0.0;
if ((x * y) <= -5e+180)
tmp = y * (x / a_m);
else
tmp = ((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_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -5e+180], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $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^{+180}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999996e180Initial program 73.8%
div-sub66.9%
*-un-lft-identity66.9%
add-sqr-sqrt28.7%
times-frac28.7%
fma-neg28.7%
associate-/l*28.7%
Applied egg-rr28.7%
associate-/l*38.5%
distribute-rgt-neg-in38.5%
distribute-frac-neg38.5%
Simplified38.5%
Taylor expanded in x around inf 77.2%
*-commutative77.2%
associate-*r/99.9%
Simplified99.9%
if -4.9999999999999996e180 < (*.f64 x y) Initial program 93.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. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (if (<= a_m 5.5e-62) (/ (* 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 (a_m <= 5.5e-62) {
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 (a_m <= 5.5d-62) 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 (a_m <= 5.5e-62) {
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 a_m <= 5.5e-62: 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 (a_m <= 5.5e-62) tmp = Float64(Float64(x * 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 (a_m <= 5.5e-62)
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[a$95$m, 5.5e-62], N[(N[(x * y), $MachinePrecision] / a$95$m), $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}\;a\_m \leq 5.5 \cdot 10^{-62}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\end{array}
\end{array}
if a < 5.50000000000000022e-62Initial program 95.0%
Taylor expanded in x around inf 52.3%
if 5.50000000000000022e-62 < a Initial program 83.3%
div-sub83.3%
*-un-lft-identity83.3%
add-sqr-sqrt83.1%
times-frac83.2%
fma-neg83.2%
associate-/l*86.5%
Applied egg-rr86.5%
associate-/l*91.5%
distribute-rgt-neg-in91.5%
distribute-frac-neg91.5%
Simplified91.5%
Taylor expanded in x around inf 47.3%
*-commutative47.3%
associate-*r/55.7%
Simplified55.7%
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 -3.5e+164) (* 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 (x <= -3.5e+164) {
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 (x <= (-3.5d+164)) 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 (x <= -3.5e+164) {
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 x <= -3.5e+164: 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 (x <= -3.5e+164) 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 (x <= -3.5e+164)
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[x, -3.5e+164], 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}\;x \leq -3.5 \cdot 10^{+164}:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\end{array}
\end{array}
if x < -3.4999999999999998e164Initial program 89.6%
Taylor expanded in x around inf 81.5%
associate-*r/87.9%
Simplified87.9%
if -3.4999999999999998e164 < x Initial program 91.9%
div-sub88.7%
*-un-lft-identity88.7%
add-sqr-sqrt42.5%
times-frac42.5%
fma-neg43.0%
associate-/l*43.7%
Applied egg-rr43.7%
associate-/l*42.8%
distribute-rgt-neg-in42.8%
distribute-frac-neg42.8%
Simplified42.8%
Taylor expanded in x around inf 45.7%
*-commutative45.7%
associate-*r/45.5%
Simplified45.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 (/ y (/ a_m x))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
return a_s * (y / (a_m / x));
}
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 * (y / (a_m / x))
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 * (y / (a_m / x));
}
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 * (y / (a_m / x))
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(y / Float64(a_m / x))) 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 * (y / (a_m / x));
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[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \frac{y}{\frac{a\_m}{x}}
\end{array}
Initial program 91.6%
div-sub88.9%
*-un-lft-identity88.9%
add-sqr-sqrt42.2%
times-frac42.3%
fma-neg42.7%
associate-/l*42.9%
Applied egg-rr42.9%
associate-/l*42.9%
distribute-rgt-neg-in42.9%
distribute-frac-neg42.9%
Simplified42.9%
Taylor expanded in x around inf 50.9%
*-commutative50.9%
associate-*r/51.5%
Simplified51.5%
clear-num51.2%
un-div-inv51.3%
Applied egg-rr51.3%
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 91.6%
Taylor expanded in x around inf 50.9%
associate-*r/51.8%
Simplified51.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 2024137
(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))