
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
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 * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\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 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
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 * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 2.0) 4e+124)
(/ 0.5 (/ a_m (fma t (* z -9.0) (* x y))))
(- (* x (/ y (* a_m 2.0))) (* (* z 9.0) (/ t (* a_m 2.0)))))))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 * 2.0) <= 4e+124) {
tmp = 0.5 / (a_m / fma(t, (z * -9.0), (x * y)));
} else {
tmp = (x * (y / (a_m * 2.0))) - ((z * 9.0) * (t / (a_m * 2.0)));
}
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(a_m * 2.0) <= 4e+124) tmp = Float64(0.5 / Float64(a_m / fma(t, Float64(z * -9.0), Float64(x * y)))); else tmp = Float64(Float64(x * Float64(y / Float64(a_m * 2.0))) - Float64(Float64(z * 9.0) * Float64(t / Float64(a_m * 2.0)))); 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[(a$95$m * 2.0), $MachinePrecision], 4e+124], N[(0.5 / N[(a$95$m / N[(t * N[(z * -9.0), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * N[(t / N[(a$95$m * 2.0), $MachinePrecision]), $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 \cdot 2 \leq 4 \cdot 10^{+124}:\\
\;\;\;\;\frac{0.5}{\frac{a\_m}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m \cdot 2} - \left(z \cdot 9\right) \cdot \frac{t}{a\_m \cdot 2}\\
\end{array}
\end{array}
if (*.f64 a 2) < 3.99999999999999979e124Initial program 88.8%
clear-num88.7%
inv-pow88.7%
*-commutative88.7%
associate-/l*88.7%
fma-neg88.7%
*-commutative88.7%
distribute-rgt-neg-in88.7%
distribute-rgt-neg-in88.7%
metadata-eval88.7%
Applied egg-rr88.7%
unpow-188.7%
associate-/r*88.7%
metadata-eval88.7%
fma-define88.7%
+-commutative88.7%
fma-define89.6%
Simplified89.6%
if 3.99999999999999979e124 < (*.f64 a 2) Initial program 69.7%
div-sub69.7%
associate-/l*76.4%
associate-/l*86.3%
Applied egg-rr86.3%
Final simplification89.1%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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
(let* ((t_1 (- (* x y) (* t (* z 9.0)))))
(*
a_s
(if (or (<= t_1 -5e+291) (not (<= t_1 INFINITY)))
(- (* x (/ y (* a_m 2.0))) (* (* z 9.0) (/ t (* a_m 2.0))))
(/ t_1 (* a_m 2.0))))))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 t_1 = (x * y) - (t * (z * 9.0));
double tmp;
if ((t_1 <= -5e+291) || !(t_1 <= ((double) INFINITY))) {
tmp = (x * (y / (a_m * 2.0))) - ((z * 9.0) * (t / (a_m * 2.0)));
} else {
tmp = t_1 / (a_m * 2.0);
}
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 t_1 = (x * y) - (t * (z * 9.0));
double tmp;
if ((t_1 <= -5e+291) || !(t_1 <= Double.POSITIVE_INFINITY)) {
tmp = (x * (y / (a_m * 2.0))) - ((z * 9.0) * (t / (a_m * 2.0)));
} else {
tmp = t_1 / (a_m * 2.0);
}
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): t_1 = (x * y) - (t * (z * 9.0)) tmp = 0 if (t_1 <= -5e+291) or not (t_1 <= math.inf): tmp = (x * (y / (a_m * 2.0))) - ((z * 9.0) * (t / (a_m * 2.0))) else: tmp = t_1 / (a_m * 2.0) 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) t_1 = Float64(Float64(x * y) - Float64(t * Float64(z * 9.0))) tmp = 0.0 if ((t_1 <= -5e+291) || !(t_1 <= Inf)) tmp = Float64(Float64(x * Float64(y / Float64(a_m * 2.0))) - Float64(Float64(z * 9.0) * Float64(t / Float64(a_m * 2.0)))); else tmp = Float64(t_1 / Float64(a_m * 2.0)); 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)
t_1 = (x * y) - (t * (z * 9.0));
tmp = 0.0;
if ((t_1 <= -5e+291) || ~((t_1 <= Inf)))
tmp = (x * (y / (a_m * 2.0))) - ((z * 9.0) * (t / (a_m * 2.0)));
else
tmp = t_1 / (a_m * 2.0);
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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[Or[LessEqual[t$95$1, -5e+291], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]], N[(N[(x * N[(y / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * N[(t / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(a$95$m * 2.0), $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])\\
\\
\begin{array}{l}
t_1 := x \cdot y - t \cdot \left(z \cdot 9\right)\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+291} \lor \neg \left(t\_1 \leq \infty\right):\\
\;\;\;\;x \cdot \frac{y}{a\_m \cdot 2} - \left(z \cdot 9\right) \cdot \frac{t}{a\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a\_m \cdot 2}\\
\end{array}
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -5.0000000000000001e291 or +inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 56.5%
div-sub50.0%
associate-/l*72.5%
associate-/l*84.7%
Applied egg-rr84.7%
if -5.0000000000000001e291 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < +inf.0Initial program 92.4%
Final simplification91.0%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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
(let* ((t_1 (* x (* 0.5 (/ y a_m)))) (t_2 (/ (* x y) (* a_m 2.0))))
(*
a_s
(if (<= (* x y) -2e+94)
t_1
(if (<= (* x y) -1e+57)
(* z (/ -4.5 (/ a_m t)))
(if (<= (* x y) -200000000000.0)
t_2
(if (<= (* x y) 2e-124)
(* t (/ -4.5 (/ a_m z)))
(if (<= (* x y) 5e+240) t_2 t_1))))))))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 t_1 = x * (0.5 * (y / a_m));
double t_2 = (x * y) / (a_m * 2.0);
double tmp;
if ((x * y) <= -2e+94) {
tmp = t_1;
} else if ((x * y) <= -1e+57) {
tmp = z * (-4.5 / (a_m / t));
} else if ((x * y) <= -200000000000.0) {
tmp = t_2;
} else if ((x * y) <= 2e-124) {
tmp = t * (-4.5 / (a_m / z));
} else if ((x * y) <= 5e+240) {
tmp = t_2;
} 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.
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 = x * (0.5d0 * (y / a_m))
t_2 = (x * y) / (a_m * 2.0d0)
if ((x * y) <= (-2d+94)) then
tmp = t_1
else if ((x * y) <= (-1d+57)) then
tmp = z * ((-4.5d0) / (a_m / t))
else if ((x * y) <= (-200000000000.0d0)) then
tmp = t_2
else if ((x * y) <= 2d-124) then
tmp = t * ((-4.5d0) / (a_m / z))
else if ((x * y) <= 5d+240) then
tmp = t_2
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;
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 * (0.5 * (y / a_m));
double t_2 = (x * y) / (a_m * 2.0);
double tmp;
if ((x * y) <= -2e+94) {
tmp = t_1;
} else if ((x * y) <= -1e+57) {
tmp = z * (-4.5 / (a_m / t));
} else if ((x * y) <= -200000000000.0) {
tmp = t_2;
} else if ((x * y) <= 2e-124) {
tmp = t * (-4.5 / (a_m / z));
} else if ((x * y) <= 5e+240) {
tmp = t_2;
} 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]) [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 * (0.5 * (y / a_m)) t_2 = (x * y) / (a_m * 2.0) tmp = 0 if (x * y) <= -2e+94: tmp = t_1 elif (x * y) <= -1e+57: tmp = z * (-4.5 / (a_m / t)) elif (x * y) <= -200000000000.0: tmp = t_2 elif (x * y) <= 2e-124: tmp = t * (-4.5 / (a_m / z)) elif (x * y) <= 5e+240: tmp = t_2 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]) 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(x * Float64(0.5 * Float64(y / a_m))) t_2 = Float64(Float64(x * y) / Float64(a_m * 2.0)) tmp = 0.0 if (Float64(x * y) <= -2e+94) tmp = t_1; elseif (Float64(x * y) <= -1e+57) tmp = Float64(z * Float64(-4.5 / Float64(a_m / t))); elseif (Float64(x * y) <= -200000000000.0) tmp = t_2; elseif (Float64(x * y) <= 2e-124) tmp = Float64(t * Float64(-4.5 / Float64(a_m / z))); elseif (Float64(x * y) <= 5e+240) tmp = t_2; 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])){:}
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 * (0.5 * (y / a_m));
t_2 = (x * y) / (a_m * 2.0);
tmp = 0.0;
if ((x * y) <= -2e+94)
tmp = t_1;
elseif ((x * y) <= -1e+57)
tmp = z * (-4.5 / (a_m / t));
elseif ((x * y) <= -200000000000.0)
tmp = t_2;
elseif ((x * y) <= 2e-124)
tmp = t * (-4.5 / (a_m / z));
elseif ((x * y) <= 5e+240)
tmp = t_2;
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.
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[(x * N[(0.5 * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -2e+94], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1e+57], N[(z * N[(-4.5 / N[(a$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -200000000000.0], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 2e-124], N[(t * N[(-4.5 / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+240], t$95$2, 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\
t_2 := \frac{x \cdot y}{a\_m \cdot 2}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{+57}:\\
\;\;\;\;z \cdot \frac{-4.5}{\frac{a\_m}{t}}\\
\mathbf{elif}\;x \cdot y \leq -200000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-124}:\\
\;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 x y) < -2e94 or 5.0000000000000003e240 < (*.f64 x y) Initial program 72.8%
Taylor expanded in x around inf 72.9%
*-commutative72.9%
associate-/l*93.4%
associate-*l*93.4%
Simplified93.4%
if -2e94 < (*.f64 x y) < -1.00000000000000005e57Initial program 82.4%
Taylor expanded in x around 0 73.4%
associate-/l*82.4%
Simplified82.4%
*-commutative82.4%
associate-*r/73.4%
metadata-eval73.4%
times-frac73.3%
associate-*r*64.9%
*-commutative64.9%
associate-*l*73.6%
clear-num73.7%
associate-*l*64.9%
*-commutative64.9%
associate-*r*73.4%
times-frac73.3%
metadata-eval73.3%
Applied egg-rr73.3%
*-commutative73.3%
associate-/r*73.3%
metadata-eval73.3%
Simplified73.3%
associate-/r*73.8%
associate-/r/73.8%
Applied egg-rr73.8%
if -1.00000000000000005e57 < (*.f64 x y) < -2e11 or 1.99999999999999987e-124 < (*.f64 x y) < 5.0000000000000003e240Initial program 94.4%
Taylor expanded in x around inf 74.3%
if -2e11 < (*.f64 x y) < 1.99999999999999987e-124Initial program 90.0%
Taylor expanded in x around 0 77.0%
associate-*r*76.9%
*-commutative76.9%
Simplified76.9%
associate-*l*76.9%
*-commutative76.9%
associate-*r*77.0%
times-frac77.0%
associate-*r/77.2%
metadata-eval77.2%
*-commutative77.2%
*-commutative77.2%
associate-*r*77.3%
Applied egg-rr77.3%
clear-num77.0%
un-div-inv77.1%
Applied egg-rr77.1%
Final simplification80.9%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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
(let* ((t_1 (* (* 0.5 y) (/ x a_m))))
(*
a_s
(if (<= x -5.5e+92)
t_1
(if (<= x -1.3e+44)
(* -4.5 (/ (* t z) a_m))
(if (<= x -0.088)
t_1
(if (<= x 1.25e-226)
(* t (* -4.5 (/ z a_m)))
(* x (* 0.5 (/ 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 t_1 = (0.5 * y) * (x / a_m);
double tmp;
if (x <= -5.5e+92) {
tmp = t_1;
} else if (x <= -1.3e+44) {
tmp = -4.5 * ((t * z) / a_m);
} else if (x <= -0.088) {
tmp = t_1;
} else if (x <= 1.25e-226) {
tmp = t * (-4.5 * (z / a_m));
} else {
tmp = x * (0.5 * (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) :: t_1
real(8) :: tmp
t_1 = (0.5d0 * y) * (x / a_m)
if (x <= (-5.5d+92)) then
tmp = t_1
else if (x <= (-1.3d+44)) then
tmp = (-4.5d0) * ((t * z) / a_m)
else if (x <= (-0.088d0)) then
tmp = t_1
else if (x <= 1.25d-226) then
tmp = t * ((-4.5d0) * (z / a_m))
else
tmp = x * (0.5d0 * (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 t_1 = (0.5 * y) * (x / a_m);
double tmp;
if (x <= -5.5e+92) {
tmp = t_1;
} else if (x <= -1.3e+44) {
tmp = -4.5 * ((t * z) / a_m);
} else if (x <= -0.088) {
tmp = t_1;
} else if (x <= 1.25e-226) {
tmp = t * (-4.5 * (z / a_m));
} else {
tmp = x * (0.5 * (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): t_1 = (0.5 * y) * (x / a_m) tmp = 0 if x <= -5.5e+92: tmp = t_1 elif x <= -1.3e+44: tmp = -4.5 * ((t * z) / a_m) elif x <= -0.088: tmp = t_1 elif x <= 1.25e-226: tmp = t * (-4.5 * (z / a_m)) else: tmp = x * (0.5 * (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) t_1 = Float64(Float64(0.5 * y) * Float64(x / a_m)) tmp = 0.0 if (x <= -5.5e+92) tmp = t_1; elseif (x <= -1.3e+44) tmp = Float64(-4.5 * Float64(Float64(t * z) / a_m)); elseif (x <= -0.088) tmp = t_1; elseif (x <= 1.25e-226) tmp = Float64(t * Float64(-4.5 * Float64(z / a_m))); else tmp = Float64(x * Float64(0.5 * 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)
t_1 = (0.5 * y) * (x / a_m);
tmp = 0.0;
if (x <= -5.5e+92)
tmp = t_1;
elseif (x <= -1.3e+44)
tmp = -4.5 * ((t * z) / a_m);
elseif (x <= -0.088)
tmp = t_1;
elseif (x <= 1.25e-226)
tmp = t * (-4.5 * (z / a_m));
else
tmp = x * (0.5 * (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_] := Block[{t$95$1 = N[(N[(0.5 * y), $MachinePrecision] * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[x, -5.5e+92], t$95$1, If[LessEqual[x, -1.3e+44], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.088], t$95$1, If[LessEqual[x, 1.25e-226], N[(t * N[(-4.5 * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * N[(y / 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])\\
\\
\begin{array}{l}
t_1 := \left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{+44}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a\_m}\\
\mathbf{elif}\;x \leq -0.088:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\
\end{array}
\end{array}
\end{array}
if x < -5.50000000000000053e92 or -1.3e44 < x < -0.087999999999999995Initial program 84.7%
clear-num84.5%
inv-pow84.5%
*-commutative84.5%
associate-/l*84.5%
fma-neg84.5%
*-commutative84.5%
distribute-rgt-neg-in84.5%
distribute-rgt-neg-in84.5%
metadata-eval84.5%
Applied egg-rr84.5%
unpow-184.5%
associate-/r*84.5%
metadata-eval84.5%
fma-define84.5%
+-commutative84.5%
fma-define86.5%
Simplified86.5%
Taylor expanded in t around 0 78.9%
associate-/r*90.1%
Simplified90.1%
associate-/r/90.0%
*-commutative90.0%
div-inv90.0%
clear-num90.0%
Applied egg-rr90.0%
associate-*r*90.0%
Simplified90.0%
if -5.50000000000000053e92 < x < -1.3e44Initial program 100.0%
Taylor expanded in x around 0 67.3%
if -0.087999999999999995 < x < 1.2499999999999999e-226Initial program 88.9%
Taylor expanded in x around 0 63.5%
*-commutative63.5%
associate-/l*68.3%
associate-*l*68.4%
Simplified68.4%
if 1.2499999999999999e-226 < x Initial program 83.3%
Taylor expanded in x around inf 56.0%
*-commutative56.0%
associate-/l*60.2%
associate-*l*60.2%
Simplified60.2%
Final simplification68.9%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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
(let* ((t_1 (* (* 0.5 y) (/ x a_m))))
(*
a_s
(if (<= x -4.8e+92)
t_1
(if (<= x -6e+43)
(* -4.5 (/ (* t z) a_m))
(if (<= x -0.00062)
t_1
(if (<= x 1.25e-226)
(* t (/ -4.5 (/ a_m z)))
(* x (* 0.5 (/ 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 t_1 = (0.5 * y) * (x / a_m);
double tmp;
if (x <= -4.8e+92) {
tmp = t_1;
} else if (x <= -6e+43) {
tmp = -4.5 * ((t * z) / a_m);
} else if (x <= -0.00062) {
tmp = t_1;
} else if (x <= 1.25e-226) {
tmp = t * (-4.5 / (a_m / z));
} else {
tmp = x * (0.5 * (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) :: t_1
real(8) :: tmp
t_1 = (0.5d0 * y) * (x / a_m)
if (x <= (-4.8d+92)) then
tmp = t_1
else if (x <= (-6d+43)) then
tmp = (-4.5d0) * ((t * z) / a_m)
else if (x <= (-0.00062d0)) then
tmp = t_1
else if (x <= 1.25d-226) then
tmp = t * ((-4.5d0) / (a_m / z))
else
tmp = x * (0.5d0 * (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 t_1 = (0.5 * y) * (x / a_m);
double tmp;
if (x <= -4.8e+92) {
tmp = t_1;
} else if (x <= -6e+43) {
tmp = -4.5 * ((t * z) / a_m);
} else if (x <= -0.00062) {
tmp = t_1;
} else if (x <= 1.25e-226) {
tmp = t * (-4.5 / (a_m / z));
} else {
tmp = x * (0.5 * (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): t_1 = (0.5 * y) * (x / a_m) tmp = 0 if x <= -4.8e+92: tmp = t_1 elif x <= -6e+43: tmp = -4.5 * ((t * z) / a_m) elif x <= -0.00062: tmp = t_1 elif x <= 1.25e-226: tmp = t * (-4.5 / (a_m / z)) else: tmp = x * (0.5 * (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) t_1 = Float64(Float64(0.5 * y) * Float64(x / a_m)) tmp = 0.0 if (x <= -4.8e+92) tmp = t_1; elseif (x <= -6e+43) tmp = Float64(-4.5 * Float64(Float64(t * z) / a_m)); elseif (x <= -0.00062) tmp = t_1; elseif (x <= 1.25e-226) tmp = Float64(t * Float64(-4.5 / Float64(a_m / z))); else tmp = Float64(x * Float64(0.5 * 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)
t_1 = (0.5 * y) * (x / a_m);
tmp = 0.0;
if (x <= -4.8e+92)
tmp = t_1;
elseif (x <= -6e+43)
tmp = -4.5 * ((t * z) / a_m);
elseif (x <= -0.00062)
tmp = t_1;
elseif (x <= 1.25e-226)
tmp = t * (-4.5 / (a_m / z));
else
tmp = x * (0.5 * (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_] := Block[{t$95$1 = N[(N[(0.5 * y), $MachinePrecision] * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[x, -4.8e+92], t$95$1, If[LessEqual[x, -6e+43], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.00062], t$95$1, If[LessEqual[x, 1.25e-226], N[(t * N[(-4.5 / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * N[(y / 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])\\
\\
\begin{array}{l}
t_1 := \left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -6 \cdot 10^{+43}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a\_m}\\
\mathbf{elif}\;x \leq -0.00062:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\
\;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\
\end{array}
\end{array}
\end{array}
if x < -4.80000000000000009e92 or -6.00000000000000033e43 < x < -6.2e-4Initial program 84.7%
clear-num84.5%
inv-pow84.5%
*-commutative84.5%
associate-/l*84.5%
fma-neg84.5%
*-commutative84.5%
distribute-rgt-neg-in84.5%
distribute-rgt-neg-in84.5%
metadata-eval84.5%
Applied egg-rr84.5%
unpow-184.5%
associate-/r*84.5%
metadata-eval84.5%
fma-define84.5%
+-commutative84.5%
fma-define86.5%
Simplified86.5%
Taylor expanded in t around 0 78.9%
associate-/r*90.1%
Simplified90.1%
associate-/r/90.0%
*-commutative90.0%
div-inv90.0%
clear-num90.0%
Applied egg-rr90.0%
associate-*r*90.0%
Simplified90.0%
if -4.80000000000000009e92 < x < -6.00000000000000033e43Initial program 100.0%
Taylor expanded in x around 0 67.3%
if -6.2e-4 < x < 1.2499999999999999e-226Initial program 88.9%
Taylor expanded in x around 0 63.4%
associate-*r*63.4%
*-commutative63.4%
Simplified63.4%
associate-*l*63.4%
*-commutative63.4%
associate-*r*63.4%
times-frac63.5%
associate-*r/68.3%
metadata-eval68.3%
*-commutative68.3%
*-commutative68.3%
associate-*r*68.4%
Applied egg-rr68.4%
clear-num68.1%
un-div-inv68.2%
Applied egg-rr68.2%
if 1.2499999999999999e-226 < x Initial program 83.3%
Taylor expanded in x around inf 56.0%
*-commutative56.0%
associate-/l*60.2%
associate-*l*60.2%
Simplified60.2%
Final simplification68.8%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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
(let* ((t_1 (* (* 0.5 y) (/ x a_m))))
(*
a_s
(if (<= x -4.8e+92)
t_1
(if (<= x -1.05e+44)
(/ -4.5 (/ a_m (* t z)))
(if (<= x -0.19)
t_1
(if (<= x 1.25e-226)
(* t (/ -4.5 (/ a_m z)))
(* x (* 0.5 (/ 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 t_1 = (0.5 * y) * (x / a_m);
double tmp;
if (x <= -4.8e+92) {
tmp = t_1;
} else if (x <= -1.05e+44) {
tmp = -4.5 / (a_m / (t * z));
} else if (x <= -0.19) {
tmp = t_1;
} else if (x <= 1.25e-226) {
tmp = t * (-4.5 / (a_m / z));
} else {
tmp = x * (0.5 * (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) :: t_1
real(8) :: tmp
t_1 = (0.5d0 * y) * (x / a_m)
if (x <= (-4.8d+92)) then
tmp = t_1
else if (x <= (-1.05d+44)) then
tmp = (-4.5d0) / (a_m / (t * z))
else if (x <= (-0.19d0)) then
tmp = t_1
else if (x <= 1.25d-226) then
tmp = t * ((-4.5d0) / (a_m / z))
else
tmp = x * (0.5d0 * (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 t_1 = (0.5 * y) * (x / a_m);
double tmp;
if (x <= -4.8e+92) {
tmp = t_1;
} else if (x <= -1.05e+44) {
tmp = -4.5 / (a_m / (t * z));
} else if (x <= -0.19) {
tmp = t_1;
} else if (x <= 1.25e-226) {
tmp = t * (-4.5 / (a_m / z));
} else {
tmp = x * (0.5 * (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): t_1 = (0.5 * y) * (x / a_m) tmp = 0 if x <= -4.8e+92: tmp = t_1 elif x <= -1.05e+44: tmp = -4.5 / (a_m / (t * z)) elif x <= -0.19: tmp = t_1 elif x <= 1.25e-226: tmp = t * (-4.5 / (a_m / z)) else: tmp = x * (0.5 * (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) t_1 = Float64(Float64(0.5 * y) * Float64(x / a_m)) tmp = 0.0 if (x <= -4.8e+92) tmp = t_1; elseif (x <= -1.05e+44) tmp = Float64(-4.5 / Float64(a_m / Float64(t * z))); elseif (x <= -0.19) tmp = t_1; elseif (x <= 1.25e-226) tmp = Float64(t * Float64(-4.5 / Float64(a_m / z))); else tmp = Float64(x * Float64(0.5 * 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)
t_1 = (0.5 * y) * (x / a_m);
tmp = 0.0;
if (x <= -4.8e+92)
tmp = t_1;
elseif (x <= -1.05e+44)
tmp = -4.5 / (a_m / (t * z));
elseif (x <= -0.19)
tmp = t_1;
elseif (x <= 1.25e-226)
tmp = t * (-4.5 / (a_m / z));
else
tmp = x * (0.5 * (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_] := Block[{t$95$1 = N[(N[(0.5 * y), $MachinePrecision] * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[x, -4.8e+92], t$95$1, If[LessEqual[x, -1.05e+44], N[(-4.5 / N[(a$95$m / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.19], t$95$1, If[LessEqual[x, 1.25e-226], N[(t * N[(-4.5 / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * N[(y / 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])\\
\\
\begin{array}{l}
t_1 := \left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{+44}:\\
\;\;\;\;\frac{-4.5}{\frac{a\_m}{t \cdot z}}\\
\mathbf{elif}\;x \leq -0.19:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\
\;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\
\end{array}
\end{array}
\end{array}
if x < -4.80000000000000009e92 or -1.04999999999999993e44 < x < -0.19Initial program 84.7%
clear-num84.5%
inv-pow84.5%
*-commutative84.5%
associate-/l*84.5%
fma-neg84.5%
*-commutative84.5%
distribute-rgt-neg-in84.5%
distribute-rgt-neg-in84.5%
metadata-eval84.5%
Applied egg-rr84.5%
unpow-184.5%
associate-/r*84.5%
metadata-eval84.5%
fma-define84.5%
+-commutative84.5%
fma-define86.5%
Simplified86.5%
Taylor expanded in t around 0 78.9%
associate-/r*90.1%
Simplified90.1%
associate-/r/90.0%
*-commutative90.0%
div-inv90.0%
clear-num90.0%
Applied egg-rr90.0%
associate-*r*90.0%
Simplified90.0%
if -4.80000000000000009e92 < x < -1.04999999999999993e44Initial program 100.0%
Taylor expanded in x around 0 67.3%
associate-/l*56.8%
Simplified56.8%
*-commutative56.8%
associate-*r/67.3%
metadata-eval67.3%
times-frac67.3%
associate-*r*67.6%
*-commutative67.6%
associate-*l*67.5%
clear-num67.6%
associate-*l*67.5%
*-commutative67.5%
associate-*r*67.5%
times-frac67.5%
metadata-eval67.5%
Applied egg-rr67.5%
*-commutative67.5%
associate-/r*67.5%
metadata-eval67.5%
Simplified67.5%
if -0.19 < x < 1.2499999999999999e-226Initial program 88.9%
Taylor expanded in x around 0 63.4%
associate-*r*63.4%
*-commutative63.4%
Simplified63.4%
associate-*l*63.4%
*-commutative63.4%
associate-*r*63.4%
times-frac63.5%
associate-*r/68.3%
metadata-eval68.3%
*-commutative68.3%
*-commutative68.3%
associate-*r*68.4%
Applied egg-rr68.4%
clear-num68.1%
un-div-inv68.2%
Applied egg-rr68.2%
if 1.2499999999999999e-226 < x Initial program 83.3%
Taylor expanded in x around inf 56.0%
*-commutative56.0%
associate-/l*60.2%
associate-*l*60.2%
Simplified60.2%
Final simplification68.8%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 -4.8e+92)
(/ 0.5 (/ (/ a_m x) y))
(if (<= x -1.25e+44)
(/ -4.5 (/ a_m (* t z)))
(if (<= x -0.0026)
(* (* 0.5 y) (/ x a_m))
(if (<= x 1.25e-226)
(* t (/ -4.5 (/ a_m z)))
(* x (* 0.5 (/ 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 <= -4.8e+92) {
tmp = 0.5 / ((a_m / x) / y);
} else if (x <= -1.25e+44) {
tmp = -4.5 / (a_m / (t * z));
} else if (x <= -0.0026) {
tmp = (0.5 * y) * (x / a_m);
} else if (x <= 1.25e-226) {
tmp = t * (-4.5 / (a_m / z));
} else {
tmp = x * (0.5 * (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 <= (-4.8d+92)) then
tmp = 0.5d0 / ((a_m / x) / y)
else if (x <= (-1.25d+44)) then
tmp = (-4.5d0) / (a_m / (t * z))
else if (x <= (-0.0026d0)) then
tmp = (0.5d0 * y) * (x / a_m)
else if (x <= 1.25d-226) then
tmp = t * ((-4.5d0) / (a_m / z))
else
tmp = x * (0.5d0 * (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 <= -4.8e+92) {
tmp = 0.5 / ((a_m / x) / y);
} else if (x <= -1.25e+44) {
tmp = -4.5 / (a_m / (t * z));
} else if (x <= -0.0026) {
tmp = (0.5 * y) * (x / a_m);
} else if (x <= 1.25e-226) {
tmp = t * (-4.5 / (a_m / z));
} else {
tmp = x * (0.5 * (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 <= -4.8e+92: tmp = 0.5 / ((a_m / x) / y) elif x <= -1.25e+44: tmp = -4.5 / (a_m / (t * z)) elif x <= -0.0026: tmp = (0.5 * y) * (x / a_m) elif x <= 1.25e-226: tmp = t * (-4.5 / (a_m / z)) else: tmp = x * (0.5 * (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 (x <= -4.8e+92) tmp = Float64(0.5 / Float64(Float64(a_m / x) / y)); elseif (x <= -1.25e+44) tmp = Float64(-4.5 / Float64(a_m / Float64(t * z))); elseif (x <= -0.0026) tmp = Float64(Float64(0.5 * y) * Float64(x / a_m)); elseif (x <= 1.25e-226) tmp = Float64(t * Float64(-4.5 / Float64(a_m / z))); else tmp = Float64(x * Float64(0.5 * 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 <= -4.8e+92)
tmp = 0.5 / ((a_m / x) / y);
elseif (x <= -1.25e+44)
tmp = -4.5 / (a_m / (t * z));
elseif (x <= -0.0026)
tmp = (0.5 * y) * (x / a_m);
elseif (x <= 1.25e-226)
tmp = t * (-4.5 / (a_m / z));
else
tmp = x * (0.5 * (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[x, -4.8e+92], N[(0.5 / N[(N[(a$95$m / x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.25e+44], N[(-4.5 / N[(a$95$m / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.0026], N[(N[(0.5 * y), $MachinePrecision] * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.25e-226], N[(t * N[(-4.5 / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * N[(y / 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}\;x \leq -4.8 \cdot 10^{+92}:\\
\;\;\;\;\frac{0.5}{\frac{\frac{a\_m}{x}}{y}}\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{+44}:\\
\;\;\;\;\frac{-4.5}{\frac{a\_m}{t \cdot z}}\\
\mathbf{elif}\;x \leq -0.0026:\\
\;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\
\;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\
\end{array}
\end{array}
if x < -4.80000000000000009e92Initial program 84.5%
clear-num84.3%
inv-pow84.3%
*-commutative84.3%
associate-/l*84.3%
fma-neg84.3%
*-commutative84.3%
distribute-rgt-neg-in84.3%
distribute-rgt-neg-in84.3%
metadata-eval84.3%
Applied egg-rr84.3%
unpow-184.3%
associate-/r*84.3%
metadata-eval84.3%
fma-define84.3%
+-commutative84.3%
fma-define86.7%
Simplified86.7%
Taylor expanded in t around 0 77.8%
associate-/r*88.6%
Simplified88.6%
if -4.80000000000000009e92 < x < -1.2499999999999999e44Initial program 100.0%
Taylor expanded in x around 0 67.3%
associate-/l*56.8%
Simplified56.8%
*-commutative56.8%
associate-*r/67.3%
metadata-eval67.3%
times-frac67.3%
associate-*r*67.6%
*-commutative67.6%
associate-*l*67.5%
clear-num67.6%
associate-*l*67.5%
*-commutative67.5%
associate-*r*67.5%
times-frac67.5%
metadata-eval67.5%
Applied egg-rr67.5%
*-commutative67.5%
associate-/r*67.5%
metadata-eval67.5%
Simplified67.5%
if -1.2499999999999999e44 < x < -0.0025999999999999999Initial program 85.8%
clear-num85.6%
inv-pow85.6%
*-commutative85.6%
associate-/l*85.6%
fma-neg85.6%
*-commutative85.6%
distribute-rgt-neg-in85.6%
distribute-rgt-neg-in85.6%
metadata-eval85.6%
Applied egg-rr85.6%
unpow-185.6%
associate-/r*85.6%
metadata-eval85.6%
fma-define85.6%
+-commutative85.6%
fma-define85.6%
Simplified85.6%
Taylor expanded in t around 0 85.6%
associate-/r*99.6%
Simplified99.6%
associate-/r/99.8%
*-commutative99.8%
div-inv99.8%
clear-num99.6%
Applied egg-rr99.6%
associate-*r*99.6%
Simplified99.6%
if -0.0025999999999999999 < x < 1.2499999999999999e-226Initial program 88.9%
Taylor expanded in x around 0 63.4%
associate-*r*63.4%
*-commutative63.4%
Simplified63.4%
associate-*l*63.4%
*-commutative63.4%
associate-*r*63.4%
times-frac63.5%
associate-*r/68.3%
metadata-eval68.3%
*-commutative68.3%
*-commutative68.3%
associate-*r*68.4%
Applied egg-rr68.4%
clear-num68.1%
un-div-inv68.2%
Applied egg-rr68.2%
if 1.2499999999999999e-226 < x Initial program 83.3%
Taylor expanded in x around inf 56.0%
*-commutative56.0%
associate-/l*60.2%
associate-*l*60.2%
Simplified60.2%
Final simplification68.8%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 (or (<= (* x y) -5e+265) (not (<= (* x y) 5e+248)))
(* x (* 0.5 (/ y a_m)))
(/ (- (* x y) (* t (* z 9.0))) (* a_m 2.0)))))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) <= -5e+265) || !((x * y) <= 5e+248)) {
tmp = x * (0.5 * (y / a_m));
} else {
tmp = ((x * y) - (t * (z * 9.0))) / (a_m * 2.0);
}
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) <= (-5d+265)) .or. (.not. ((x * y) <= 5d+248))) then
tmp = x * (0.5d0 * (y / a_m))
else
tmp = ((x * y) - (t * (z * 9.0d0))) / (a_m * 2.0d0)
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) <= -5e+265) || !((x * y) <= 5e+248)) {
tmp = x * (0.5 * (y / a_m));
} else {
tmp = ((x * y) - (t * (z * 9.0))) / (a_m * 2.0);
}
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) <= -5e+265) or not ((x * y) <= 5e+248): tmp = x * (0.5 * (y / a_m)) else: tmp = ((x * y) - (t * (z * 9.0))) / (a_m * 2.0) 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) <= -5e+265) || !(Float64(x * y) <= 5e+248)) tmp = Float64(x * Float64(0.5 * Float64(y / a_m))); else tmp = Float64(Float64(Float64(x * y) - Float64(t * Float64(z * 9.0))) / Float64(a_m * 2.0)); 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) <= -5e+265) || ~(((x * y) <= 5e+248)))
tmp = x * (0.5 * (y / a_m));
else
tmp = ((x * y) - (t * (z * 9.0))) / (a_m * 2.0);
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[Or[LessEqual[N[(x * y), $MachinePrecision], -5e+265], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e+248]], $MachinePrecision]], N[(x * N[(0.5 * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a$95$m * 2.0), $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 -5 \cdot 10^{+265} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+248}\right):\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - t \cdot \left(z \cdot 9\right)}{a\_m \cdot 2}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.0000000000000002e265 or 4.9999999999999996e248 < (*.f64 x y) Initial program 62.9%
Taylor expanded in x around inf 66.6%
*-commutative66.6%
associate-/l*98.1%
associate-*l*98.1%
Simplified98.1%
if -5.0000000000000002e265 < (*.f64 x y) < 4.9999999999999996e248Initial program 92.1%
Final simplification93.4%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 (or (<= y -2.05e-117) (not (<= y 1.7e+54)))
(* x (* 0.5 (/ y a_m)))
(* t (* -4.5 (/ 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 ((y <= -2.05e-117) || !(y <= 1.7e+54)) {
tmp = x * (0.5 * (y / a_m));
} else {
tmp = t * (-4.5 * (z / 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 ((y <= (-2.05d-117)) .or. (.not. (y <= 1.7d+54))) then
tmp = x * (0.5d0 * (y / a_m))
else
tmp = t * ((-4.5d0) * (z / 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 ((y <= -2.05e-117) || !(y <= 1.7e+54)) {
tmp = x * (0.5 * (y / a_m));
} else {
tmp = t * (-4.5 * (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 (y <= -2.05e-117) or not (y <= 1.7e+54): tmp = x * (0.5 * (y / a_m)) else: tmp = t * (-4.5 * (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 ((y <= -2.05e-117) || !(y <= 1.7e+54)) tmp = Float64(x * Float64(0.5 * Float64(y / a_m))); else tmp = Float64(t * Float64(-4.5 * Float64(z / 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 ((y <= -2.05e-117) || ~((y <= 1.7e+54)))
tmp = x * (0.5 * (y / a_m));
else
tmp = t * (-4.5 * (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[Or[LessEqual[y, -2.05e-117], N[Not[LessEqual[y, 1.7e+54]], $MachinePrecision]], N[(x * N[(0.5 * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(-4.5 * 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{-117} \lor \neg \left(y \leq 1.7 \cdot 10^{+54}\right):\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a\_m}\right)\\
\end{array}
\end{array}
if y < -2.05000000000000016e-117 or 1.7e54 < y Initial program 81.6%
Taylor expanded in x around inf 60.8%
*-commutative60.8%
associate-/l*70.7%
associate-*l*70.7%
Simplified70.7%
if -2.05000000000000016e-117 < y < 1.7e54Initial program 91.8%
Taylor expanded in x around 0 64.7%
*-commutative64.7%
associate-/l*64.6%
associate-*l*64.7%
Simplified64.7%
Final simplification68.1%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 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 (* -4.5 (* 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) {
return a_s * (-4.5 * (t * (z / 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 * ((-4.5d0) * (t * (z / 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 * (-4.5 * (t * (z / 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 * (-4.5 * (t * (z / 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(-4.5 * Float64(t * Float64(z / 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 * (-4.5 * (t * (z / 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[(-4.5 * 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(-4.5 \cdot \left(t \cdot \frac{z}{a\_m}\right)\right)
\end{array}
Initial program 86.0%
Taylor expanded in x around 0 42.8%
associate-/l*46.2%
Simplified46.2%
Final simplification46.2%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 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 (* t (* -4.5 (/ 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) {
return a_s * (t * (-4.5 * (z / 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 * (t * ((-4.5d0) * (z / 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 * (t * (-4.5 * (z / 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 * (t * (-4.5 * (z / 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(t * Float64(-4.5 * Float64(z / 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 * (t * (-4.5 * (z / 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[(t * N[(-4.5 * 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(t \cdot \left(-4.5 \cdot \frac{z}{a\_m}\right)\right)
\end{array}
Initial program 86.0%
Taylor expanded in x around 0 42.8%
*-commutative42.8%
associate-/l*46.2%
associate-*l*46.2%
Simplified46.2%
Final simplification46.2%
(FPCore (x y z t a)
:precision binary64
(if (< a -2.090464557976709e+86)
(- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z))))
(if (< a 2.144030707833976e+99)
(/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))
(- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a < -2.090464557976709e+86) {
tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
} else if (a < 2.144030707833976e+99) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
}
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) :: tmp
if (a < (-2.090464557976709d+86)) then
tmp = (0.5d0 * ((y * x) / a)) - (4.5d0 * (t / (a / z)))
else if (a < 2.144030707833976d+99) then
tmp = ((x * y) - (z * (9.0d0 * t))) / (a * 2.0d0)
else
tmp = ((y / a) * (x * 0.5d0)) - ((t / a) * (z * 4.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a < -2.090464557976709e+86) {
tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
} else if (a < 2.144030707833976e+99) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a < -2.090464557976709e+86: tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z))) elif a < 2.144030707833976e+99: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) else: tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a < -2.090464557976709e+86) tmp = Float64(Float64(0.5 * Float64(Float64(y * x) / a)) - Float64(4.5 * Float64(t / Float64(a / z)))); elseif (a < 2.144030707833976e+99) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); else tmp = Float64(Float64(Float64(y / a) * Float64(x * 0.5)) - Float64(Float64(t / a) * Float64(z * 4.5))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a < -2.090464557976709e+86) tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z))); elseif (a < 2.144030707833976e+99) tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0); else tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Less[a, -2.090464557976709e+86], N[(N[(0.5 * N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] - N[(4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[a, 2.144030707833976e+99], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / a), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a < -2.090464557976709 \cdot 10^{+86}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;a < 2.144030707833976 \cdot 10^{+99}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(x \cdot 0.5\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\
\end{array}
\end{array}
herbie shell --seed 2024041
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
:herbie-target
(if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))