
(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 10 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.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* t (* z 9.0)))))
(if (<= t_1 (- INFINITY))
(- (* x (/ y (* a 2.0))) (* z (* (/ t a) 4.5)))
(if (<= t_1 2e+264)
(/ t_1 (* a 2.0))
(/ 1.0 (* 2.0 (/ (/ a x) (fma (* t -9.0) (/ z x) y))))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (t * (z * 9.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x * (y / (a * 2.0))) - (z * ((t / a) * 4.5));
} else if (t_1 <= 2e+264) {
tmp = t_1 / (a * 2.0);
} else {
tmp = 1.0 / (2.0 * ((a / x) / fma((t * -9.0), (z / x), y)));
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(t * Float64(z * 9.0))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x * Float64(y / Float64(a * 2.0))) - Float64(z * Float64(Float64(t / a) * 4.5))); elseif (t_1 <= 2e+264) tmp = Float64(t_1 / Float64(a * 2.0)); else tmp = Float64(1.0 / Float64(2.0 * Float64(Float64(a / x) / fma(Float64(t * -9.0), Float64(z / x), y)))); end return tmp end
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[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * N[(y / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(N[(t / a), $MachinePrecision] * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+264], N[(t$95$1 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 * N[(N[(a / x), $MachinePrecision] / N[(N[(t * -9.0), $MachinePrecision] * N[(z / x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - t \cdot \left(z \cdot 9\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x \cdot \frac{y}{a \cdot 2} - z \cdot \left(\frac{t}{a} \cdot 4.5\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\frac{t\_1}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 \cdot \frac{\frac{a}{x}}{\mathsf{fma}\left(t \cdot -9, \frac{z}{x}, y\right)}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < -inf.0Initial program 56.1%
div-sub46.1%
*-commutative46.1%
div-sub56.1%
cancel-sign-sub-inv56.1%
*-commutative56.1%
fma-define56.1%
distribute-rgt-neg-in56.1%
associate-*r*56.1%
distribute-lft-neg-in56.1%
*-commutative56.1%
distribute-rgt-neg-in56.1%
metadata-eval56.1%
Simplified56.1%
*-un-lft-identity56.1%
*-un-lft-identity56.1%
*-commutative56.1%
associate-*r*56.1%
metadata-eval56.1%
distribute-rgt-neg-in56.1%
distribute-lft-neg-in56.1%
fmm-def56.1%
div-sub46.1%
associate-/l*74.4%
associate-*l*74.4%
associate-/l*89.8%
Applied egg-rr89.8%
*-commutative89.8%
times-frac89.8%
metadata-eval89.8%
Applied egg-rr89.8%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 2.00000000000000009e264Initial program 98.6%
if 2.00000000000000009e264 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) Initial program 66.0%
div-sub58.9%
*-commutative58.9%
div-sub66.0%
cancel-sign-sub-inv66.0%
*-commutative66.0%
fma-define68.6%
distribute-rgt-neg-in68.6%
associate-*r*68.7%
distribute-lft-neg-in68.7%
*-commutative68.7%
distribute-rgt-neg-in68.7%
metadata-eval68.7%
Simplified68.7%
Taylor expanded in x around inf 68.7%
clear-num68.7%
inv-pow68.7%
*-commutative68.7%
*-un-lft-identity68.7%
times-frac68.7%
metadata-eval68.7%
+-commutative68.7%
fma-define68.7%
associate-/l*73.6%
Applied egg-rr73.6%
unpow-173.6%
associate-/r*93.1%
fma-undefine93.1%
associate-*r*93.1%
fma-define93.1%
Simplified93.1%
Final simplification96.7%
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 (sqrt (* a 2.0))))
(if (<= (* a 2.0) 5e-41)
(/ (/ (fma z (* t -9.0) (* x y)) t_1) t_1)
(- (* x (/ y (* a 2.0))) (* z (* (/ t a) 4.5))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = sqrt((a * 2.0));
double tmp;
if ((a * 2.0) <= 5e-41) {
tmp = (fma(z, (t * -9.0), (x * y)) / t_1) / t_1;
} else {
tmp = (x * (y / (a * 2.0))) - (z * ((t / a) * 4.5));
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = sqrt(Float64(a * 2.0)) tmp = 0.0 if (Float64(a * 2.0) <= 5e-41) tmp = Float64(Float64(fma(z, Float64(t * -9.0), Float64(x * y)) / t_1) / t_1); else tmp = Float64(Float64(x * Float64(y / Float64(a * 2.0))) - Float64(z * Float64(Float64(t / a) * 4.5))); end return tmp end
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[Sqrt[N[(a * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(a * 2.0), $MachinePrecision], 5e-41], N[(N[(N[(z * N[(t * -9.0), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(x * N[(y / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(N[(t / a), $MachinePrecision] * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \sqrt{a \cdot 2}\\
\mathbf{if}\;a \cdot 2 \leq 5 \cdot 10^{-41}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(z, t \cdot -9, x \cdot y\right)}{t\_1}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a \cdot 2} - z \cdot \left(\frac{t}{a} \cdot 4.5\right)\\
\end{array}
\end{array}
if (*.f64 a #s(literal 2 binary64)) < 4.9999999999999996e-41Initial program 91.5%
div-sub86.8%
*-commutative86.8%
div-sub91.5%
cancel-sign-sub-inv91.5%
*-commutative91.5%
fma-define92.0%
distribute-rgt-neg-in92.0%
associate-*r*92.1%
distribute-lft-neg-in92.1%
*-commutative92.1%
distribute-rgt-neg-in92.1%
metadata-eval92.1%
Simplified92.1%
*-un-lft-identity92.1%
add-sqr-sqrt28.8%
times-frac28.8%
Applied egg-rr28.8%
associate-*l/28.8%
*-lft-identity28.8%
fma-define28.2%
+-commutative28.2%
fma-define28.2%
*-commutative28.2%
*-commutative28.2%
Simplified28.2%
if 4.9999999999999996e-41 < (*.f64 a #s(literal 2 binary64)) Initial program 82.1%
div-sub82.1%
*-commutative82.1%
div-sub82.1%
cancel-sign-sub-inv82.1%
*-commutative82.1%
fma-define82.2%
distribute-rgt-neg-in82.2%
associate-*r*82.2%
distribute-lft-neg-in82.2%
*-commutative82.2%
distribute-rgt-neg-in82.2%
metadata-eval82.2%
Simplified82.2%
*-un-lft-identity82.2%
*-un-lft-identity82.2%
*-commutative82.2%
associate-*r*82.2%
metadata-eval82.2%
distribute-rgt-neg-in82.2%
distribute-lft-neg-in82.2%
fmm-def82.1%
div-sub82.1%
associate-/l*90.0%
associate-*l*90.0%
associate-/l*95.8%
Applied egg-rr95.8%
*-commutative95.8%
times-frac95.7%
metadata-eval95.7%
Applied egg-rr95.7%
Final simplification50.9%
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 (<= (* a 2.0) 1.0) (/ (fma x y (* z (* t -9.0))) (* a 2.0)) (- (* x (/ y (* a 2.0))) (* z (* (/ t a) 4.5)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= 1.0) {
tmp = fma(x, y, (z * (t * -9.0))) / (a * 2.0);
} else {
tmp = (x * (y / (a * 2.0))) - (z * ((t / a) * 4.5));
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= 1.0) tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) / Float64(a * 2.0)); else tmp = Float64(Float64(x * Float64(y / Float64(a * 2.0))) - Float64(z * Float64(Float64(t / a) * 4.5))); end return tmp end
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[(a * 2.0), $MachinePrecision], 1.0], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(N[(t / a), $MachinePrecision] * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq 1:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a \cdot 2} - z \cdot \left(\frac{t}{a} \cdot 4.5\right)\\
\end{array}
\end{array}
if (*.f64 a #s(literal 2 binary64)) < 1Initial program 91.9%
div-sub87.4%
*-commutative87.4%
div-sub91.9%
cancel-sign-sub-inv91.9%
*-commutative91.9%
fma-define92.4%
distribute-rgt-neg-in92.4%
associate-*r*92.5%
distribute-lft-neg-in92.5%
*-commutative92.5%
distribute-rgt-neg-in92.5%
metadata-eval92.5%
Simplified92.5%
if 1 < (*.f64 a #s(literal 2 binary64)) Initial program 80.0%
div-sub80.0%
*-commutative80.0%
div-sub80.0%
cancel-sign-sub-inv80.0%
*-commutative80.0%
fma-define80.1%
distribute-rgt-neg-in80.1%
associate-*r*80.2%
distribute-lft-neg-in80.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
metadata-eval80.2%
Simplified80.2%
*-un-lft-identity80.2%
*-un-lft-identity80.2%
*-commutative80.2%
associate-*r*80.1%
metadata-eval80.1%
distribute-rgt-neg-in80.1%
distribute-lft-neg-in80.1%
fmm-def80.0%
div-sub80.0%
associate-/l*88.8%
associate-*l*88.9%
associate-/l*95.3%
Applied egg-rr95.3%
*-commutative95.3%
times-frac95.2%
metadata-eval95.2%
Applied egg-rr95.2%
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) -1e+209)
(* (/ x a) (/ y 2.0))
(if (<= (* x y) 2e+301)
(/ (- (* x y) (* t (* z 9.0))) (* a 2.0))
(* x (* y (/ 0.5 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) <= -1e+209) {
tmp = (x / a) * (y / 2.0);
} else if ((x * y) <= 2e+301) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} 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.
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 * y) <= (-1d+209)) then
tmp = (x / a) * (y / 2.0d0)
else if ((x * y) <= 2d+301) then
tmp = ((x * y) - (t * (z * 9.0d0))) / (a * 2.0d0)
else
tmp = x * (y * (0.5d0 / a))
end if
code = tmp
end function
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) <= -1e+209) {
tmp = (x / a) * (y / 2.0);
} else if ((x * y) <= 2e+301) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = x * (y * (0.5 / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -1e+209: tmp = (x / a) * (y / 2.0) elif (x * y) <= 2e+301: tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0) else: tmp = x * (y * (0.5 / a)) return tmp
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) <= -1e+209) tmp = Float64(Float64(x / a) * Float64(y / 2.0)); elseif (Float64(x * y) <= 2e+301) tmp = Float64(Float64(Float64(x * y) - Float64(t * Float64(z * 9.0))) / Float64(a * 2.0)); else tmp = Float64(x * Float64(y * Float64(0.5 / a))); end return tmp end
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) <= -1e+209)
tmp = (x / a) * (y / 2.0);
elseif ((x * y) <= 2e+301)
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
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. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+209], N[(N[(x / a), $MachinePrecision] * N[(y / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+301], N[(N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+209}:\\
\;\;\;\;\frac{x}{a} \cdot \frac{y}{2}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+301}:\\
\;\;\;\;\frac{x \cdot y - t \cdot \left(z \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0000000000000001e209Initial program 53.7%
div-sub53.7%
*-commutative53.7%
div-sub53.7%
cancel-sign-sub-inv53.7%
*-commutative53.7%
fma-define57.5%
distribute-rgt-neg-in57.5%
associate-*r*57.5%
distribute-lft-neg-in57.5%
*-commutative57.5%
distribute-rgt-neg-in57.5%
metadata-eval57.5%
Simplified57.5%
Taylor expanded in x around inf 57.1%
associate-/l*86.4%
Simplified86.4%
Taylor expanded in x around 0 57.1%
associate-*r/57.1%
associate-*l/57.0%
*-commutative57.0%
associate-/r/57.1%
metadata-eval57.1%
associate-/r*57.1%
*-commutative57.1%
associate-/r*57.1%
*-commutative57.1%
associate-/r/57.0%
*-commutative57.0%
associate-*r*86.3%
*-commutative86.3%
associate-*r/86.4%
associate-*l/86.4%
*-rgt-identity86.4%
associate-*l/57.1%
associate-*r/86.3%
associate-*l/86.3%
*-commutative86.3%
Simplified86.3%
if -1.0000000000000001e209 < (*.f64 x y) < 2.00000000000000011e301Initial program 96.5%
if 2.00000000000000011e301 < (*.f64 x y) Initial program 55.5%
div-sub50.7%
*-commutative50.7%
div-sub55.5%
cancel-sign-sub-inv55.5%
*-commutative55.5%
fma-define55.5%
distribute-rgt-neg-in55.5%
associate-*r*55.5%
distribute-lft-neg-in55.5%
*-commutative55.5%
distribute-rgt-neg-in55.5%
metadata-eval55.5%
Simplified55.5%
*-un-lft-identity55.5%
add-sqr-sqrt25.7%
times-frac25.7%
Applied egg-rr25.7%
associate-*l/25.7%
*-lft-identity25.7%
fma-define25.7%
+-commutative25.7%
fma-define25.9%
*-commutative25.9%
*-commutative25.9%
Simplified25.9%
Taylor expanded in z around 0 60.5%
associate-/l*97.6%
*-rgt-identity97.6%
*-commutative97.6%
unpow297.6%
rem-square-sqrt98.2%
associate-*r/98.2%
associate-/r*98.2%
metadata-eval98.2%
Simplified98.2%
Final simplification95.5%
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 (<= (* a 2.0) 1.0) (/ (- (* x y) (* t (* z 9.0))) (* a 2.0)) (- (* x (/ y (* a 2.0))) (* z (* (/ t a) 4.5)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= 1.0) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = (x * (y / (a * 2.0))) - (z * ((t / a) * 4.5));
}
return tmp;
}
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 ((a * 2.0d0) <= 1.0d0) then
tmp = ((x * y) - (t * (z * 9.0d0))) / (a * 2.0d0)
else
tmp = (x * (y / (a * 2.0d0))) - (z * ((t / a) * 4.5d0))
end if
code = tmp
end function
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 ((a * 2.0) <= 1.0) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = (x * (y / (a * 2.0))) - (z * ((t / a) * 4.5));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (a * 2.0) <= 1.0: tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0) else: tmp = (x * (y / (a * 2.0))) - (z * ((t / a) * 4.5)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= 1.0) tmp = Float64(Float64(Float64(x * y) - Float64(t * Float64(z * 9.0))) / Float64(a * 2.0)); else tmp = Float64(Float64(x * Float64(y / Float64(a * 2.0))) - Float64(z * Float64(Float64(t / a) * 4.5))); end return tmp end
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 ((a * 2.0) <= 1.0)
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
else
tmp = (x * (y / (a * 2.0))) - (z * ((t / a) * 4.5));
end
tmp_2 = tmp;
end
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[(a * 2.0), $MachinePrecision], 1.0], N[(N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(N[(t / a), $MachinePrecision] * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq 1:\\
\;\;\;\;\frac{x \cdot y - t \cdot \left(z \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a \cdot 2} - z \cdot \left(\frac{t}{a} \cdot 4.5\right)\\
\end{array}
\end{array}
if (*.f64 a #s(literal 2 binary64)) < 1Initial program 91.9%
if 1 < (*.f64 a #s(literal 2 binary64)) Initial program 80.0%
div-sub80.0%
*-commutative80.0%
div-sub80.0%
cancel-sign-sub-inv80.0%
*-commutative80.0%
fma-define80.1%
distribute-rgt-neg-in80.1%
associate-*r*80.2%
distribute-lft-neg-in80.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
metadata-eval80.2%
Simplified80.2%
*-un-lft-identity80.2%
*-un-lft-identity80.2%
*-commutative80.2%
associate-*r*80.1%
metadata-eval80.1%
distribute-rgt-neg-in80.1%
distribute-lft-neg-in80.1%
fmm-def80.0%
div-sub80.0%
associate-/l*88.8%
associate-*l*88.9%
associate-/l*95.3%
Applied egg-rr95.3%
*-commutative95.3%
times-frac95.2%
metadata-eval95.2%
Applied egg-rr95.2%
Final simplification92.9%
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 y) -1e+47) (not (<= (* x y) 5e-77))) (* (/ x a) (/ y 2.0)) (/ t (* -0.2222222222222222 (/ a z)))))
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) <= -1e+47) || !((x * y) <= 5e-77)) {
tmp = (x / a) * (y / 2.0);
} else {
tmp = t / (-0.2222222222222222 * (a / z));
}
return tmp;
}
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 * y) <= (-1d+47)) .or. (.not. ((x * y) <= 5d-77))) then
tmp = (x / a) * (y / 2.0d0)
else
tmp = t / ((-0.2222222222222222d0) * (a / z))
end if
code = tmp
end function
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) <= -1e+47) || !((x * y) <= 5e-77)) {
tmp = (x / a) * (y / 2.0);
} else {
tmp = t / (-0.2222222222222222 * (a / z));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if ((x * y) <= -1e+47) or not ((x * y) <= 5e-77): tmp = (x / a) * (y / 2.0) else: tmp = t / (-0.2222222222222222 * (a / z)) return tmp
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) <= -1e+47) || !(Float64(x * y) <= 5e-77)) tmp = Float64(Float64(x / a) * Float64(y / 2.0)); else tmp = Float64(t / Float64(-0.2222222222222222 * Float64(a / z))); end return tmp end
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) <= -1e+47) || ~(((x * y) <= 5e-77)))
tmp = (x / a) * (y / 2.0);
else
tmp = t / (-0.2222222222222222 * (a / z));
end
tmp_2 = tmp;
end
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[N[(x * y), $MachinePrecision], -1e+47], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e-77]], $MachinePrecision]], N[(N[(x / a), $MachinePrecision] * N[(y / 2.0), $MachinePrecision]), $MachinePrecision], N[(t / N[(-0.2222222222222222 * N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+47} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{-77}\right):\\
\;\;\;\;\frac{x}{a} \cdot \frac{y}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{-0.2222222222222222 \cdot \frac{a}{z}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1e47 or 4.99999999999999963e-77 < (*.f64 x y) Initial program 82.5%
div-sub77.6%
*-commutative77.6%
div-sub82.5%
cancel-sign-sub-inv82.5%
*-commutative82.5%
fma-define83.3%
distribute-rgt-neg-in83.3%
associate-*r*83.3%
distribute-lft-neg-in83.3%
*-commutative83.3%
distribute-rgt-neg-in83.3%
metadata-eval83.3%
Simplified83.3%
Taylor expanded in x around inf 65.3%
associate-/l*72.9%
Simplified72.9%
Taylor expanded in x around 0 65.3%
associate-*r/65.3%
associate-*l/65.2%
*-commutative65.2%
associate-/r/65.2%
metadata-eval65.2%
associate-/r*65.2%
*-commutative65.2%
associate-/r*65.2%
*-commutative65.2%
associate-/r/65.2%
*-commutative65.2%
associate-*r*72.7%
*-commutative72.7%
associate-*r/72.9%
associate-*l/72.9%
*-rgt-identity72.9%
associate-*l/65.3%
associate-*r/72.8%
associate-*l/72.8%
*-commutative72.8%
Simplified72.8%
if -1e47 < (*.f64 x y) < 4.99999999999999963e-77Initial program 95.5%
div-sub94.6%
*-commutative94.6%
div-sub95.5%
cancel-sign-sub-inv95.5%
*-commutative95.5%
fma-define95.5%
distribute-rgt-neg-in95.5%
associate-*r*95.6%
distribute-lft-neg-in95.6%
*-commutative95.6%
distribute-rgt-neg-in95.6%
metadata-eval95.6%
Simplified95.6%
Taylor expanded in x around 0 79.8%
associate-/l*78.3%
Simplified78.3%
associate-*r/79.8%
*-commutative79.8%
Applied egg-rr79.8%
associate-*r/79.9%
associate-*r*79.8%
associate-*l/78.2%
clear-num78.1%
associate-*l/79.2%
*-un-lft-identity79.2%
*-un-lft-identity79.2%
times-frac79.2%
metadata-eval79.2%
Applied egg-rr79.2%
Final simplification75.6%
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 (<= t -9000000000.0) (not (<= t 41000.0))) (* t (* -4.5 (/ z a))) (* (/ x a) (/ y 2.0))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -9000000000.0) || !(t <= 41000.0)) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = (x / a) * (y / 2.0);
}
return tmp;
}
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 ((t <= (-9000000000.0d0)) .or. (.not. (t <= 41000.0d0))) then
tmp = t * ((-4.5d0) * (z / a))
else
tmp = (x / a) * (y / 2.0d0)
end if
code = tmp
end function
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 ((t <= -9000000000.0) || !(t <= 41000.0)) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = (x / a) * (y / 2.0);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (t <= -9000000000.0) or not (t <= 41000.0): tmp = t * (-4.5 * (z / a)) else: tmp = (x / a) * (y / 2.0) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((t <= -9000000000.0) || !(t <= 41000.0)) tmp = Float64(t * Float64(-4.5 * Float64(z / a))); else tmp = Float64(Float64(x / a) * Float64(y / 2.0)); end return tmp end
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 ((t <= -9000000000.0) || ~((t <= 41000.0)))
tmp = t * (-4.5 * (z / a));
else
tmp = (x / a) * (y / 2.0);
end
tmp_2 = tmp;
end
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[t, -9000000000.0], N[Not[LessEqual[t, 41000.0]], $MachinePrecision]], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / a), $MachinePrecision] * N[(y / 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9000000000 \lor \neg \left(t \leq 41000\right):\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a} \cdot \frac{y}{2}\\
\end{array}
\end{array}
if t < -9e9 or 41000 < t Initial program 86.2%
div-sub80.3%
*-commutative80.3%
div-sub86.2%
cancel-sign-sub-inv86.2%
*-commutative86.2%
fma-define87.1%
distribute-rgt-neg-in87.1%
associate-*r*87.1%
distribute-lft-neg-in87.1%
*-commutative87.1%
distribute-rgt-neg-in87.1%
metadata-eval87.1%
Simplified87.1%
Taylor expanded in x around 0 68.9%
*-commutative68.9%
associate-/l*73.6%
associate-*r*73.6%
*-commutative73.6%
Simplified73.6%
if -9e9 < t < 41000Initial program 90.2%
div-sub89.4%
*-commutative89.4%
div-sub90.2%
cancel-sign-sub-inv90.2%
*-commutative90.2%
fma-define90.2%
distribute-rgt-neg-in90.2%
associate-*r*90.2%
distribute-lft-neg-in90.2%
*-commutative90.2%
distribute-rgt-neg-in90.2%
metadata-eval90.2%
Simplified90.2%
Taylor expanded in x around inf 67.9%
associate-/l*68.5%
Simplified68.5%
Taylor expanded in x around 0 67.9%
associate-*r/67.9%
associate-*l/67.8%
*-commutative67.8%
associate-/r/67.8%
metadata-eval67.8%
associate-/r*67.8%
*-commutative67.8%
associate-/r*67.8%
*-commutative67.8%
associate-/r/67.8%
*-commutative67.8%
associate-*r*68.4%
*-commutative68.4%
associate-*r/68.5%
associate-*l/68.5%
*-rgt-identity68.5%
associate-*l/67.9%
associate-*r/71.2%
associate-*l/71.2%
*-commutative71.2%
Simplified71.2%
Final simplification72.3%
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 (<= t -0.74) (not (<= t 13500.0))) (* t (* -4.5 (/ z a))) (* 0.5 (* x (/ y 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 ((t <= -0.74) || !(t <= 13500.0)) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = 0.5 * (x * (y / a));
}
return tmp;
}
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 ((t <= (-0.74d0)) .or. (.not. (t <= 13500.0d0))) then
tmp = t * ((-4.5d0) * (z / a))
else
tmp = 0.5d0 * (x * (y / a))
end if
code = tmp
end function
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 ((t <= -0.74) || !(t <= 13500.0)) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = 0.5 * (x * (y / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (t <= -0.74) or not (t <= 13500.0): tmp = t * (-4.5 * (z / a)) else: tmp = 0.5 * (x * (y / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((t <= -0.74) || !(t <= 13500.0)) tmp = Float64(t * Float64(-4.5 * Float64(z / a))); else tmp = Float64(0.5 * Float64(x * Float64(y / a))); end return tmp end
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 ((t <= -0.74) || ~((t <= 13500.0)))
tmp = t * (-4.5 * (z / a));
else
tmp = 0.5 * (x * (y / a));
end
tmp_2 = tmp;
end
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[t, -0.74], N[Not[LessEqual[t, 13500.0]], $MachinePrecision]], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.74 \lor \neg \left(t \leq 13500\right):\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\end{array}
\end{array}
if t < -0.73999999999999999 or 13500 < t Initial program 86.6%
div-sub80.9%
*-commutative80.9%
div-sub86.6%
cancel-sign-sub-inv86.6%
*-commutative86.6%
fma-define87.5%
distribute-rgt-neg-in87.5%
associate-*r*87.5%
distribute-lft-neg-in87.5%
*-commutative87.5%
distribute-rgt-neg-in87.5%
metadata-eval87.5%
Simplified87.5%
Taylor expanded in x around 0 66.8%
*-commutative66.8%
associate-/l*71.3%
associate-*r*71.3%
*-commutative71.3%
Simplified71.3%
if -0.73999999999999999 < t < 13500Initial program 89.9%
div-sub89.1%
*-commutative89.1%
div-sub89.9%
cancel-sign-sub-inv89.9%
*-commutative89.9%
fma-define89.9%
distribute-rgt-neg-in89.9%
associate-*r*89.9%
distribute-lft-neg-in89.9%
*-commutative89.9%
distribute-rgt-neg-in89.9%
metadata-eval89.9%
Simplified89.9%
Taylor expanded in x around inf 66.9%
associate-/l*67.6%
Simplified67.6%
Final simplification69.3%
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 (<= t -900000000.0) (not (<= t 38000.0))) (* -4.5 (* t (/ z a))) (* 0.5 (* x (/ y 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 ((t <= -900000000.0) || !(t <= 38000.0)) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = 0.5 * (x * (y / a));
}
return tmp;
}
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 ((t <= (-900000000.0d0)) .or. (.not. (t <= 38000.0d0))) then
tmp = (-4.5d0) * (t * (z / a))
else
tmp = 0.5d0 * (x * (y / a))
end if
code = tmp
end function
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 ((t <= -900000000.0) || !(t <= 38000.0)) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = 0.5 * (x * (y / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (t <= -900000000.0) or not (t <= 38000.0): tmp = -4.5 * (t * (z / a)) else: tmp = 0.5 * (x * (y / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((t <= -900000000.0) || !(t <= 38000.0)) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); else tmp = Float64(0.5 * Float64(x * Float64(y / a))); end return tmp end
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 ((t <= -900000000.0) || ~((t <= 38000.0)))
tmp = -4.5 * (t * (z / a));
else
tmp = 0.5 * (x * (y / a));
end
tmp_2 = tmp;
end
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[t, -900000000.0], N[Not[LessEqual[t, 38000.0]], $MachinePrecision]], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -900000000 \lor \neg \left(t \leq 38000\right):\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\end{array}
\end{array}
if t < -9e8 or 38000 < t Initial program 86.2%
div-sub80.3%
*-commutative80.3%
div-sub86.2%
cancel-sign-sub-inv86.2%
*-commutative86.2%
fma-define87.1%
distribute-rgt-neg-in87.1%
associate-*r*87.1%
distribute-lft-neg-in87.1%
*-commutative87.1%
distribute-rgt-neg-in87.1%
metadata-eval87.1%
Simplified87.1%
Taylor expanded in x around 0 68.9%
associate-/l*73.6%
Simplified73.6%
if -9e8 < t < 38000Initial program 90.2%
div-sub89.4%
*-commutative89.4%
div-sub90.2%
cancel-sign-sub-inv90.2%
*-commutative90.2%
fma-define90.2%
distribute-rgt-neg-in90.2%
associate-*r*90.2%
distribute-lft-neg-in90.2%
*-commutative90.2%
distribute-rgt-neg-in90.2%
metadata-eval90.2%
Simplified90.2%
Taylor expanded in x around inf 67.9%
associate-/l*68.5%
Simplified68.5%
Final simplification70.8%
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);
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.
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;
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]) def code(x, y, z, t, a): return -4.5 * (t * (z / 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])){:}
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. 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])\\
\\
-4.5 \cdot \left(t \cdot \frac{z}{a}\right)
\end{array}
Initial program 88.3%
div-sub85.2%
*-commutative85.2%
div-sub88.3%
cancel-sign-sub-inv88.3%
*-commutative88.3%
fma-define88.7%
distribute-rgt-neg-in88.7%
associate-*r*88.8%
distribute-lft-neg-in88.8%
*-commutative88.8%
distribute-rgt-neg-in88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in x around 0 51.5%
associate-/l*52.2%
Simplified52.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 2024185
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
:alt
(! :herbie-platform default (if (< a -209046455797670900000000000000000000000000000000000000000000000000000000000000000000000) (- (* 1/2 (/ (* y x) a)) (* 9/2 (/ t (/ a z)))) (if (< a 2144030707833976000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 1/2)) (* (/ t a) (* z 9/2))))))
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))