
(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 9 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))) (t_2 (* (* y (/ x a)) 0.5)))
(if (<= t_1 -4e+278)
(+ (* z (/ t (* a -0.2222222222222222))) t_2)
(if (<= t_1 5e+289)
(/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))
(+ t_2 (* t (/ -4.5 (/ a z))))))))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 t_2 = (y * (x / a)) * 0.5;
double tmp;
if (t_1 <= -4e+278) {
tmp = (z * (t / (a * -0.2222222222222222))) + t_2;
} else if (t_1 <= 5e+289) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = t_2 + (t * (-4.5 / (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) :: t_2
real(8) :: tmp
t_1 = (x * y) - ((z * 9.0d0) * t)
t_2 = (y * (x / a)) * 0.5d0
if (t_1 <= (-4d+278)) then
tmp = (z * (t / (a * (-0.2222222222222222d0)))) + t_2
else if (t_1 <= 5d+289) then
tmp = ((x * y) - (z * (9.0d0 * t))) / (a * 2.0d0)
else
tmp = t_2 + (t * ((-4.5d0) / (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 = (x * y) - ((z * 9.0) * t);
double t_2 = (y * (x / a)) * 0.5;
double tmp;
if (t_1 <= -4e+278) {
tmp = (z * (t / (a * -0.2222222222222222))) + t_2;
} else if (t_1 <= 5e+289) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = t_2 + (t * (-4.5 / (a / z)));
}
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) t_2 = (y * (x / a)) * 0.5 tmp = 0 if t_1 <= -4e+278: tmp = (z * (t / (a * -0.2222222222222222))) + t_2 elif t_1 <= 5e+289: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) else: tmp = t_2 + (t * (-4.5 / (a / z))) 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)) t_2 = Float64(Float64(y * Float64(x / a)) * 0.5) tmp = 0.0 if (t_1 <= -4e+278) tmp = Float64(Float64(z * Float64(t / Float64(a * -0.2222222222222222))) + t_2); elseif (t_1 <= 5e+289) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); else tmp = Float64(t_2 + Float64(t * Float64(-4.5 / 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 = (x * y) - ((z * 9.0) * t);
t_2 = (y * (x / a)) * 0.5;
tmp = 0.0;
if (t_1 <= -4e+278)
tmp = (z * (t / (a * -0.2222222222222222))) + t_2;
elseif (t_1 <= 5e+289)
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
else
tmp = t_2 + (t * (-4.5 / (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[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+278], N[(N[(z * N[(t / N[(a * -0.2222222222222222), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 5e+289], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(t * N[(-4.5 / N[(a / z), $MachinePrecision]), $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 - \left(z \cdot 9\right) \cdot t\\
t_2 := \left(y \cdot \frac{x}{a}\right) \cdot 0.5\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+278}:\\
\;\;\;\;z \cdot \frac{t}{a \cdot -0.2222222222222222} + t_2\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+289}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;t_2 + t \cdot \frac{-4.5}{\frac{a}{z}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -3.99999999999999985e278Initial program 74.4%
sub-neg74.4%
+-commutative74.4%
neg-sub074.4%
associate-+l-74.4%
sub0-neg74.4%
neg-mul-174.4%
associate-/l*74.5%
associate-/r/74.4%
*-commutative74.4%
sub-neg74.4%
+-commutative74.4%
neg-sub074.4%
associate-+l-74.4%
sub0-neg74.4%
distribute-lft-neg-out74.4%
distribute-rgt-neg-in74.4%
Simplified74.4%
Taylor expanded in x around 0 74.4%
Taylor expanded in y around 0 71.4%
fma-def71.4%
associate-/l*88.3%
associate-/l*96.7%
Simplified96.7%
fma-udef96.7%
div-inv96.8%
clear-num96.8%
*-commutative96.8%
associate-*r*96.7%
clear-num96.7%
un-div-inv96.7%
*-commutative96.7%
div-inv96.7%
clear-num96.8%
Applied egg-rr96.8%
*-commutative96.8%
clear-num96.8%
un-div-inv96.8%
div-inv96.7%
metadata-eval96.7%
Applied egg-rr96.7%
associate-*l/96.7%
associate-/r/96.8%
Simplified96.8%
if -3.99999999999999985e278 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 5.00000000000000031e289Initial program 98.6%
associate-*l*98.6%
Simplified98.6%
if 5.00000000000000031e289 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 64.5%
sub-neg64.5%
+-commutative64.5%
neg-sub064.5%
associate-+l-64.5%
sub0-neg64.5%
neg-mul-164.5%
associate-/l*64.4%
associate-/r/64.4%
*-commutative64.4%
sub-neg64.4%
+-commutative64.4%
neg-sub064.4%
associate-+l-64.4%
sub0-neg64.4%
distribute-lft-neg-out64.4%
distribute-rgt-neg-in64.4%
Simplified66.9%
Taylor expanded in x around 0 64.4%
Taylor expanded in y around 0 54.5%
fma-def54.5%
associate-/l*73.1%
associate-/l*82.3%
Simplified82.3%
fma-udef82.3%
div-inv82.3%
clear-num82.4%
*-commutative82.4%
associate-*r*82.4%
clear-num82.3%
un-div-inv82.4%
*-commutative82.4%
div-inv82.3%
clear-num82.4%
Applied egg-rr82.4%
Final simplification95.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
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (or (<= t_1 -1e+249) (not (<= t_1 5e+289)))
(+ (* (* y (/ x a)) 0.5) (* t (/ -4.5 (/ a z))))
(/ (- (* 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 <= -1e+249) || !(t_1 <= 5e+289)) {
tmp = ((y * (x / a)) * 0.5) + (t * (-4.5 / (a / z)));
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) - ((z * 9.0d0) * t)
if ((t_1 <= (-1d+249)) .or. (.not. (t_1 <= 5d+289))) then
tmp = ((y * (x / a)) * 0.5d0) + (t * ((-4.5d0) / (a / z)))
else
tmp = ((x * y) - (z * (9.0d0 * t))) / (a * 2.0d0)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if ((t_1 <= -1e+249) || !(t_1 <= 5e+289)) {
tmp = ((y * (x / a)) * 0.5) + (t * (-4.5 / (a / z)));
} 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 <= -1e+249) or not (t_1 <= 5e+289): tmp = ((y * (x / a)) * 0.5) + (t * (-4.5 / (a / z))) 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 <= -1e+249) || !(t_1 <= 5e+289)) tmp = Float64(Float64(Float64(y * Float64(x / a)) * 0.5) + Float64(t * Float64(-4.5 / Float64(a / z)))); 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 <= -1e+249) || ~((t_1 <= 5e+289)))
tmp = ((y * (x / a)) * 0.5) + (t * (-4.5 / (a / z)));
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, -1e+249], N[Not[LessEqual[t$95$1, 5e+289]], $MachinePrecision]], N[(N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] + N[(t * N[(-4.5 / N[(a / z), $MachinePrecision]), $MachinePrecision]), $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 -1 \cdot 10^{+249} \lor \neg \left(t_1 \leq 5 \cdot 10^{+289}\right):\\
\;\;\;\;\left(y \cdot \frac{x}{a}\right) \cdot 0.5 + t \cdot \frac{-4.5}{\frac{a}{z}}\\
\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)) < -9.9999999999999992e248 or 5.00000000000000031e289 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 71.7%
sub-neg71.7%
+-commutative71.7%
neg-sub071.7%
associate-+l-71.7%
sub0-neg71.7%
neg-mul-171.7%
associate-/l*71.7%
associate-/r/71.7%
*-commutative71.7%
sub-neg71.7%
+-commutative71.7%
neg-sub071.7%
associate-+l-71.7%
sub0-neg71.7%
distribute-lft-neg-out71.7%
distribute-rgt-neg-in71.7%
Simplified72.8%
Taylor expanded in x around 0 71.6%
Taylor expanded in y around 0 65.4%
fma-def65.4%
associate-/l*81.7%
associate-/l*89.8%
Simplified89.8%
fma-udef89.8%
div-inv89.8%
clear-num89.8%
*-commutative89.8%
associate-*r*89.8%
clear-num89.7%
un-div-inv89.8%
*-commutative89.8%
div-inv89.8%
clear-num89.8%
Applied egg-rr89.8%
if -9.9999999999999992e248 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 5.00000000000000031e289Initial program 98.5%
associate-*l*98.6%
Simplified98.6%
Final simplification95.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
(let* ((t_1 (* (* z 9.0) t)))
(if (<= t_1 (- INFINITY))
(* -4.5 (* z (/ t a)))
(if (<= t_1 2e+273)
(/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))
(* -4.5 (* t (/ z 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+273) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = -4.5 * (t * (z / 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+273) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} 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): t_1 = (z * 9.0) * t tmp = 0 if t_1 <= -math.inf: tmp = -4.5 * (z * (t / a)) elif t_1 <= 2e+273: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) 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) 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+273) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); else tmp = Float64(-4.5 * Float64(t * 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)
t_1 = (z * 9.0) * t;
tmp = 0.0;
if (t_1 <= -Inf)
tmp = -4.5 * (z * (t / a));
elseif (t_1 <= 2e+273)
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
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_] := 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+273], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t * N[(z / 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^{+273}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < -inf.0Initial program 60.8%
sub-neg60.8%
+-commutative60.8%
neg-sub060.8%
associate-+l-60.8%
sub0-neg60.8%
neg-mul-160.8%
associate-/l*60.8%
associate-/r/60.8%
*-commutative60.8%
sub-neg60.8%
+-commutative60.8%
neg-sub060.8%
associate-+l-60.8%
sub0-neg60.8%
distribute-lft-neg-out60.8%
distribute-rgt-neg-in60.8%
Simplified64.9%
Taylor expanded in x around 0 64.9%
associate-/l*97.7%
associate-/r/97.8%
Simplified97.8%
if -inf.0 < (*.f64 (*.f64 z 9) t) < 1.99999999999999989e273Initial program 95.7%
associate-*l*95.7%
Simplified95.7%
if 1.99999999999999989e273 < (*.f64 (*.f64 z 9) t) Initial program 63.1%
sub-neg63.1%
+-commutative63.1%
neg-sub063.1%
associate-+l-63.1%
sub0-neg63.1%
neg-mul-163.1%
associate-/l*63.2%
associate-/r/63.2%
*-commutative63.2%
sub-neg63.2%
+-commutative63.2%
neg-sub063.2%
associate-+l-63.2%
sub0-neg63.2%
distribute-lft-neg-out63.2%
distribute-rgt-neg-in63.2%
Simplified63.1%
Taylor expanded in x around 0 63.2%
Taylor expanded in y around 0 63.2%
*-commutative63.2%
associate-*l/94.4%
Simplified94.4%
Final simplification95.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 (<= z -3.5e+212) (* -4.5 (* t (/ z a))) (* (+ (* x y) (* -9.0 (* z t))) (/ 0.5 a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+212) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = ((x * y) + (-9.0 * (z * t))) * (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 (z <= (-3.5d+212)) then
tmp = (-4.5d0) * (t * (z / a))
else
tmp = ((x * y) + ((-9.0d0) * (z * t))) * (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 (z <= -3.5e+212) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = ((x * y) + (-9.0 * (z * t))) * (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 z <= -3.5e+212: tmp = -4.5 * (t * (z / a)) else: tmp = ((x * y) + (-9.0 * (z * t))) * (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 (z <= -3.5e+212) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); else tmp = Float64(Float64(Float64(x * y) + Float64(-9.0 * Float64(z * t))) * 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 (z <= -3.5e+212)
tmp = -4.5 * (t * (z / a));
else
tmp = ((x * y) + (-9.0 * (z * t))) * (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[z, -3.5e+212], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] + N[(-9.0 * N[(z * t), $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}\;z \leq -3.5 \cdot 10^{+212}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y + -9 \cdot \left(z \cdot t\right)\right) \cdot \frac{0.5}{a}\\
\end{array}
\end{array}
if z < -3.49999999999999987e212Initial program 74.5%
sub-neg74.5%
+-commutative74.5%
neg-sub074.5%
associate-+l-74.5%
sub0-neg74.5%
neg-mul-174.5%
associate-/l*74.4%
associate-/r/74.5%
*-commutative74.5%
sub-neg74.5%
+-commutative74.5%
neg-sub074.5%
associate-+l-74.5%
sub0-neg74.5%
distribute-lft-neg-out74.5%
distribute-rgt-neg-in74.5%
Simplified74.4%
Taylor expanded in x around 0 74.4%
Taylor expanded in y around 0 61.3%
*-commutative61.3%
associate-*l/79.4%
Simplified79.4%
if -3.49999999999999987e212 < z Initial program 91.9%
sub-neg91.9%
+-commutative91.9%
neg-sub091.9%
associate-+l-91.9%
sub0-neg91.9%
neg-mul-191.9%
associate-/l*91.8%
associate-/r/91.8%
*-commutative91.8%
sub-neg91.8%
+-commutative91.8%
neg-sub091.8%
associate-+l-91.8%
sub0-neg91.8%
distribute-lft-neg-out91.8%
distribute-rgt-neg-in91.8%
Simplified92.3%
Taylor expanded in x around 0 91.9%
Final simplification90.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 (<= t -5.4e-135) (* -4.5 (* t (/ z a))) (if (<= t 1.9e+136) (* 0.5 (/ y (/ a x))) (* -4.5 (/ z (/ a t))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.4e-135) {
tmp = -4.5 * (t * (z / a));
} else if (t <= 1.9e+136) {
tmp = 0.5 * (y / (a / x));
} else {
tmp = -4.5 * (z / (a / t));
}
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 (t <= (-5.4d-135)) then
tmp = (-4.5d0) * (t * (z / a))
else if (t <= 1.9d+136) then
tmp = 0.5d0 * (y / (a / x))
else
tmp = (-4.5d0) * (z / (a / t))
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 (t <= -5.4e-135) {
tmp = -4.5 * (t * (z / a));
} else if (t <= 1.9e+136) {
tmp = 0.5 * (y / (a / x));
} else {
tmp = -4.5 * (z / (a / t));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if t <= -5.4e-135: tmp = -4.5 * (t * (z / a)) elif t <= 1.9e+136: tmp = 0.5 * (y / (a / x)) else: tmp = -4.5 * (z / (a / t)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.4e-135) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); elseif (t <= 1.9e+136) tmp = Float64(0.5 * Float64(y / Float64(a / x))); else tmp = Float64(-4.5 * Float64(z / Float64(a / t))); 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 (t <= -5.4e-135)
tmp = -4.5 * (t * (z / a));
elseif (t <= 1.9e+136)
tmp = 0.5 * (y / (a / x));
else
tmp = -4.5 * (z / (a / t));
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[t, -5.4e-135], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.9e+136], N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.4 \cdot 10^{-135}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{+136}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if t < -5.39999999999999997e-135Initial program 86.3%
sub-neg86.3%
+-commutative86.3%
neg-sub086.3%
associate-+l-86.3%
sub0-neg86.3%
neg-mul-186.3%
associate-/l*86.2%
associate-/r/86.2%
*-commutative86.2%
sub-neg86.2%
+-commutative86.2%
neg-sub086.2%
associate-+l-86.2%
sub0-neg86.2%
distribute-lft-neg-out86.2%
distribute-rgt-neg-in86.2%
Simplified87.3%
Taylor expanded in x around 0 86.3%
Taylor expanded in y around 0 53.8%
*-commutative53.8%
associate-*l/60.9%
Simplified60.9%
if -5.39999999999999997e-135 < t < 1.90000000000000007e136Initial 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.5%
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%
Taylor expanded in x around 0 93.6%
Taylor expanded in y around inf 66.1%
associate-/l*66.2%
Simplified66.2%
if 1.90000000000000007e136 < t Initial program 87.8%
sub-neg87.8%
+-commutative87.8%
neg-sub087.8%
associate-+l-87.8%
sub0-neg87.8%
neg-mul-187.8%
associate-/l*87.8%
associate-/r/87.8%
*-commutative87.8%
sub-neg87.8%
+-commutative87.8%
neg-sub087.8%
associate-+l-87.8%
sub0-neg87.8%
distribute-lft-neg-out87.8%
distribute-rgt-neg-in87.8%
Simplified87.9%
Taylor expanded in x around 0 65.6%
associate-/l*70.1%
associate-/r/74.8%
Simplified74.8%
*-commutative74.8%
clear-num74.8%
un-div-inv77.0%
Applied egg-rr77.0%
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 (<= t -6e-134) (* -4.5 (* t (/ z a))) (if (<= t 7.2e+85) (* 0.5 (/ (* x y) a)) (* -4.5 (/ z (/ a t))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6e-134) {
tmp = -4.5 * (t * (z / a));
} else if (t <= 7.2e+85) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 * (z / (a / t));
}
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 (t <= (-6d-134)) then
tmp = (-4.5d0) * (t * (z / a))
else if (t <= 7.2d+85) then
tmp = 0.5d0 * ((x * y) / a)
else
tmp = (-4.5d0) * (z / (a / t))
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 (t <= -6e-134) {
tmp = -4.5 * (t * (z / a));
} else if (t <= 7.2e+85) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 * (z / (a / t));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if t <= -6e-134: tmp = -4.5 * (t * (z / a)) elif t <= 7.2e+85: tmp = 0.5 * ((x * y) / a) else: tmp = -4.5 * (z / (a / t)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (t <= -6e-134) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); elseif (t <= 7.2e+85) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); else tmp = Float64(-4.5 * Float64(z / Float64(a / t))); 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 (t <= -6e-134)
tmp = -4.5 * (t * (z / a));
elseif (t <= 7.2e+85)
tmp = 0.5 * ((x * y) / a);
else
tmp = -4.5 * (z / (a / t));
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[t, -6e-134], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e+85], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{-134}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{+85}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if t < -6e-134Initial program 86.1%
sub-neg86.1%
+-commutative86.1%
neg-sub086.1%
associate-+l-86.1%
sub0-neg86.1%
neg-mul-186.1%
associate-/l*86.1%
associate-/r/86.1%
*-commutative86.1%
sub-neg86.1%
+-commutative86.1%
neg-sub086.1%
associate-+l-86.1%
sub0-neg86.1%
distribute-lft-neg-out86.1%
distribute-rgt-neg-in86.1%
Simplified87.2%
Taylor expanded in x around 0 86.1%
Taylor expanded in y around 0 54.3%
*-commutative54.3%
associate-*l/61.5%
Simplified61.5%
if -6e-134 < t < 7.1999999999999996e85Initial program 94.0%
sub-neg94.0%
+-commutative94.0%
neg-sub094.0%
associate-+l-94.0%
sub0-neg94.0%
neg-mul-194.0%
associate-/l*93.8%
associate-/r/93.9%
*-commutative93.9%
sub-neg93.9%
+-commutative93.9%
neg-sub093.9%
associate-+l-93.9%
sub0-neg93.9%
distribute-lft-neg-out93.9%
distribute-rgt-neg-in93.9%
Simplified93.9%
Taylor expanded in x around inf 67.4%
if 7.1999999999999996e85 < t Initial program 88.5%
sub-neg88.5%
+-commutative88.5%
neg-sub088.5%
associate-+l-88.5%
sub0-neg88.5%
neg-mul-188.5%
associate-/l*88.5%
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%
Simplified88.6%
Taylor expanded in x around 0 61.5%
associate-/l*63.1%
associate-/r/68.7%
Simplified68.7%
*-commutative68.7%
clear-num68.7%
un-div-inv70.4%
Applied egg-rr70.4%
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 (<= z -2.5e-178) (* -4.5 (* t (/ z a))) (* -4.5 (* z (/ t a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.5e-178) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-2.5d-178)) then
tmp = (-4.5d0) * (t * (z / a))
else
tmp = (-4.5d0) * (z * (t / a))
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.5e-178) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if z <= -2.5e-178: tmp = -4.5 * (t * (z / a)) else: tmp = -4.5 * (z * (t / a)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.5e-178) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); else tmp = Float64(-4.5 * Float64(z * 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)
tmp = 0.0;
if (z <= -2.5e-178)
tmp = -4.5 * (t * (z / a));
else
tmp = -4.5 * (z * (t / a));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.5e-178], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-178}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if z < -2.49999999999999988e-178Initial program 89.2%
sub-neg89.2%
+-commutative89.2%
neg-sub089.2%
associate-+l-89.2%
sub0-neg89.2%
neg-mul-189.2%
associate-/l*89.2%
associate-/r/89.2%
*-commutative89.2%
sub-neg89.2%
+-commutative89.2%
neg-sub089.2%
associate-+l-89.2%
sub0-neg89.2%
distribute-lft-neg-out89.2%
distribute-rgt-neg-in89.2%
Simplified89.3%
Taylor expanded in x around 0 89.3%
Taylor expanded in y around 0 56.6%
*-commutative56.6%
associate-*l/62.8%
Simplified62.8%
if -2.49999999999999988e-178 < z Initial program 90.8%
sub-neg90.8%
+-commutative90.8%
neg-sub090.8%
associate-+l-90.8%
sub0-neg90.8%
neg-mul-190.8%
associate-/l*90.7%
associate-/r/90.7%
*-commutative90.7%
sub-neg90.7%
+-commutative90.7%
neg-sub090.7%
associate-+l-90.7%
sub0-neg90.7%
distribute-lft-neg-out90.7%
distribute-rgt-neg-in90.7%
Simplified91.3%
Taylor expanded in x around 0 41.2%
associate-/l*43.7%
associate-/r/44.7%
Simplified44.7%
Final simplification52.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 (<= z -3.2e-178) (* -4.5 (* t (/ z a))) (* -4.5 (/ z (/ a t)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e-178) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = -4.5 * (z / (a / t));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-3.2d-178)) then
tmp = (-4.5d0) * (t * (z / a))
else
tmp = (-4.5d0) * (z / (a / t))
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e-178) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = -4.5 * (z / (a / t));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if z <= -3.2e-178: tmp = -4.5 * (t * (z / a)) else: tmp = -4.5 * (z / (a / t)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.2e-178) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); else tmp = Float64(-4.5 * Float64(z / Float64(a / t))); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -3.2e-178)
tmp = -4.5 * (t * (z / a));
else
tmp = -4.5 * (z / (a / t));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.2e-178], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-178}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if z < -3.2000000000000001e-178Initial program 89.2%
sub-neg89.2%
+-commutative89.2%
neg-sub089.2%
associate-+l-89.2%
sub0-neg89.2%
neg-mul-189.2%
associate-/l*89.2%
associate-/r/89.2%
*-commutative89.2%
sub-neg89.2%
+-commutative89.2%
neg-sub089.2%
associate-+l-89.2%
sub0-neg89.2%
distribute-lft-neg-out89.2%
distribute-rgt-neg-in89.2%
Simplified89.3%
Taylor expanded in x around 0 89.3%
Taylor expanded in y around 0 56.6%
*-commutative56.6%
associate-*l/62.8%
Simplified62.8%
if -3.2000000000000001e-178 < z Initial program 90.8%
sub-neg90.8%
+-commutative90.8%
neg-sub090.8%
associate-+l-90.8%
sub0-neg90.8%
neg-mul-190.8%
associate-/l*90.7%
associate-/r/90.7%
*-commutative90.7%
sub-neg90.7%
+-commutative90.7%
neg-sub090.7%
associate-+l-90.7%
sub0-neg90.7%
distribute-lft-neg-out90.7%
distribute-rgt-neg-in90.7%
Simplified91.3%
Taylor expanded in x around 0 41.2%
associate-/l*43.7%
associate-/r/44.7%
Simplified44.7%
*-commutative44.7%
clear-num44.3%
un-div-inv44.3%
Applied egg-rr44.3%
Final simplification52.2%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (* z (/ 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 90.1%
sub-neg90.1%
+-commutative90.1%
neg-sub090.1%
associate-+l-90.1%
sub0-neg90.1%
neg-mul-190.1%
associate-/l*90.0%
associate-/r/90.1%
*-commutative90.1%
sub-neg90.1%
+-commutative90.1%
neg-sub090.1%
associate-+l-90.1%
sub0-neg90.1%
distribute-lft-neg-out90.1%
distribute-rgt-neg-in90.1%
Simplified90.5%
Taylor expanded in x around 0 47.8%
associate-/l*51.4%
associate-/r/51.0%
Simplified51.0%
Final simplification51.0%
(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 2023175
(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)))