
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -5e-137) (fma a (* 27.0 b) (fma x 2.0 (* y (* t (* z -9.0))))) (+ (- (* x 2.0) (* t (* z (* y 9.0)))) (* b (* a 27.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -5e-137) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * (t * (z * -9.0)))));
} else {
tmp = ((x * 2.0) - (t * (z * (y * 9.0)))) + (b * (a * 27.0));
}
return tmp;
}
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -5e-137) tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(y * Float64(t * Float64(z * -9.0))))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0)))) + Float64(b * Float64(a * 27.0))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -5e-137], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-137}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if z < -5.00000000000000001e-137Initial program 95.9%
+-commutative95.9%
associate-+r-95.9%
cancel-sign-sub-inv95.9%
*-commutative95.9%
distribute-rgt-neg-out95.9%
associate-*r*97.8%
*-commutative97.8%
distribute-rgt-neg-in97.8%
associate-+r+97.8%
sub-neg97.8%
associate-*l*97.8%
fma-def97.8%
fma-neg97.8%
associate-*l*97.8%
*-commutative97.8%
associate-*r*95.8%
distribute-rgt-neg-in95.8%
Simplified95.9%
if -5.00000000000000001e-137 < z Initial program 98.0%
Final simplification97.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* 27.0 b))))
(if (<= (* y 9.0) -5e-40)
(+ t_1 (- (* x 2.0) (* (* y 9.0) (* z t))))
(+ t_1 (+ (* x 2.0) (* z (* y (* t -9.0))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double tmp;
if ((y * 9.0) <= -5e-40) {
tmp = t_1 + ((x * 2.0) - ((y * 9.0) * (z * t)));
} else {
tmp = t_1 + ((x * 2.0) + (z * (y * (t * -9.0))));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = a * (27.0d0 * b)
if ((y * 9.0d0) <= (-5d-40)) then
tmp = t_1 + ((x * 2.0d0) - ((y * 9.0d0) * (z * t)))
else
tmp = t_1 + ((x * 2.0d0) + (z * (y * (t * (-9.0d0)))))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double tmp;
if ((y * 9.0) <= -5e-40) {
tmp = t_1 + ((x * 2.0) - ((y * 9.0) * (z * t)));
} else {
tmp = t_1 + ((x * 2.0) + (z * (y * (t * -9.0))));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = a * (27.0 * b) tmp = 0 if (y * 9.0) <= -5e-40: tmp = t_1 + ((x * 2.0) - ((y * 9.0) * (z * t))) else: tmp = t_1 + ((x * 2.0) + (z * (y * (t * -9.0)))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(27.0 * b)) tmp = 0.0 if (Float64(y * 9.0) <= -5e-40) tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t)))); else tmp = Float64(t_1 + Float64(Float64(x * 2.0) + Float64(z * Float64(y * Float64(t * -9.0))))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = a * (27.0 * b);
tmp = 0.0;
if ((y * 9.0) <= -5e-40)
tmp = t_1 + ((x * 2.0) - ((y * 9.0) * (z * t)));
else
tmp = t_1 + ((x * 2.0) + (z * (y * (t * -9.0))));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * 9.0), $MachinePrecision], -5e-40], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] + N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;y \cdot 9 \leq -5 \cdot 10^{-40}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 + z \cdot \left(y \cdot \left(t \cdot -9\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 y 9) < -4.99999999999999965e-40Initial program 95.0%
sub-neg95.0%
distribute-lft-neg-in95.0%
associate-*l*95.0%
*-commutative95.0%
*-commutative95.0%
cancel-sign-sub-inv95.0%
*-commutative95.0%
*-commutative95.0%
associate-*l*95.0%
associate-*l*97.4%
associate-*l*97.4%
Simplified97.4%
if -4.99999999999999965e-40 < (*.f64 y 9) Initial program 98.1%
+-commutative98.1%
associate-+r-98.1%
cancel-sign-sub-inv98.1%
*-commutative98.1%
distribute-rgt-neg-out98.1%
associate-*r*96.1%
*-commutative96.1%
distribute-rgt-neg-in96.1%
associate-+r+96.1%
sub-neg96.1%
+-commutative96.1%
associate-+l-96.1%
fma-neg96.1%
associate-*l*94.4%
fma-neg94.4%
*-commutative94.4%
fma-neg94.4%
Simplified96.1%
fma-udef96.1%
fma-udef96.1%
associate-*r*96.1%
associate-+r+96.1%
Applied egg-rr96.1%
Final simplification96.5%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= t 230000000.0) (+ (+ (* x 2.0) (* a (* 27.0 b))) (* (* y t) (* z -9.0))) (+ (- (* x 2.0) (* t (* z (* y 9.0)))) (* b (* a 27.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 230000000.0) {
tmp = ((x * 2.0) + (a * (27.0 * b))) + ((y * t) * (z * -9.0));
} else {
tmp = ((x * 2.0) - (t * (z * (y * 9.0)))) + (b * (a * 27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (t <= 230000000.0d0) then
tmp = ((x * 2.0d0) + (a * (27.0d0 * b))) + ((y * t) * (z * (-9.0d0)))
else
tmp = ((x * 2.0d0) - (t * (z * (y * 9.0d0)))) + (b * (a * 27.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 230000000.0) {
tmp = ((x * 2.0) + (a * (27.0 * b))) + ((y * t) * (z * -9.0));
} else {
tmp = ((x * 2.0) - (t * (z * (y * 9.0)))) + (b * (a * 27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if t <= 230000000.0: tmp = ((x * 2.0) + (a * (27.0 * b))) + ((y * t) * (z * -9.0)) else: tmp = ((x * 2.0) - (t * (z * (y * 9.0)))) + (b * (a * 27.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 230000000.0) tmp = Float64(Float64(Float64(x * 2.0) + Float64(a * Float64(27.0 * b))) + Float64(Float64(y * t) * Float64(z * -9.0))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0)))) + Float64(b * Float64(a * 27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (t <= 230000000.0)
tmp = ((x * 2.0) + (a * (27.0 * b))) + ((y * t) * (z * -9.0));
else
tmp = ((x * 2.0) - (t * (z * (y * 9.0)))) + (b * (a * 27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 230000000.0], N[(N[(N[(x * 2.0), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y * t), $MachinePrecision] * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 230000000:\\
\;\;\;\;\left(x \cdot 2 + a \cdot \left(27 \cdot b\right)\right) + \left(y \cdot t\right) \cdot \left(z \cdot -9\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if t < 2.3e8Initial program 96.0%
+-commutative96.0%
associate-+r-96.0%
cancel-sign-sub-inv96.0%
*-commutative96.0%
distribute-rgt-neg-out96.0%
associate-*r*96.1%
*-commutative96.1%
distribute-rgt-neg-in96.1%
associate-+r+96.1%
sub-neg96.1%
associate-*l*96.1%
fma-def96.1%
fma-neg96.1%
associate-*l*96.1%
*-commutative96.1%
associate-*r*96.1%
distribute-rgt-neg-in96.1%
Simplified96.2%
fma-udef96.2%
fma-udef96.2%
associate-+r+96.2%
associate-*r*96.1%
*-commutative96.1%
Applied egg-rr96.1%
if 2.3e8 < t Initial program 99.8%
Final simplification97.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= b -6.8e-245)
(+ (* x 2.0) (* 27.0 (* a b)))
(if (<= b 4.2e+59)
(+ (* x 2.0) (* y (* -9.0 (* z t))))
(+ (* a (* 27.0 b)) (* t (* y (* z -9.0)))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6.8e-245) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else if (b <= 4.2e+59) {
tmp = (x * 2.0) + (y * (-9.0 * (z * t)));
} else {
tmp = (a * (27.0 * b)) + (t * (y * (z * -9.0)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (b <= (-6.8d-245)) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else if (b <= 4.2d+59) then
tmp = (x * 2.0d0) + (y * ((-9.0d0) * (z * t)))
else
tmp = (a * (27.0d0 * b)) + (t * (y * (z * (-9.0d0))))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6.8e-245) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else if (b <= 4.2e+59) {
tmp = (x * 2.0) + (y * (-9.0 * (z * t)));
} else {
tmp = (a * (27.0 * b)) + (t * (y * (z * -9.0)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if b <= -6.8e-245: tmp = (x * 2.0) + (27.0 * (a * b)) elif b <= 4.2e+59: tmp = (x * 2.0) + (y * (-9.0 * (z * t))) else: tmp = (a * (27.0 * b)) + (t * (y * (z * -9.0))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -6.8e-245) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); elseif (b <= 4.2e+59) tmp = Float64(Float64(x * 2.0) + Float64(y * Float64(-9.0 * Float64(z * t)))); else tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(t * Float64(y * Float64(z * -9.0)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (b <= -6.8e-245)
tmp = (x * 2.0) + (27.0 * (a * b));
elseif (b <= 4.2e+59)
tmp = (x * 2.0) + (y * (-9.0 * (z * t)));
else
tmp = (a * (27.0 * b)) + (t * (y * (z * -9.0)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -6.8e-245], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.2e+59], N[(N[(x * 2.0), $MachinePrecision] + N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.8 \cdot 10^{-245}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{+59}:\\
\;\;\;\;x \cdot 2 + y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\end{array}
if b < -6.7999999999999999e-245Initial program 98.2%
sub-neg98.2%
distribute-lft-neg-in98.2%
associate-*l*98.2%
*-commutative98.2%
*-commutative98.2%
cancel-sign-sub-inv98.2%
*-commutative98.2%
*-commutative98.2%
associate-*l*98.2%
associate-*l*95.8%
associate-*l*95.7%
Simplified95.7%
Taylor expanded in y around 0 64.5%
if -6.7999999999999999e-245 < b < 4.19999999999999968e59Initial program 96.5%
sub-neg96.5%
distribute-lft-neg-in96.5%
associate-*l*96.5%
*-commutative96.5%
*-commutative96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
*-commutative96.5%
associate-*l*96.5%
associate-*l*94.1%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in a around 0 86.3%
expm1-log1p-u66.0%
expm1-udef61.6%
*-commutative61.6%
Applied egg-rr61.6%
expm1-def66.0%
expm1-log1p86.3%
associate-*l*86.4%
associate-*l*86.4%
Simplified86.4%
Taylor expanded in t around 0 86.3%
*-commutative86.3%
associate-*r*86.4%
*-commutative86.4%
associate-*l*86.5%
Simplified86.5%
sub-neg86.5%
distribute-rgt-neg-in86.5%
associate-*r*86.4%
*-commutative86.4%
distribute-rgt-neg-in86.4%
metadata-eval86.4%
*-commutative86.4%
associate-*r*86.4%
*-commutative86.4%
+-commutative86.4%
*-commutative86.4%
associate-*r*84.0%
associate-*r*84.0%
*-commutative84.0%
Applied egg-rr84.0%
if 4.19999999999999968e59 < b Initial program 96.0%
sub-neg96.0%
distribute-lft-neg-in96.0%
associate-*l*95.9%
*-commutative95.9%
*-commutative95.9%
cancel-sign-sub-inv95.9%
*-commutative95.9%
*-commutative95.9%
associate-*l*96.0%
associate-*l*96.4%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in x around 0 94.2%
*-commutative94.2%
associate-*l*94.2%
associate-*l*94.1%
Simplified94.1%
Final simplification76.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (+ (* x 2.0) (* a (* 27.0 b))) (* (* y t) (* z -9.0))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) + (a * (27.0 * b))) + ((y * t) * (z * -9.0));
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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
code = ((x * 2.0d0) + (a * (27.0d0 * b))) + ((y * t) * (z * (-9.0d0)))
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) + (a * (27.0 * b))) + ((y * t) * (z * -9.0));
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return ((x * 2.0) + (a * (27.0 * b))) + ((y * t) * (z * -9.0))
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) + Float64(a * Float64(27.0 * b))) + Float64(Float64(y * t) * Float64(z * -9.0))) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = ((x * 2.0) + (a * (27.0 * b))) + ((y * t) * (z * -9.0));
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y * t), $MachinePrecision] * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\left(x \cdot 2 + a \cdot \left(27 \cdot b\right)\right) + \left(y \cdot t\right) \cdot \left(z \cdot -9\right)
\end{array}
Initial program 97.2%
+-commutative97.2%
associate-+r-97.2%
cancel-sign-sub-inv97.2%
*-commutative97.2%
distribute-rgt-neg-out97.2%
associate-*r*96.1%
*-commutative96.1%
distribute-rgt-neg-in96.1%
associate-+r+96.1%
sub-neg96.1%
associate-*l*96.1%
fma-def96.1%
fma-neg96.1%
associate-*l*96.1%
*-commutative96.1%
associate-*r*95.3%
distribute-rgt-neg-in95.3%
Simplified95.4%
fma-udef95.4%
fma-udef95.4%
associate-+r+95.4%
associate-*r*96.1%
*-commutative96.1%
Applied egg-rr96.1%
Final simplification96.1%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.8e-245) (not (<= b 5.6e+201))) (+ (* x 2.0) (* 27.0 (* a b))) (+ (* x 2.0) (* y (* -9.0 (* z t))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.8e-245) || !(b <= 5.6e+201)) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) + (y * (-9.0 * (z * t)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((b <= (-6.8d-245)) .or. (.not. (b <= 5.6d+201))) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (x * 2.0d0) + (y * ((-9.0d0) * (z * t)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.8e-245) || !(b <= 5.6e+201)) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) + (y * (-9.0 * (z * t)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (b <= -6.8e-245) or not (b <= 5.6e+201): tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = (x * 2.0) + (y * (-9.0 * (z * t))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6.8e-245) || !(b <= 5.6e+201)) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(Float64(x * 2.0) + Float64(y * Float64(-9.0 * Float64(z * t)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((b <= -6.8e-245) || ~((b <= 5.6e+201)))
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = (x * 2.0) + (y * (-9.0 * (z * t)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6.8e-245], N[Not[LessEqual[b, 5.6e+201]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.8 \cdot 10^{-245} \lor \neg \left(b \leq 5.6 \cdot 10^{+201}\right):\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if b < -6.7999999999999999e-245 or 5.6000000000000001e201 < b Initial program 97.8%
sub-neg97.8%
distribute-lft-neg-in97.8%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
cancel-sign-sub-inv97.8%
*-commutative97.8%
*-commutative97.8%
associate-*l*97.8%
associate-*l*96.5%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in y around 0 68.0%
if -6.7999999999999999e-245 < b < 5.6000000000000001e201Initial program 96.4%
sub-neg96.4%
distribute-lft-neg-in96.4%
associate-*l*96.4%
*-commutative96.4%
*-commutative96.4%
cancel-sign-sub-inv96.4%
*-commutative96.4%
*-commutative96.4%
associate-*l*96.4%
associate-*l*93.9%
associate-*l*94.0%
Simplified94.0%
Taylor expanded in a around 0 76.5%
expm1-log1p-u54.8%
expm1-udef50.9%
*-commutative50.9%
Applied egg-rr50.9%
expm1-def54.8%
expm1-log1p76.5%
associate-*l*76.6%
associate-*l*76.6%
Simplified76.6%
Taylor expanded in t around 0 76.5%
*-commutative76.5%
associate-*r*76.6%
*-commutative76.6%
associate-*l*76.6%
Simplified76.6%
sub-neg76.6%
distribute-rgt-neg-in76.6%
associate-*r*76.6%
*-commutative76.6%
distribute-rgt-neg-in76.6%
metadata-eval76.6%
*-commutative76.6%
associate-*r*76.6%
*-commutative76.6%
+-commutative76.6%
*-commutative76.6%
associate-*r*74.1%
associate-*r*74.1%
*-commutative74.1%
Applied egg-rr74.1%
Final simplification70.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))))
(if (<= t 8.2e-303)
t_1
(if (<= t 1.15e-76)
(* x 2.0)
(if (<= t 1.4e+52) t_1 (* -9.0 (* t (* z y))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (t <= 8.2e-303) {
tmp = t_1;
} else if (t <= 1.15e-76) {
tmp = x * 2.0;
} else if (t <= 1.4e+52) {
tmp = t_1;
} else {
tmp = -9.0 * (t * (z * y));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
if (t <= 8.2d-303) then
tmp = t_1
else if (t <= 1.15d-76) then
tmp = x * 2.0d0
else if (t <= 1.4d+52) then
tmp = t_1
else
tmp = (-9.0d0) * (t * (z * y))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (t <= 8.2e-303) {
tmp = t_1;
} else if (t <= 1.15e-76) {
tmp = x * 2.0;
} else if (t <= 1.4e+52) {
tmp = t_1;
} else {
tmp = -9.0 * (t * (z * y));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) tmp = 0 if t <= 8.2e-303: tmp = t_1 elif t <= 1.15e-76: tmp = x * 2.0 elif t <= 1.4e+52: tmp = t_1 else: tmp = -9.0 * (t * (z * y)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (t <= 8.2e-303) tmp = t_1; elseif (t <= 1.15e-76) tmp = Float64(x * 2.0); elseif (t <= 1.4e+52) tmp = t_1; else tmp = Float64(-9.0 * Float64(t * Float64(z * y))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if (t <= 8.2e-303)
tmp = t_1;
elseif (t <= 1.15e-76)
tmp = x * 2.0;
elseif (t <= 1.4e+52)
tmp = t_1;
else
tmp = -9.0 * (t * (z * y));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 8.2e-303], t$95$1, If[LessEqual[t, 1.15e-76], N[(x * 2.0), $MachinePrecision], If[LessEqual[t, 1.4e+52], t$95$1, N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;t \leq 8.2 \cdot 10^{-303}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-76}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+52}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if t < 8.20000000000000037e-303 or 1.15000000000000003e-76 < t < 1.4e52Initial program 96.5%
+-commutative96.5%
associate-+r-96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
distribute-rgt-neg-out96.5%
associate-*r*95.8%
*-commutative95.8%
distribute-rgt-neg-in95.8%
associate-+r+95.8%
sub-neg95.8%
associate-*l*95.8%
fma-def95.8%
fma-neg95.8%
associate-*l*95.8%
*-commutative95.8%
associate-*r*95.2%
distribute-rgt-neg-in95.2%
Simplified95.2%
fma-udef95.2%
fma-udef95.2%
associate-+r+95.2%
associate-*r*95.8%
*-commutative95.8%
Applied egg-rr95.8%
Taylor expanded in a around inf 38.2%
if 8.20000000000000037e-303 < t < 1.15000000000000003e-76Initial program 95.6%
+-commutative95.6%
associate-+r-95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
distribute-rgt-neg-out95.6%
associate-*r*97.7%
*-commutative97.7%
distribute-rgt-neg-in97.7%
associate-+r+97.7%
sub-neg97.7%
associate-*l*97.9%
fma-def97.9%
fma-neg97.9%
associate-*l*97.7%
*-commutative97.7%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
Simplified100.0%
fma-udef100.0%
fma-udef100.0%
associate-+r+100.0%
associate-*r*97.9%
*-commutative97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 51.7%
if 1.4e52 < t Initial program 99.9%
sub-neg99.9%
distribute-lft-neg-in99.9%
associate-*l*99.9%
*-commutative99.9%
*-commutative99.9%
cancel-sign-sub-inv99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
associate-*l*92.7%
associate-*l*92.7%
Simplified92.7%
Taylor expanded in x around 0 73.9%
Taylor expanded in a around 0 56.3%
Final simplification45.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))))
(if (<= t 1.4e-305)
t_1
(if (<= t 1.15e-76)
(* x 2.0)
(if (<= t 3e+53) t_1 (* t (* -9.0 (* z y))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (t <= 1.4e-305) {
tmp = t_1;
} else if (t <= 1.15e-76) {
tmp = x * 2.0;
} else if (t <= 3e+53) {
tmp = t_1;
} else {
tmp = t * (-9.0 * (z * y));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
if (t <= 1.4d-305) then
tmp = t_1
else if (t <= 1.15d-76) then
tmp = x * 2.0d0
else if (t <= 3d+53) then
tmp = t_1
else
tmp = t * ((-9.0d0) * (z * y))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (t <= 1.4e-305) {
tmp = t_1;
} else if (t <= 1.15e-76) {
tmp = x * 2.0;
} else if (t <= 3e+53) {
tmp = t_1;
} else {
tmp = t * (-9.0 * (z * y));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) tmp = 0 if t <= 1.4e-305: tmp = t_1 elif t <= 1.15e-76: tmp = x * 2.0 elif t <= 3e+53: tmp = t_1 else: tmp = t * (-9.0 * (z * y)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (t <= 1.4e-305) tmp = t_1; elseif (t <= 1.15e-76) tmp = Float64(x * 2.0); elseif (t <= 3e+53) tmp = t_1; else tmp = Float64(t * Float64(-9.0 * Float64(z * y))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if (t <= 1.4e-305)
tmp = t_1;
elseif (t <= 1.15e-76)
tmp = x * 2.0;
elseif (t <= 3e+53)
tmp = t_1;
else
tmp = t * (-9.0 * (z * y));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 1.4e-305], t$95$1, If[LessEqual[t, 1.15e-76], N[(x * 2.0), $MachinePrecision], If[LessEqual[t, 3e+53], t$95$1, N[(t * N[(-9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;t \leq 1.4 \cdot 10^{-305}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-76}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+53}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-9 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if t < 1.40000000000000007e-305 or 1.15000000000000003e-76 < t < 2.99999999999999998e53Initial program 96.5%
+-commutative96.5%
associate-+r-96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
distribute-rgt-neg-out96.5%
associate-*r*95.8%
*-commutative95.8%
distribute-rgt-neg-in95.8%
associate-+r+95.8%
sub-neg95.8%
associate-*l*95.8%
fma-def95.8%
fma-neg95.8%
associate-*l*95.8%
*-commutative95.8%
associate-*r*95.2%
distribute-rgt-neg-in95.2%
Simplified95.2%
fma-udef95.2%
fma-udef95.2%
associate-+r+95.2%
associate-*r*95.8%
*-commutative95.8%
Applied egg-rr95.8%
Taylor expanded in a around inf 38.2%
if 1.40000000000000007e-305 < t < 1.15000000000000003e-76Initial program 95.6%
+-commutative95.6%
associate-+r-95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
distribute-rgt-neg-out95.6%
associate-*r*97.7%
*-commutative97.7%
distribute-rgt-neg-in97.7%
associate-+r+97.7%
sub-neg97.7%
associate-*l*97.9%
fma-def97.9%
fma-neg97.9%
associate-*l*97.7%
*-commutative97.7%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
Simplified100.0%
fma-udef100.0%
fma-udef100.0%
associate-+r+100.0%
associate-*r*97.9%
*-commutative97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 51.7%
if 2.99999999999999998e53 < t Initial program 99.9%
sub-neg99.9%
distribute-lft-neg-in99.9%
associate-*l*99.9%
*-commutative99.9%
*-commutative99.9%
cancel-sign-sub-inv99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
associate-*l*92.7%
associate-*l*92.7%
Simplified92.7%
Taylor expanded in x around 0 73.9%
Taylor expanded in a around 0 56.3%
*-commutative56.3%
associate-*l*56.5%
*-commutative56.5%
Simplified56.5%
Final simplification45.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))))
(if (<= t 2.85e-294)
t_1
(if (<= t 1.2e-76)
(* x 2.0)
(if (<= t 3.4e+52) t_1 (* t (* z (* y -9.0))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (t <= 2.85e-294) {
tmp = t_1;
} else if (t <= 1.2e-76) {
tmp = x * 2.0;
} else if (t <= 3.4e+52) {
tmp = t_1;
} else {
tmp = t * (z * (y * -9.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
if (t <= 2.85d-294) then
tmp = t_1
else if (t <= 1.2d-76) then
tmp = x * 2.0d0
else if (t <= 3.4d+52) then
tmp = t_1
else
tmp = t * (z * (y * (-9.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (t <= 2.85e-294) {
tmp = t_1;
} else if (t <= 1.2e-76) {
tmp = x * 2.0;
} else if (t <= 3.4e+52) {
tmp = t_1;
} else {
tmp = t * (z * (y * -9.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) tmp = 0 if t <= 2.85e-294: tmp = t_1 elif t <= 1.2e-76: tmp = x * 2.0 elif t <= 3.4e+52: tmp = t_1 else: tmp = t * (z * (y * -9.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (t <= 2.85e-294) tmp = t_1; elseif (t <= 1.2e-76) tmp = Float64(x * 2.0); elseif (t <= 3.4e+52) tmp = t_1; else tmp = Float64(t * Float64(z * Float64(y * -9.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if (t <= 2.85e-294)
tmp = t_1;
elseif (t <= 1.2e-76)
tmp = x * 2.0;
elseif (t <= 3.4e+52)
tmp = t_1;
else
tmp = t * (z * (y * -9.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 2.85e-294], t$95$1, If[LessEqual[t, 1.2e-76], N[(x * 2.0), $MachinePrecision], If[LessEqual[t, 3.4e+52], t$95$1, N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;t \leq 2.85 \cdot 10^{-294}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{-76}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+52}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\\
\end{array}
\end{array}
if t < 2.85000000000000016e-294 or 1.20000000000000007e-76 < t < 3.4e52Initial program 95.9%
+-commutative95.9%
associate-+r-95.9%
cancel-sign-sub-inv95.9%
*-commutative95.9%
distribute-rgt-neg-out95.9%
associate-*r*95.9%
*-commutative95.9%
distribute-rgt-neg-in95.9%
associate-+r+95.9%
sub-neg95.9%
associate-*l*95.9%
fma-def95.9%
fma-neg95.9%
associate-*l*95.9%
*-commutative95.9%
associate-*r*95.3%
distribute-rgt-neg-in95.3%
Simplified95.3%
fma-udef95.3%
fma-udef95.3%
associate-+r+95.3%
associate-*r*95.9%
*-commutative95.9%
Applied egg-rr95.9%
Taylor expanded in a around inf 37.5%
if 2.85000000000000016e-294 < t < 1.20000000000000007e-76Initial program 97.5%
+-commutative97.5%
associate-+r-97.5%
cancel-sign-sub-inv97.5%
*-commutative97.5%
distribute-rgt-neg-out97.5%
associate-*r*97.6%
*-commutative97.6%
distribute-rgt-neg-in97.6%
associate-+r+97.6%
sub-neg97.6%
associate-*l*97.7%
fma-def97.7%
fma-neg97.7%
associate-*l*97.6%
*-commutative97.6%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
Simplified100.0%
fma-udef100.0%
fma-udef100.0%
associate-+r+100.0%
associate-*r*97.7%
*-commutative97.7%
Applied egg-rr97.7%
Taylor expanded in x around inf 50.6%
if 3.4e52 < t Initial program 99.9%
sub-neg99.9%
distribute-lft-neg-in99.9%
associate-*l*99.9%
*-commutative99.9%
*-commutative99.9%
cancel-sign-sub-inv99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
associate-*l*92.7%
associate-*l*92.7%
Simplified92.7%
Taylor expanded in x around 0 73.9%
Taylor expanded in a around 0 56.3%
*-commutative56.3%
associate-*l*56.5%
*-commutative56.5%
Simplified56.5%
*-commutative56.5%
metadata-eval56.5%
distribute-rgt-neg-in56.5%
*-commutative56.5%
associate-*r*56.5%
neg-sub056.5%
Applied egg-rr56.5%
neg-sub056.5%
distribute-rgt-neg-in56.5%
distribute-rgt-neg-in56.5%
metadata-eval56.5%
*-commutative56.5%
Simplified56.5%
Final simplification44.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= y -5.9e+172) (* -9.0 (* t (* z y))) (+ (* x 2.0) (* 27.0 (* a b)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -5.9e+172) {
tmp = -9.0 * (t * (z * y));
} else {
tmp = (x * 2.0) + (27.0 * (a * b));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (y <= (-5.9d+172)) then
tmp = (-9.0d0) * (t * (z * y))
else
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -5.9e+172) {
tmp = -9.0 * (t * (z * y));
} else {
tmp = (x * 2.0) + (27.0 * (a * b));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if y <= -5.9e+172: tmp = -9.0 * (t * (z * y)) else: tmp = (x * 2.0) + (27.0 * (a * b)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -5.9e+172) tmp = Float64(-9.0 * Float64(t * Float64(z * y))); else tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (y <= -5.9e+172)
tmp = -9.0 * (t * (z * y));
else
tmp = (x * 2.0) + (27.0 * (a * b));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -5.9e+172], N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{+172}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if y < -5.8999999999999998e172Initial program 93.2%
sub-neg93.2%
distribute-lft-neg-in93.2%
associate-*l*93.1%
*-commutative93.1%
*-commutative93.1%
cancel-sign-sub-inv93.1%
*-commutative93.1%
*-commutative93.1%
associate-*l*93.2%
associate-*l*93.0%
associate-*l*93.0%
Simplified93.0%
Taylor expanded in x around 0 82.9%
Taylor expanded in a around 0 70.8%
if -5.8999999999999998e172 < y Initial program 97.7%
sub-neg97.7%
distribute-lft-neg-in97.7%
associate-*l*97.7%
*-commutative97.7%
*-commutative97.7%
cancel-sign-sub-inv97.7%
*-commutative97.7%
*-commutative97.7%
associate-*l*97.7%
associate-*l*95.6%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in y around 0 64.8%
Final simplification65.5%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.22e-63) (not (<= b 4.5e+59))) (* 27.0 (* a b)) (* x 2.0)))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.22e-63) || !(b <= 4.5e+59)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((b <= (-1.22d-63)) .or. (.not. (b <= 4.5d+59))) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.22e-63) || !(b <= 4.5e+59)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (b <= -1.22e-63) or not (b <= 4.5e+59): tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.22e-63) || !(b <= 4.5e+59)) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((b <= -1.22e-63) || ~((b <= 4.5e+59)))
tmp = 27.0 * (a * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.22e-63], N[Not[LessEqual[b, 4.5e+59]], $MachinePrecision]], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.22 \cdot 10^{-63} \lor \neg \left(b \leq 4.5 \cdot 10^{+59}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -1.2199999999999999e-63 or 4.49999999999999959e59 < b Initial program 98.2%
+-commutative98.2%
associate-+r-98.2%
cancel-sign-sub-inv98.2%
*-commutative98.2%
distribute-rgt-neg-out98.2%
associate-*r*95.3%
*-commutative95.3%
distribute-rgt-neg-in95.3%
associate-+r+95.3%
sub-neg95.3%
associate-*l*95.3%
fma-def95.4%
fma-neg95.4%
associate-*l*95.4%
*-commutative95.4%
associate-*r*95.3%
distribute-rgt-neg-in95.3%
Simplified95.3%
fma-udef95.3%
fma-udef95.3%
associate-+r+95.3%
associate-*r*95.4%
*-commutative95.4%
Applied egg-rr95.4%
Taylor expanded in a around inf 56.1%
if -1.2199999999999999e-63 < b < 4.49999999999999959e59Initial program 96.2%
+-commutative96.2%
associate-+r-96.2%
cancel-sign-sub-inv96.2%
*-commutative96.2%
distribute-rgt-neg-out96.2%
associate-*r*96.9%
*-commutative96.9%
distribute-rgt-neg-in96.9%
associate-+r+96.9%
sub-neg96.9%
associate-*l*96.9%
fma-def96.9%
fma-neg96.9%
associate-*l*96.9%
*-commutative96.9%
associate-*r*95.3%
distribute-rgt-neg-in95.3%
Simplified95.5%
fma-udef95.5%
fma-udef95.5%
associate-+r+95.5%
associate-*r*96.9%
*-commutative96.9%
Applied egg-rr96.9%
Taylor expanded in x around inf 41.0%
Final simplification48.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (* x 2.0))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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
code = x * 2.0d0
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return x * 2.0
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = x * 2.0;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
x \cdot 2
\end{array}
Initial program 97.2%
+-commutative97.2%
associate-+r-97.2%
cancel-sign-sub-inv97.2%
*-commutative97.2%
distribute-rgt-neg-out97.2%
associate-*r*96.1%
*-commutative96.1%
distribute-rgt-neg-in96.1%
associate-+r+96.1%
sub-neg96.1%
associate-*l*96.1%
fma-def96.1%
fma-neg96.1%
associate-*l*96.1%
*-commutative96.1%
associate-*r*95.3%
distribute-rgt-neg-in95.3%
Simplified95.4%
fma-udef95.4%
fma-udef95.4%
associate-+r+95.4%
associate-*r*96.1%
*-commutative96.1%
Applied egg-rr96.1%
Taylor expanded in x around inf 29.4%
Final simplification29.4%
(FPCore (x y z t a b) :precision binary64 (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (y < 7.590524218811189d-161) then
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y < 7.590524218811189e-161: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y < 7.590524218811189e-161) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y < 7.590524218811189e-161) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)); else tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
herbie shell --seed 2023275
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))