
(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 16 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
(let* ((t_1 (- (* x y) (* t (* z 9.0)))))
(if (<= t_1 -2e+292)
(fma 0.5 (/ y (/ a x)) (* -4.5 (* z (/ t a))))
(if (<= t_1 2e+259)
(* (fma x y (* z (* t -9.0))) (/ 0.5 a))
(fma -4.5 (* t (/ z a)) (* (* 0.5 y) (/ x a)))))))assert(x < y);
assert(z < t);
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 <= -2e+292) {
tmp = fma(0.5, (y / (a / x)), (-4.5 * (z * (t / a))));
} else if (t_1 <= 2e+259) {
tmp = fma(x, y, (z * (t * -9.0))) * (0.5 / a);
} else {
tmp = fma(-4.5, (t * (z / a)), ((0.5 * y) * (x / a)));
}
return tmp;
}
x, y = sort([x, y]) z, t = sort([z, t]) 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 <= -2e+292) tmp = fma(0.5, Float64(y / Float64(a / x)), Float64(-4.5 * Float64(z * Float64(t / a)))); elseif (t_1 <= 2e+259) tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) * Float64(0.5 / a)); else tmp = fma(-4.5, Float64(t * Float64(z / a)), Float64(Float64(0.5 * y) * Float64(x / 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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+292], N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision] + N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+259], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - t \cdot \left(z \cdot 9\right)\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{y}{\frac{a}{x}}, -4.5 \cdot \left(z \cdot \frac{t}{a}\right)\right)\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+259}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4.5, t \cdot \frac{z}{a}, \left(0.5 \cdot y\right) \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -2e292Initial program 60.1%
associate-*l*60.1%
Simplified60.1%
Taylor expanded in x around 0 57.2%
+-commutative57.2%
fma-def57.2%
associate-/l*78.0%
associate-/l*91.2%
associate-/r/88.4%
Simplified88.4%
if -2e292 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 2e259Initial program 98.6%
associate-*l*98.5%
Simplified98.5%
div-inv98.5%
fma-neg98.5%
distribute-rgt-neg-in98.5%
*-commutative98.5%
distribute-rgt-neg-in98.5%
metadata-eval98.5%
*-commutative98.5%
associate-/r*98.9%
metadata-eval98.9%
Applied egg-rr98.9%
if 2e259 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 68.0%
associate-*l*68.0%
Simplified68.0%
div-inv68.0%
fma-neg70.8%
distribute-rgt-neg-in70.8%
*-commutative70.8%
distribute-rgt-neg-in70.8%
metadata-eval70.8%
*-commutative70.8%
associate-/r*70.8%
metadata-eval70.8%
Applied egg-rr70.8%
Taylor expanded in x around 0 65.2%
fma-def65.2%
*-commutative65.2%
associate-*l/73.4%
associate-*r/91.7%
associate-*l*91.7%
*-commutative91.7%
Simplified91.7%
Final simplification96.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 (<= (* a 2.0) -100000000.0) (fma -4.5 (* t (/ z a)) (* (* 0.5 y) (/ x a))) (* (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 = fma(-4.5, (t * (z / a)), ((0.5 * y) * (x / a)));
} 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 = fma(-4.5, Float64(t * Float64(z / a)), Float64(Float64(0.5 * y) * Float64(x / a))); 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[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $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:\\
\;\;\;\;\mathsf{fma}\left(-4.5, t \cdot \frac{z}{a}, \left(0.5 \cdot y\right) \cdot \frac{x}{a}\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%
div-inv74.8%
fma-neg74.8%
distribute-rgt-neg-in74.8%
*-commutative74.8%
distribute-rgt-neg-in74.8%
metadata-eval74.8%
*-commutative74.8%
associate-/r*74.8%
metadata-eval74.8%
Applied egg-rr74.8%
Taylor expanded in x around 0 74.9%
fma-def74.9%
*-commutative74.9%
associate-*l/82.0%
associate-*r/97.1%
associate-*l*97.1%
*-commutative97.1%
Simplified97.1%
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 simplification96.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) -1e-39) (fma x (/ (* 0.5 y) a) (* (* -4.5 t) (/ z a))) (* (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(x, ((0.5 * y) / a), ((-4.5 * t) * (z / a)));
} 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(x, Float64(Float64(0.5 * y) / a), Float64(Float64(-4.5 * t) * Float64(z / a))); 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[(x * N[(N[(0.5 * y), $MachinePrecision] / a), $MachinePrecision] + N[(N[(-4.5 * t), $MachinePrecision] * N[(z / a), $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(x, \frac{0.5 \cdot y}{a}, \left(-4.5 \cdot t\right) \cdot \frac{z}{a}\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%
div-inv76.3%
fma-neg76.3%
distribute-rgt-neg-in76.3%
*-commutative76.3%
distribute-rgt-neg-in76.3%
metadata-eval76.3%
*-commutative76.3%
associate-/r*76.3%
metadata-eval76.3%
Applied egg-rr76.3%
Taylor expanded in x around 0 76.4%
fma-def76.3%
*-commutative76.3%
associate-*l/83.0%
associate-*r/97.2%
associate-*l*97.2%
*-commutative97.2%
Simplified97.2%
fma-udef97.2%
*-commutative97.2%
clear-num97.2%
div-inv97.2%
associate-*r/97.1%
div-inv97.2%
clear-num97.2%
Applied egg-rr97.2%
Taylor expanded in t around 0 76.4%
*-commutative76.4%
associate-/r/76.4%
associate-*l/87.5%
*-commutative87.5%
+-commutative87.5%
fma-udef87.5%
associate-/l*87.5%
*-commutative87.5%
associate-*r/87.5%
associate-*r*87.5%
associate-*r/95.2%
Simplified95.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) (+ (* (* -4.5 t) (/ z a)) (* (* 0.5 y) (/ x a))) (* (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 = ((-4.5 * t) * (z / a)) + ((0.5 * y) * (x / a));
} 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(-4.5 * t) * Float64(z / a)) + Float64(Float64(0.5 * y) * Float64(x / a))); 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[(-4.5 * t), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $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:\\
\;\;\;\;\left(-4.5 \cdot t\right) \cdot \frac{z}{a} + \left(0.5 \cdot y\right) \cdot \frac{x}{a}\\
\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%
div-inv74.8%
fma-neg74.8%
distribute-rgt-neg-in74.8%
*-commutative74.8%
distribute-rgt-neg-in74.8%
metadata-eval74.8%
*-commutative74.8%
associate-/r*74.8%
metadata-eval74.8%
Applied egg-rr74.8%
Taylor expanded in x around 0 74.9%
fma-def74.9%
*-commutative74.9%
associate-*l/82.0%
associate-*r/97.1%
associate-*l*97.1%
*-commutative97.1%
Simplified97.1%
fma-udef97.1%
*-commutative97.1%
clear-num97.0%
div-inv97.1%
associate-*r/97.0%
div-inv97.0%
clear-num97.0%
Applied egg-rr97.0%
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 simplification96.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 (- (* x y) (* t (* z 9.0)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+234)))
(+ (* (* -4.5 t) (/ z a)) (* (* 0.5 y) (/ x a)))
(/ t_1 (* a 2.0)))))assert(x < y);
assert(z < t);
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)) || !(t_1 <= 2e+234)) {
tmp = ((-4.5 * t) * (z / a)) + ((0.5 * y) * (x / a));
} else {
tmp = t_1 / (a * 2.0);
}
return tmp;
}
assert x < y;
assert z < t;
public static 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.POSITIVE_INFINITY) || !(t_1 <= 2e+234)) {
tmp = ((-4.5 * t) * (z / a)) + ((0.5 * y) * (x / a));
} else {
tmp = t_1 / (a * 2.0);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) - (t * (z * 9.0)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+234): tmp = ((-4.5 * t) * (z / a)) + ((0.5 * y) * (x / a)) else: tmp = t_1 / (a * 2.0) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) 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)) || !(t_1 <= 2e+234)) tmp = Float64(Float64(Float64(-4.5 * t) * Float64(z / a)) + Float64(Float64(0.5 * y) * Float64(x / a))); else tmp = Float64(t_1 / 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)
t_1 = (x * y) - (t * (z * 9.0));
tmp = 0.0;
if ((t_1 <= -Inf) || ~((t_1 <= 2e+234)))
tmp = ((-4.5 * t) * (z / a)) + ((0.5 * y) * (x / a));
else
tmp = t_1 / (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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+234]], $MachinePrecision]], N[(N[(N[(-4.5 * t), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - t \cdot \left(z \cdot 9\right)\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+234}\right):\\
\;\;\;\;\left(-4.5 \cdot t\right) \cdot \frac{z}{a} + \left(0.5 \cdot y\right) \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a \cdot 2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -inf.0 or 2.00000000000000004e234 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 66.8%
associate-*l*66.8%
Simplified66.8%
div-inv66.9%
fma-neg68.2%
distribute-rgt-neg-in68.2%
*-commutative68.2%
distribute-rgt-neg-in68.2%
metadata-eval68.2%
*-commutative68.2%
associate-/r*68.2%
metadata-eval68.2%
Applied egg-rr68.2%
Taylor expanded in x around 0 64.2%
fma-def64.2%
*-commutative64.2%
associate-*l/72.9%
associate-*r/92.1%
associate-*l*92.1%
*-commutative92.1%
Simplified92.1%
fma-udef92.1%
*-commutative92.1%
clear-num92.1%
div-inv93.1%
associate-*r/93.1%
div-inv92.1%
clear-num92.1%
Applied egg-rr92.1%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 2.00000000000000004e234Initial program 98.5%
Final simplification96.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 (<= (* x y) (- INFINITY))
(/ 0.5 (/ (/ a y) x))
(if (<= (* x y) 1e+211)
(/ (- (* x y) (* z (* t 9.0))) (* a 2.0))
(* x (/ (* 0.5 y) a)))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = 0.5 / ((a / y) / x);
} else if ((x * y) <= 1e+211) {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = x * ((0.5 * y) / a);
}
return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = 0.5 / ((a / y) / x);
} else if ((x * y) <= 1e+211) {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = x * ((0.5 * y) / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = 0.5 / ((a / y) / x) elif (x * y) <= 1e+211: tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0) else: tmp = x * ((0.5 * y) / 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(x * y) <= Float64(-Inf)) tmp = Float64(0.5 / Float64(Float64(a / y) / x)); elseif (Float64(x * y) <= 1e+211) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(t * 9.0))) / Float64(a * 2.0)); else tmp = Float64(x * Float64(Float64(0.5 * y) / 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 * y) <= -Inf)
tmp = 0.5 / ((a / y) / x);
elseif ((x * y) <= 1e+211)
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
else
tmp = x * ((0.5 * y) / 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[N[(x * y), $MachinePrecision], (-Infinity)], N[(0.5 / N[(N[(a / y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+211], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(0.5 * y), $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 \cdot y \leq -\infty:\\
\;\;\;\;\frac{0.5}{\frac{\frac{a}{y}}{x}}\\
\mathbf{elif}\;x \cdot y \leq 10^{+211}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 46.4%
associate-*l*46.4%
Simplified46.4%
Taylor expanded in x around inf 46.4%
associate-/l*90.6%
Simplified90.6%
clear-num90.4%
un-div-inv90.4%
Applied egg-rr90.4%
Taylor expanded in a around 0 46.4%
associate-/r*90.6%
Simplified90.6%
if -inf.0 < (*.f64 x y) < 9.9999999999999996e210Initial program 95.6%
associate-*l*95.5%
Simplified95.5%
if 9.9999999999999996e210 < (*.f64 x y) Initial program 70.4%
associate-*l*70.4%
Simplified70.4%
div-inv70.5%
fma-neg70.5%
distribute-rgt-neg-in70.5%
*-commutative70.5%
distribute-rgt-neg-in70.5%
metadata-eval70.5%
*-commutative70.5%
associate-/r*70.5%
metadata-eval70.5%
Applied egg-rr70.5%
Taylor expanded in x around inf 74.3%
associate-*r/74.3%
*-commutative74.3%
associate-*l/74.3%
*-commutative74.3%
associate-*l*99.5%
associate-*r/99.5%
*-commutative99.5%
Simplified99.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 (<= (* x y) (- INFINITY))
(/ 0.5 (/ (/ a y) x))
(if (<= (* x y) 1e+211)
(/ (- (* x y) (* t (* z 9.0))) (* a 2.0))
(* x (/ (* 0.5 y) a)))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = 0.5 / ((a / y) / x);
} else if ((x * y) <= 1e+211) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = x * ((0.5 * y) / a);
}
return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = 0.5 / ((a / y) / x);
} else if ((x * y) <= 1e+211) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = x * ((0.5 * y) / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = 0.5 / ((a / y) / x) elif (x * y) <= 1e+211: tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0) else: tmp = x * ((0.5 * y) / 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(x * y) <= Float64(-Inf)) tmp = Float64(0.5 / Float64(Float64(a / y) / x)); elseif (Float64(x * y) <= 1e+211) tmp = Float64(Float64(Float64(x * y) - Float64(t * Float64(z * 9.0))) / Float64(a * 2.0)); else tmp = Float64(x * Float64(Float64(0.5 * y) / 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 * y) <= -Inf)
tmp = 0.5 / ((a / y) / x);
elseif ((x * y) <= 1e+211)
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
else
tmp = x * ((0.5 * y) / 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[N[(x * y), $MachinePrecision], (-Infinity)], N[(0.5 / N[(N[(a / y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+211], N[(N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(0.5 * y), $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 \cdot y \leq -\infty:\\
\;\;\;\;\frac{0.5}{\frac{\frac{a}{y}}{x}}\\
\mathbf{elif}\;x \cdot y \leq 10^{+211}:\\
\;\;\;\;\frac{x \cdot y - t \cdot \left(z \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 46.4%
associate-*l*46.4%
Simplified46.4%
Taylor expanded in x around inf 46.4%
associate-/l*90.6%
Simplified90.6%
clear-num90.4%
un-div-inv90.4%
Applied egg-rr90.4%
Taylor expanded in a around 0 46.4%
associate-/r*90.6%
Simplified90.6%
if -inf.0 < (*.f64 x y) < 9.9999999999999996e210Initial program 95.6%
if 9.9999999999999996e210 < (*.f64 x y) Initial program 70.4%
associate-*l*70.4%
Simplified70.4%
div-inv70.5%
fma-neg70.5%
distribute-rgt-neg-in70.5%
*-commutative70.5%
distribute-rgt-neg-in70.5%
metadata-eval70.5%
*-commutative70.5%
associate-/r*70.5%
metadata-eval70.5%
Applied egg-rr70.5%
Taylor expanded in x around inf 74.3%
associate-*r/74.3%
*-commutative74.3%
associate-*l/74.3%
*-commutative74.3%
associate-*l*99.5%
associate-*r/99.5%
*-commutative99.5%
Simplified99.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
(if (<= y -6e-120)
(* x (/ (* 0.5 y) a))
(if (<= y 1.15e-13)
(* -4.5 (/ (* t z) a))
(if (or (<= y 5.4e+57) (not (<= y 7e+96)))
(* 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 (y <= -6e-120) {
tmp = x * ((0.5 * y) / a);
} else if (y <= 1.15e-13) {
tmp = -4.5 * ((t * z) / a);
} else if ((y <= 5.4e+57) || !(y <= 7e+96)) {
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 (y <= (-6d-120)) then
tmp = x * ((0.5d0 * y) / a)
else if (y <= 1.15d-13) then
tmp = (-4.5d0) * ((t * z) / a)
else if ((y <= 5.4d+57) .or. (.not. (y <= 7d+96))) 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 (y <= -6e-120) {
tmp = x * ((0.5 * y) / a);
} else if (y <= 1.15e-13) {
tmp = -4.5 * ((t * z) / a);
} else if ((y <= 5.4e+57) || !(y <= 7e+96)) {
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 y <= -6e-120: tmp = x * ((0.5 * y) / a) elif y <= 1.15e-13: tmp = -4.5 * ((t * z) / a) elif (y <= 5.4e+57) or not (y <= 7e+96): 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 (y <= -6e-120) tmp = Float64(x * Float64(Float64(0.5 * y) / a)); elseif (y <= 1.15e-13) tmp = Float64(-4.5 * Float64(Float64(t * z) / a)); elseif ((y <= 5.4e+57) || !(y <= 7e+96)) tmp = Float64(0.5 * Float64(y / Float64(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 (y <= -6e-120)
tmp = x * ((0.5 * y) / a);
elseif (y <= 1.15e-13)
tmp = -4.5 * ((t * z) / a);
elseif ((y <= 5.4e+57) || ~((y <= 7e+96)))
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[y, -6e-120], N[(x * N[(N[(0.5 * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e-13], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 5.4e+57], N[Not[LessEqual[y, 7e+96]], $MachinePrecision]], N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $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}\;y \leq -6 \cdot 10^{-120}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-13}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+57} \lor \neg \left(y \leq 7 \cdot 10^{+96}\right):\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\end{array}
\end{array}
if y < -6.00000000000000022e-120Initial program 86.9%
associate-*l*86.9%
Simplified86.9%
div-inv86.9%
fma-neg87.8%
distribute-rgt-neg-in87.8%
*-commutative87.8%
distribute-rgt-neg-in87.8%
metadata-eval87.8%
*-commutative87.8%
associate-/r*87.8%
metadata-eval87.8%
Applied egg-rr87.8%
Taylor expanded in x around inf 50.4%
associate-*r/50.4%
*-commutative50.4%
associate-*l/50.4%
*-commutative50.4%
associate-*l*55.3%
associate-*r/55.3%
*-commutative55.3%
Simplified55.3%
if -6.00000000000000022e-120 < y < 1.1499999999999999e-13Initial program 95.5%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in x around 0 76.0%
if 1.1499999999999999e-13 < y < 5.3999999999999997e57 or 6.9999999999999998e96 < y Initial program 82.3%
associate-*l*82.3%
Simplified82.3%
Taylor expanded in x around inf 63.9%
associate-/l*75.9%
Simplified75.9%
if 5.3999999999999997e57 < y < 6.9999999999999998e96Initial program 83.5%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in x around 0 53.3%
associate-/l*53.6%
Simplified53.6%
Final simplification67.1%
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 (* 0.5 (/ y (/ a x)))))
(if (<= z -2e+176)
(* -4.5 (* z (/ t a)))
(if (<= z -2.9e+80)
t_1
(if (<= z -8.5e-13)
(* -4.5 (/ (* t z) a))
(if (<= z 3.4e-38) t_1 (* -4.5 (/ t (/ a z)))))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * (y / (a / x));
double tmp;
if (z <= -2e+176) {
tmp = -4.5 * (z * (t / a));
} else if (z <= -2.9e+80) {
tmp = t_1;
} else if (z <= -8.5e-13) {
tmp = -4.5 * ((t * z) / a);
} else if (z <= 3.4e-38) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = 0.5d0 * (y / (a / x))
if (z <= (-2d+176)) then
tmp = (-4.5d0) * (z * (t / a))
else if (z <= (-2.9d+80)) then
tmp = t_1
else if (z <= (-8.5d-13)) then
tmp = (-4.5d0) * ((t * z) / a)
else if (z <= 3.4d-38) then
tmp = t_1
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 t_1 = 0.5 * (y / (a / x));
double tmp;
if (z <= -2e+176) {
tmp = -4.5 * (z * (t / a));
} else if (z <= -2.9e+80) {
tmp = t_1;
} else if (z <= -8.5e-13) {
tmp = -4.5 * ((t * z) / a);
} else if (z <= 3.4e-38) {
tmp = t_1;
} 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): t_1 = 0.5 * (y / (a / x)) tmp = 0 if z <= -2e+176: tmp = -4.5 * (z * (t / a)) elif z <= -2.9e+80: tmp = t_1 elif z <= -8.5e-13: tmp = -4.5 * ((t * z) / a) elif z <= 3.4e-38: tmp = t_1 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) t_1 = Float64(0.5 * Float64(y / Float64(a / x))) tmp = 0.0 if (z <= -2e+176) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); elseif (z <= -2.9e+80) tmp = t_1; elseif (z <= -8.5e-13) tmp = Float64(-4.5 * Float64(Float64(t * z) / a)); elseif (z <= 3.4e-38) tmp = t_1; 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)
t_1 = 0.5 * (y / (a / x));
tmp = 0.0;
if (z <= -2e+176)
tmp = -4.5 * (z * (t / a));
elseif (z <= -2.9e+80)
tmp = t_1;
elseif (z <= -8.5e-13)
tmp = -4.5 * ((t * z) / a);
elseif (z <= 3.4e-38)
tmp = t_1;
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_] := Block[{t$95$1 = N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e+176], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.9e+80], t$95$1, If[LessEqual[z, -8.5e-13], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.4e-38], t$95$1, 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}
t_1 := 0.5 \cdot \frac{y}{\frac{a}{x}}\\
\mathbf{if}\;z \leq -2 \cdot 10^{+176}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{+80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{-13}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-38}:\\
\;\;\;\;t_1\\
\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 82.5%
associate-/l*82.6%
associate-/r/89.3%
Simplified89.3%
if -2e176 < z < -2.89999999999999986e80 or -8.5000000000000001e-13 < z < 3.4000000000000002e-38Initial program 90.8%
associate-*l*90.7%
Simplified90.7%
Taylor expanded in x around inf 59.2%
associate-/l*64.7%
Simplified64.7%
if -2.89999999999999986e80 < z < -8.5000000000000001e-13Initial program 95.0%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in x around 0 76.5%
if 3.4000000000000002e-38 < z Initial program 85.1%
associate-*l*85.1%
Simplified85.1%
Taylor expanded in x around 0 51.2%
associate-/l*56.3%
Simplified56.3%
Final simplification65.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 -2.9e-120)
(* x (/ (* 0.5 y) a))
(if (<= y 1.1e-12)
(* -4.5 (/ (* t z) a))
(if (<= y 1.26e+63)
(* 0.5 (/ y (/ a x)))
(if (<= y 7.5e+96) (* -4.5 (/ t (/ a z))) (* (* 0.5 y) (/ x a)))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.9e-120) {
tmp = x * ((0.5 * y) / a);
} else if (y <= 1.1e-12) {
tmp = -4.5 * ((t * z) / a);
} else if (y <= 1.26e+63) {
tmp = 0.5 * (y / (a / x));
} else if (y <= 7.5e+96) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = (0.5 * y) * (x / 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 (y <= (-2.9d-120)) then
tmp = x * ((0.5d0 * y) / a)
else if (y <= 1.1d-12) then
tmp = (-4.5d0) * ((t * z) / a)
else if (y <= 1.26d+63) then
tmp = 0.5d0 * (y / (a / x))
else if (y <= 7.5d+96) then
tmp = (-4.5d0) * (t / (a / z))
else
tmp = (0.5d0 * y) * (x / 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 (y <= -2.9e-120) {
tmp = x * ((0.5 * y) / a);
} else if (y <= 1.1e-12) {
tmp = -4.5 * ((t * z) / a);
} else if (y <= 1.26e+63) {
tmp = 0.5 * (y / (a / x));
} else if (y <= 7.5e+96) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = (0.5 * y) * (x / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -2.9e-120: tmp = x * ((0.5 * y) / a) elif y <= 1.1e-12: tmp = -4.5 * ((t * z) / a) elif y <= 1.26e+63: tmp = 0.5 * (y / (a / x)) elif y <= 7.5e+96: tmp = -4.5 * (t / (a / z)) else: tmp = (0.5 * y) * (x / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.9e-120) tmp = Float64(x * Float64(Float64(0.5 * y) / a)); elseif (y <= 1.1e-12) tmp = Float64(-4.5 * Float64(Float64(t * z) / a)); elseif (y <= 1.26e+63) tmp = Float64(0.5 * Float64(y / Float64(a / x))); elseif (y <= 7.5e+96) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); else tmp = Float64(Float64(0.5 * y) * Float64(x / 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 (y <= -2.9e-120)
tmp = x * ((0.5 * y) / a);
elseif (y <= 1.1e-12)
tmp = -4.5 * ((t * z) / a);
elseif (y <= 1.26e+63)
tmp = 0.5 * (y / (a / x));
elseif (y <= 7.5e+96)
tmp = -4.5 * (t / (a / z));
else
tmp = (0.5 * y) * (x / 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[y, -2.9e-120], N[(x * N[(N[(0.5 * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-12], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.26e+63], N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+96], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-120}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-12}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{elif}\;y \leq 1.26 \cdot 10^{+63}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+96}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\
\end{array}
\end{array}
if y < -2.9e-120Initial program 86.9%
associate-*l*86.9%
Simplified86.9%
div-inv86.9%
fma-neg87.8%
distribute-rgt-neg-in87.8%
*-commutative87.8%
distribute-rgt-neg-in87.8%
metadata-eval87.8%
*-commutative87.8%
associate-/r*87.8%
metadata-eval87.8%
Applied egg-rr87.8%
Taylor expanded in x around inf 50.4%
associate-*r/50.4%
*-commutative50.4%
associate-*l/50.4%
*-commutative50.4%
associate-*l*55.3%
associate-*r/55.3%
*-commutative55.3%
Simplified55.3%
if -2.9e-120 < y < 1.09999999999999996e-12Initial program 95.5%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in x around 0 76.0%
if 1.09999999999999996e-12 < y < 1.26e63Initial program 93.0%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in x around inf 64.0%
associate-/l*70.0%
Simplified70.0%
if 1.26e63 < y < 7.4999999999999996e96Initial program 83.5%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in x around 0 53.3%
associate-/l*53.6%
Simplified53.6%
if 7.4999999999999996e96 < y Initial program 78.6%
associate-*l*78.5%
Simplified78.5%
div-inv78.6%
fma-neg78.6%
distribute-rgt-neg-in78.6%
*-commutative78.6%
distribute-rgt-neg-in78.6%
metadata-eval78.6%
*-commutative78.6%
associate-/r*78.6%
metadata-eval78.6%
Applied egg-rr78.6%
Taylor expanded in x around inf 63.9%
associate-*r/77.8%
associate-*l*77.8%
*-commutative77.8%
Simplified77.8%
Final simplification67.1%
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 -6e-120)
(* x (/ (* 0.5 y) a))
(if (<= y 8e-12)
(* -4.5 (/ (* t z) a))
(if (<= y 7.2e+63)
(* 0.5 (/ y (/ a x)))
(if (<= y 7e+96) (/ -4.5 (/ (/ a z) t)) (* (* 0.5 y) (/ x a)))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -6e-120) {
tmp = x * ((0.5 * y) / a);
} else if (y <= 8e-12) {
tmp = -4.5 * ((t * z) / a);
} else if (y <= 7.2e+63) {
tmp = 0.5 * (y / (a / x));
} else if (y <= 7e+96) {
tmp = -4.5 / ((a / z) / t);
} else {
tmp = (0.5 * y) * (x / 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 (y <= (-6d-120)) then
tmp = x * ((0.5d0 * y) / a)
else if (y <= 8d-12) then
tmp = (-4.5d0) * ((t * z) / a)
else if (y <= 7.2d+63) then
tmp = 0.5d0 * (y / (a / x))
else if (y <= 7d+96) then
tmp = (-4.5d0) / ((a / z) / t)
else
tmp = (0.5d0 * y) * (x / 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 (y <= -6e-120) {
tmp = x * ((0.5 * y) / a);
} else if (y <= 8e-12) {
tmp = -4.5 * ((t * z) / a);
} else if (y <= 7.2e+63) {
tmp = 0.5 * (y / (a / x));
} else if (y <= 7e+96) {
tmp = -4.5 / ((a / z) / t);
} else {
tmp = (0.5 * y) * (x / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -6e-120: tmp = x * ((0.5 * y) / a) elif y <= 8e-12: tmp = -4.5 * ((t * z) / a) elif y <= 7.2e+63: tmp = 0.5 * (y / (a / x)) elif y <= 7e+96: tmp = -4.5 / ((a / z) / t) else: tmp = (0.5 * y) * (x / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -6e-120) tmp = Float64(x * Float64(Float64(0.5 * y) / a)); elseif (y <= 8e-12) tmp = Float64(-4.5 * Float64(Float64(t * z) / a)); elseif (y <= 7.2e+63) tmp = Float64(0.5 * Float64(y / Float64(a / x))); elseif (y <= 7e+96) tmp = Float64(-4.5 / Float64(Float64(a / z) / t)); else tmp = Float64(Float64(0.5 * y) * Float64(x / 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 (y <= -6e-120)
tmp = x * ((0.5 * y) / a);
elseif (y <= 8e-12)
tmp = -4.5 * ((t * z) / a);
elseif (y <= 7.2e+63)
tmp = 0.5 * (y / (a / x));
elseif (y <= 7e+96)
tmp = -4.5 / ((a / z) / t);
else
tmp = (0.5 * y) * (x / 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[y, -6e-120], N[(x * N[(N[(0.5 * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e-12], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e+63], N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+96], N[(-4.5 / N[(N[(a / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-120}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-12}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+63}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+96}:\\
\;\;\;\;\frac{-4.5}{\frac{\frac{a}{z}}{t}}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\
\end{array}
\end{array}
if y < -6.00000000000000022e-120Initial program 86.9%
associate-*l*86.9%
Simplified86.9%
div-inv86.9%
fma-neg87.8%
distribute-rgt-neg-in87.8%
*-commutative87.8%
distribute-rgt-neg-in87.8%
metadata-eval87.8%
*-commutative87.8%
associate-/r*87.8%
metadata-eval87.8%
Applied egg-rr87.8%
Taylor expanded in x around inf 50.4%
associate-*r/50.4%
*-commutative50.4%
associate-*l/50.4%
*-commutative50.4%
associate-*l*55.3%
associate-*r/55.3%
*-commutative55.3%
Simplified55.3%
if -6.00000000000000022e-120 < y < 7.99999999999999984e-12Initial program 95.5%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in x around 0 76.0%
if 7.99999999999999984e-12 < y < 7.19999999999999998e63Initial program 93.0%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in x around inf 64.0%
associate-/l*70.0%
Simplified70.0%
if 7.19999999999999998e63 < y < 6.9999999999999998e96Initial program 83.5%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in x around 0 53.3%
associate-/l*53.6%
Simplified53.6%
clear-num53.6%
un-div-inv53.4%
Applied egg-rr53.4%
if 6.9999999999999998e96 < y Initial program 78.6%
associate-*l*78.5%
Simplified78.5%
div-inv78.6%
fma-neg78.6%
distribute-rgt-neg-in78.6%
*-commutative78.6%
distribute-rgt-neg-in78.6%
metadata-eval78.6%
*-commutative78.6%
associate-/r*78.6%
metadata-eval78.6%
Applied egg-rr78.6%
Taylor expanded in x around inf 63.9%
associate-*r/77.8%
associate-*l*77.8%
*-commutative77.8%
Simplified77.8%
Final simplification67.1%
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 -6e-120)
(* x (/ (* 0.5 y) a))
(if (<= y 1.46e-13)
(* -4.5 (/ (* t z) a))
(if (<= y 1.26e+63)
(* 0.5 (/ y (/ a x)))
(if (<= y 7e+96)
(/ z (* -0.2222222222222222 (/ a t)))
(* (* 0.5 y) (/ x a)))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -6e-120) {
tmp = x * ((0.5 * y) / a);
} else if (y <= 1.46e-13) {
tmp = -4.5 * ((t * z) / a);
} else if (y <= 1.26e+63) {
tmp = 0.5 * (y / (a / x));
} else if (y <= 7e+96) {
tmp = z / (-0.2222222222222222 * (a / t));
} else {
tmp = (0.5 * y) * (x / 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 (y <= (-6d-120)) then
tmp = x * ((0.5d0 * y) / a)
else if (y <= 1.46d-13) then
tmp = (-4.5d0) * ((t * z) / a)
else if (y <= 1.26d+63) then
tmp = 0.5d0 * (y / (a / x))
else if (y <= 7d+96) then
tmp = z / ((-0.2222222222222222d0) * (a / t))
else
tmp = (0.5d0 * y) * (x / 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 (y <= -6e-120) {
tmp = x * ((0.5 * y) / a);
} else if (y <= 1.46e-13) {
tmp = -4.5 * ((t * z) / a);
} else if (y <= 1.26e+63) {
tmp = 0.5 * (y / (a / x));
} else if (y <= 7e+96) {
tmp = z / (-0.2222222222222222 * (a / t));
} else {
tmp = (0.5 * y) * (x / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -6e-120: tmp = x * ((0.5 * y) / a) elif y <= 1.46e-13: tmp = -4.5 * ((t * z) / a) elif y <= 1.26e+63: tmp = 0.5 * (y / (a / x)) elif y <= 7e+96: tmp = z / (-0.2222222222222222 * (a / t)) else: tmp = (0.5 * y) * (x / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -6e-120) tmp = Float64(x * Float64(Float64(0.5 * y) / a)); elseif (y <= 1.46e-13) tmp = Float64(-4.5 * Float64(Float64(t * z) / a)); elseif (y <= 1.26e+63) tmp = Float64(0.5 * Float64(y / Float64(a / x))); elseif (y <= 7e+96) tmp = Float64(z / Float64(-0.2222222222222222 * Float64(a / t))); else tmp = Float64(Float64(0.5 * y) * Float64(x / 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 (y <= -6e-120)
tmp = x * ((0.5 * y) / a);
elseif (y <= 1.46e-13)
tmp = -4.5 * ((t * z) / a);
elseif (y <= 1.26e+63)
tmp = 0.5 * (y / (a / x));
elseif (y <= 7e+96)
tmp = z / (-0.2222222222222222 * (a / t));
else
tmp = (0.5 * y) * (x / 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[y, -6e-120], N[(x * N[(N[(0.5 * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.46e-13], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.26e+63], N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+96], N[(z / N[(-0.2222222222222222 * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-120}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{-13}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{elif}\;y \leq 1.26 \cdot 10^{+63}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+96}:\\
\;\;\;\;\frac{z}{-0.2222222222222222 \cdot \frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\
\end{array}
\end{array}
if y < -6.00000000000000022e-120Initial program 86.9%
associate-*l*86.9%
Simplified86.9%
div-inv86.9%
fma-neg87.8%
distribute-rgt-neg-in87.8%
*-commutative87.8%
distribute-rgt-neg-in87.8%
metadata-eval87.8%
*-commutative87.8%
associate-/r*87.8%
metadata-eval87.8%
Applied egg-rr87.8%
Taylor expanded in x around inf 50.4%
associate-*r/50.4%
*-commutative50.4%
associate-*l/50.4%
*-commutative50.4%
associate-*l*55.3%
associate-*r/55.3%
*-commutative55.3%
Simplified55.3%
if -6.00000000000000022e-120 < y < 1.46000000000000009e-13Initial program 95.5%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in x around 0 76.0%
if 1.46000000000000009e-13 < y < 1.26e63Initial program 93.0%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in x around inf 64.0%
associate-/l*70.0%
Simplified70.0%
if 1.26e63 < y < 6.9999999999999998e96Initial program 83.5%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in x around 0 53.3%
*-commutative53.3%
*-commutative53.3%
associate-*r*53.1%
Simplified53.1%
associate-/l*65.9%
div-inv51.6%
times-frac52.1%
metadata-eval52.1%
Applied egg-rr52.1%
associate-*r/66.2%
*-rgt-identity66.2%
*-commutative66.2%
Simplified66.2%
if 6.9999999999999998e96 < y Initial program 78.6%
associate-*l*78.5%
Simplified78.5%
div-inv78.6%
fma-neg78.6%
distribute-rgt-neg-in78.6%
*-commutative78.6%
distribute-rgt-neg-in78.6%
metadata-eval78.6%
*-commutative78.6%
associate-/r*78.6%
metadata-eval78.6%
Applied egg-rr78.6%
Taylor expanded in x around inf 63.9%
associate-*r/77.8%
associate-*l*77.8%
*-commutative77.8%
Simplified77.8%
Final simplification67.4%
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 -5.9e-120)
(* x (/ (* 0.5 y) a))
(if (<= y 1.75e-13)
(* -4.5 (/ (* t z) a))
(if (<= y 6.6e+63)
(/ (* x y) (* a 2.0))
(if (<= y 1.42e+97)
(/ z (* -0.2222222222222222 (/ a t)))
(* (* 0.5 y) (/ x a)))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5.9e-120) {
tmp = x * ((0.5 * y) / a);
} else if (y <= 1.75e-13) {
tmp = -4.5 * ((t * z) / a);
} else if (y <= 6.6e+63) {
tmp = (x * y) / (a * 2.0);
} else if (y <= 1.42e+97) {
tmp = z / (-0.2222222222222222 * (a / t));
} else {
tmp = (0.5 * y) * (x / 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 (y <= (-5.9d-120)) then
tmp = x * ((0.5d0 * y) / a)
else if (y <= 1.75d-13) then
tmp = (-4.5d0) * ((t * z) / a)
else if (y <= 6.6d+63) then
tmp = (x * y) / (a * 2.0d0)
else if (y <= 1.42d+97) then
tmp = z / ((-0.2222222222222222d0) * (a / t))
else
tmp = (0.5d0 * y) * (x / 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 (y <= -5.9e-120) {
tmp = x * ((0.5 * y) / a);
} else if (y <= 1.75e-13) {
tmp = -4.5 * ((t * z) / a);
} else if (y <= 6.6e+63) {
tmp = (x * y) / (a * 2.0);
} else if (y <= 1.42e+97) {
tmp = z / (-0.2222222222222222 * (a / t));
} else {
tmp = (0.5 * y) * (x / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -5.9e-120: tmp = x * ((0.5 * y) / a) elif y <= 1.75e-13: tmp = -4.5 * ((t * z) / a) elif y <= 6.6e+63: tmp = (x * y) / (a * 2.0) elif y <= 1.42e+97: tmp = z / (-0.2222222222222222 * (a / t)) else: tmp = (0.5 * y) * (x / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -5.9e-120) tmp = Float64(x * Float64(Float64(0.5 * y) / a)); elseif (y <= 1.75e-13) tmp = Float64(-4.5 * Float64(Float64(t * z) / a)); elseif (y <= 6.6e+63) tmp = Float64(Float64(x * y) / Float64(a * 2.0)); elseif (y <= 1.42e+97) tmp = Float64(z / Float64(-0.2222222222222222 * Float64(a / t))); else tmp = Float64(Float64(0.5 * y) * Float64(x / 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 (y <= -5.9e-120)
tmp = x * ((0.5 * y) / a);
elseif (y <= 1.75e-13)
tmp = -4.5 * ((t * z) / a);
elseif (y <= 6.6e+63)
tmp = (x * y) / (a * 2.0);
elseif (y <= 1.42e+97)
tmp = z / (-0.2222222222222222 * (a / t));
else
tmp = (0.5 * y) * (x / 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[y, -5.9e-120], N[(x * N[(N[(0.5 * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e-13], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e+63], N[(N[(x * y), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.42e+97], N[(z / N[(-0.2222222222222222 * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{-120}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+63}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2}\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{+97}:\\
\;\;\;\;\frac{z}{-0.2222222222222222 \cdot \frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\
\end{array}
\end{array}
if y < -5.89999999999999979e-120Initial program 86.9%
associate-*l*86.9%
Simplified86.9%
div-inv86.9%
fma-neg87.8%
distribute-rgt-neg-in87.8%
*-commutative87.8%
distribute-rgt-neg-in87.8%
metadata-eval87.8%
*-commutative87.8%
associate-/r*87.8%
metadata-eval87.8%
Applied egg-rr87.8%
Taylor expanded in x around inf 50.4%
associate-*r/50.4%
*-commutative50.4%
associate-*l/50.4%
*-commutative50.4%
associate-*l*55.3%
associate-*r/55.3%
*-commutative55.3%
Simplified55.3%
if -5.89999999999999979e-120 < y < 1.7500000000000001e-13Initial program 95.5%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in x around 0 76.0%
if 1.7500000000000001e-13 < y < 6.6000000000000003e63Initial program 93.0%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in x around inf 64.0%
if 6.6000000000000003e63 < y < 1.41999999999999991e97Initial program 83.5%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in x around 0 53.3%
*-commutative53.3%
*-commutative53.3%
associate-*r*53.1%
Simplified53.1%
associate-/l*65.9%
div-inv51.6%
times-frac52.1%
metadata-eval52.1%
Applied egg-rr52.1%
associate-*r/66.2%
*-rgt-identity66.2%
*-commutative66.2%
Simplified66.2%
if 1.41999999999999991e97 < y Initial program 78.6%
associate-*l*78.5%
Simplified78.5%
div-inv78.6%
fma-neg78.6%
distribute-rgt-neg-in78.6%
*-commutative78.6%
distribute-rgt-neg-in78.6%
metadata-eval78.6%
*-commutative78.6%
associate-/r*78.6%
metadata-eval78.6%
Applied egg-rr78.6%
Taylor expanded in x around inf 63.9%
associate-*r/77.8%
associate-*l*77.8%
*-commutative77.8%
Simplified77.8%
Final simplification67.1%
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 -5.6e+51) (* -4.5 (* z (/ t a))) (* -4.5 (/ (* t z) a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.6e+51) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = -4.5 * ((t * z) / 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 (a <= (-5.6d+51)) then
tmp = (-4.5d0) * (z * (t / a))
else
tmp = (-4.5d0) * ((t * z) / 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 (a <= -5.6e+51) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = -4.5 * ((t * z) / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if a <= -5.6e+51: tmp = -4.5 * (z * (t / a)) else: tmp = -4.5 * ((t * z) / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.6e+51) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); else tmp = Float64(-4.5 * Float64(Float64(t * z) / 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 (a <= -5.6e+51)
tmp = -4.5 * (z * (t / a));
else
tmp = -4.5 * ((t * z) / 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[a, -5.6e+51], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.6 \cdot 10^{+51}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\
\end{array}
\end{array}
if a < -5.60000000000000009e51Initial program 71.9%
associate-*l*71.9%
Simplified71.9%
Taylor expanded in x around 0 41.9%
associate-/l*50.1%
associate-/r/50.8%
Simplified50.8%
if -5.60000000000000009e51 < a Initial program 95.2%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in x around 0 52.6%
Final simplification52.1%
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 (/ t a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
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 * (t / a))
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 * (t / a));
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return -4.5 * (z * (t / a))
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(z * Float64(t / a))) 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 * (t / a));
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[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \left(z \cdot \frac{t}{a}\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%
associate-/r/48.8%
Simplified48.8%
Final simplification48.8%
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 (/ t (/ a z))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (t / (a / z));
}
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) * (t / (a / z))
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 * (t / (a / z));
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return -4.5 * (t / (a / z))
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(t / Float64(a / z))) end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (t / (a / z));
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[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \frac{t}{\frac{a}{z}}
\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%
Final simplification49.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 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)))