
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (or (<= z -1.45e+102) (not (<= z 4.4e+197))) (/ (+ (* -4.0 (* a t)) (* 9.0 (/ (* x y) z))) c) (* (/ 1.0 z) (/ (fma x (* 9.0 y) (+ b (* (* z -4.0) (* a t)))) c))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -1.45e+102) || !(z <= 4.4e+197)) {
tmp = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
} else {
tmp = (1.0 / z) * (fma(x, (9.0 * y), (b + ((z * -4.0) * (a * t)))) / c);
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -1.45e+102) || !(z <= 4.4e+197)) tmp = Float64(Float64(Float64(-4.0 * Float64(a * t)) + Float64(9.0 * Float64(Float64(x * y) / z))) / c); else tmp = Float64(Float64(1.0 / z) * Float64(fma(x, Float64(9.0 * y), Float64(b + Float64(Float64(z * -4.0) * Float64(a * t)))) / c)); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -1.45e+102], N[Not[LessEqual[z, 4.4e+197]], $MachinePrecision]], N[(N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(x * N[(9.0 * y), $MachinePrecision] + N[(b + N[(N[(z * -4.0), $MachinePrecision] * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+102} \lor \neg \left(z \leq 4.4 \cdot 10^{+197}\right):\\
\;\;\;\;\frac{-4 \cdot \left(a \cdot t\right) + 9 \cdot \frac{x \cdot y}{z}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\mathsf{fma}\left(x, 9 \cdot y, b + \left(z \cdot -4\right) \cdot \left(a \cdot t\right)\right)}{c}\\
\end{array}
\end{array}
if z < -1.4500000000000001e102 or 4.39999999999999979e197 < z Initial program 49.0%
associate-+l-49.0%
associate-*l*49.0%
associate-*l*52.7%
Simplified52.7%
Taylor expanded in b around 0 45.4%
Taylor expanded in x around 0 77.6%
Taylor expanded in c around 0 83.4%
if -1.4500000000000001e102 < z < 4.39999999999999979e197Initial program 86.7%
associate-+l-86.7%
associate-*l*86.7%
fma-neg87.8%
sub-neg87.8%
distribute-neg-in87.8%
remove-double-neg87.8%
+-commutative87.8%
unsub-neg87.8%
associate-*l*91.2%
*-commutative91.2%
associate-*l*91.2%
Simplified91.2%
*-un-lft-identity91.2%
times-frac91.6%
cancel-sign-sub-inv91.6%
associate-*r*91.6%
metadata-eval91.6%
Applied egg-rr91.6%
Final simplification89.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (or (<= z -9.8e+101) (not (<= z 2.5e+197))) (/ (+ (* -4.0 (* a t)) (* 9.0 (/ (* x y) z))) c) (/ (fma x (* 9.0 y) (- b (* 4.0 (* z (* a t))))) (* z c))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -9.8e+101) || !(z <= 2.5e+197)) {
tmp = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
} else {
tmp = fma(x, (9.0 * y), (b - (4.0 * (z * (a * t))))) / (z * c);
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -9.8e+101) || !(z <= 2.5e+197)) tmp = Float64(Float64(Float64(-4.0 * Float64(a * t)) + Float64(9.0 * Float64(Float64(x * y) / z))) / c); else tmp = Float64(fma(x, Float64(9.0 * y), Float64(b - Float64(4.0 * Float64(z * Float64(a * t))))) / Float64(z * c)); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -9.8e+101], N[Not[LessEqual[z, 2.5e+197]], $MachinePrecision]], N[(N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(x * N[(9.0 * y), $MachinePrecision] + N[(b - N[(4.0 * N[(z * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.8 \cdot 10^{+101} \lor \neg \left(z \leq 2.5 \cdot 10^{+197}\right):\\
\;\;\;\;\frac{-4 \cdot \left(a \cdot t\right) + 9 \cdot \frac{x \cdot y}{z}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, 9 \cdot y, b - 4 \cdot \left(z \cdot \left(a \cdot t\right)\right)\right)}{z \cdot c}\\
\end{array}
\end{array}
if z < -9.79999999999999965e101 or 2.50000000000000004e197 < z Initial program 49.0%
associate-+l-49.0%
associate-*l*49.0%
associate-*l*52.7%
Simplified52.7%
Taylor expanded in b around 0 45.4%
Taylor expanded in x around 0 77.6%
Taylor expanded in c around 0 83.4%
if -9.79999999999999965e101 < z < 2.50000000000000004e197Initial program 86.7%
associate-+l-86.7%
associate-*l*86.7%
fma-neg87.8%
sub-neg87.8%
distribute-neg-in87.8%
remove-double-neg87.8%
+-commutative87.8%
unsub-neg87.8%
associate-*l*91.2%
*-commutative91.2%
associate-*l*91.2%
Simplified91.2%
Final simplification88.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (+ (* -4.0 (* a t)) (* 9.0 (/ (* x y) z))) c))
(t_2 (/ (- b (* 4.0 (* a (* z t)))) (* z c))))
(if (<= z -1.8e+73)
t_1
(if (<= z -1.16e-85)
t_2
(if (<= z 7e-13)
(/ (+ b (* 9.0 (* x y))) (* z c))
(if (<= z 9.5e+55) t_2 t_1))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
double t_2 = (b - (4.0 * (a * (z * t)))) / (z * c);
double tmp;
if (z <= -1.8e+73) {
tmp = t_1;
} else if (z <= -1.16e-85) {
tmp = t_2;
} else if (z <= 7e-13) {
tmp = (b + (9.0 * (x * y))) / (z * c);
} else if (z <= 9.5e+55) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (((-4.0d0) * (a * t)) + (9.0d0 * ((x * y) / z))) / c
t_2 = (b - (4.0d0 * (a * (z * t)))) / (z * c)
if (z <= (-1.8d+73)) then
tmp = t_1
else if (z <= (-1.16d-85)) then
tmp = t_2
else if (z <= 7d-13) then
tmp = (b + (9.0d0 * (x * y))) / (z * c)
else if (z <= 9.5d+55) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
double t_2 = (b - (4.0 * (a * (z * t)))) / (z * c);
double tmp;
if (z <= -1.8e+73) {
tmp = t_1;
} else if (z <= -1.16e-85) {
tmp = t_2;
} else if (z <= 7e-13) {
tmp = (b + (9.0 * (x * y))) / (z * c);
} else if (z <= 9.5e+55) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): t_1 = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c t_2 = (b - (4.0 * (a * (z * t)))) / (z * c) tmp = 0 if z <= -1.8e+73: tmp = t_1 elif z <= -1.16e-85: tmp = t_2 elif z <= 7e-13: tmp = (b + (9.0 * (x * y))) / (z * c) elif z <= 9.5e+55: tmp = t_2 else: tmp = t_1 return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(-4.0 * Float64(a * t)) + Float64(9.0 * Float64(Float64(x * y) / z))) / c) t_2 = Float64(Float64(b - Float64(4.0 * Float64(a * Float64(z * t)))) / Float64(z * c)) tmp = 0.0 if (z <= -1.8e+73) tmp = t_1; elseif (z <= -1.16e-85) tmp = t_2; elseif (z <= 7e-13) tmp = Float64(Float64(b + Float64(9.0 * Float64(x * y))) / Float64(z * c)); elseif (z <= 9.5e+55) tmp = t_2; else tmp = t_1; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
t_2 = (b - (4.0 * (a * (z * t)))) / (z * c);
tmp = 0.0;
if (z <= -1.8e+73)
tmp = t_1;
elseif (z <= -1.16e-85)
tmp = t_2;
elseif (z <= 7e-13)
tmp = (b + (9.0 * (x * y))) / (z * c);
elseif (z <= 9.5e+55)
tmp = t_2;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - N[(4.0 * N[(a * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+73], t$95$1, If[LessEqual[z, -1.16e-85], t$95$2, If[LessEqual[z, 7e-13], N[(N[(b + N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.5e+55], t$95$2, t$95$1]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := \frac{-4 \cdot \left(a \cdot t\right) + 9 \cdot \frac{x \cdot y}{z}}{c}\\
t_2 := \frac{b - 4 \cdot \left(a \cdot \left(z \cdot t\right)\right)}{z \cdot c}\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+73}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{-85}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-13}:\\
\;\;\;\;\frac{b + 9 \cdot \left(x \cdot y\right)}{z \cdot c}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+55}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.7999999999999999e73 or 9.49999999999999989e55 < z Initial program 55.2%
associate-+l-55.2%
associate-*l*55.2%
associate-*l*62.8%
Simplified62.8%
Taylor expanded in b around 0 49.2%
Taylor expanded in x around 0 75.4%
Taylor expanded in c around 0 81.2%
if -1.7999999999999999e73 < z < -1.16e-85 or 7.0000000000000005e-13 < z < 9.49999999999999989e55Initial program 84.1%
associate-+l-84.1%
associate-*l*84.2%
associate-*l*84.4%
Simplified84.4%
Taylor expanded in x around 0 77.5%
if -1.16e-85 < z < 7.0000000000000005e-13Initial program 93.8%
Taylor expanded in x around inf 81.8%
Final simplification80.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (+ (* -4.0 (* a t)) (* 9.0 (/ (* x y) z))) c)))
(if (<= z -2.8e+70)
t_1
(if (<= z -2.25e-35)
(- (/ b (* z c)) (* (/ (* a 4.0) z) (/ (* z t) c)))
(if (<= z 1.35e-10)
(/ (+ b (* 9.0 (* x y))) (* z c))
(if (<= z 7.4e+55) (/ (- b (* 4.0 (* a (* z t)))) (* z c)) t_1))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
double tmp;
if (z <= -2.8e+70) {
tmp = t_1;
} else if (z <= -2.25e-35) {
tmp = (b / (z * c)) - (((a * 4.0) / z) * ((z * t) / c));
} else if (z <= 1.35e-10) {
tmp = (b + (9.0 * (x * y))) / (z * c);
} else if (z <= 7.4e+55) {
tmp = (b - (4.0 * (a * (z * t)))) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = (((-4.0d0) * (a * t)) + (9.0d0 * ((x * y) / z))) / c
if (z <= (-2.8d+70)) then
tmp = t_1
else if (z <= (-2.25d-35)) then
tmp = (b / (z * c)) - (((a * 4.0d0) / z) * ((z * t) / c))
else if (z <= 1.35d-10) then
tmp = (b + (9.0d0 * (x * y))) / (z * c)
else if (z <= 7.4d+55) then
tmp = (b - (4.0d0 * (a * (z * t)))) / (z * c)
else
tmp = t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
double tmp;
if (z <= -2.8e+70) {
tmp = t_1;
} else if (z <= -2.25e-35) {
tmp = (b / (z * c)) - (((a * 4.0) / z) * ((z * t) / c));
} else if (z <= 1.35e-10) {
tmp = (b + (9.0 * (x * y))) / (z * c);
} else if (z <= 7.4e+55) {
tmp = (b - (4.0 * (a * (z * t)))) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): t_1 = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c tmp = 0 if z <= -2.8e+70: tmp = t_1 elif z <= -2.25e-35: tmp = (b / (z * c)) - (((a * 4.0) / z) * ((z * t) / c)) elif z <= 1.35e-10: tmp = (b + (9.0 * (x * y))) / (z * c) elif z <= 7.4e+55: tmp = (b - (4.0 * (a * (z * t)))) / (z * c) else: tmp = t_1 return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(-4.0 * Float64(a * t)) + Float64(9.0 * Float64(Float64(x * y) / z))) / c) tmp = 0.0 if (z <= -2.8e+70) tmp = t_1; elseif (z <= -2.25e-35) tmp = Float64(Float64(b / Float64(z * c)) - Float64(Float64(Float64(a * 4.0) / z) * Float64(Float64(z * t) / c))); elseif (z <= 1.35e-10) tmp = Float64(Float64(b + Float64(9.0 * Float64(x * y))) / Float64(z * c)); elseif (z <= 7.4e+55) tmp = Float64(Float64(b - Float64(4.0 * Float64(a * Float64(z * t)))) / Float64(z * c)); else tmp = t_1; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
tmp = 0.0;
if (z <= -2.8e+70)
tmp = t_1;
elseif (z <= -2.25e-35)
tmp = (b / (z * c)) - (((a * 4.0) / z) * ((z * t) / c));
elseif (z <= 1.35e-10)
tmp = (b + (9.0 * (x * y))) / (z * c);
elseif (z <= 7.4e+55)
tmp = (b - (4.0 * (a * (z * t)))) / (z * c);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[z, -2.8e+70], t$95$1, If[LessEqual[z, -2.25e-35], N[(N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a * 4.0), $MachinePrecision] / z), $MachinePrecision] * N[(N[(z * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e-10], N[(N[(b + N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.4e+55], N[(N[(b - N[(4.0 * N[(a * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := \frac{-4 \cdot \left(a \cdot t\right) + 9 \cdot \frac{x \cdot y}{z}}{c}\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+70}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.25 \cdot 10^{-35}:\\
\;\;\;\;\frac{b}{z \cdot c} - \frac{a \cdot 4}{z} \cdot \frac{z \cdot t}{c}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-10}:\\
\;\;\;\;\frac{b + 9 \cdot \left(x \cdot y\right)}{z \cdot c}\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{+55}:\\
\;\;\;\;\frac{b - 4 \cdot \left(a \cdot \left(z \cdot t\right)\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.7999999999999999e70 or 7.4000000000000004e55 < z Initial program 55.2%
associate-+l-55.2%
associate-*l*55.2%
associate-*l*62.8%
Simplified62.8%
Taylor expanded in b around 0 49.2%
Taylor expanded in x around 0 75.4%
Taylor expanded in c around 0 81.2%
if -2.7999999999999999e70 < z < -2.25000000000000005e-35Initial program 78.2%
associate-+l-78.2%
associate-*l*78.2%
associate-*l*82.6%
Simplified82.6%
Taylor expanded in x around 0 81.0%
div-sub81.0%
associate-*r*81.0%
times-frac81.2%
Applied egg-rr81.2%
if -2.25000000000000005e-35 < z < 1.35e-10Initial program 93.6%
Taylor expanded in x around inf 79.2%
if 1.35e-10 < z < 7.4000000000000004e55Initial program 87.1%
associate-+l-87.1%
associate-*l*87.1%
associate-*l*87.2%
Simplified87.2%
Taylor expanded in x around 0 86.0%
Final simplification80.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (or (<= z -2.65e+54) (not (<= z 1.2e+56))) (/ (+ (* -4.0 (* a t)) (* 9.0 (/ (* x y) z))) c) (/ (+ b (- (* y (* 9.0 x)) (* a (* t (* z 4.0))))) (* z c))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -2.65e+54) || !(z <= 1.2e+56)) {
tmp = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
} else {
tmp = (b + ((y * (9.0 * x)) - (a * (t * (z * 4.0))))) / (z * c);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((z <= (-2.65d+54)) .or. (.not. (z <= 1.2d+56))) then
tmp = (((-4.0d0) * (a * t)) + (9.0d0 * ((x * y) / z))) / c
else
tmp = (b + ((y * (9.0d0 * x)) - (a * (t * (z * 4.0d0))))) / (z * c)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -2.65e+54) || !(z <= 1.2e+56)) {
tmp = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
} else {
tmp = (b + ((y * (9.0 * x)) - (a * (t * (z * 4.0))))) / (z * c);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): tmp = 0 if (z <= -2.65e+54) or not (z <= 1.2e+56): tmp = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c else: tmp = (b + ((y * (9.0 * x)) - (a * (t * (z * 4.0))))) / (z * c) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -2.65e+54) || !(z <= 1.2e+56)) tmp = Float64(Float64(Float64(-4.0 * Float64(a * t)) + Float64(9.0 * Float64(Float64(x * y) / z))) / c); else tmp = Float64(Float64(b + Float64(Float64(y * Float64(9.0 * x)) - Float64(a * Float64(t * Float64(z * 4.0))))) / Float64(z * c)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if ((z <= -2.65e+54) || ~((z <= 1.2e+56)))
tmp = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
else
tmp = (b + ((y * (9.0 * x)) - (a * (t * (z * 4.0))))) / (z * c);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -2.65e+54], N[Not[LessEqual[z, 1.2e+56]], $MachinePrecision]], N[(N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(b + N[(N[(y * N[(9.0 * x), $MachinePrecision]), $MachinePrecision] - N[(a * N[(t * N[(z * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+54} \lor \neg \left(z \leq 1.2 \cdot 10^{+56}\right):\\
\;\;\;\;\frac{-4 \cdot \left(a \cdot t\right) + 9 \cdot \frac{x \cdot y}{z}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + \left(y \cdot \left(9 \cdot x\right) - a \cdot \left(t \cdot \left(z \cdot 4\right)\right)\right)}{z \cdot c}\\
\end{array}
\end{array}
if z < -2.65000000000000009e54 or 1.20000000000000007e56 < z Initial program 54.2%
associate-+l-54.2%
associate-*l*54.2%
associate-*l*62.4%
Simplified62.4%
Taylor expanded in b around 0 48.4%
Taylor expanded in x around 0 74.6%
Taylor expanded in c around 0 81.0%
if -2.65000000000000009e54 < z < 1.20000000000000007e56Initial program 92.2%
Final simplification87.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (or (<= z -2.65e+54) (not (<= z 3.2e+197))) (/ (+ (* -4.0 (* a t)) (* 9.0 (/ (* x y) z))) c) (/ (+ (* x (* 9.0 y)) (- b (* (* a t) (* z 4.0)))) (* z c))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -2.65e+54) || !(z <= 3.2e+197)) {
tmp = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
} else {
tmp = ((x * (9.0 * y)) + (b - ((a * t) * (z * 4.0)))) / (z * c);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((z <= (-2.65d+54)) .or. (.not. (z <= 3.2d+197))) then
tmp = (((-4.0d0) * (a * t)) + (9.0d0 * ((x * y) / z))) / c
else
tmp = ((x * (9.0d0 * y)) + (b - ((a * t) * (z * 4.0d0)))) / (z * c)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -2.65e+54) || !(z <= 3.2e+197)) {
tmp = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
} else {
tmp = ((x * (9.0 * y)) + (b - ((a * t) * (z * 4.0)))) / (z * c);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): tmp = 0 if (z <= -2.65e+54) or not (z <= 3.2e+197): tmp = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c else: tmp = ((x * (9.0 * y)) + (b - ((a * t) * (z * 4.0)))) / (z * c) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -2.65e+54) || !(z <= 3.2e+197)) tmp = Float64(Float64(Float64(-4.0 * Float64(a * t)) + Float64(9.0 * Float64(Float64(x * y) / z))) / c); else tmp = Float64(Float64(Float64(x * Float64(9.0 * y)) + Float64(b - Float64(Float64(a * t) * Float64(z * 4.0)))) / Float64(z * c)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if ((z <= -2.65e+54) || ~((z <= 3.2e+197)))
tmp = ((-4.0 * (a * t)) + (9.0 * ((x * y) / z))) / c;
else
tmp = ((x * (9.0 * y)) + (b - ((a * t) * (z * 4.0)))) / (z * c);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -2.65e+54], N[Not[LessEqual[z, 3.2e+197]], $MachinePrecision]], N[(N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(x * N[(9.0 * y), $MachinePrecision]), $MachinePrecision] + N[(b - N[(N[(a * t), $MachinePrecision] * N[(z * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+54} \lor \neg \left(z \leq 3.2 \cdot 10^{+197}\right):\\
\;\;\;\;\frac{-4 \cdot \left(a \cdot t\right) + 9 \cdot \frac{x \cdot y}{z}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(9 \cdot y\right) + \left(b - \left(a \cdot t\right) \cdot \left(z \cdot 4\right)\right)}{z \cdot c}\\
\end{array}
\end{array}
if z < -2.65000000000000009e54 or 3.1999999999999998e197 < z Initial program 50.2%
associate-+l-50.2%
associate-*l*50.2%
associate-*l*54.7%
Simplified54.7%
Taylor expanded in b around 0 45.9%
Taylor expanded in x around 0 76.3%
Taylor expanded in c around 0 82.7%
if -2.65000000000000009e54 < z < 3.1999999999999998e197Initial program 87.8%
associate-+l-87.8%
associate-*l*87.8%
associate-*l*90.7%
Simplified90.7%
Final simplification87.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (- b (* 4.0 (* a (* z t)))) (* z c))))
(if (<= z -2.15e+54)
(* -4.0 (/ a (/ c t)))
(if (<= z -5.6e-86)
t_1
(if (<= z 4.8e-13)
(/ (+ b (* 9.0 (* x y))) (* z c))
(if (<= z 2.5e+197) t_1 (* -4.0 (/ (* a t) c))))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (b - (4.0 * (a * (z * t)))) / (z * c);
double tmp;
if (z <= -2.15e+54) {
tmp = -4.0 * (a / (c / t));
} else if (z <= -5.6e-86) {
tmp = t_1;
} else if (z <= 4.8e-13) {
tmp = (b + (9.0 * (x * y))) / (z * c);
} else if (z <= 2.5e+197) {
tmp = t_1;
} else {
tmp = -4.0 * ((a * t) / c);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = (b - (4.0d0 * (a * (z * t)))) / (z * c)
if (z <= (-2.15d+54)) then
tmp = (-4.0d0) * (a / (c / t))
else if (z <= (-5.6d-86)) then
tmp = t_1
else if (z <= 4.8d-13) then
tmp = (b + (9.0d0 * (x * y))) / (z * c)
else if (z <= 2.5d+197) then
tmp = t_1
else
tmp = (-4.0d0) * ((a * t) / c)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (b - (4.0 * (a * (z * t)))) / (z * c);
double tmp;
if (z <= -2.15e+54) {
tmp = -4.0 * (a / (c / t));
} else if (z <= -5.6e-86) {
tmp = t_1;
} else if (z <= 4.8e-13) {
tmp = (b + (9.0 * (x * y))) / (z * c);
} else if (z <= 2.5e+197) {
tmp = t_1;
} else {
tmp = -4.0 * ((a * t) / c);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): t_1 = (b - (4.0 * (a * (z * t)))) / (z * c) tmp = 0 if z <= -2.15e+54: tmp = -4.0 * (a / (c / t)) elif z <= -5.6e-86: tmp = t_1 elif z <= 4.8e-13: tmp = (b + (9.0 * (x * y))) / (z * c) elif z <= 2.5e+197: tmp = t_1 else: tmp = -4.0 * ((a * t) / c) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(b - Float64(4.0 * Float64(a * Float64(z * t)))) / Float64(z * c)) tmp = 0.0 if (z <= -2.15e+54) tmp = Float64(-4.0 * Float64(a / Float64(c / t))); elseif (z <= -5.6e-86) tmp = t_1; elseif (z <= 4.8e-13) tmp = Float64(Float64(b + Float64(9.0 * Float64(x * y))) / Float64(z * c)); elseif (z <= 2.5e+197) tmp = t_1; else tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (b - (4.0 * (a * (z * t)))) / (z * c);
tmp = 0.0;
if (z <= -2.15e+54)
tmp = -4.0 * (a / (c / t));
elseif (z <= -5.6e-86)
tmp = t_1;
elseif (z <= 4.8e-13)
tmp = (b + (9.0 * (x * y))) / (z * c);
elseif (z <= 2.5e+197)
tmp = t_1;
else
tmp = -4.0 * ((a * t) / c);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(b - N[(4.0 * N[(a * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.15e+54], N[(-4.0 * N[(a / N[(c / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.6e-86], t$95$1, If[LessEqual[z, 4.8e-13], N[(N[(b + N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.5e+197], t$95$1, N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := \frac{b - 4 \cdot \left(a \cdot \left(z \cdot t\right)\right)}{z \cdot c}\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{+54}:\\
\;\;\;\;-4 \cdot \frac{a}{\frac{c}{t}}\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-13}:\\
\;\;\;\;\frac{b + 9 \cdot \left(x \cdot y\right)}{z \cdot c}\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+197}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\end{array}
\end{array}
if z < -2.14999999999999988e54Initial program 56.8%
Taylor expanded in z around inf 69.8%
*-commutative69.8%
associate-/l*72.8%
Simplified72.8%
if -2.14999999999999988e54 < z < -5.60000000000000019e-86 or 4.7999999999999997e-13 < z < 2.50000000000000004e197Initial program 80.6%
associate-+l-80.6%
associate-*l*80.6%
associate-*l*86.9%
Simplified86.9%
Taylor expanded in x around 0 72.2%
if -5.60000000000000019e-86 < z < 4.7999999999999997e-13Initial program 93.8%
Taylor expanded in x around inf 81.8%
if 2.50000000000000004e197 < z Initial program 36.2%
Taylor expanded in z around inf 73.0%
Final simplification75.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* 9.0 (* (/ x c) (/ y z)))))
(if (<= a -1e-100)
(* -4.0 (/ a (/ c t)))
(if (<= a -4e-200)
t_1
(if (<= a 1.32e-140)
(* b (/ 1.0 (* z c)))
(if (<= a 3.9e-33) t_1 (* -4.0 (* t (/ a c)))))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = 9.0 * ((x / c) * (y / z));
double tmp;
if (a <= -1e-100) {
tmp = -4.0 * (a / (c / t));
} else if (a <= -4e-200) {
tmp = t_1;
} else if (a <= 1.32e-140) {
tmp = b * (1.0 / (z * c));
} else if (a <= 3.9e-33) {
tmp = t_1;
} else {
tmp = -4.0 * (t * (a / c));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = 9.0d0 * ((x / c) * (y / z))
if (a <= (-1d-100)) then
tmp = (-4.0d0) * (a / (c / t))
else if (a <= (-4d-200)) then
tmp = t_1
else if (a <= 1.32d-140) then
tmp = b * (1.0d0 / (z * c))
else if (a <= 3.9d-33) then
tmp = t_1
else
tmp = (-4.0d0) * (t * (a / c))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = 9.0 * ((x / c) * (y / z));
double tmp;
if (a <= -1e-100) {
tmp = -4.0 * (a / (c / t));
} else if (a <= -4e-200) {
tmp = t_1;
} else if (a <= 1.32e-140) {
tmp = b * (1.0 / (z * c));
} else if (a <= 3.9e-33) {
tmp = t_1;
} else {
tmp = -4.0 * (t * (a / c));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): t_1 = 9.0 * ((x / c) * (y / z)) tmp = 0 if a <= -1e-100: tmp = -4.0 * (a / (c / t)) elif a <= -4e-200: tmp = t_1 elif a <= 1.32e-140: tmp = b * (1.0 / (z * c)) elif a <= 3.9e-33: tmp = t_1 else: tmp = -4.0 * (t * (a / c)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) t_1 = Float64(9.0 * Float64(Float64(x / c) * Float64(y / z))) tmp = 0.0 if (a <= -1e-100) tmp = Float64(-4.0 * Float64(a / Float64(c / t))); elseif (a <= -4e-200) tmp = t_1; elseif (a <= 1.32e-140) tmp = Float64(b * Float64(1.0 / Float64(z * c))); elseif (a <= 3.9e-33) tmp = t_1; else tmp = Float64(-4.0 * Float64(t * Float64(a / c))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = 9.0 * ((x / c) * (y / z));
tmp = 0.0;
if (a <= -1e-100)
tmp = -4.0 * (a / (c / t));
elseif (a <= -4e-200)
tmp = t_1;
elseif (a <= 1.32e-140)
tmp = b * (1.0 / (z * c));
elseif (a <= 3.9e-33)
tmp = t_1;
else
tmp = -4.0 * (t * (a / c));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(9.0 * N[(N[(x / c), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1e-100], N[(-4.0 * N[(a / N[(c / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -4e-200], t$95$1, If[LessEqual[a, 1.32e-140], N[(b * N[(1.0 / N[(z * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.9e-33], t$95$1, N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := 9 \cdot \left(\frac{x}{c} \cdot \frac{y}{z}\right)\\
\mathbf{if}\;a \leq -1 \cdot 10^{-100}:\\
\;\;\;\;-4 \cdot \frac{a}{\frac{c}{t}}\\
\mathbf{elif}\;a \leq -4 \cdot 10^{-200}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 1.32 \cdot 10^{-140}:\\
\;\;\;\;b \cdot \frac{1}{z \cdot c}\\
\mathbf{elif}\;a \leq 3.9 \cdot 10^{-33}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\end{array}
\end{array}
if a < -1e-100Initial program 81.6%
Taylor expanded in z around inf 57.8%
*-commutative57.8%
associate-/l*60.2%
Simplified60.2%
if -1e-100 < a < -3.9999999999999999e-200 or 1.32e-140 < a < 3.89999999999999974e-33Initial program 60.5%
Taylor expanded in x around inf 25.4%
times-frac36.2%
Simplified36.2%
if -3.9999999999999999e-200 < a < 1.32e-140Initial program 77.4%
associate-+l-77.4%
associate-*l*77.4%
fma-neg77.4%
sub-neg77.4%
distribute-neg-in77.4%
remove-double-neg77.4%
+-commutative77.4%
unsub-neg77.4%
associate-*l*85.4%
*-commutative85.4%
associate-*l*85.4%
Simplified85.4%
div-inv85.2%
cancel-sign-sub-inv85.2%
associate-*r*85.2%
metadata-eval85.2%
Applied egg-rr85.2%
Taylor expanded in b around inf 46.0%
if 3.89999999999999974e-33 < a Initial program 73.2%
associate-+l-73.2%
associate-*l*73.3%
fma-neg77.4%
sub-neg77.4%
distribute-neg-in77.4%
remove-double-neg77.4%
+-commutative77.4%
unsub-neg77.4%
associate-*l*77.5%
*-commutative77.5%
associate-*l*77.5%
Simplified77.5%
associate-/r*74.0%
div-inv74.0%
cancel-sign-sub-inv74.0%
associate-*r*74.0%
metadata-eval74.0%
Applied egg-rr74.0%
Taylor expanded in z around inf 63.1%
associate-/l*69.4%
associate-/r/69.5%
Simplified69.5%
Final simplification55.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(if (<= a -7.4e-101)
(* -4.0 (/ a (/ c t)))
(if (<= a -5.5e-200)
(/ (/ (* 9.0 x) (/ z y)) c)
(if (<= a 1e-140)
(* b (/ 1.0 (* z c)))
(if (<= a 2.5e-29)
(* 9.0 (* (/ x c) (/ y z)))
(* -4.0 (* t (/ a c))))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (a <= -7.4e-101) {
tmp = -4.0 * (a / (c / t));
} else if (a <= -5.5e-200) {
tmp = ((9.0 * x) / (z / y)) / c;
} else if (a <= 1e-140) {
tmp = b * (1.0 / (z * c));
} else if (a <= 2.5e-29) {
tmp = 9.0 * ((x / c) * (y / z));
} else {
tmp = -4.0 * (t * (a / c));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (a <= (-7.4d-101)) then
tmp = (-4.0d0) * (a / (c / t))
else if (a <= (-5.5d-200)) then
tmp = ((9.0d0 * x) / (z / y)) / c
else if (a <= 1d-140) then
tmp = b * (1.0d0 / (z * c))
else if (a <= 2.5d-29) then
tmp = 9.0d0 * ((x / c) * (y / z))
else
tmp = (-4.0d0) * (t * (a / c))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (a <= -7.4e-101) {
tmp = -4.0 * (a / (c / t));
} else if (a <= -5.5e-200) {
tmp = ((9.0 * x) / (z / y)) / c;
} else if (a <= 1e-140) {
tmp = b * (1.0 / (z * c));
} else if (a <= 2.5e-29) {
tmp = 9.0 * ((x / c) * (y / z));
} else {
tmp = -4.0 * (t * (a / c));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): tmp = 0 if a <= -7.4e-101: tmp = -4.0 * (a / (c / t)) elif a <= -5.5e-200: tmp = ((9.0 * x) / (z / y)) / c elif a <= 1e-140: tmp = b * (1.0 / (z * c)) elif a <= 2.5e-29: tmp = 9.0 * ((x / c) * (y / z)) else: tmp = -4.0 * (t * (a / c)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (a <= -7.4e-101) tmp = Float64(-4.0 * Float64(a / Float64(c / t))); elseif (a <= -5.5e-200) tmp = Float64(Float64(Float64(9.0 * x) / Float64(z / y)) / c); elseif (a <= 1e-140) tmp = Float64(b * Float64(1.0 / Float64(z * c))); elseif (a <= 2.5e-29) tmp = Float64(9.0 * Float64(Float64(x / c) * Float64(y / z))); else tmp = Float64(-4.0 * Float64(t * Float64(a / c))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if (a <= -7.4e-101)
tmp = -4.0 * (a / (c / t));
elseif (a <= -5.5e-200)
tmp = ((9.0 * x) / (z / y)) / c;
elseif (a <= 1e-140)
tmp = b * (1.0 / (z * c));
elseif (a <= 2.5e-29)
tmp = 9.0 * ((x / c) * (y / z));
else
tmp = -4.0 * (t * (a / c));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[a, -7.4e-101], N[(-4.0 * N[(a / N[(c / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -5.5e-200], N[(N[(N[(9.0 * x), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[a, 1e-140], N[(b * N[(1.0 / N[(z * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.5e-29], N[(9.0 * N[(N[(x / c), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.4 \cdot 10^{-101}:\\
\;\;\;\;-4 \cdot \frac{a}{\frac{c}{t}}\\
\mathbf{elif}\;a \leq -5.5 \cdot 10^{-200}:\\
\;\;\;\;\frac{\frac{9 \cdot x}{\frac{z}{y}}}{c}\\
\mathbf{elif}\;a \leq 10^{-140}:\\
\;\;\;\;b \cdot \frac{1}{z \cdot c}\\
\mathbf{elif}\;a \leq 2.5 \cdot 10^{-29}:\\
\;\;\;\;9 \cdot \left(\frac{x}{c} \cdot \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\end{array}
\end{array}
if a < -7.4000000000000001e-101Initial program 81.6%
Taylor expanded in z around inf 57.8%
*-commutative57.8%
associate-/l*60.2%
Simplified60.2%
if -7.4000000000000001e-101 < a < -5.4999999999999996e-200Initial program 70.9%
associate-+l-70.9%
associate-*l*70.9%
associate-*l*76.8%
Simplified76.8%
Taylor expanded in b around 0 30.5%
Taylor expanded in x around 0 53.2%
Taylor expanded in c around 0 53.5%
Taylor expanded in a around 0 19.9%
associate-/l*25.5%
associate-*r/25.5%
Simplified25.5%
if -5.4999999999999996e-200 < a < 9.9999999999999998e-141Initial program 77.4%
associate-+l-77.4%
associate-*l*77.4%
fma-neg77.4%
sub-neg77.4%
distribute-neg-in77.4%
remove-double-neg77.4%
+-commutative77.4%
unsub-neg77.4%
associate-*l*85.4%
*-commutative85.4%
associate-*l*85.4%
Simplified85.4%
div-inv85.2%
cancel-sign-sub-inv85.2%
associate-*r*85.2%
metadata-eval85.2%
Applied egg-rr85.2%
Taylor expanded in b around inf 46.0%
if 9.9999999999999998e-141 < a < 2.49999999999999993e-29Initial program 55.5%
Taylor expanded in x around inf 28.0%
times-frac41.4%
Simplified41.4%
if 2.49999999999999993e-29 < a Initial program 72.9%
associate-+l-72.9%
associate-*l*72.9%
fma-neg77.0%
sub-neg77.0%
distribute-neg-in77.0%
remove-double-neg77.0%
+-commutative77.0%
unsub-neg77.0%
associate-*l*77.2%
*-commutative77.2%
associate-*l*77.2%
Simplified77.2%
associate-/r*73.7%
div-inv73.6%
cancel-sign-sub-inv73.6%
associate-*r*73.6%
metadata-eval73.6%
Applied egg-rr73.6%
Taylor expanded in z around inf 62.6%
associate-/l*68.9%
associate-/r/69.1%
Simplified69.1%
Final simplification55.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* -4.0 (* t (/ a c)))) (t_2 (/ (/ b c) z)))
(if (<= b -8.5e+78)
t_2
(if (<= b 5.5e-26)
t_1
(if (<= b 2.95e+146) t_2 (if (<= b 1.85e+198) t_1 (/ b (* z c))))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * (t * (a / c));
double t_2 = (b / c) / z;
double tmp;
if (b <= -8.5e+78) {
tmp = t_2;
} else if (b <= 5.5e-26) {
tmp = t_1;
} else if (b <= 2.95e+146) {
tmp = t_2;
} else if (b <= 1.85e+198) {
tmp = t_1;
} else {
tmp = b / (z * c);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-4.0d0) * (t * (a / c))
t_2 = (b / c) / z
if (b <= (-8.5d+78)) then
tmp = t_2
else if (b <= 5.5d-26) then
tmp = t_1
else if (b <= 2.95d+146) then
tmp = t_2
else if (b <= 1.85d+198) then
tmp = t_1
else
tmp = b / (z * c)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * (t * (a / c));
double t_2 = (b / c) / z;
double tmp;
if (b <= -8.5e+78) {
tmp = t_2;
} else if (b <= 5.5e-26) {
tmp = t_1;
} else if (b <= 2.95e+146) {
tmp = t_2;
} else if (b <= 1.85e+198) {
tmp = t_1;
} else {
tmp = b / (z * c);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): t_1 = -4.0 * (t * (a / c)) t_2 = (b / c) / z tmp = 0 if b <= -8.5e+78: tmp = t_2 elif b <= 5.5e-26: tmp = t_1 elif b <= 2.95e+146: tmp = t_2 elif b <= 1.85e+198: tmp = t_1 else: tmp = b / (z * c) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(t * Float64(a / c))) t_2 = Float64(Float64(b / c) / z) tmp = 0.0 if (b <= -8.5e+78) tmp = t_2; elseif (b <= 5.5e-26) tmp = t_1; elseif (b <= 2.95e+146) tmp = t_2; elseif (b <= 1.85e+198) tmp = t_1; else tmp = Float64(b / Float64(z * c)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = -4.0 * (t * (a / c));
t_2 = (b / c) / z;
tmp = 0.0;
if (b <= -8.5e+78)
tmp = t_2;
elseif (b <= 5.5e-26)
tmp = t_1;
elseif (b <= 2.95e+146)
tmp = t_2;
elseif (b <= 1.85e+198)
tmp = t_1;
else
tmp = b / (z * c);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[b, -8.5e+78], t$95$2, If[LessEqual[b, 5.5e-26], t$95$1, If[LessEqual[b, 2.95e+146], t$95$2, If[LessEqual[b, 1.85e+198], t$95$1, N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \left(t \cdot \frac{a}{c}\right)\\
t_2 := \frac{\frac{b}{c}}{z}\\
\mathbf{if}\;b \leq -8.5 \cdot 10^{+78}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;b \leq 5.5 \cdot 10^{-26}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 2.95 \cdot 10^{+146}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;b \leq 1.85 \cdot 10^{+198}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{z \cdot c}\\
\end{array}
\end{array}
if b < -8.50000000000000079e78 or 5.5000000000000005e-26 < b < 2.95000000000000015e146Initial program 72.2%
associate-+l-72.2%
associate-*l*72.3%
fma-neg74.8%
sub-neg74.8%
distribute-neg-in74.8%
remove-double-neg74.8%
+-commutative74.8%
unsub-neg74.8%
associate-*l*77.1%
*-commutative77.1%
associate-*l*77.1%
Simplified77.1%
div-inv77.0%
cancel-sign-sub-inv77.0%
associate-*r*77.0%
metadata-eval77.0%
Applied egg-rr77.0%
Taylor expanded in b around inf 50.7%
associate-*r/50.7%
frac-times50.7%
associate-*l/56.7%
un-div-inv56.7%
Applied egg-rr56.7%
if -8.50000000000000079e78 < b < 5.5000000000000005e-26 or 2.95000000000000015e146 < b < 1.8499999999999999e198Initial program 72.7%
associate-+l-72.7%
associate-*l*72.8%
fma-neg74.1%
sub-neg74.1%
distribute-neg-in74.1%
remove-double-neg74.1%
+-commutative74.1%
unsub-neg74.1%
associate-*l*78.7%
*-commutative78.7%
associate-*l*78.7%
Simplified78.7%
associate-/r*82.8%
div-inv82.8%
cancel-sign-sub-inv82.8%
associate-*r*82.8%
metadata-eval82.8%
Applied egg-rr82.8%
Taylor expanded in z around inf 60.0%
associate-/l*63.7%
associate-/r/61.4%
Simplified61.4%
if 1.8499999999999999e198 < b Initial program 92.4%
Taylor expanded in b around inf 73.7%
*-commutative73.7%
Simplified73.7%
Final simplification61.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* -4.0 (* t (/ a c)))) (t_2 (/ (/ b c) z)))
(if (<= b -2.25e+79)
t_2
(if (<= b 2.15e-32)
t_1
(if (<= b 1.85e+146)
t_2
(if (<= b 3.8e+195) t_1 (* b (/ (/ 1.0 z) c))))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * (t * (a / c));
double t_2 = (b / c) / z;
double tmp;
if (b <= -2.25e+79) {
tmp = t_2;
} else if (b <= 2.15e-32) {
tmp = t_1;
} else if (b <= 1.85e+146) {
tmp = t_2;
} else if (b <= 3.8e+195) {
tmp = t_1;
} else {
tmp = b * ((1.0 / z) / c);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-4.0d0) * (t * (a / c))
t_2 = (b / c) / z
if (b <= (-2.25d+79)) then
tmp = t_2
else if (b <= 2.15d-32) then
tmp = t_1
else if (b <= 1.85d+146) then
tmp = t_2
else if (b <= 3.8d+195) then
tmp = t_1
else
tmp = b * ((1.0d0 / z) / c)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * (t * (a / c));
double t_2 = (b / c) / z;
double tmp;
if (b <= -2.25e+79) {
tmp = t_2;
} else if (b <= 2.15e-32) {
tmp = t_1;
} else if (b <= 1.85e+146) {
tmp = t_2;
} else if (b <= 3.8e+195) {
tmp = t_1;
} else {
tmp = b * ((1.0 / z) / c);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): t_1 = -4.0 * (t * (a / c)) t_2 = (b / c) / z tmp = 0 if b <= -2.25e+79: tmp = t_2 elif b <= 2.15e-32: tmp = t_1 elif b <= 1.85e+146: tmp = t_2 elif b <= 3.8e+195: tmp = t_1 else: tmp = b * ((1.0 / z) / c) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(t * Float64(a / c))) t_2 = Float64(Float64(b / c) / z) tmp = 0.0 if (b <= -2.25e+79) tmp = t_2; elseif (b <= 2.15e-32) tmp = t_1; elseif (b <= 1.85e+146) tmp = t_2; elseif (b <= 3.8e+195) tmp = t_1; else tmp = Float64(b * Float64(Float64(1.0 / z) / c)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = -4.0 * (t * (a / c));
t_2 = (b / c) / z;
tmp = 0.0;
if (b <= -2.25e+79)
tmp = t_2;
elseif (b <= 2.15e-32)
tmp = t_1;
elseif (b <= 1.85e+146)
tmp = t_2;
elseif (b <= 3.8e+195)
tmp = t_1;
else
tmp = b * ((1.0 / z) / c);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(t * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[b, -2.25e+79], t$95$2, If[LessEqual[b, 2.15e-32], t$95$1, If[LessEqual[b, 1.85e+146], t$95$2, If[LessEqual[b, 3.8e+195], t$95$1, N[(b * N[(N[(1.0 / z), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \left(t \cdot \frac{a}{c}\right)\\
t_2 := \frac{\frac{b}{c}}{z}\\
\mathbf{if}\;b \leq -2.25 \cdot 10^{+79}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;b \leq 2.15 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 1.85 \cdot 10^{+146}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{+195}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{\frac{1}{z}}{c}\\
\end{array}
\end{array}
if b < -2.24999999999999997e79 or 2.14999999999999995e-32 < b < 1.85000000000000002e146Initial program 72.2%
associate-+l-72.2%
associate-*l*72.3%
fma-neg74.8%
sub-neg74.8%
distribute-neg-in74.8%
remove-double-neg74.8%
+-commutative74.8%
unsub-neg74.8%
associate-*l*77.1%
*-commutative77.1%
associate-*l*77.1%
Simplified77.1%
div-inv77.0%
cancel-sign-sub-inv77.0%
associate-*r*77.0%
metadata-eval77.0%
Applied egg-rr77.0%
Taylor expanded in b around inf 50.7%
associate-*r/50.7%
frac-times50.7%
associate-*l/56.7%
un-div-inv56.7%
Applied egg-rr56.7%
if -2.24999999999999997e79 < b < 2.14999999999999995e-32 or 1.85000000000000002e146 < b < 3.8e195Initial program 72.7%
associate-+l-72.7%
associate-*l*72.8%
fma-neg74.1%
sub-neg74.1%
distribute-neg-in74.1%
remove-double-neg74.1%
+-commutative74.1%
unsub-neg74.1%
associate-*l*78.7%
*-commutative78.7%
associate-*l*78.7%
Simplified78.7%
associate-/r*82.8%
div-inv82.8%
cancel-sign-sub-inv82.8%
associate-*r*82.8%
metadata-eval82.8%
Applied egg-rr82.8%
Taylor expanded in z around inf 60.0%
associate-/l*63.7%
associate-/r/61.4%
Simplified61.4%
if 3.8e195 < b Initial program 92.4%
associate-+l-92.4%
associate-*l*92.4%
fma-neg92.4%
sub-neg92.4%
distribute-neg-in92.4%
remove-double-neg92.4%
+-commutative92.4%
unsub-neg92.4%
associate-*l*92.4%
*-commutative92.4%
associate-*l*92.4%
Simplified92.4%
div-inv92.3%
cancel-sign-sub-inv92.3%
associate-*r*92.3%
metadata-eval92.3%
Applied egg-rr92.3%
Taylor expanded in b around inf 73.6%
Taylor expanded in z around 0 73.6%
associate-/l/73.8%
Simplified73.8%
Final simplification61.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(if (<= z -6e+53)
(* -4.0 (/ a (/ c t)))
(if (<= z 8.8e+55)
(/ (+ b (* 9.0 (* x y))) (* z c))
(/ -4.0 (/ c (* a t))))))assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -6e+53) {
tmp = -4.0 * (a / (c / t));
} else if (z <= 8.8e+55) {
tmp = (b + (9.0 * (x * y))) / (z * c);
} else {
tmp = -4.0 / (c / (a * t));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (z <= (-6d+53)) then
tmp = (-4.0d0) * (a / (c / t))
else if (z <= 8.8d+55) then
tmp = (b + (9.0d0 * (x * y))) / (z * c)
else
tmp = (-4.0d0) / (c / (a * t))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -6e+53) {
tmp = -4.0 * (a / (c / t));
} else if (z <= 8.8e+55) {
tmp = (b + (9.0 * (x * y))) / (z * c);
} else {
tmp = -4.0 / (c / (a * t));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): tmp = 0 if z <= -6e+53: tmp = -4.0 * (a / (c / t)) elif z <= 8.8e+55: tmp = (b + (9.0 * (x * y))) / (z * c) else: tmp = -4.0 / (c / (a * t)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -6e+53) tmp = Float64(-4.0 * Float64(a / Float64(c / t))); elseif (z <= 8.8e+55) tmp = Float64(Float64(b + Float64(9.0 * Float64(x * y))) / Float64(z * c)); else tmp = Float64(-4.0 / Float64(c / Float64(a * t))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if (z <= -6e+53)
tmp = -4.0 * (a / (c / t));
elseif (z <= 8.8e+55)
tmp = (b + (9.0 * (x * y))) / (z * c);
else
tmp = -4.0 / (c / (a * t));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -6e+53], N[(-4.0 * N[(a / N[(c / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.8e+55], N[(N[(b + N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(-4.0 / N[(c / N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+53}:\\
\;\;\;\;-4 \cdot \frac{a}{\frac{c}{t}}\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{+55}:\\
\;\;\;\;\frac{b + 9 \cdot \left(x \cdot y\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-4}{\frac{c}{a \cdot t}}\\
\end{array}
\end{array}
if z < -5.99999999999999996e53Initial program 56.8%
Taylor expanded in z around inf 69.8%
*-commutative69.8%
associate-/l*72.8%
Simplified72.8%
if -5.99999999999999996e53 < z < 8.80000000000000042e55Initial program 92.2%
Taylor expanded in x around inf 74.5%
if 8.80000000000000042e55 < z Initial program 51.6%
associate-+l-51.6%
associate-*l*51.6%
fma-neg53.3%
sub-neg53.3%
distribute-neg-in53.3%
remove-double-neg53.3%
+-commutative53.3%
unsub-neg53.3%
associate-*l*64.9%
*-commutative64.9%
associate-*l*64.9%
Simplified64.9%
div-inv64.8%
cancel-sign-sub-inv64.8%
associate-*r*64.8%
metadata-eval64.8%
Applied egg-rr64.8%
Taylor expanded in z around 0 64.8%
associate-/r*64.8%
Simplified64.8%
Taylor expanded in z around inf 64.5%
associate-/l*63.1%
associate-*r/63.1%
associate-/l*63.0%
associate-/l/64.5%
Simplified64.5%
Final simplification71.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (<= z -1e+14) (/ (/ b c) z) (/ b (* z c))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -1e+14) {
tmp = (b / c) / z;
} else {
tmp = b / (z * c);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (z <= (-1d+14)) then
tmp = (b / c) / z
else
tmp = b / (z * c)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -1e+14) {
tmp = (b / c) / z;
} else {
tmp = b / (z * c);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): tmp = 0 if z <= -1e+14: tmp = (b / c) / z else: tmp = b / (z * c) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -1e+14) tmp = Float64(Float64(b / c) / z); else tmp = Float64(b / Float64(z * c)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if (z <= -1e+14)
tmp = (b / c) / z;
else
tmp = b / (z * c);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -1e+14], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+14}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{z \cdot c}\\
\end{array}
\end{array}
if z < -1e14Initial program 62.2%
associate-+l-62.2%
associate-*l*62.2%
fma-neg65.1%
sub-neg65.1%
distribute-neg-in65.1%
remove-double-neg65.1%
+-commutative65.1%
unsub-neg65.1%
associate-*l*69.3%
*-commutative69.3%
associate-*l*69.3%
Simplified69.3%
div-inv69.2%
cancel-sign-sub-inv69.2%
associate-*r*69.2%
metadata-eval69.2%
Applied egg-rr69.2%
Taylor expanded in b around inf 18.1%
associate-*r/18.1%
frac-times20.7%
associate-*l/24.8%
un-div-inv24.8%
Applied egg-rr24.8%
if -1e14 < z Initial program 79.2%
Taylor expanded in b around inf 38.3%
*-commutative38.3%
Simplified38.3%
Final simplification34.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (/ b (* z c)))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (z * c);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
code = b / (z * c)
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (z * c);
}
[x, y] = sort([x, y]) def code(x, y, z, t, a, b, c): return b / (z * c)
x, y = sort([x, y]) function code(x, y, z, t, a, b, c) return Float64(b / Float64(z * c)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a, b, c)
tmp = b / (z * c);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{b}{z \cdot c}
\end{array}
Initial program 74.6%
Taylor expanded in b around inf 32.8%
*-commutative32.8%
Simplified32.8%
Final simplification32.8%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ b (* c z)))
(t_2 (* 4.0 (/ (* a t) c)))
(t_3 (* (* x 9.0) y))
(t_4 (+ (- t_3 (* (* (* z 4.0) t) a)) b))
(t_5 (/ t_4 (* z c)))
(t_6 (/ (+ (- t_3 (* (* z 4.0) (* t a))) b) (* z c))))
(if (< t_5 -1.100156740804105e-171)
t_6
(if (< t_5 0.0)
(/ (/ t_4 z) c)
(if (< t_5 1.1708877911747488e-53)
t_6
(if (< t_5 2.876823679546137e+130)
(- (+ (* (* 9.0 (/ y c)) (/ x z)) t_1) t_2)
(if (< t_5 1.3838515042456319e+158)
t_6
(- (+ (* 9.0 (* (/ y (* c z)) x)) t_1) t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = b / (c * z);
double t_2 = 4.0 * ((a * t) / c);
double t_3 = (x * 9.0) * y;
double t_4 = (t_3 - (((z * 4.0) * t) * a)) + b;
double t_5 = t_4 / (z * c);
double t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c);
double tmp;
if (t_5 < -1.100156740804105e-171) {
tmp = t_6;
} else if (t_5 < 0.0) {
tmp = (t_4 / z) / c;
} else if (t_5 < 1.1708877911747488e-53) {
tmp = t_6;
} else if (t_5 < 2.876823679546137e+130) {
tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2;
} else if (t_5 < 1.3838515042456319e+158) {
tmp = t_6;
} else {
tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = b / (c * z)
t_2 = 4.0d0 * ((a * t) / c)
t_3 = (x * 9.0d0) * y
t_4 = (t_3 - (((z * 4.0d0) * t) * a)) + b
t_5 = t_4 / (z * c)
t_6 = ((t_3 - ((z * 4.0d0) * (t * a))) + b) / (z * c)
if (t_5 < (-1.100156740804105d-171)) then
tmp = t_6
else if (t_5 < 0.0d0) then
tmp = (t_4 / z) / c
else if (t_5 < 1.1708877911747488d-53) then
tmp = t_6
else if (t_5 < 2.876823679546137d+130) then
tmp = (((9.0d0 * (y / c)) * (x / z)) + t_1) - t_2
else if (t_5 < 1.3838515042456319d+158) then
tmp = t_6
else
tmp = ((9.0d0 * ((y / (c * z)) * x)) + t_1) - t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = b / (c * z);
double t_2 = 4.0 * ((a * t) / c);
double t_3 = (x * 9.0) * y;
double t_4 = (t_3 - (((z * 4.0) * t) * a)) + b;
double t_5 = t_4 / (z * c);
double t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c);
double tmp;
if (t_5 < -1.100156740804105e-171) {
tmp = t_6;
} else if (t_5 < 0.0) {
tmp = (t_4 / z) / c;
} else if (t_5 < 1.1708877911747488e-53) {
tmp = t_6;
} else if (t_5 < 2.876823679546137e+130) {
tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2;
} else if (t_5 < 1.3838515042456319e+158) {
tmp = t_6;
} else {
tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = b / (c * z) t_2 = 4.0 * ((a * t) / c) t_3 = (x * 9.0) * y t_4 = (t_3 - (((z * 4.0) * t) * a)) + b t_5 = t_4 / (z * c) t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c) tmp = 0 if t_5 < -1.100156740804105e-171: tmp = t_6 elif t_5 < 0.0: tmp = (t_4 / z) / c elif t_5 < 1.1708877911747488e-53: tmp = t_6 elif t_5 < 2.876823679546137e+130: tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2 elif t_5 < 1.3838515042456319e+158: tmp = t_6 else: tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(b / Float64(c * z)) t_2 = Float64(4.0 * Float64(Float64(a * t) / c)) t_3 = Float64(Float64(x * 9.0) * y) t_4 = Float64(Float64(t_3 - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) t_5 = Float64(t_4 / Float64(z * c)) t_6 = Float64(Float64(Float64(t_3 - Float64(Float64(z * 4.0) * Float64(t * a))) + b) / Float64(z * c)) tmp = 0.0 if (t_5 < -1.100156740804105e-171) tmp = t_6; elseif (t_5 < 0.0) tmp = Float64(Float64(t_4 / z) / c); elseif (t_5 < 1.1708877911747488e-53) tmp = t_6; elseif (t_5 < 2.876823679546137e+130) tmp = Float64(Float64(Float64(Float64(9.0 * Float64(y / c)) * Float64(x / z)) + t_1) - t_2); elseif (t_5 < 1.3838515042456319e+158) tmp = t_6; else tmp = Float64(Float64(Float64(9.0 * Float64(Float64(y / Float64(c * z)) * x)) + t_1) - t_2); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = b / (c * z); t_2 = 4.0 * ((a * t) / c); t_3 = (x * 9.0) * y; t_4 = (t_3 - (((z * 4.0) * t) * a)) + b; t_5 = t_4 / (z * c); t_6 = ((t_3 - ((z * 4.0) * (t * a))) + b) / (z * c); tmp = 0.0; if (t_5 < -1.100156740804105e-171) tmp = t_6; elseif (t_5 < 0.0) tmp = (t_4 / z) / c; elseif (t_5 < 1.1708877911747488e-53) tmp = t_6; elseif (t_5 < 2.876823679546137e+130) tmp = (((9.0 * (y / c)) * (x / z)) + t_1) - t_2; elseif (t_5 < 1.3838515042456319e+158) tmp = t_6; else tmp = ((9.0 * ((y / (c * z)) * x)) + t_1) - t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(b / N[(c * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$3 - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 / N[(z * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$3 - N[(N[(z * 4.0), $MachinePrecision] * N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$5, -1.100156740804105e-171], t$95$6, If[Less[t$95$5, 0.0], N[(N[(t$95$4 / z), $MachinePrecision] / c), $MachinePrecision], If[Less[t$95$5, 1.1708877911747488e-53], t$95$6, If[Less[t$95$5, 2.876823679546137e+130], N[(N[(N[(N[(9.0 * N[(y / c), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision], If[Less[t$95$5, 1.3838515042456319e+158], t$95$6, N[(N[(N[(9.0 * N[(N[(y / N[(c * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{b}{c \cdot z}\\
t_2 := 4 \cdot \frac{a \cdot t}{c}\\
t_3 := \left(x \cdot 9\right) \cdot y\\
t_4 := \left(t_3 - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b\\
t_5 := \frac{t_4}{z \cdot c}\\
t_6 := \frac{\left(t_3 - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\
\mathbf{if}\;t_5 < -1.100156740804105 \cdot 10^{-171}:\\
\;\;\;\;t_6\\
\mathbf{elif}\;t_5 < 0:\\
\;\;\;\;\frac{\frac{t_4}{z}}{c}\\
\mathbf{elif}\;t_5 < 1.1708877911747488 \cdot 10^{-53}:\\
\;\;\;\;t_6\\
\mathbf{elif}\;t_5 < 2.876823679546137 \cdot 10^{+130}:\\
\;\;\;\;\left(\left(9 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + t_1\right) - t_2\\
\mathbf{elif}\;t_5 < 1.3838515042456319 \cdot 10^{+158}:\\
\;\;\;\;t_6\\
\mathbf{else}:\\
\;\;\;\;\left(9 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + t_1\right) - t_2\\
\end{array}
\end{array}
herbie shell --seed 2023306
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, J"
:precision binary64
:herbie-target
(if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -1.100156740804105e-171) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 0.0) (/ (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.1708877911747488e-53) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9.0 (/ y c)) (/ x z)) (/ b (* c z))) (* 4.0 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (- (+ (* 9.0 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4.0 (/ (* a t) c))))))))
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))