
(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 and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* a 2.0) -1e-39) (fma (/ y a) (* x 0.5) (* (/ z a) (* -4.5 t))) (* (fma x y (* z (* t -9.0))) (/ 0.5 a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= -1e-39) {
tmp = fma((y / a), (x * 0.5), ((z / a) * (-4.5 * t)));
} else {
tmp = fma(x, y, (z * (t * -9.0))) * (0.5 / a);
}
return tmp;
}
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= -1e-39) tmp = fma(Float64(y / a), Float64(x * 0.5), Float64(Float64(z / a) * Float64(-4.5 * t))); else tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) * Float64(0.5 / a)); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -1e-39], N[(N[(y / a), $MachinePrecision] * N[(x * 0.5), $MachinePrecision] + N[(N[(z / a), $MachinePrecision] * N[(-4.5 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -1 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, x \cdot 0.5, \frac{z}{a} \cdot \left(-4.5 \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\
\end{array}
\end{array}
if (*.f64 a 2) < -9.99999999999999929e-40Initial program 76.3%
associate-*l*76.3%
Simplified76.3%
Taylor expanded in x around 0 76.4%
fma-def76.3%
associate-/l*83.0%
associate-/l*95.1%
associate-/r/97.2%
Simplified97.2%
fma-udef97.2%
div-inv97.2%
clear-num97.2%
*-commutative97.2%
*-commutative97.2%
associate-*l*97.2%
*-commutative97.2%
associate-*r*97.0%
div-inv97.0%
associate-*r*97.0%
associate-*r*95.2%
associate-/r/95.1%
*-commutative95.1%
clear-num95.2%
*-commutative95.2%
Applied egg-rr95.2%
+-commutative95.2%
*-un-lft-identity95.2%
associate-*l/95.2%
fma-def95.2%
associate-*l/95.2%
*-un-lft-identity95.2%
Applied egg-rr95.2%
if -9.99999999999999929e-40 < (*.f64 a 2) Initial program 95.3%
associate-*l*95.2%
Simplified95.2%
div-inv95.2%
fma-neg95.8%
distribute-rgt-neg-in95.8%
*-commutative95.8%
distribute-rgt-neg-in95.8%
metadata-eval95.8%
*-commutative95.8%
associate-/r*96.3%
metadata-eval96.3%
Applied egg-rr96.3%
Final simplification96.0%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* a 2.0) -100000000.0) (+ (* (/ z a) (* -4.5 t)) (* (/ y a) (* x 0.5))) (* (fma x y (* z (* t -9.0))) (/ 0.5 a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= -100000000.0) {
tmp = ((z / a) * (-4.5 * t)) + ((y / a) * (x * 0.5));
} else {
tmp = fma(x, y, (z * (t * -9.0))) * (0.5 / a);
}
return tmp;
}
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= -100000000.0) tmp = Float64(Float64(Float64(z / a) * Float64(-4.5 * t)) + Float64(Float64(y / a) * Float64(x * 0.5))); else tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) * Float64(0.5 / a)); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -100000000.0], N[(N[(N[(z / a), $MachinePrecision] * N[(-4.5 * t), $MachinePrecision]), $MachinePrecision] + N[(N[(y / a), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -100000000:\\
\;\;\;\;\frac{z}{a} \cdot \left(-4.5 \cdot t\right) + \frac{y}{a} \cdot \left(x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\
\end{array}
\end{array}
if (*.f64 a 2) < -1e8Initial program 74.9%
associate-*l*74.9%
Simplified74.9%
Taylor expanded in x around 0 74.9%
fma-def74.9%
associate-/l*81.9%
associate-/l*94.9%
associate-/r/97.1%
Simplified97.1%
fma-udef97.1%
div-inv97.0%
clear-num97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.0%
*-commutative97.0%
associate-*r*96.9%
div-inv96.8%
associate-*r*96.8%
associate-*r*94.9%
associate-/r/94.8%
*-commutative94.8%
clear-num94.9%
*-commutative94.9%
Applied egg-rr94.9%
if -1e8 < (*.f64 a 2) Initial program 95.4%
associate-*l*95.4%
Simplified95.4%
div-inv95.3%
fma-neg95.9%
distribute-rgt-neg-in95.9%
*-commutative95.9%
distribute-rgt-neg-in95.9%
metadata-eval95.9%
*-commutative95.9%
associate-/r*96.4%
metadata-eval96.4%
Applied egg-rr96.4%
Final simplification95.9%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* y x) -2e+275)
(* 0.5 (/ x (/ a y)))
(if (<= (* y x) 1e+211)
(/ (- (* y x) (* z (* t 9.0))) (* a 2.0))
(* (* y (/ 1.0 a)) (* x 0.5)))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= -2e+275) {
tmp = 0.5 * (x / (a / y));
} else if ((y * x) <= 1e+211) {
tmp = ((y * x) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = (y * (1.0 / a)) * (x * 0.5);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 * x) <= (-2d+275)) then
tmp = 0.5d0 * (x / (a / y))
else if ((y * x) <= 1d+211) then
tmp = ((y * x) - (z * (t * 9.0d0))) / (a * 2.0d0)
else
tmp = (y * (1.0d0 / a)) * (x * 0.5d0)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= -2e+275) {
tmp = 0.5 * (x / (a / y));
} else if ((y * x) <= 1e+211) {
tmp = ((y * x) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = (y * (1.0 / a)) * (x * 0.5);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (y * x) <= -2e+275: tmp = 0.5 * (x / (a / y)) elif (y * x) <= 1e+211: tmp = ((y * x) - (z * (t * 9.0))) / (a * 2.0) else: tmp = (y * (1.0 / a)) * (x * 0.5) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(y * x) <= -2e+275) tmp = Float64(0.5 * Float64(x / Float64(a / y))); elseif (Float64(y * x) <= 1e+211) tmp = Float64(Float64(Float64(y * x) - Float64(z * Float64(t * 9.0))) / Float64(a * 2.0)); else tmp = Float64(Float64(y * Float64(1.0 / a)) * Float64(x * 0.5)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((y * x) <= -2e+275)
tmp = 0.5 * (x / (a / y));
elseif ((y * x) <= 1e+211)
tmp = ((y * x) - (z * (t * 9.0))) / (a * 2.0);
else
tmp = (y * (1.0 / a)) * (x * 0.5);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(y * x), $MachinePrecision], -2e+275], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 1e+211], N[(N[(N[(y * x), $MachinePrecision] - N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -2 \cdot 10^{+275}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;y \cdot x \leq 10^{+211}:\\
\;\;\;\;\frac{y \cdot x - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \frac{1}{a}\right) \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999992e275Initial program 54.9%
associate-*l*54.9%
Simplified54.9%
Taylor expanded in x around inf 54.9%
associate-/l*92.1%
Simplified92.1%
if -1.99999999999999992e275 < (*.f64 x y) < 9.9999999999999996e210Initial program 95.5%
associate-*l*95.4%
Simplified95.4%
if 9.9999999999999996e210 < (*.f64 x y) Initial program 70.4%
associate-*l*70.4%
Simplified70.4%
Taylor expanded in x around inf 74.3%
associate-/l*99.4%
Simplified99.4%
associate-*r/99.4%
clear-num99.4%
Applied egg-rr99.4%
associate-/r/99.5%
Simplified99.5%
associate-/r/99.5%
Applied egg-rr99.5%
Final simplification95.5%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* y x) -2e+275)
(* 0.5 (/ x (/ a y)))
(if (<= (* y x) 1e+211)
(/ (- (* y x) (* t (* z 9.0))) (* a 2.0))
(* (* y (/ 1.0 a)) (* x 0.5)))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= -2e+275) {
tmp = 0.5 * (x / (a / y));
} else if ((y * x) <= 1e+211) {
tmp = ((y * x) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = (y * (1.0 / a)) * (x * 0.5);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 * x) <= (-2d+275)) then
tmp = 0.5d0 * (x / (a / y))
else if ((y * x) <= 1d+211) then
tmp = ((y * x) - (t * (z * 9.0d0))) / (a * 2.0d0)
else
tmp = (y * (1.0d0 / a)) * (x * 0.5d0)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= -2e+275) {
tmp = 0.5 * (x / (a / y));
} else if ((y * x) <= 1e+211) {
tmp = ((y * x) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = (y * (1.0 / a)) * (x * 0.5);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (y * x) <= -2e+275: tmp = 0.5 * (x / (a / y)) elif (y * x) <= 1e+211: tmp = ((y * x) - (t * (z * 9.0))) / (a * 2.0) else: tmp = (y * (1.0 / a)) * (x * 0.5) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(y * x) <= -2e+275) tmp = Float64(0.5 * Float64(x / Float64(a / y))); elseif (Float64(y * x) <= 1e+211) tmp = Float64(Float64(Float64(y * x) - Float64(t * Float64(z * 9.0))) / Float64(a * 2.0)); else tmp = Float64(Float64(y * Float64(1.0 / a)) * Float64(x * 0.5)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((y * x) <= -2e+275)
tmp = 0.5 * (x / (a / y));
elseif ((y * x) <= 1e+211)
tmp = ((y * x) - (t * (z * 9.0))) / (a * 2.0);
else
tmp = (y * (1.0 / a)) * (x * 0.5);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(y * x), $MachinePrecision], -2e+275], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 1e+211], N[(N[(N[(y * x), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -2 \cdot 10^{+275}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;y \cdot x \leq 10^{+211}:\\
\;\;\;\;\frac{y \cdot x - t \cdot \left(z \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \frac{1}{a}\right) \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999992e275Initial program 54.9%
associate-*l*54.9%
Simplified54.9%
Taylor expanded in x around inf 54.9%
associate-/l*92.1%
Simplified92.1%
if -1.99999999999999992e275 < (*.f64 x y) < 9.9999999999999996e210Initial program 95.5%
if 9.9999999999999996e210 < (*.f64 x y) Initial program 70.4%
associate-*l*70.4%
Simplified70.4%
Taylor expanded in x around inf 74.3%
associate-/l*99.4%
Simplified99.4%
associate-*r/99.4%
clear-num99.4%
Applied egg-rr99.4%
associate-/r/99.5%
Simplified99.5%
associate-/r/99.5%
Applied egg-rr99.5%
Final simplification95.6%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -4.5 (/ (* z t) a))) (t_2 (* 0.5 (* (/ y a) x))))
(if (<= x -3e+156)
t_2
(if (<= x -9.4e+147)
t_1
(if (<= x -9.8e+87)
t_2
(if (<= x -1.7e-40)
(* -4.5 (/ t (/ a z)))
(if (or (<= x -5.2e-55) (not (<= x 2.7e-118))) t_2 t_1)))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * ((y / a) * x);
double tmp;
if (x <= -3e+156) {
tmp = t_2;
} else if (x <= -9.4e+147) {
tmp = t_1;
} else if (x <= -9.8e+87) {
tmp = t_2;
} else if (x <= -1.7e-40) {
tmp = -4.5 * (t / (a / z));
} else if ((x <= -5.2e-55) || !(x <= 2.7e-118)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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) :: t_2
real(8) :: tmp
t_1 = (-4.5d0) * ((z * t) / a)
t_2 = 0.5d0 * ((y / a) * x)
if (x <= (-3d+156)) then
tmp = t_2
else if (x <= (-9.4d+147)) then
tmp = t_1
else if (x <= (-9.8d+87)) then
tmp = t_2
else if (x <= (-1.7d-40)) then
tmp = (-4.5d0) * (t / (a / z))
else if ((x <= (-5.2d-55)) .or. (.not. (x <= 2.7d-118))) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * ((y / a) * x);
double tmp;
if (x <= -3e+156) {
tmp = t_2;
} else if (x <= -9.4e+147) {
tmp = t_1;
} else if (x <= -9.8e+87) {
tmp = t_2;
} else if (x <= -1.7e-40) {
tmp = -4.5 * (t / (a / z));
} else if ((x <= -5.2e-55) || !(x <= 2.7e-118)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = -4.5 * ((z * t) / a) t_2 = 0.5 * ((y / a) * x) tmp = 0 if x <= -3e+156: tmp = t_2 elif x <= -9.4e+147: tmp = t_1 elif x <= -9.8e+87: tmp = t_2 elif x <= -1.7e-40: tmp = -4.5 * (t / (a / z)) elif (x <= -5.2e-55) or not (x <= 2.7e-118): tmp = t_2 else: tmp = t_1 return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(Float64(z * t) / a)) t_2 = Float64(0.5 * Float64(Float64(y / a) * x)) tmp = 0.0 if (x <= -3e+156) tmp = t_2; elseif (x <= -9.4e+147) tmp = t_1; elseif (x <= -9.8e+87) tmp = t_2; elseif (x <= -1.7e-40) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); elseif ((x <= -5.2e-55) || !(x <= 2.7e-118)) tmp = t_2; else tmp = t_1; end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -4.5 * ((z * t) / a);
t_2 = 0.5 * ((y / a) * x);
tmp = 0.0;
if (x <= -3e+156)
tmp = t_2;
elseif (x <= -9.4e+147)
tmp = t_1;
elseif (x <= -9.8e+87)
tmp = t_2;
elseif (x <= -1.7e-40)
tmp = -4.5 * (t / (a / z));
elseif ((x <= -5.2e-55) || ~((x <= 2.7e-118)))
tmp = t_2;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e+156], t$95$2, If[LessEqual[x, -9.4e+147], t$95$1, If[LessEqual[x, -9.8e+87], t$95$2, If[LessEqual[x, -1.7e-40], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -5.2e-55], N[Not[LessEqual[x, 2.7e-118]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := -4.5 \cdot \frac{z \cdot t}{a}\\
t_2 := 0.5 \cdot \left(\frac{y}{a} \cdot x\right)\\
\mathbf{if}\;x \leq -3 \cdot 10^{+156}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -9.4 \cdot 10^{+147}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -9.8 \cdot 10^{+87}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{-40}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-55} \lor \neg \left(x \leq 2.7 \cdot 10^{-118}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -3e156 or -9.4000000000000006e147 < x < -9.79999999999999943e87 or -1.69999999999999992e-40 < x < -5.1999999999999998e-55 or 2.69999999999999994e-118 < x Initial program 87.4%
associate-*l*87.4%
Simplified87.4%
Taylor expanded in x around inf 61.5%
associate-/l*68.2%
Simplified68.2%
div-inv68.1%
clear-num68.2%
Applied egg-rr68.2%
if -3e156 < x < -9.4000000000000006e147 or -5.1999999999999998e-55 < x < 2.69999999999999994e-118Initial program 94.7%
associate-*l*94.5%
Simplified94.5%
Taylor expanded in x around 0 72.7%
if -9.79999999999999943e87 < x < -1.69999999999999992e-40Initial program 77.8%
associate-*l*77.6%
Simplified77.6%
Taylor expanded in x around 0 58.5%
associate-/l*74.0%
Simplified74.0%
Final simplification70.6%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* a 2.0) -100000000.0) (+ (* (/ z a) (* -4.5 t)) (* (/ y a) (* x 0.5))) (/ (- (* y x) (* t (* z 9.0))) (* a 2.0))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= -100000000.0) {
tmp = ((z / a) * (-4.5 * t)) + ((y / a) * (x * 0.5));
} else {
tmp = ((y * x) - (t * (z * 9.0))) / (a * 2.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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) <= (-100000000.0d0)) then
tmp = ((z / a) * ((-4.5d0) * t)) + ((y / a) * (x * 0.5d0))
else
tmp = ((y * x) - (t * (z * 9.0d0))) / (a * 2.0d0)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= -100000000.0) {
tmp = ((z / a) * (-4.5 * t)) + ((y / a) * (x * 0.5));
} else {
tmp = ((y * x) - (t * (z * 9.0))) / (a * 2.0);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (a * 2.0) <= -100000000.0: tmp = ((z / a) * (-4.5 * t)) + ((y / a) * (x * 0.5)) else: tmp = ((y * x) - (t * (z * 9.0))) / (a * 2.0) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= -100000000.0) tmp = Float64(Float64(Float64(z / a) * Float64(-4.5 * t)) + Float64(Float64(y / a) * Float64(x * 0.5))); else tmp = Float64(Float64(Float64(y * x) - Float64(t * Float64(z * 9.0))) / Float64(a * 2.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((a * 2.0) <= -100000000.0)
tmp = ((z / a) * (-4.5 * t)) + ((y / a) * (x * 0.5));
else
tmp = ((y * x) - (t * (z * 9.0))) / (a * 2.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -100000000.0], N[(N[(N[(z / a), $MachinePrecision] * N[(-4.5 * t), $MachinePrecision]), $MachinePrecision] + N[(N[(y / a), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * x), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -100000000:\\
\;\;\;\;\frac{z}{a} \cdot \left(-4.5 \cdot t\right) + \frac{y}{a} \cdot \left(x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x - t \cdot \left(z \cdot 9\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 a 2) < -1e8Initial program 74.9%
associate-*l*74.9%
Simplified74.9%
Taylor expanded in x around 0 74.9%
fma-def74.9%
associate-/l*81.9%
associate-/l*94.9%
associate-/r/97.1%
Simplified97.1%
fma-udef97.1%
div-inv97.0%
clear-num97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.0%
*-commutative97.0%
associate-*r*96.9%
div-inv96.8%
associate-*r*96.8%
associate-*r*94.9%
associate-/r/94.8%
*-commutative94.8%
clear-num94.9%
*-commutative94.9%
Applied egg-rr94.9%
if -1e8 < (*.f64 a 2) Initial program 95.4%
Final simplification95.3%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* y x) -4e-7)
(* 0.5 (* y (/ x a)))
(if (<= (* y x) 1.5e+33)
(* -4.5 (/ (* z t) a))
(* (* x 0.5) (/ 1.0 (/ a y))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= -4e-7) {
tmp = 0.5 * (y * (x / a));
} else if ((y * x) <= 1.5e+33) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = (x * 0.5) * (1.0 / (a / y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 * x) <= (-4d-7)) then
tmp = 0.5d0 * (y * (x / a))
else if ((y * x) <= 1.5d+33) then
tmp = (-4.5d0) * ((z * t) / a)
else
tmp = (x * 0.5d0) * (1.0d0 / (a / y))
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= -4e-7) {
tmp = 0.5 * (y * (x / a));
} else if ((y * x) <= 1.5e+33) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = (x * 0.5) * (1.0 / (a / y));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (y * x) <= -4e-7: tmp = 0.5 * (y * (x / a)) elif (y * x) <= 1.5e+33: tmp = -4.5 * ((z * t) / a) else: tmp = (x * 0.5) * (1.0 / (a / y)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(y * x) <= -4e-7) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (Float64(y * x) <= 1.5e+33) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); else tmp = Float64(Float64(x * 0.5) * Float64(1.0 / Float64(a / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((y * x) <= -4e-7)
tmp = 0.5 * (y * (x / a));
elseif ((y * x) <= 1.5e+33)
tmp = -4.5 * ((z * t) / a);
else
tmp = (x * 0.5) * (1.0 / (a / y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(y * x), $MachinePrecision], -4e-7], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 1.5e+33], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] * N[(1.0 / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -4 \cdot 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;y \cdot x \leq 1.5 \cdot 10^{+33}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 0.5\right) \cdot \frac{1}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -3.9999999999999998e-7Initial program 79.6%
associate-*l*79.5%
Simplified79.5%
Taylor expanded in x around inf 63.9%
associate-/l*77.6%
associate-/r/75.3%
Simplified75.3%
if -3.9999999999999998e-7 < (*.f64 x y) < 1.49999999999999992e33Initial program 96.0%
associate-*l*96.0%
Simplified96.0%
Taylor expanded in x around 0 77.4%
if 1.49999999999999992e33 < (*.f64 x y) Initial program 83.5%
associate-*l*83.4%
Simplified83.4%
Taylor expanded in x around inf 68.4%
associate-/l*72.0%
Simplified72.0%
associate-*r/72.0%
clear-num72.0%
Applied egg-rr72.0%
associate-/r/71.6%
Simplified71.6%
Final simplification75.6%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= z -2e+176)
(* -4.5 (* z (/ t a)))
(if (<= z -2e+80)
(* 0.5 (* y (/ x a)))
(if (<= z -1.95e-12)
(* -4.5 (/ (* z t) a))
(if (<= z 1.8e-44) (* 0.5 (* (/ y a) x)) (* -4.5 (/ t (/ a z))))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2e+176) {
tmp = -4.5 * (z * (t / a));
} else if (z <= -2e+80) {
tmp = 0.5 * (y * (x / a));
} else if (z <= -1.95e-12) {
tmp = -4.5 * ((z * t) / a);
} else if (z <= 1.8e-44) {
tmp = 0.5 * ((y / a) * x);
} else {
tmp = -4.5 * (t / (a / z));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 (z <= (-2d+176)) then
tmp = (-4.5d0) * (z * (t / a))
else if (z <= (-2d+80)) then
tmp = 0.5d0 * (y * (x / a))
else if (z <= (-1.95d-12)) then
tmp = (-4.5d0) * ((z * t) / a)
else if (z <= 1.8d-44) then
tmp = 0.5d0 * ((y / a) * x)
else
tmp = (-4.5d0) * (t / (a / z))
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2e+176) {
tmp = -4.5 * (z * (t / a));
} else if (z <= -2e+80) {
tmp = 0.5 * (y * (x / a));
} else if (z <= -1.95e-12) {
tmp = -4.5 * ((z * t) / a);
} else if (z <= 1.8e-44) {
tmp = 0.5 * ((y / a) * x);
} else {
tmp = -4.5 * (t / (a / z));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if z <= -2e+176: tmp = -4.5 * (z * (t / a)) elif z <= -2e+80: tmp = 0.5 * (y * (x / a)) elif z <= -1.95e-12: tmp = -4.5 * ((z * t) / a) elif z <= 1.8e-44: tmp = 0.5 * ((y / a) * x) else: tmp = -4.5 * (t / (a / z)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -2e+176) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); elseif (z <= -2e+80) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (z <= -1.95e-12) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (z <= 1.8e-44) tmp = Float64(0.5 * Float64(Float64(y / a) * x)); else tmp = Float64(-4.5 * Float64(t / Float64(a / z))); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -2e+176)
tmp = -4.5 * (z * (t / a));
elseif (z <= -2e+80)
tmp = 0.5 * (y * (x / a));
elseif (z <= -1.95e-12)
tmp = -4.5 * ((z * t) / a);
elseif (z <= 1.8e-44)
tmp = 0.5 * ((y / a) * x);
else
tmp = -4.5 * (t / (a / z));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2e+176], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2e+80], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.95e-12], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-44], N[(0.5 * N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+176}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{elif}\;z \leq -2 \cdot 10^{+80}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;z \leq -1.95 \cdot 10^{-12}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-44}:\\
\;\;\;\;0.5 \cdot \left(\frac{y}{a} \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\end{array}
\end{array}
if z < -2e176Initial program 85.5%
associate-*l*85.4%
Simplified85.4%
Taylor expanded in x around 0 81.8%
fma-def81.8%
associate-/l*85.5%
associate-/l*82.3%
associate-/r/85.6%
Simplified85.6%
Taylor expanded in t around inf 82.5%
associate-*l/89.3%
Simplified89.3%
if -2e176 < z < -2e80Initial program 94.0%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in x around inf 57.4%
associate-/l*63.1%
associate-/r/57.2%
Simplified57.2%
if -2e80 < z < -1.94999999999999997e-12Initial program 95.0%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in x around 0 76.5%
if -1.94999999999999997e-12 < z < 1.7999999999999999e-44Initial program 90.2%
associate-*l*90.1%
Simplified90.1%
Taylor expanded in x around inf 59.5%
associate-/l*61.8%
Simplified61.8%
div-inv61.1%
clear-num61.2%
Applied egg-rr61.2%
if 1.7999999999999999e-44 < z Initial program 85.5%
associate-*l*85.5%
Simplified85.5%
Taylor expanded in x around 0 51.2%
associate-/l*56.1%
Simplified56.1%
Final simplification63.7%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* y x) -4e-7) (* 0.5 (* y (/ x a))) (if (<= (* y x) 1.5e+33) (* -4.5 (/ (* z t) a)) (* 0.5 (/ x (/ a y))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= -4e-7) {
tmp = 0.5 * (y * (x / a));
} else if ((y * x) <= 1.5e+33) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = 0.5 * (x / (a / y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 * x) <= (-4d-7)) then
tmp = 0.5d0 * (y * (x / a))
else if ((y * x) <= 1.5d+33) then
tmp = (-4.5d0) * ((z * t) / a)
else
tmp = 0.5d0 * (x / (a / y))
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= -4e-7) {
tmp = 0.5 * (y * (x / a));
} else if ((y * x) <= 1.5e+33) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = 0.5 * (x / (a / y));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (y * x) <= -4e-7: tmp = 0.5 * (y * (x / a)) elif (y * x) <= 1.5e+33: tmp = -4.5 * ((z * t) / a) else: tmp = 0.5 * (x / (a / y)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(y * x) <= -4e-7) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (Float64(y * x) <= 1.5e+33) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); else tmp = Float64(0.5 * Float64(x / Float64(a / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((y * x) <= -4e-7)
tmp = 0.5 * (y * (x / a));
elseif ((y * x) <= 1.5e+33)
tmp = -4.5 * ((z * t) / a);
else
tmp = 0.5 * (x / (a / y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(y * x), $MachinePrecision], -4e-7], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 1.5e+33], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -4 \cdot 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;y \cdot x \leq 1.5 \cdot 10^{+33}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -3.9999999999999998e-7Initial program 79.6%
associate-*l*79.5%
Simplified79.5%
Taylor expanded in x around inf 63.9%
associate-/l*77.6%
associate-/r/75.3%
Simplified75.3%
if -3.9999999999999998e-7 < (*.f64 x y) < 1.49999999999999992e33Initial program 96.0%
associate-*l*96.0%
Simplified96.0%
Taylor expanded in x around 0 77.4%
if 1.49999999999999992e33 < (*.f64 x y) Initial program 83.5%
associate-*l*83.4%
Simplified83.4%
Taylor expanded in x around inf 68.4%
associate-/l*72.0%
Simplified72.0%
Final simplification75.7%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= x -4.8e-37) (* -4.5 (* (/ z a) t)) (* -4.5 (/ (* z t) a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -4.8e-37) {
tmp = -4.5 * ((z / a) * t);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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 <= (-4.8d-37)) then
tmp = (-4.5d0) * ((z / a) * t)
else
tmp = (-4.5d0) * ((z * t) / a)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -4.8e-37) {
tmp = -4.5 * ((z / a) * t);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if x <= -4.8e-37: tmp = -4.5 * ((z / a) * t) else: tmp = -4.5 * ((z * t) / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (x <= -4.8e-37) tmp = Float64(-4.5 * Float64(Float64(z / a) * t)); else tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (x <= -4.8e-37)
tmp = -4.5 * ((z / a) * t);
else
tmp = -4.5 * ((z * t) / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[x, -4.8e-37], N[(-4.5 * N[(N[(z / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-37}:\\
\;\;\;\;-4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\end{array}
\end{array}
if x < -4.79999999999999982e-37Initial program 83.6%
associate-*l*83.6%
Simplified83.6%
Taylor expanded in x around 0 38.5%
associate-/l*41.8%
Simplified41.8%
Taylor expanded in t around 0 38.5%
associate-*r/42.9%
Simplified42.9%
if -4.79999999999999982e-37 < x Initial program 91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in x around 0 55.0%
Final simplification51.2%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t 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);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return -4.5 * ((z / a) * t);
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t 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;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * ((z / a) * t);
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return -4.5 * ((z / a) * t)
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(Float64(z / a) * t)) end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * ((z / a) * t);
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(N[(z / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \left(\frac{z}{a} \cdot t\right)
\end{array}
Initial program 89.0%
associate-*l*88.9%
Simplified88.9%
Taylor expanded in x around 0 49.7%
associate-/l*49.2%
Simplified49.2%
Taylor expanded in t around 0 49.7%
associate-*r/48.9%
Simplified48.9%
Final simplification48.9%
(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 2023274
(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)))