
(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}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) (- INFINITY))
(/ x (* a (/ 2.0 y)))
(if (<= (* x y) 4e+206)
(/ (fma x y (* z (* t -9.0))) (* a 2.0))
(* y (+ (* -4.5 (/ (* z t) (* y a))) (* 0.5 (/ x a)))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = x / (a * (2.0 / y));
} else if ((x * y) <= 4e+206) {
tmp = fma(x, y, (z * (t * -9.0))) / (a * 2.0);
} else {
tmp = y * ((-4.5 * ((z * t) / (y * a))) + (0.5 * (x / a)));
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(x / Float64(a * Float64(2.0 / y))); elseif (Float64(x * y) <= 4e+206) tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) / Float64(a * 2.0)); else tmp = Float64(y * Float64(Float64(-4.5 * Float64(Float64(z * t) / Float64(y * a))) + Float64(0.5 * Float64(x / a)))); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(x / N[(a * N[(2.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e+206], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(-4.5 * N[(N[(z * t), $MachinePrecision] / N[(y * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{x}{a \cdot \frac{2}{y}}\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+206}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-4.5 \cdot \frac{z \cdot t}{y \cdot a} + 0.5 \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 63.0%
Taylor expanded in x around inf 70.7%
*-commutative70.7%
associate-/l*99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r/99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.8%
*-un-lft-identity99.8%
times-frac99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-commutative99.8%
associate-/l*99.6%
Simplified99.6%
if -inf.0 < (*.f64 x y) < 4.0000000000000002e206Initial program 95.3%
div-sub94.3%
*-commutative94.3%
div-sub95.3%
cancel-sign-sub-inv95.3%
*-commutative95.3%
fma-define95.3%
distribute-rgt-neg-in95.3%
associate-*r*95.3%
distribute-lft-neg-in95.3%
*-commutative95.3%
distribute-rgt-neg-in95.3%
metadata-eval95.3%
Simplified95.3%
if 4.0000000000000002e206 < (*.f64 x y) Initial program 73.0%
Taylor expanded in y around inf 99.8%
Final simplification96.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (* x 0.5) a))))
(if (<= (* x y) -5e-59)
t_1
(if (<= (* x y) 2e-88)
(/ (* t (* z -4.5)) a)
(if (<= (* x y) 1e-15)
(/ (* x y) (* a 2.0))
(if (<= (* x y) 1e+47) (* -4.5 (/ z (/ a t))) t_1))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((x * 0.5) / a);
double tmp;
if ((x * y) <= -5e-59) {
tmp = t_1;
} else if ((x * y) <= 2e-88) {
tmp = (t * (z * -4.5)) / a;
} else if ((x * y) <= 1e-15) {
tmp = (x * y) / (a * 2.0);
} else if ((x * y) <= 1e+47) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 * ((x * 0.5d0) / a)
if ((x * y) <= (-5d-59)) then
tmp = t_1
else if ((x * y) <= 2d-88) then
tmp = (t * (z * (-4.5d0))) / a
else if ((x * y) <= 1d-15) then
tmp = (x * y) / (a * 2.0d0)
else if ((x * y) <= 1d+47) then
tmp = (-4.5d0) * (z / (a / t))
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((x * 0.5) / a);
double tmp;
if ((x * y) <= -5e-59) {
tmp = t_1;
} else if ((x * y) <= 2e-88) {
tmp = (t * (z * -4.5)) / a;
} else if ((x * y) <= 1e-15) {
tmp = (x * y) / (a * 2.0);
} else if ((x * y) <= 1e+47) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = y * ((x * 0.5) / a) tmp = 0 if (x * y) <= -5e-59: tmp = t_1 elif (x * y) <= 2e-88: tmp = (t * (z * -4.5)) / a elif (x * y) <= 1e-15: tmp = (x * y) / (a * 2.0) elif (x * y) <= 1e+47: tmp = -4.5 * (z / (a / t)) else: tmp = t_1 return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(x * 0.5) / a)) tmp = 0.0 if (Float64(x * y) <= -5e-59) tmp = t_1; elseif (Float64(x * y) <= 2e-88) tmp = Float64(Float64(t * Float64(z * -4.5)) / a); elseif (Float64(x * y) <= 1e-15) tmp = Float64(Float64(x * y) / Float64(a * 2.0)); elseif (Float64(x * y) <= 1e+47) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); else tmp = t_1; end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = y * ((x * 0.5) / a);
tmp = 0.0;
if ((x * y) <= -5e-59)
tmp = t_1;
elseif ((x * y) <= 2e-88)
tmp = (t * (z * -4.5)) / a;
elseif ((x * y) <= 1e-15)
tmp = (x * y) / (a * 2.0);
elseif ((x * y) <= 1e+47)
tmp = -4.5 * (z / (a / t));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(x * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e-59], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-88], N[(N[(t * N[(z * -4.5), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-15], N[(N[(x * y), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+47], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := y \cdot \frac{x \cdot 0.5}{a}\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-88}:\\
\;\;\;\;\frac{t \cdot \left(z \cdot -4.5\right)}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{-15}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2}\\
\mathbf{elif}\;x \cdot y \leq 10^{+47}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -5.0000000000000001e-59 or 1e47 < (*.f64 x y) Initial program 85.8%
Taylor expanded in y around inf 84.8%
Taylor expanded in t around 0 79.6%
associate-*r/79.6%
Simplified79.6%
if -5.0000000000000001e-59 < (*.f64 x y) < 1.99999999999999987e-88Initial program 97.8%
Taylor expanded in x around 0 91.8%
associate-/l*85.9%
Simplified85.9%
associate-*r*85.9%
div-inv85.9%
associate-*r*91.9%
associate-*r*91.8%
*-commutative91.8%
associate-*r*91.8%
associate-*r*83.9%
div-inv83.9%
*-commutative83.9%
associate-*l/91.9%
*-commutative91.9%
Applied egg-rr91.9%
if 1.99999999999999987e-88 < (*.f64 x y) < 1.0000000000000001e-15Initial program 91.4%
Taylor expanded in x around inf 72.6%
if 1.0000000000000001e-15 < (*.f64 x y) < 1e47Initial program 91.6%
Taylor expanded in x around 0 67.9%
associate-/l*67.9%
Simplified67.9%
associate-*r*67.9%
div-inv67.8%
associate-*r*67.9%
associate-*r*67.7%
*-commutative67.7%
associate-*r*67.7%
associate-*r*76.1%
div-inv76.1%
clear-num76.2%
un-div-inv76.2%
*-commutative76.2%
Applied egg-rr76.2%
*-commutative76.2%
*-un-lft-identity76.2%
times-frac76.2%
metadata-eval76.2%
Applied egg-rr76.2%
Final simplification83.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (* x 0.5) a))))
(if (<= (* x y) -5e-59)
t_1
(if (<= (* x y) 2e-88)
(/ (* z (* t -4.5)) a)
(if (<= (* x y) 1e-15)
(/ (* x y) (* a 2.0))
(if (<= (* x y) 1e+47) (* -4.5 (/ z (/ a t))) t_1))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((x * 0.5) / a);
double tmp;
if ((x * y) <= -5e-59) {
tmp = t_1;
} else if ((x * y) <= 2e-88) {
tmp = (z * (t * -4.5)) / a;
} else if ((x * y) <= 1e-15) {
tmp = (x * y) / (a * 2.0);
} else if ((x * y) <= 1e+47) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 * ((x * 0.5d0) / a)
if ((x * y) <= (-5d-59)) then
tmp = t_1
else if ((x * y) <= 2d-88) then
tmp = (z * (t * (-4.5d0))) / a
else if ((x * y) <= 1d-15) then
tmp = (x * y) / (a * 2.0d0)
else if ((x * y) <= 1d+47) then
tmp = (-4.5d0) * (z / (a / t))
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((x * 0.5) / a);
double tmp;
if ((x * y) <= -5e-59) {
tmp = t_1;
} else if ((x * y) <= 2e-88) {
tmp = (z * (t * -4.5)) / a;
} else if ((x * y) <= 1e-15) {
tmp = (x * y) / (a * 2.0);
} else if ((x * y) <= 1e+47) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = y * ((x * 0.5) / a) tmp = 0 if (x * y) <= -5e-59: tmp = t_1 elif (x * y) <= 2e-88: tmp = (z * (t * -4.5)) / a elif (x * y) <= 1e-15: tmp = (x * y) / (a * 2.0) elif (x * y) <= 1e+47: tmp = -4.5 * (z / (a / t)) else: tmp = t_1 return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(x * 0.5) / a)) tmp = 0.0 if (Float64(x * y) <= -5e-59) tmp = t_1; elseif (Float64(x * y) <= 2e-88) tmp = Float64(Float64(z * Float64(t * -4.5)) / a); elseif (Float64(x * y) <= 1e-15) tmp = Float64(Float64(x * y) / Float64(a * 2.0)); elseif (Float64(x * y) <= 1e+47) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); else tmp = t_1; end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = y * ((x * 0.5) / a);
tmp = 0.0;
if ((x * y) <= -5e-59)
tmp = t_1;
elseif ((x * y) <= 2e-88)
tmp = (z * (t * -4.5)) / a;
elseif ((x * y) <= 1e-15)
tmp = (x * y) / (a * 2.0);
elseif ((x * y) <= 1e+47)
tmp = -4.5 * (z / (a / t));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(x * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e-59], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-88], N[(N[(z * N[(t * -4.5), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-15], N[(N[(x * y), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+47], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := y \cdot \frac{x \cdot 0.5}{a}\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-88}:\\
\;\;\;\;\frac{z \cdot \left(t \cdot -4.5\right)}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{-15}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2}\\
\mathbf{elif}\;x \cdot y \leq 10^{+47}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -5.0000000000000001e-59 or 1e47 < (*.f64 x y) Initial program 85.8%
Taylor expanded in y around inf 84.8%
Taylor expanded in t around 0 79.6%
associate-*r/79.6%
Simplified79.6%
if -5.0000000000000001e-59 < (*.f64 x y) < 1.99999999999999987e-88Initial program 97.8%
Taylor expanded in x around 0 91.8%
associate-*r/91.9%
associate-*r*91.9%
associate-*l/83.9%
associate-*r/83.8%
*-commutative83.8%
associate-*r/83.9%
Simplified83.9%
associate-*r/91.9%
*-commutative91.9%
Applied egg-rr91.9%
if 1.99999999999999987e-88 < (*.f64 x y) < 1.0000000000000001e-15Initial program 91.4%
Taylor expanded in x around inf 72.6%
if 1.0000000000000001e-15 < (*.f64 x y) < 1e47Initial program 91.6%
Taylor expanded in x around 0 67.9%
associate-/l*67.9%
Simplified67.9%
associate-*r*67.9%
div-inv67.8%
associate-*r*67.9%
associate-*r*67.7%
*-commutative67.7%
associate-*r*67.7%
associate-*r*76.1%
div-inv76.1%
clear-num76.2%
un-div-inv76.2%
*-commutative76.2%
Applied egg-rr76.2%
*-commutative76.2%
*-un-lft-identity76.2%
times-frac76.2%
metadata-eval76.2%
Applied egg-rr76.2%
Final simplification83.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) (- INFINITY))
(/ x (* a (/ 2.0 y)))
(if (<= (* x y) 4e+206)
(/ (- (* x y) (* t (* z 9.0))) (* a 2.0))
(* y (+ (* -4.5 (/ (* z t) (* y a))) (* 0.5 (/ x a)))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = x / (a * (2.0 / y));
} else if ((x * y) <= 4e+206) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = y * ((-4.5 * ((z * t) / (y * a))) + (0.5 * (x / a)));
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = x / (a * (2.0 / y));
} else if ((x * y) <= 4e+206) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = y * ((-4.5 * ((z * t) / (y * a))) + (0.5 * (x / a)));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = x / (a * (2.0 / y)) elif (x * y) <= 4e+206: tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0) else: tmp = y * ((-4.5 * ((z * t) / (y * a))) + (0.5 * (x / a))) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(x / Float64(a * Float64(2.0 / y))); elseif (Float64(x * y) <= 4e+206) tmp = Float64(Float64(Float64(x * y) - Float64(t * Float64(z * 9.0))) / Float64(a * 2.0)); else tmp = Float64(y * Float64(Float64(-4.5 * Float64(Float64(z * t) / Float64(y * a))) + Float64(0.5 * Float64(x / a)))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -Inf)
tmp = x / (a * (2.0 / y));
elseif ((x * y) <= 4e+206)
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
else
tmp = y * ((-4.5 * ((z * t) / (y * a))) + (0.5 * (x / a)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(x / N[(a * N[(2.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e+206], N[(N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(-4.5 * N[(N[(z * t), $MachinePrecision] / N[(y * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{x}{a \cdot \frac{2}{y}}\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+206}:\\
\;\;\;\;\frac{x \cdot y - t \cdot \left(z \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-4.5 \cdot \frac{z \cdot t}{y \cdot a} + 0.5 \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 63.0%
Taylor expanded in x around inf 70.7%
*-commutative70.7%
associate-/l*99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r/99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.8%
*-un-lft-identity99.8%
times-frac99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-commutative99.8%
associate-/l*99.6%
Simplified99.6%
if -inf.0 < (*.f64 x y) < 4.0000000000000002e206Initial program 95.3%
if 4.0000000000000002e206 < (*.f64 x y) Initial program 73.0%
Taylor expanded in y around inf 99.8%
Final simplification96.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) (- INFINITY))
(/ x (* a (/ 2.0 y)))
(if (<= (* x y) 2e+220)
(/ (- (* x y) (* t (* z 9.0))) (* a 2.0))
(* y (/ (* x 0.5) a)))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = x / (a * (2.0 / y));
} else if ((x * y) <= 2e+220) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = y * ((x * 0.5) / a);
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = x / (a * (2.0 / y));
} else if ((x * y) <= 2e+220) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = y * ((x * 0.5) / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = x / (a * (2.0 / y)) elif (x * y) <= 2e+220: tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0) else: tmp = y * ((x * 0.5) / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(x / Float64(a * Float64(2.0 / y))); elseif (Float64(x * y) <= 2e+220) tmp = Float64(Float64(Float64(x * y) - Float64(t * Float64(z * 9.0))) / Float64(a * 2.0)); else tmp = Float64(y * Float64(Float64(x * 0.5) / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -Inf)
tmp = x / (a * (2.0 / y));
elseif ((x * y) <= 2e+220)
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
else
tmp = y * ((x * 0.5) / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(x / N[(a * N[(2.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+220], N[(N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{x}{a \cdot \frac{2}{y}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+220}:\\
\;\;\;\;\frac{x \cdot y - t \cdot \left(z \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 63.0%
Taylor expanded in x around inf 70.7%
*-commutative70.7%
associate-/l*99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r/99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.8%
*-un-lft-identity99.8%
times-frac99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-commutative99.8%
associate-/l*99.6%
Simplified99.6%
if -inf.0 < (*.f64 x y) < 2e220Initial program 95.4%
if 2e220 < (*.f64 x y) Initial program 65.3%
Taylor expanded in y around inf 99.9%
Taylor expanded in t around 0 99.9%
associate-*r/99.9%
Simplified99.9%
Final simplification96.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= y -5.2e-79) (not (<= y 6.5e-33))) (* x (/ (* y 0.5) a)) (* -4.5 (/ (* z t) a))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.2e-79) || !(y <= 6.5e-33)) {
tmp = x * ((y * 0.5) / a);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 ((y <= (-5.2d-79)) .or. (.not. (y <= 6.5d-33))) then
tmp = x * ((y * 0.5d0) / a)
else
tmp = (-4.5d0) * ((z * t) / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.2e-79) || !(y <= 6.5e-33)) {
tmp = x * ((y * 0.5) / a);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (y <= -5.2e-79) or not (y <= 6.5e-33): tmp = x * ((y * 0.5) / a) else: tmp = -4.5 * ((z * t) / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5.2e-79) || !(y <= 6.5e-33)) tmp = Float64(x * Float64(Float64(y * 0.5) / a)); else tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((y <= -5.2e-79) || ~((y <= 6.5e-33)))
tmp = x * ((y * 0.5) / a);
else
tmp = -4.5 * ((z * t) / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5.2e-79], N[Not[LessEqual[y, 6.5e-33]], $MachinePrecision]], N[(x * N[(N[(y * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-79} \lor \neg \left(y \leq 6.5 \cdot 10^{-33}\right):\\
\;\;\;\;x \cdot \frac{y \cdot 0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\end{array}
\end{array}
if y < -5.19999999999999987e-79 or 6.4999999999999993e-33 < y Initial program 87.7%
Taylor expanded in x around inf 65.9%
*-commutative65.9%
associate-/l*72.1%
associate-*r*72.0%
*-commutative72.0%
associate-*r/72.0%
Simplified72.0%
if -5.19999999999999987e-79 < y < 6.4999999999999993e-33Initial program 95.3%
Taylor expanded in x around 0 76.6%
Final simplification74.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= x -0.062) (not (<= x 8.5e-119))) (* y (/ (* x 0.5) a)) (* -4.5 (/ (* z t) a))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -0.062) || !(x <= 8.5e-119)) {
tmp = y * ((x * 0.5) / a);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 ((x <= (-0.062d0)) .or. (.not. (x <= 8.5d-119))) then
tmp = y * ((x * 0.5d0) / a)
else
tmp = (-4.5d0) * ((z * t) / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -0.062) || !(x <= 8.5e-119)) {
tmp = y * ((x * 0.5) / a);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x <= -0.062) or not (x <= 8.5e-119): tmp = y * ((x * 0.5) / a) else: tmp = -4.5 * ((z * t) / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((x <= -0.062) || !(x <= 8.5e-119)) tmp = Float64(y * Float64(Float64(x * 0.5) / a)); else tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x <= -0.062) || ~((x <= 8.5e-119)))
tmp = y * ((x * 0.5) / a);
else
tmp = -4.5 * ((z * t) / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -0.062], N[Not[LessEqual[x, 8.5e-119]], $MachinePrecision]], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.062 \lor \neg \left(x \leq 8.5 \cdot 10^{-119}\right):\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\end{array}
\end{array}
if x < -0.062 or 8.49999999999999977e-119 < x Initial program 87.4%
Taylor expanded in y around inf 81.9%
Taylor expanded in t around 0 68.6%
associate-*r/68.6%
Simplified68.6%
if -0.062 < x < 8.49999999999999977e-119Initial program 96.1%
Taylor expanded in x around 0 75.4%
Final simplification71.3%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= x -0.084) (not (<= x 9e-119))) (* y (/ (* x 0.5) a)) (/ (* t (* z -4.5)) a)))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -0.084) || !(x <= 9e-119)) {
tmp = y * ((x * 0.5) / a);
} else {
tmp = (t * (z * -4.5)) / a;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 ((x <= (-0.084d0)) .or. (.not. (x <= 9d-119))) then
tmp = y * ((x * 0.5d0) / a)
else
tmp = (t * (z * (-4.5d0))) / a
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -0.084) || !(x <= 9e-119)) {
tmp = y * ((x * 0.5) / a);
} else {
tmp = (t * (z * -4.5)) / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x <= -0.084) or not (x <= 9e-119): tmp = y * ((x * 0.5) / a) else: tmp = (t * (z * -4.5)) / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((x <= -0.084) || !(x <= 9e-119)) tmp = Float64(y * Float64(Float64(x * 0.5) / a)); else tmp = Float64(Float64(t * Float64(z * -4.5)) / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x <= -0.084) || ~((x <= 9e-119)))
tmp = y * ((x * 0.5) / a);
else
tmp = (t * (z * -4.5)) / a;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -0.084], N[Not[LessEqual[x, 9e-119]], $MachinePrecision]], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(t * N[(z * -4.5), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.084 \lor \neg \left(x \leq 9 \cdot 10^{-119}\right):\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \left(z \cdot -4.5\right)}{a}\\
\end{array}
\end{array}
if x < -0.0840000000000000052 or 9.0000000000000005e-119 < x Initial program 87.4%
Taylor expanded in y around inf 81.9%
Taylor expanded in t around 0 68.6%
associate-*r/68.6%
Simplified68.6%
if -0.0840000000000000052 < x < 9.0000000000000005e-119Initial program 96.1%
Taylor expanded in x around 0 75.4%
associate-/l*71.8%
Simplified71.8%
associate-*r*71.7%
div-inv71.8%
associate-*r*75.4%
associate-*r*75.3%
*-commutative75.3%
associate-*r*75.3%
associate-*r*73.3%
div-inv73.2%
*-commutative73.2%
associate-*l/75.4%
*-commutative75.4%
Applied egg-rr75.4%
Final simplification71.3%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= x -15.2) (* y (* x (/ 0.5 a))) (if (<= x 1.9e-120) (* -4.5 (/ (* z t) a)) (* x (/ (* y 0.5) a)))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -15.2) {
tmp = y * (x * (0.5 / a));
} else if (x <= 1.9e-120) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = x * ((y * 0.5) / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (x <= (-15.2d0)) then
tmp = y * (x * (0.5d0 / a))
else if (x <= 1.9d-120) then
tmp = (-4.5d0) * ((z * t) / a)
else
tmp = x * ((y * 0.5d0) / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -15.2) {
tmp = y * (x * (0.5 / a));
} else if (x <= 1.9e-120) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = x * ((y * 0.5) / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if x <= -15.2: tmp = y * (x * (0.5 / a)) elif x <= 1.9e-120: tmp = -4.5 * ((z * t) / a) else: tmp = x * ((y * 0.5) / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (x <= -15.2) tmp = Float64(y * Float64(x * Float64(0.5 / a))); elseif (x <= 1.9e-120) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); else tmp = Float64(x * Float64(Float64(y * 0.5) / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (x <= -15.2)
tmp = y * (x * (0.5 / a));
elseif (x <= 1.9e-120)
tmp = -4.5 * ((z * t) / a);
else
tmp = x * ((y * 0.5) / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[x, -15.2], N[(y * N[(x * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e-120], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -15.2:\\
\;\;\;\;y \cdot \left(x \cdot \frac{0.5}{a}\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-120}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y \cdot 0.5}{a}\\
\end{array}
\end{array}
if x < -15.199999999999999Initial program 89.7%
Taylor expanded in y around inf 84.2%
Taylor expanded in t around 0 72.0%
associate-*r/72.0%
*-commutative72.0%
associate-*r/71.9%
Simplified71.9%
if -15.199999999999999 < x < 1.8999999999999999e-120Initial program 96.1%
Taylor expanded in x around 0 75.4%
if 1.8999999999999999e-120 < x Initial program 85.3%
Taylor expanded in x around inf 55.7%
*-commutative55.7%
associate-/l*64.1%
associate-*r*64.1%
*-commutative64.1%
associate-*r/64.1%
Simplified64.1%
Final simplification71.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (* t (/ z a))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (t * (z / a));
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 = (-4.5d0) * (t * (z / a))
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (t * (z / a));
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return -4.5 * (t * (z / a))
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(t * Float64(z / a))) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (t * (z / a));
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
-4.5 \cdot \left(t \cdot \frac{z}{a}\right)
\end{array}
Initial program 90.9%
Taylor expanded in x around 0 49.7%
associate-/l*50.7%
Simplified50.7%
Final simplification50.7%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (/ z (/ a t))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (z / (a / t));
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 = (-4.5d0) * (z / (a / t))
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (z / (a / t));
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return -4.5 * (z / (a / t))
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(z / Float64(a / t))) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (z / (a / t));
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
-4.5 \cdot \frac{z}{\frac{a}{t}}
\end{array}
Initial program 90.9%
Taylor expanded in x around 0 49.7%
associate-/l*50.7%
Simplified50.7%
associate-*r*50.7%
div-inv50.7%
associate-*r*49.7%
associate-*r*49.6%
*-commutative49.6%
associate-*r*49.6%
associate-*r*49.9%
div-inv49.9%
clear-num49.6%
un-div-inv49.3%
*-commutative49.3%
Applied egg-rr49.3%
*-commutative49.3%
*-un-lft-identity49.3%
times-frac49.3%
metadata-eval49.3%
Applied egg-rr49.3%
Final simplification49.3%
(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 2024055
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
:alt
(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)))