
(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
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+287)))
(+ (* -4.5 (* z (/ t a))) (* (* x (/ y a)) 0.5))
(/ (fma x y (* z (* t -9.0))) (* 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) - ((z * 9.0) * t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+287)) {
tmp = (-4.5 * (z * (t / a))) + ((x * (y / a)) * 0.5);
} else {
tmp = fma(x, y, (z * (t * -9.0))) / (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(Float64(z * 9.0) * t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+287)) tmp = Float64(Float64(-4.5 * Float64(z * Float64(t / a))) + Float64(Float64(x * Float64(y / a)) * 0.5)); else tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) / Float64(a * 2.0)); 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[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+287]], $MachinePrecision]], N[(N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(z * N[(t * -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}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+287}\right):\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right) + \left(x \cdot \frac{y}{a}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -inf.0 or 2.0000000000000002e287 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 59.3%
sub-neg59.3%
+-commutative59.3%
neg-sub059.3%
associate-+l-59.3%
sub0-neg59.3%
neg-mul-159.3%
associate-/l*59.3%
associate-/r/59.3%
*-commutative59.3%
sub-neg59.3%
+-commutative59.3%
neg-sub059.3%
associate-+l-59.3%
sub0-neg59.3%
distribute-lft-neg-out59.3%
distribute-rgt-neg-in59.3%
Simplified62.7%
clear-num62.7%
div-inv62.7%
metadata-eval62.7%
div-inv62.7%
*-commutative62.7%
metadata-eval62.7%
distribute-lft-neg-in62.7%
distribute-rgt-neg-in62.7%
fma-neg59.3%
div-sub56.0%
frac-sub54.9%
associate-*r*54.9%
*-commutative54.9%
swap-sqr54.9%
metadata-eval54.9%
Applied egg-rr54.9%
Taylor expanded in x around 0 56.0%
fma-def56.0%
associate-/l*71.4%
associate-*r/71.4%
associate-*r*71.4%
*-commutative71.4%
associate-*l/86.7%
*-commutative86.7%
associate-*r/86.7%
associate-*l*86.7%
Simplified86.7%
fma-udef86.7%
associate-/r/83.4%
*-commutative83.4%
Applied egg-rr83.4%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 2.0000000000000002e287Initial program 97.7%
div-sub95.7%
+-rgt-identity95.7%
div-sub97.7%
+-rgt-identity97.7%
fma-neg97.7%
associate-*l*97.7%
distribute-rgt-neg-in97.7%
*-commutative97.7%
distribute-rgt-neg-in97.7%
metadata-eval97.7%
Simplified97.7%
Final simplification94.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
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+287)))
(+ (* -4.5 (* z (/ t a))) (* (* x (/ y a)) 0.5))
(/ (- (* x y) (* z (* 9.0 t))) (* 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) - ((z * 9.0) * t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+287)) {
tmp = (-4.5 * (z * (t / a))) + ((x * (y / a)) * 0.5);
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (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) - ((z * 9.0) * t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+287)) {
tmp = (-4.5 * (z * (t / a))) + ((x * (y / a)) * 0.5);
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (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) - ((z * 9.0) * t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+287): tmp = (-4.5 * (z * (t / a))) + ((x * (y / a)) * 0.5) else: tmp = ((x * y) - (z * (9.0 * t))) / (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(Float64(z * 9.0) * t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+287)) tmp = Float64(Float64(-4.5 * Float64(z * Float64(t / a))) + Float64(Float64(x * Float64(y / a)) * 0.5)); else tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / 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) - ((z * 9.0) * t);
tmp = 0.0;
if ((t_1 <= -Inf) || ~((t_1 <= 2e+287)))
tmp = (-4.5 * (z * (t / a))) + ((x * (y / a)) * 0.5);
else
tmp = ((x * y) - (z * (9.0 * t))) / (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[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+287]], $MachinePrecision]], N[(N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $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}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+287}\right):\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right) + \left(x \cdot \frac{y}{a}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -inf.0 or 2.0000000000000002e287 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 59.3%
sub-neg59.3%
+-commutative59.3%
neg-sub059.3%
associate-+l-59.3%
sub0-neg59.3%
neg-mul-159.3%
associate-/l*59.3%
associate-/r/59.3%
*-commutative59.3%
sub-neg59.3%
+-commutative59.3%
neg-sub059.3%
associate-+l-59.3%
sub0-neg59.3%
distribute-lft-neg-out59.3%
distribute-rgt-neg-in59.3%
Simplified62.7%
clear-num62.7%
div-inv62.7%
metadata-eval62.7%
div-inv62.7%
*-commutative62.7%
metadata-eval62.7%
distribute-lft-neg-in62.7%
distribute-rgt-neg-in62.7%
fma-neg59.3%
div-sub56.0%
frac-sub54.9%
associate-*r*54.9%
*-commutative54.9%
swap-sqr54.9%
metadata-eval54.9%
Applied egg-rr54.9%
Taylor expanded in x around 0 56.0%
fma-def56.0%
associate-/l*71.4%
associate-*r/71.4%
associate-*r*71.4%
*-commutative71.4%
associate-*l/86.7%
*-commutative86.7%
associate-*r/86.7%
associate-*l*86.7%
Simplified86.7%
fma-udef86.7%
associate-/r/83.4%
*-commutative83.4%
Applied egg-rr83.4%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 2.0000000000000002e287Initial program 97.7%
associate-*l*97.7%
Simplified97.7%
Final simplification94.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
(let* ((t_1 (* (* z 9.0) t)))
(if (<= t_1 (- INFINITY))
(* -4.5 (* z (/ t a)))
(if (<= t_1 2e+296)
(/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))
(* z (* -4.5 (/ t a)))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (z * 9.0) * t;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -4.5 * (z * (t / a));
} else if (t_1 <= 2e+296) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = z * (-4.5 * (t / a));
}
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 = (z * 9.0) * t;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = -4.5 * (z * (t / a));
} else if (t_1 <= 2e+296) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = z * (-4.5 * (t / a));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (z * 9.0) * t tmp = 0 if t_1 <= -math.inf: tmp = -4.5 * (z * (t / a)) elif t_1 <= 2e+296: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) else: tmp = z * (-4.5 * (t / a)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(z * 9.0) * t) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); elseif (t_1 <= 2e+296) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); else tmp = Float64(z * Float64(-4.5 * Float64(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)
t_1 = (z * 9.0) * t;
tmp = 0.0;
if (t_1 <= -Inf)
tmp = -4.5 * (z * (t / a));
elseif (t_1 <= 2e+296)
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
else
tmp = z * (-4.5 * (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_] := Block[{t$95$1 = N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+296], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(-4.5 * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+296}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-4.5 \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < -inf.0Initial program 49.7%
div-sub49.7%
+-rgt-identity49.7%
div-sub49.7%
+-rgt-identity49.7%
fma-neg49.7%
associate-*l*49.7%
distribute-rgt-neg-in49.7%
*-commutative49.7%
distribute-rgt-neg-in49.7%
metadata-eval49.7%
Simplified49.7%
Taylor expanded in x around 0 49.7%
associate-/l*87.9%
associate-/r/88.0%
Simplified88.0%
if -inf.0 < (*.f64 (*.f64 z 9) t) < 1.99999999999999996e296Initial program 94.2%
associate-*l*94.2%
Simplified94.2%
if 1.99999999999999996e296 < (*.f64 (*.f64 z 9) t) Initial program 56.5%
sub-neg56.5%
+-commutative56.5%
neg-sub056.5%
associate-+l-56.5%
sub0-neg56.5%
neg-mul-156.5%
associate-/l*56.5%
associate-/r/56.5%
*-commutative56.5%
sub-neg56.5%
+-commutative56.5%
neg-sub056.5%
associate-+l-56.5%
sub0-neg56.5%
distribute-lft-neg-out56.5%
distribute-rgt-neg-in56.5%
Simplified67.9%
*-commutative67.9%
metadata-eval67.9%
distribute-lft-neg-in67.9%
distribute-rgt-neg-in67.9%
fma-neg56.5%
associate-*r*56.5%
*-commutative56.5%
Applied egg-rr56.5%
Taylor expanded in x around 0 67.9%
*-commutative67.9%
*-commutative67.9%
associate-*r/94.3%
associate-*l*94.3%
Simplified94.3%
Final simplification93.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
(if (<= (* x y) (- INFINITY))
(* x (* y (/ 0.5 a)))
(if (<= (* x y) 2e+287)
(* (- (* x y) (* (* z 9.0) t)) (/ 0.5 a))
(* x (/ (* y 0.5) 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 = x * (y * (0.5 / a));
} else if ((x * y) <= 2e+287) {
tmp = ((x * y) - ((z * 9.0) * t)) * (0.5 / a);
} else {
tmp = x * ((y * 0.5) / 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 = x * (y * (0.5 / a));
} else if ((x * y) <= 2e+287) {
tmp = ((x * y) - ((z * 9.0) * t)) * (0.5 / a);
} else {
tmp = x * ((y * 0.5) / 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 = x * (y * (0.5 / a)) elif (x * y) <= 2e+287: tmp = ((x * y) - ((z * 9.0) * t)) * (0.5 / a) else: tmp = x * ((y * 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(x * y) <= Float64(-Inf)) tmp = Float64(x * Float64(y * Float64(0.5 / a))); elseif (Float64(x * y) <= 2e+287) tmp = Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) * Float64(0.5 / a)); else tmp = Float64(x * Float64(Float64(y * 0.5) / 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 = x * (y * (0.5 / a));
elseif ((x * y) <= 2e+287)
tmp = ((x * y) - ((z * 9.0) * t)) * (0.5 / a);
else
tmp = x * ((y * 0.5) / 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[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+287], N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y * 0.5), $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:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+287}:\\
\;\;\;\;\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right) \cdot \frac{0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y \cdot 0.5}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 69.9%
div-sub69.9%
+-rgt-identity69.9%
div-sub69.9%
+-rgt-identity69.9%
fma-neg69.9%
associate-*l*69.9%
distribute-rgt-neg-in69.9%
*-commutative69.9%
distribute-rgt-neg-in69.9%
metadata-eval69.9%
Simplified69.9%
Taylor expanded in x around inf 70.6%
associate-*r/70.6%
*-commutative70.6%
*-commutative70.6%
associate-/l*70.6%
*-commutative70.6%
Simplified70.6%
div-inv70.6%
metadata-eval70.6%
div-inv70.6%
*-commutative70.6%
metadata-eval70.6%
div-inv70.6%
clear-num70.6%
associate-*l*95.5%
Applied egg-rr95.5%
if -inf.0 < (*.f64 x y) < 2.0000000000000002e287Initial program 93.7%
sub-neg93.7%
+-commutative93.7%
neg-sub093.7%
associate-+l-93.7%
sub0-neg93.7%
neg-mul-193.7%
associate-/l*93.1%
associate-/r/93.6%
*-commutative93.6%
sub-neg93.6%
+-commutative93.6%
neg-sub093.6%
associate-+l-93.6%
sub0-neg93.6%
distribute-lft-neg-out93.6%
distribute-rgt-neg-in93.6%
Simplified93.6%
*-commutative93.6%
metadata-eval93.6%
distribute-lft-neg-in93.6%
distribute-rgt-neg-in93.6%
fma-neg93.6%
associate-*r*93.6%
*-commutative93.6%
Applied egg-rr93.6%
if 2.0000000000000002e287 < (*.f64 x y) Initial program 49.6%
div-sub44.8%
+-rgt-identity44.8%
div-sub49.6%
+-rgt-identity49.6%
fma-neg59.4%
associate-*l*59.4%
distribute-rgt-neg-in59.4%
*-commutative59.4%
distribute-rgt-neg-in59.4%
metadata-eval59.4%
Simplified59.4%
Taylor expanded in x around inf 54.4%
associate-*r/54.4%
*-commutative54.4%
*-commutative54.4%
associate-/l*54.4%
*-commutative54.4%
Simplified54.4%
div-inv54.4%
metadata-eval54.4%
div-inv54.4%
*-commutative54.4%
metadata-eval54.4%
div-inv54.4%
clear-num54.4%
associate-*l*81.1%
Applied egg-rr81.1%
associate-*r/81.1%
Applied egg-rr81.1%
Final simplification92.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 (or (<= y -2.6e-72) (not (<= y 8.6e-16))) (* x (* y (/ 0.5 a))) (* t (* -4.5 (/ z a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.6e-72) || !(y <= 8.6e-16)) {
tmp = x * (y * (0.5 / a));
} else {
tmp = t * (-4.5 * (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 ((y <= (-2.6d-72)) .or. (.not. (y <= 8.6d-16))) then
tmp = x * (y * (0.5d0 / a))
else
tmp = t * ((-4.5d0) * (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 ((y <= -2.6e-72) || !(y <= 8.6e-16)) {
tmp = x * (y * (0.5 / a));
} else {
tmp = t * (-4.5 * (z / 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.6e-72) or not (y <= 8.6e-16): tmp = x * (y * (0.5 / a)) else: tmp = t * (-4.5 * (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 ((y <= -2.6e-72) || !(y <= 8.6e-16)) tmp = Float64(x * Float64(y * Float64(0.5 / a))); else tmp = Float64(t * Float64(-4.5 * Float64(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 ((y <= -2.6e-72) || ~((y <= 8.6e-16)))
tmp = x * (y * (0.5 / a));
else
tmp = t * (-4.5 * (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[Or[LessEqual[y, -2.6e-72], N[Not[LessEqual[y, 8.6e-16]], $MachinePrecision]], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(-4.5 * N[(z / a), $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 -2.6 \cdot 10^{-72} \lor \neg \left(y \leq 8.6 \cdot 10^{-16}\right):\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\
\end{array}
\end{array}
if y < -2.59999999999999996e-72 or 8.5999999999999997e-16 < y Initial program 85.0%
div-sub82.9%
+-rgt-identity82.9%
div-sub85.0%
+-rgt-identity85.0%
fma-neg86.5%
associate-*l*86.4%
distribute-rgt-neg-in86.4%
*-commutative86.4%
distribute-rgt-neg-in86.4%
metadata-eval86.4%
Simplified86.4%
Taylor expanded in x around inf 59.2%
associate-*r/59.2%
*-commutative59.2%
*-commutative59.2%
associate-/l*59.2%
*-commutative59.2%
Simplified59.2%
div-inv59.2%
metadata-eval59.2%
div-inv59.2%
*-commutative59.2%
metadata-eval59.2%
div-inv59.2%
clear-num59.2%
associate-*l*63.8%
Applied egg-rr63.8%
if -2.59999999999999996e-72 < y < 8.5999999999999997e-16Initial program 93.0%
sub-neg93.0%
+-commutative93.0%
neg-sub093.0%
associate-+l-93.0%
sub0-neg93.0%
neg-mul-193.0%
associate-/l*92.0%
associate-/r/93.0%
*-commutative93.0%
sub-neg93.0%
+-commutative93.0%
neg-sub093.0%
associate-+l-93.0%
sub0-neg93.0%
distribute-lft-neg-out93.0%
distribute-rgt-neg-in93.0%
Simplified93.0%
clear-num93.0%
div-inv93.0%
metadata-eval93.0%
div-inv93.0%
*-commutative93.0%
metadata-eval93.0%
distribute-lft-neg-in93.0%
distribute-rgt-neg-in93.0%
fma-neg93.0%
div-sub90.4%
frac-sub67.8%
associate-*r*67.9%
*-commutative67.9%
swap-sqr67.8%
metadata-eval67.8%
Applied egg-rr67.8%
Taylor expanded in x around 0 90.2%
fma-def90.3%
associate-/l*87.3%
associate-*r/87.3%
associate-*r*87.3%
*-commutative87.3%
associate-*l/85.8%
*-commutative85.8%
associate-*r/85.8%
associate-*l*85.8%
Simplified85.8%
Taylor expanded in t around inf 71.2%
associate-/l*69.1%
associate-*r/69.2%
*-rgt-identity69.2%
associate-*r/68.7%
*-commutative68.7%
associate-*l*68.8%
associate-/r/69.3%
associate-*l/69.4%
*-lft-identity69.4%
Simplified69.4%
Final simplification66.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 -3.2e-72) (* x (* y (/ 0.5 a))) (if (<= y 1.1e-15) (* t (* -4.5 (/ z a))) (* x (/ (* y 0.5) a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.2e-72) {
tmp = x * (y * (0.5 / a));
} else if (y <= 1.1e-15) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = x * ((y * 0.5) / 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 <= (-3.2d-72)) then
tmp = x * (y * (0.5d0 / a))
else if (y <= 1.1d-15) then
tmp = t * ((-4.5d0) * (z / a))
else
tmp = x * ((y * 0.5d0) / 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 <= -3.2e-72) {
tmp = x * (y * (0.5 / a));
} else if (y <= 1.1e-15) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = x * ((y * 0.5) / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -3.2e-72: tmp = x * (y * (0.5 / a)) elif y <= 1.1e-15: tmp = t * (-4.5 * (z / a)) else: tmp = x * ((y * 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 (y <= -3.2e-72) tmp = Float64(x * Float64(y * Float64(0.5 / a))); elseif (y <= 1.1e-15) tmp = Float64(t * Float64(-4.5 * Float64(z / a))); else tmp = Float64(x * Float64(Float64(y * 0.5) / 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 <= -3.2e-72)
tmp = x * (y * (0.5 / a));
elseif (y <= 1.1e-15)
tmp = t * (-4.5 * (z / a));
else
tmp = x * ((y * 0.5) / 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, -3.2e-72], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-15], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y * 0.5), $MachinePrecision] / 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 -3.2 \cdot 10^{-72}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-15}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y \cdot 0.5}{a}\\
\end{array}
\end{array}
if y < -3.19999999999999999e-72Initial program 86.0%
div-sub83.6%
+-rgt-identity83.6%
div-sub86.0%
+-rgt-identity86.0%
fma-neg87.2%
associate-*l*87.2%
distribute-rgt-neg-in87.2%
*-commutative87.2%
distribute-rgt-neg-in87.2%
metadata-eval87.2%
Simplified87.2%
Taylor expanded in x around inf 51.4%
associate-*r/51.4%
*-commutative51.4%
*-commutative51.4%
associate-/l*51.4%
*-commutative51.4%
Simplified51.4%
div-inv51.4%
metadata-eval51.4%
div-inv51.4%
*-commutative51.4%
metadata-eval51.4%
div-inv51.4%
clear-num51.4%
associate-*l*57.0%
Applied egg-rr57.0%
if -3.19999999999999999e-72 < y < 1.09999999999999993e-15Initial program 93.0%
sub-neg93.0%
+-commutative93.0%
neg-sub093.0%
associate-+l-93.0%
sub0-neg93.0%
neg-mul-193.0%
associate-/l*92.0%
associate-/r/93.0%
*-commutative93.0%
sub-neg93.0%
+-commutative93.0%
neg-sub093.0%
associate-+l-93.0%
sub0-neg93.0%
distribute-lft-neg-out93.0%
distribute-rgt-neg-in93.0%
Simplified93.0%
clear-num93.0%
div-inv93.0%
metadata-eval93.0%
div-inv93.0%
*-commutative93.0%
metadata-eval93.0%
distribute-lft-neg-in93.0%
distribute-rgt-neg-in93.0%
fma-neg93.0%
div-sub90.4%
frac-sub67.8%
associate-*r*67.9%
*-commutative67.9%
swap-sqr67.8%
metadata-eval67.8%
Applied egg-rr67.8%
Taylor expanded in x around 0 90.2%
fma-def90.3%
associate-/l*87.3%
associate-*r/87.3%
associate-*r*87.3%
*-commutative87.3%
associate-*l/85.8%
*-commutative85.8%
associate-*r/85.8%
associate-*l*85.8%
Simplified85.8%
Taylor expanded in t around inf 71.2%
associate-/l*69.1%
associate-*r/69.2%
*-rgt-identity69.2%
associate-*r/68.7%
*-commutative68.7%
associate-*l*68.8%
associate-/r/69.3%
associate-*l/69.4%
*-lft-identity69.4%
Simplified69.4%
if 1.09999999999999993e-15 < y Initial program 83.6%
div-sub82.0%
+-rgt-identity82.0%
div-sub83.6%
+-rgt-identity83.6%
fma-neg85.4%
associate-*l*85.4%
distribute-rgt-neg-in85.4%
*-commutative85.4%
distribute-rgt-neg-in85.4%
metadata-eval85.4%
Simplified85.4%
Taylor expanded in x around inf 69.9%
associate-*r/69.9%
*-commutative69.9%
*-commutative69.9%
associate-/l*69.9%
*-commutative69.9%
Simplified69.9%
div-inv69.9%
metadata-eval69.9%
div-inv69.8%
*-commutative69.8%
metadata-eval69.8%
div-inv69.8%
clear-num69.8%
associate-*l*73.2%
Applied egg-rr73.2%
associate-*r/73.3%
Applied egg-rr73.3%
Final simplification66.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 -1.05e-72) (* x (* y (/ 0.5 a))) (if (<= y 8.6e-16) (* t (* -4.5 (/ z a))) (* (* x y) (/ 0.5 a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.05e-72) {
tmp = x * (y * (0.5 / a));
} else if (y <= 8.6e-16) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = (x * y) * (0.5 / 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 <= (-1.05d-72)) then
tmp = x * (y * (0.5d0 / a))
else if (y <= 8.6d-16) then
tmp = t * ((-4.5d0) * (z / a))
else
tmp = (x * y) * (0.5d0 / 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 <= -1.05e-72) {
tmp = x * (y * (0.5 / a));
} else if (y <= 8.6e-16) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = (x * y) * (0.5 / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -1.05e-72: tmp = x * (y * (0.5 / a)) elif y <= 8.6e-16: tmp = t * (-4.5 * (z / a)) else: tmp = (x * y) * (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 (y <= -1.05e-72) tmp = Float64(x * Float64(y * Float64(0.5 / a))); elseif (y <= 8.6e-16) tmp = Float64(t * Float64(-4.5 * Float64(z / a))); else tmp = Float64(Float64(x * y) * Float64(0.5 / 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 <= -1.05e-72)
tmp = x * (y * (0.5 / a));
elseif (y <= 8.6e-16)
tmp = t * (-4.5 * (z / a));
else
tmp = (x * y) * (0.5 / 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, -1.05e-72], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.6e-16], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $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}\;y \leq -1.05 \cdot 10^{-72}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{-16}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{0.5}{a}\\
\end{array}
\end{array}
if y < -1.05e-72Initial program 86.0%
div-sub83.6%
+-rgt-identity83.6%
div-sub86.0%
+-rgt-identity86.0%
fma-neg87.2%
associate-*l*87.2%
distribute-rgt-neg-in87.2%
*-commutative87.2%
distribute-rgt-neg-in87.2%
metadata-eval87.2%
Simplified87.2%
Taylor expanded in x around inf 51.4%
associate-*r/51.4%
*-commutative51.4%
*-commutative51.4%
associate-/l*51.4%
*-commutative51.4%
Simplified51.4%
div-inv51.4%
metadata-eval51.4%
div-inv51.4%
*-commutative51.4%
metadata-eval51.4%
div-inv51.4%
clear-num51.4%
associate-*l*57.0%
Applied egg-rr57.0%
if -1.05e-72 < y < 8.5999999999999997e-16Initial program 93.0%
sub-neg93.0%
+-commutative93.0%
neg-sub093.0%
associate-+l-93.0%
sub0-neg93.0%
neg-mul-193.0%
associate-/l*92.0%
associate-/r/93.0%
*-commutative93.0%
sub-neg93.0%
+-commutative93.0%
neg-sub093.0%
associate-+l-93.0%
sub0-neg93.0%
distribute-lft-neg-out93.0%
distribute-rgt-neg-in93.0%
Simplified93.0%
clear-num93.0%
div-inv93.0%
metadata-eval93.0%
div-inv93.0%
*-commutative93.0%
metadata-eval93.0%
distribute-lft-neg-in93.0%
distribute-rgt-neg-in93.0%
fma-neg93.0%
div-sub90.4%
frac-sub67.8%
associate-*r*67.9%
*-commutative67.9%
swap-sqr67.8%
metadata-eval67.8%
Applied egg-rr67.8%
Taylor expanded in x around 0 90.2%
fma-def90.3%
associate-/l*87.3%
associate-*r/87.3%
associate-*r*87.3%
*-commutative87.3%
associate-*l/85.8%
*-commutative85.8%
associate-*r/85.8%
associate-*l*85.8%
Simplified85.8%
Taylor expanded in t around inf 71.2%
associate-/l*69.1%
associate-*r/69.2%
*-rgt-identity69.2%
associate-*r/68.7%
*-commutative68.7%
associate-*l*68.8%
associate-/r/69.3%
associate-*l/69.4%
*-lft-identity69.4%
Simplified69.4%
if 8.5999999999999997e-16 < y Initial program 83.6%
sub-neg83.6%
+-commutative83.6%
neg-sub083.6%
associate-+l-83.6%
sub0-neg83.6%
neg-mul-183.6%
associate-/l*83.5%
associate-/r/83.5%
*-commutative83.5%
sub-neg83.5%
+-commutative83.5%
neg-sub083.5%
associate-+l-83.5%
sub0-neg83.5%
distribute-lft-neg-out83.5%
distribute-rgt-neg-in83.5%
Simplified85.3%
Taylor expanded in x around inf 69.8%
Final simplification65.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 -5.4e-76) (* x (* y (/ 0.5 a))) (if (<= y 1e-15) (* t (* -4.5 (/ z a))) (/ (* x y) (/ a 0.5)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5.4e-76) {
tmp = x * (y * (0.5 / a));
} else if (y <= 1e-15) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = (x * y) / (a / 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 <= (-5.4d-76)) then
tmp = x * (y * (0.5d0 / a))
else if (y <= 1d-15) then
tmp = t * ((-4.5d0) * (z / a))
else
tmp = (x * y) / (a / 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 <= -5.4e-76) {
tmp = x * (y * (0.5 / a));
} else if (y <= 1e-15) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = (x * y) / (a / 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 <= -5.4e-76: tmp = x * (y * (0.5 / a)) elif y <= 1e-15: tmp = t * (-4.5 * (z / a)) else: tmp = (x * y) / (a / 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 (y <= -5.4e-76) tmp = Float64(x * Float64(y * Float64(0.5 / a))); elseif (y <= 1e-15) tmp = Float64(t * Float64(-4.5 * Float64(z / a))); else tmp = Float64(Float64(x * y) / Float64(a / 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 <= -5.4e-76)
tmp = x * (y * (0.5 / a));
elseif (y <= 1e-15)
tmp = t * (-4.5 * (z / a));
else
tmp = (x * y) / (a / 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[y, -5.4e-76], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e-15], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(a / 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 \leq -5.4 \cdot 10^{-76}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{elif}\;y \leq 10^{-15}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{\frac{a}{0.5}}\\
\end{array}
\end{array}
if y < -5.4000000000000001e-76Initial program 86.2%
div-sub83.8%
+-rgt-identity83.8%
div-sub86.2%
+-rgt-identity86.2%
fma-neg87.4%
associate-*l*87.4%
distribute-rgt-neg-in87.4%
*-commutative87.4%
distribute-rgt-neg-in87.4%
metadata-eval87.4%
Simplified87.4%
Taylor expanded in x around inf 50.8%
associate-*r/50.8%
*-commutative50.8%
*-commutative50.8%
associate-/l*50.8%
*-commutative50.8%
Simplified50.8%
div-inv50.8%
metadata-eval50.8%
div-inv50.8%
*-commutative50.8%
metadata-eval50.8%
div-inv50.8%
clear-num50.8%
associate-*l*56.3%
Applied egg-rr56.3%
if -5.4000000000000001e-76 < y < 1.0000000000000001e-15Initial program 92.9%
sub-neg92.9%
+-commutative92.9%
neg-sub092.9%
associate-+l-92.9%
sub0-neg92.9%
neg-mul-192.9%
associate-/l*92.0%
associate-/r/92.9%
*-commutative92.9%
sub-neg92.9%
+-commutative92.9%
neg-sub092.9%
associate-+l-92.9%
sub0-neg92.9%
distribute-lft-neg-out92.9%
distribute-rgt-neg-in92.9%
Simplified92.9%
clear-num92.9%
div-inv92.9%
metadata-eval92.9%
div-inv92.9%
*-commutative92.9%
metadata-eval92.9%
distribute-lft-neg-in92.9%
distribute-rgt-neg-in92.9%
fma-neg92.9%
div-sub90.3%
frac-sub68.4%
associate-*r*68.5%
*-commutative68.5%
swap-sqr68.4%
metadata-eval68.4%
Applied egg-rr68.4%
Taylor expanded in x around 0 90.1%
fma-def90.2%
associate-/l*87.2%
associate-*r/87.2%
associate-*r*87.2%
*-commutative87.2%
associate-*l/85.7%
*-commutative85.7%
associate-*r/85.7%
associate-*l*85.7%
Simplified85.7%
Taylor expanded in t around inf 71.0%
associate-/l*68.8%
associate-*r/68.9%
*-rgt-identity68.9%
associate-*r/68.5%
*-commutative68.5%
associate-*l*68.5%
associate-/r/69.0%
associate-*l/69.1%
*-lft-identity69.1%
Simplified69.1%
if 1.0000000000000001e-15 < y Initial program 83.6%
div-sub82.0%
+-rgt-identity82.0%
div-sub83.6%
+-rgt-identity83.6%
fma-neg85.4%
associate-*l*85.4%
distribute-rgt-neg-in85.4%
*-commutative85.4%
distribute-rgt-neg-in85.4%
metadata-eval85.4%
Simplified85.4%
Taylor expanded in x around inf 69.9%
associate-*r/69.9%
*-commutative69.9%
*-commutative69.9%
associate-/l*69.9%
*-commutative69.9%
Simplified69.9%
Final simplification65.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 88.6%
div-sub86.2%
+-rgt-identity86.2%
div-sub88.6%
+-rgt-identity88.6%
fma-neg89.4%
associate-*l*89.4%
distribute-rgt-neg-in89.4%
*-commutative89.4%
distribute-rgt-neg-in89.4%
metadata-eval89.4%
Simplified89.4%
Taylor expanded in x around 0 51.1%
associate-/l*53.0%
associate-/r/52.9%
Simplified52.9%
Final simplification52.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 (* -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 88.6%
div-sub86.2%
+-rgt-identity86.2%
div-sub88.6%
+-rgt-identity88.6%
fma-neg89.4%
associate-*l*89.4%
distribute-rgt-neg-in89.4%
*-commutative89.4%
distribute-rgt-neg-in89.4%
metadata-eval89.4%
Simplified89.4%
Taylor expanded in x around 0 51.1%
associate-/l*53.0%
Simplified53.0%
Final simplification53.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 (* t (* -4.5 (/ z a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return t * (-4.5 * (z / 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 = t * ((-4.5d0) * (z / a))
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return t * (-4.5 * (z / a));
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return t * (-4.5 * (z / a))
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(t * Float64(-4.5 * Float64(z / a))) end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = t * (-4.5 * (z / 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[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
t \cdot \left(-4.5 \cdot \frac{z}{a}\right)
\end{array}
Initial program 88.6%
sub-neg88.6%
+-commutative88.6%
neg-sub088.6%
associate-+l-88.6%
sub0-neg88.6%
neg-mul-188.6%
associate-/l*88.1%
associate-/r/88.5%
*-commutative88.5%
sub-neg88.5%
+-commutative88.5%
neg-sub088.5%
associate-+l-88.5%
sub0-neg88.5%
distribute-lft-neg-out88.5%
distribute-rgt-neg-in88.5%
Simplified89.3%
clear-num89.3%
div-inv89.3%
metadata-eval89.3%
div-inv89.4%
*-commutative89.4%
metadata-eval89.4%
distribute-lft-neg-in89.4%
distribute-rgt-neg-in89.4%
fma-neg88.6%
div-sub86.2%
frac-sub60.6%
associate-*r*60.6%
*-commutative60.6%
swap-sqr60.5%
metadata-eval60.5%
Applied egg-rr60.5%
Taylor expanded in x around 0 86.1%
fma-def86.2%
associate-/l*85.7%
associate-*r/85.7%
associate-*r*85.7%
*-commutative85.7%
associate-*l/85.6%
*-commutative85.6%
associate-*r/85.3%
associate-*l*85.3%
Simplified85.3%
Taylor expanded in t around inf 51.1%
associate-/l*53.0%
associate-*r/53.1%
*-rgt-identity53.1%
associate-*r/52.9%
*-commutative52.9%
associate-*l*52.9%
associate-/r/53.1%
associate-*l/53.2%
*-lft-identity53.2%
Simplified53.2%
Final simplification53.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 2023173
(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)))