
(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 14 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. (FPCore (x y z t a b) :precision binary64 (if (<= z 1e-71) (- (+ (* 27.0 (* a b)) (* x 2.0)) (* y (* (* z 9.0) t))) (fma a (* 27.0 b) (fma x 2.0 (* (* z y) (* t -9.0))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 1e-71) {
tmp = ((27.0 * (a * b)) + (x * 2.0)) - (y * ((z * 9.0) * t));
} else {
tmp = fma(a, (27.0 * b), fma(x, 2.0, ((z * y) * (t * -9.0))));
}
return tmp;
}
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 1e-71) tmp = Float64(Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)) - Float64(y * Float64(Float64(z * 9.0) * t))); else tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(Float64(z * y) * Float64(t * -9.0)))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 1e-71], N[(N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] - N[(y * N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(N[(z * y), $MachinePrecision] * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 10^{-71}:\\
\;\;\;\;\left(27 \cdot \left(a \cdot b\right) + x \cdot 2\right) - y \cdot \left(\left(z \cdot 9\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, \left(z \cdot y\right) \cdot \left(t \cdot -9\right)\right)\right)\\
\end{array}
\end{array}
if z < 9.9999999999999992e-72Initial program 95.0%
Simplified95.9%
fma-udef95.9%
associate-*l*95.4%
fma-udef95.4%
associate-*r*95.3%
*-commutative95.3%
associate-+r+95.3%
*-commutative95.3%
associate-*r*95.3%
associate-*l*95.4%
metadata-eval95.4%
distribute-lft-neg-in95.4%
*-commutative95.4%
*-commutative95.4%
associate-+r+95.4%
cancel-sign-sub-inv95.4%
associate-+r-95.4%
Applied egg-rr95.9%
if 9.9999999999999992e-72 < z Initial program 90.6%
Simplified91.9%
Final simplification94.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (* y 9.0) -1e-10) (fma a (* 27.0 b) (fma x 2.0 (* y (* t (* z -9.0))))) (+ (- (* x 2.0) (* 9.0 (* z (* y t)))) (* b (* 27.0 a)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y * 9.0) <= -1e-10) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * (t * (z * -9.0)))));
} else {
tmp = ((x * 2.0) - (9.0 * (z * (y * t)))) + (b * (27.0 * a));
}
return tmp;
}
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(y * 9.0) <= -1e-10) 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(9.0 * Float64(z * Float64(y * t)))) + Float64(b * Float64(27.0 * a))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(y * 9.0), $MachinePrecision], -1e-10], 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[(9.0 * N[(z * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(27.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot 9 \leq -1 \cdot 10^{-10}:\\
\;\;\;\;\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 - 9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\right) + b \cdot \left(27 \cdot a\right)\\
\end{array}
\end{array}
if (*.f64 y 9) < -1.00000000000000004e-10Initial program 90.8%
Simplified98.5%
if -1.00000000000000004e-10 < (*.f64 y 9) Initial program 94.7%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in y around 0 94.7%
*-commutative94.7%
associate-*r*97.2%
Simplified97.2%
Final simplification97.5%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (* 27.0 a))))
(if (<= (* y 9.0) -2e+131)
(+ t_1 (- (* x 2.0) (* (* y 9.0) (* z t))))
(+ (- (* x 2.0) (* 9.0 (* z (* y t)))) t_1))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (27.0 * a);
double tmp;
if ((y * 9.0) <= -2e+131) {
tmp = t_1 + ((x * 2.0) - ((y * 9.0) * (z * t)));
} else {
tmp = ((x * 2.0) - (9.0 * (z * (y * t)))) + t_1;
}
return tmp;
}
NOTE: y, z, and t 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 = b * (27.0d0 * a)
if ((y * 9.0d0) <= (-2d+131)) then
tmp = t_1 + ((x * 2.0d0) - ((y * 9.0d0) * (z * t)))
else
tmp = ((x * 2.0d0) - (9.0d0 * (z * (y * t)))) + t_1
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (27.0 * a);
double tmp;
if ((y * 9.0) <= -2e+131) {
tmp = t_1 + ((x * 2.0) - ((y * 9.0) * (z * t)));
} else {
tmp = ((x * 2.0) - (9.0 * (z * (y * t)))) + t_1;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = b * (27.0 * a) tmp = 0 if (y * 9.0) <= -2e+131: tmp = t_1 + ((x * 2.0) - ((y * 9.0) * (z * t))) else: tmp = ((x * 2.0) - (9.0 * (z * (y * t)))) + t_1 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(27.0 * a)) tmp = 0.0 if (Float64(y * 9.0) <= -2e+131) tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t)))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(z * Float64(y * t)))) + t_1); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = b * (27.0 * a);
tmp = 0.0;
if ((y * 9.0) <= -2e+131)
tmp = t_1 + ((x * 2.0) - ((y * 9.0) * (z * t)));
else
tmp = ((x * 2.0) - (9.0 * (z * (y * t)))) + t_1;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(27.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * 9.0), $MachinePrecision], -2e+131], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(z * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(27 \cdot a\right)\\
\mathbf{if}\;y \cdot 9 \leq -2 \cdot 10^{+131}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\right) + t_1\\
\end{array}
\end{array}
if (*.f64 y 9) < -1.9999999999999998e131Initial program 86.0%
associate-*l*92.9%
Simplified92.9%
if -1.9999999999999998e131 < (*.f64 y 9) Initial program 95.0%
associate-*l*94.9%
Simplified94.9%
Taylor expanded in y around 0 95.0%
*-commutative95.0%
associate-*r*97.6%
Simplified97.6%
Final simplification96.8%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 6.6e+121) (+ (* b (* 27.0 a)) (- (* x 2.0) (* (* y 9.0) (* z t)))) (- (* x 2.0) (* 9.0 (* t (* z y))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 6.6e+121) {
tmp = (b * (27.0 * a)) + ((x * 2.0) - ((y * 9.0) * (z * t)));
} else {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
}
return tmp;
}
NOTE: y, z, and t 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 (z <= 6.6d+121) then
tmp = (b * (27.0d0 * a)) + ((x * 2.0d0) - ((y * 9.0d0) * (z * t)))
else
tmp = (x * 2.0d0) - (9.0d0 * (t * (z * y)))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 6.6e+121) {
tmp = (b * (27.0 * a)) + ((x * 2.0) - ((y * 9.0) * (z * t)));
} else {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= 6.6e+121: tmp = (b * (27.0 * a)) + ((x * 2.0) - ((y * 9.0) * (z * t))) else: tmp = (x * 2.0) - (9.0 * (t * (z * y))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 6.6e+121) tmp = Float64(Float64(b * Float64(27.0 * a)) + Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t)))); else tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(z * y)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= 6.6e+121)
tmp = (b * (27.0 * a)) + ((x * 2.0) - ((y * 9.0) * (z * t)));
else
tmp = (x * 2.0) - (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. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 6.6e+121], N[(N[(b * N[(27.0 * a), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.6 \cdot 10^{+121}:\\
\;\;\;\;b \cdot \left(27 \cdot a\right) + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < 6.59999999999999958e121Initial program 95.3%
associate-*l*95.6%
Simplified95.6%
if 6.59999999999999958e121 < z Initial program 80.3%
associate-*l*86.7%
Simplified86.7%
Taylor expanded in a around 0 73.9%
Final simplification93.1%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 1.6e-102) (- (+ (* 27.0 (* a b)) (* x 2.0)) (* y (* (* z 9.0) t))) (+ (- (* x 2.0) (* 9.0 (* z (* y t)))) (* b (* 27.0 a)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 1.6e-102) {
tmp = ((27.0 * (a * b)) + (x * 2.0)) - (y * ((z * 9.0) * t));
} else {
tmp = ((x * 2.0) - (9.0 * (z * (y * t)))) + (b * (27.0 * a));
}
return tmp;
}
NOTE: y, z, and t 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 (z <= 1.6d-102) then
tmp = ((27.0d0 * (a * b)) + (x * 2.0d0)) - (y * ((z * 9.0d0) * t))
else
tmp = ((x * 2.0d0) - (9.0d0 * (z * (y * t)))) + (b * (27.0d0 * a))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 1.6e-102) {
tmp = ((27.0 * (a * b)) + (x * 2.0)) - (y * ((z * 9.0) * t));
} else {
tmp = ((x * 2.0) - (9.0 * (z * (y * t)))) + (b * (27.0 * a));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= 1.6e-102: tmp = ((27.0 * (a * b)) + (x * 2.0)) - (y * ((z * 9.0) * t)) else: tmp = ((x * 2.0) - (9.0 * (z * (y * t)))) + (b * (27.0 * a)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 1.6e-102) tmp = Float64(Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)) - Float64(y * Float64(Float64(z * 9.0) * t))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(z * Float64(y * t)))) + Float64(b * Float64(27.0 * a))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= 1.6e-102)
tmp = ((27.0 * (a * b)) + (x * 2.0)) - (y * ((z * 9.0) * t));
else
tmp = ((x * 2.0) - (9.0 * (z * (y * t)))) + (b * (27.0 * a));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 1.6e-102], N[(N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] - N[(y * N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(z * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(27.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.6 \cdot 10^{-102}:\\
\;\;\;\;\left(27 \cdot \left(a \cdot b\right) + x \cdot 2\right) - y \cdot \left(\left(z \cdot 9\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\right) + b \cdot \left(27 \cdot a\right)\\
\end{array}
\end{array}
if z < 1.59999999999999993e-102Initial program 94.8%
Simplified95.7%
fma-udef95.7%
associate-*l*95.2%
fma-udef95.2%
associate-*r*95.2%
*-commutative95.2%
associate-+r+95.2%
*-commutative95.2%
associate-*r*95.2%
associate-*l*95.2%
metadata-eval95.2%
distribute-lft-neg-in95.2%
*-commutative95.2%
*-commutative95.2%
associate-+r+95.2%
cancel-sign-sub-inv95.2%
associate-+r-95.2%
Applied egg-rr95.8%
if 1.59999999999999993e-102 < z Initial program 91.2%
associate-*l*93.5%
Simplified93.5%
Taylor expanded in y around 0 91.2%
*-commutative91.2%
associate-*r*94.6%
Simplified94.6%
Final simplification95.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* -9.0 (* t (* z y)))))
(if (<= y -4.1e+138)
t_1
(if (<= y -1.45e+112)
(* x 2.0)
(if (<= y -6.2e+106)
t_1
(if (or (<= y -62000000000000.0)
(and (not (<= y -3.2e-53)) (<= y -2.25e-113)))
(* x 2.0)
(* 27.0 (* a b))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (t * (z * y));
double tmp;
if (y <= -4.1e+138) {
tmp = t_1;
} else if (y <= -1.45e+112) {
tmp = x * 2.0;
} else if (y <= -6.2e+106) {
tmp = t_1;
} else if ((y <= -62000000000000.0) || (!(y <= -3.2e-53) && (y <= -2.25e-113))) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: y, z, and t 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 = (-9.0d0) * (t * (z * y))
if (y <= (-4.1d+138)) then
tmp = t_1
else if (y <= (-1.45d+112)) then
tmp = x * 2.0d0
else if (y <= (-6.2d+106)) then
tmp = t_1
else if ((y <= (-62000000000000.0d0)) .or. (.not. (y <= (-3.2d-53))) .and. (y <= (-2.25d-113))) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (t * (z * y));
double tmp;
if (y <= -4.1e+138) {
tmp = t_1;
} else if (y <= -1.45e+112) {
tmp = x * 2.0;
} else if (y <= -6.2e+106) {
tmp = t_1;
} else if ((y <= -62000000000000.0) || (!(y <= -3.2e-53) && (y <= -2.25e-113))) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = -9.0 * (t * (z * y)) tmp = 0 if y <= -4.1e+138: tmp = t_1 elif y <= -1.45e+112: tmp = x * 2.0 elif y <= -6.2e+106: tmp = t_1 elif (y <= -62000000000000.0) or (not (y <= -3.2e-53) and (y <= -2.25e-113)): tmp = x * 2.0 else: tmp = 27.0 * (a * b) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(t * Float64(z * y))) tmp = 0.0 if (y <= -4.1e+138) tmp = t_1; elseif (y <= -1.45e+112) tmp = Float64(x * 2.0); elseif (y <= -6.2e+106) tmp = t_1; elseif ((y <= -62000000000000.0) || (!(y <= -3.2e-53) && (y <= -2.25e-113))) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = -9.0 * (t * (z * y));
tmp = 0.0;
if (y <= -4.1e+138)
tmp = t_1;
elseif (y <= -1.45e+112)
tmp = x * 2.0;
elseif (y <= -6.2e+106)
tmp = t_1;
elseif ((y <= -62000000000000.0) || (~((y <= -3.2e-53)) && (y <= -2.25e-113)))
tmp = x * 2.0;
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.1e+138], t$95$1, If[LessEqual[y, -1.45e+112], N[(x * 2.0), $MachinePrecision], If[LessEqual[y, -6.2e+106], t$95$1, If[Or[LessEqual[y, -62000000000000.0], And[N[Not[LessEqual[y, -3.2e-53]], $MachinePrecision], LessEqual[y, -2.25e-113]]], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{if}\;y \leq -4.1 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{+112}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{+106}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -62000000000000 \lor \neg \left(y \leq -3.2 \cdot 10^{-53}\right) \land y \leq -2.25 \cdot 10^{-113}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if y < -4.0999999999999998e138 or -1.4500000000000001e112 < y < -6.1999999999999999e106Initial program 84.0%
Simplified97.1%
fma-udef94.3%
associate-*l*91.9%
fma-udef91.9%
associate-*r*91.6%
*-commutative91.6%
associate-+r+91.6%
*-commutative91.6%
associate-*r*91.9%
associate-*l*91.9%
metadata-eval91.9%
distribute-lft-neg-in91.9%
*-commutative91.9%
*-commutative91.9%
associate-+r+91.9%
cancel-sign-sub-inv91.9%
associate-+r-91.9%
Applied egg-rr94.3%
Taylor expanded in y around inf 63.4%
if -4.0999999999999998e138 < y < -1.4500000000000001e112 or -6.1999999999999999e106 < y < -6.2e13 or -3.2000000000000001e-53 < y < -2.2500000000000001e-113Initial program 97.7%
Simplified99.7%
Taylor expanded in x around inf 40.7%
if -6.2e13 < y < -3.2000000000000001e-53 or -2.2500000000000001e-113 < y Initial program 94.4%
Simplified93.8%
Taylor expanded in a around inf 37.0%
Final simplification41.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= y -4.1e+138)
(* y (* -9.0 (* z t)))
(if (<= y -1.45e+112)
(* x 2.0)
(if (<= y -6.8e+106)
(* -9.0 (* t (* z y)))
(if (or (<= y -2100000000000.0)
(and (not (<= y -3.1e-53)) (<= y -1.86e-115)))
(* x 2.0)
(* 27.0 (* a b)))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -4.1e+138) {
tmp = y * (-9.0 * (z * t));
} else if (y <= -1.45e+112) {
tmp = x * 2.0;
} else if (y <= -6.8e+106) {
tmp = -9.0 * (t * (z * y));
} else if ((y <= -2100000000000.0) || (!(y <= -3.1e-53) && (y <= -1.86e-115))) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: y, z, and t 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 <= (-4.1d+138)) then
tmp = y * ((-9.0d0) * (z * t))
else if (y <= (-1.45d+112)) then
tmp = x * 2.0d0
else if (y <= (-6.8d+106)) then
tmp = (-9.0d0) * (t * (z * y))
else if ((y <= (-2100000000000.0d0)) .or. (.not. (y <= (-3.1d-53))) .and. (y <= (-1.86d-115))) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -4.1e+138) {
tmp = y * (-9.0 * (z * t));
} else if (y <= -1.45e+112) {
tmp = x * 2.0;
} else if (y <= -6.8e+106) {
tmp = -9.0 * (t * (z * y));
} else if ((y <= -2100000000000.0) || (!(y <= -3.1e-53) && (y <= -1.86e-115))) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if y <= -4.1e+138: tmp = y * (-9.0 * (z * t)) elif y <= -1.45e+112: tmp = x * 2.0 elif y <= -6.8e+106: tmp = -9.0 * (t * (z * y)) elif (y <= -2100000000000.0) or (not (y <= -3.1e-53) and (y <= -1.86e-115)): tmp = x * 2.0 else: tmp = 27.0 * (a * b) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -4.1e+138) tmp = Float64(y * Float64(-9.0 * Float64(z * t))); elseif (y <= -1.45e+112) tmp = Float64(x * 2.0); elseif (y <= -6.8e+106) tmp = Float64(-9.0 * Float64(t * Float64(z * y))); elseif ((y <= -2100000000000.0) || (!(y <= -3.1e-53) && (y <= -1.86e-115))) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (y <= -4.1e+138)
tmp = y * (-9.0 * (z * t));
elseif (y <= -1.45e+112)
tmp = x * 2.0;
elseif (y <= -6.8e+106)
tmp = -9.0 * (t * (z * y));
elseif ((y <= -2100000000000.0) || (~((y <= -3.1e-53)) && (y <= -1.86e-115)))
tmp = x * 2.0;
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -4.1e+138], N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.45e+112], N[(x * 2.0), $MachinePrecision], If[LessEqual[y, -6.8e+106], N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2100000000000.0], And[N[Not[LessEqual[y, -3.1e-53]], $MachinePrecision], LessEqual[y, -1.86e-115]]], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+138}:\\
\;\;\;\;y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{+112}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;y \leq -6.8 \cdot 10^{+106}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{elif}\;y \leq -2100000000000 \lor \neg \left(y \leq -3.1 \cdot 10^{-53}\right) \land y \leq -1.86 \cdot 10^{-115}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if y < -4.0999999999999998e138Initial program 83.1%
Simplified97.0%
fma-udef94.0%
associate-*l*91.4%
fma-udef91.4%
associate-*r*91.1%
*-commutative91.1%
associate-+r+91.1%
*-commutative91.1%
associate-*r*91.4%
associate-*l*91.5%
metadata-eval91.5%
distribute-lft-neg-in91.5%
*-commutative91.5%
*-commutative91.5%
associate-+r+91.5%
cancel-sign-sub-inv91.5%
associate-+r-91.5%
Applied egg-rr94.0%
Taylor expanded in y around inf 64.2%
*-commutative64.2%
associate-*r*66.7%
*-commutative66.7%
associate-*l*66.8%
*-commutative66.8%
*-commutative66.8%
Simplified66.8%
if -4.0999999999999998e138 < y < -1.4500000000000001e112 or -6.79999999999999989e106 < y < -2.1e12 or -3.10000000000000015e-53 < y < -1.86e-115Initial program 97.7%
Simplified99.7%
Taylor expanded in x around inf 40.7%
if -1.4500000000000001e112 < y < -6.79999999999999989e106Initial program 100.0%
Simplified100.0%
fma-udef100.0%
associate-*l*100.0%
fma-udef100.0%
associate-*r*100.0%
*-commutative100.0%
associate-+r+100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*l*100.0%
metadata-eval100.0%
distribute-lft-neg-in100.0%
*-commutative100.0%
*-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 50.2%
if -2.1e12 < y < -3.10000000000000015e-53 or -1.86e-115 < y Initial program 94.4%
Simplified93.8%
Taylor expanded in a around inf 37.0%
Final simplification41.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= a -2.9e-7)
(+ (* 27.0 (* a b)) (* x 2.0))
(if (<= a 3.5e-120)
(- (* x 2.0) (* y (* z (* 9.0 t))))
(+ (* a (* 27.0 b)) (* -9.0 (* z (* y t)))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.9e-7) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else if (a <= 3.5e-120) {
tmp = (x * 2.0) - (y * (z * (9.0 * t)));
} else {
tmp = (a * (27.0 * b)) + (-9.0 * (z * (y * t)));
}
return tmp;
}
NOTE: y, z, and t 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 (a <= (-2.9d-7)) then
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
else if (a <= 3.5d-120) then
tmp = (x * 2.0d0) - (y * (z * (9.0d0 * t)))
else
tmp = (a * (27.0d0 * b)) + ((-9.0d0) * (z * (y * t)))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.9e-7) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else if (a <= 3.5e-120) {
tmp = (x * 2.0) - (y * (z * (9.0 * t)));
} else {
tmp = (a * (27.0 * b)) + (-9.0 * (z * (y * t)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if a <= -2.9e-7: tmp = (27.0 * (a * b)) + (x * 2.0) elif a <= 3.5e-120: tmp = (x * 2.0) - (y * (z * (9.0 * t))) else: tmp = (a * (27.0 * b)) + (-9.0 * (z * (y * t))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2.9e-7) tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); elseif (a <= 3.5e-120) tmp = Float64(Float64(x * 2.0) - Float64(y * Float64(z * Float64(9.0 * t)))); else tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(-9.0 * Float64(z * Float64(y * t)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (a <= -2.9e-7)
tmp = (27.0 * (a * b)) + (x * 2.0);
elseif (a <= 3.5e-120)
tmp = (x * 2.0) - (y * (z * (9.0 * t)));
else
tmp = (a * (27.0 * b)) + (-9.0 * (z * (y * t)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.9e-7], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.5e-120], N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(-9.0 * N[(z * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-7}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{-120}:\\
\;\;\;\;x \cdot 2 - y \cdot \left(z \cdot \left(9 \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + -9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\end{array}
\end{array}
if a < -2.8999999999999998e-7Initial program 94.6%
Simplified99.7%
Taylor expanded in y around 0 85.6%
if -2.8999999999999998e-7 < a < 3.5e-120Initial program 95.2%
associate-*l*91.2%
Simplified91.2%
Taylor expanded in a around 0 82.7%
pow182.7%
*-commutative82.7%
associate-*l*78.7%
Applied egg-rr78.7%
Taylor expanded in y around 0 82.7%
associate-*r*82.7%
*-commutative82.7%
*-commutative82.7%
associate-*r*78.7%
Simplified78.7%
if 3.5e-120 < a Initial program 91.4%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in x around 0 63.4%
cancel-sign-sub-inv63.4%
associate-*r*62.5%
*-commutative62.5%
associate-*l*63.4%
metadata-eval63.4%
associate-*r*66.2%
*-commutative66.2%
*-commutative66.2%
Applied egg-rr66.2%
Final simplification75.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= a -4.6e-7) (not (<= a 4.9e-30))) (+ (* 27.0 (* a b)) (* x 2.0)) (- (* x 2.0) (* 9.0 (* t (* z y))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -4.6e-7) || !(a <= 4.9e-30)) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
}
return tmp;
}
NOTE: y, z, and t 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 ((a <= (-4.6d-7)) .or. (.not. (a <= 4.9d-30))) then
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
else
tmp = (x * 2.0d0) - (9.0d0 * (t * (z * y)))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -4.6e-7) || !(a <= 4.9e-30)) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if (a <= -4.6e-7) or not (a <= 4.9e-30): tmp = (27.0 * (a * b)) + (x * 2.0) else: tmp = (x * 2.0) - (9.0 * (t * (z * y))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -4.6e-7) || !(a <= 4.9e-30)) tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); else tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(z * y)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a <= -4.6e-7) || ~((a <= 4.9e-30)))
tmp = (27.0 * (a * b)) + (x * 2.0);
else
tmp = (x * 2.0) - (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. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -4.6e-7], N[Not[LessEqual[a, 4.9e-30]], $MachinePrecision]], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.6 \cdot 10^{-7} \lor \neg \left(a \leq 4.9 \cdot 10^{-30}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if a < -4.5999999999999999e-7 or 4.89999999999999971e-30 < a Initial program 92.9%
Simplified97.7%
Taylor expanded in y around 0 74.6%
if -4.5999999999999999e-7 < a < 4.89999999999999971e-30Initial program 94.3%
associate-*l*92.6%
Simplified92.6%
Taylor expanded in a around 0 81.6%
Final simplification77.8%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.55e-7) (not (<= a 1.08e-38))) (+ (* 27.0 (* a b)) (* x 2.0)) (- (* x 2.0) (* y (* z (* 9.0 t))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.55e-7) || !(a <= 1.08e-38)) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else {
tmp = (x * 2.0) - (y * (z * (9.0 * t)));
}
return tmp;
}
NOTE: y, z, and t 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 ((a <= (-1.55d-7)) .or. (.not. (a <= 1.08d-38))) then
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
else
tmp = (x * 2.0d0) - (y * (z * (9.0d0 * t)))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.55e-7) || !(a <= 1.08e-38)) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else {
tmp = (x * 2.0) - (y * (z * (9.0 * t)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.55e-7) or not (a <= 1.08e-38): tmp = (27.0 * (a * b)) + (x * 2.0) else: tmp = (x * 2.0) - (y * (z * (9.0 * t))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.55e-7) || !(a <= 1.08e-38)) tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); else tmp = Float64(Float64(x * 2.0) - Float64(y * Float64(z * Float64(9.0 * t)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a <= -1.55e-7) || ~((a <= 1.08e-38)))
tmp = (27.0 * (a * b)) + (x * 2.0);
else
tmp = (x * 2.0) - (y * (z * (9.0 * t)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.55e-7], N[Not[LessEqual[a, 1.08e-38]], $MachinePrecision]], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{-7} \lor \neg \left(a \leq 1.08 \cdot 10^{-38}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - y \cdot \left(z \cdot \left(9 \cdot t\right)\right)\\
\end{array}
\end{array}
if a < -1.55e-7 or 1.08e-38 < a Initial program 92.9%
Simplified97.7%
Taylor expanded in y around 0 74.6%
if -1.55e-7 < a < 1.08e-38Initial program 94.3%
associate-*l*92.6%
Simplified92.6%
Taylor expanded in a around 0 81.6%
pow181.6%
*-commutative81.6%
associate-*l*79.9%
Applied egg-rr79.9%
Taylor expanded in y around 0 81.6%
associate-*r*81.6%
*-commutative81.6%
*-commutative81.6%
associate-*r*79.8%
Simplified79.8%
Final simplification77.0%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -1.1e-16) (* y (* t (* z -9.0))) (if (<= z 2.5e+38) (+ (* 27.0 (* a b)) (* x 2.0)) (* (* z y) (* t -9.0)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.1e-16) {
tmp = y * (t * (z * -9.0));
} else if (z <= 2.5e+38) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else {
tmp = (z * y) * (t * -9.0);
}
return tmp;
}
NOTE: y, z, and t 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 (z <= (-1.1d-16)) then
tmp = y * (t * (z * (-9.0d0)))
else if (z <= 2.5d+38) then
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
else
tmp = (z * y) * (t * (-9.0d0))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.1e-16) {
tmp = y * (t * (z * -9.0));
} else if (z <= 2.5e+38) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else {
tmp = (z * y) * (t * -9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1.1e-16: tmp = y * (t * (z * -9.0)) elif z <= 2.5e+38: tmp = (27.0 * (a * b)) + (x * 2.0) else: tmp = (z * y) * (t * -9.0) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.1e-16) tmp = Float64(y * Float64(t * Float64(z * -9.0))); elseif (z <= 2.5e+38) tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); else tmp = Float64(Float64(z * y) * Float64(t * -9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -1.1e-16)
tmp = y * (t * (z * -9.0));
elseif (z <= 2.5e+38)
tmp = (27.0 * (a * b)) + (x * 2.0);
else
tmp = (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. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.1e-16], N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.5e+38], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{-16}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+38}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(t \cdot -9\right)\\
\end{array}
\end{array}
if z < -1.1e-16Initial program 88.8%
Simplified91.4%
fma-udef91.4%
associate-*l*90.1%
fma-udef90.1%
associate-*r*90.1%
*-commutative90.1%
associate-+r+90.1%
*-commutative90.1%
associate-*r*90.1%
associate-*l*90.1%
metadata-eval90.1%
distribute-lft-neg-in90.1%
*-commutative90.1%
*-commutative90.1%
associate-+r+90.1%
cancel-sign-sub-inv90.1%
associate-+r-90.1%
Applied egg-rr91.4%
Taylor expanded in y around inf 47.7%
*-commutative47.7%
associate-*r*44.5%
*-commutative44.5%
associate-*l*44.4%
*-commutative44.4%
*-commutative44.4%
Simplified44.4%
expm1-log1p-u21.8%
expm1-udef17.1%
associate-*r*17.1%
*-commutative17.1%
*-commutative17.1%
Applied egg-rr17.1%
expm1-def21.8%
expm1-log1p44.4%
associate-*r*44.4%
*-commutative44.4%
associate-*l*44.4%
Simplified44.4%
if -1.1e-16 < z < 2.49999999999999985e38Initial program 99.4%
Simplified99.1%
Taylor expanded in y around 0 81.1%
if 2.49999999999999985e38 < z Initial program 86.3%
Simplified91.6%
fma-udef89.9%
associate-*l*89.8%
fma-udef89.8%
associate-*r*89.8%
*-commutative89.8%
associate-+r+89.8%
*-commutative89.8%
associate-*r*89.8%
associate-*l*89.9%
metadata-eval89.9%
distribute-lft-neg-in89.9%
*-commutative89.9%
*-commutative89.9%
associate-+r+89.9%
cancel-sign-sub-inv89.9%
associate-+r-89.9%
Applied egg-rr89.9%
Taylor expanded in y around inf 52.2%
associate-*r*52.2%
Simplified52.2%
Final simplification64.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= b -4e-41) (not (<= b 5.1e+91))) (* 27.0 (* a b)) (* x 2.0)))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -4e-41) || !(b <= 5.1e+91)) {
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.
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 <= (-4d-41)) .or. (.not. (b <= 5.1d+91))) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -4e-41) || !(b <= 5.1e+91)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if (b <= -4e-41) or not (b <= 5.1e+91): tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -4e-41) || !(b <= 5.1e+91)) 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])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((b <= -4e-41) || ~((b <= 5.1e+91)))
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. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -4e-41], N[Not[LessEqual[b, 5.1e+91]], $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])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{-41} \lor \neg \left(b \leq 5.1 \cdot 10^{+91}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -4.00000000000000002e-41 or 5.10000000000000013e91 < b Initial program 94.4%
Simplified97.2%
Taylor expanded in a around inf 60.2%
if -4.00000000000000002e-41 < b < 5.10000000000000013e91Initial program 93.0%
Simplified94.0%
Taylor expanded in x around inf 41.2%
Final simplification49.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= b -3.5e-32) (* 27.0 (* a b)) (if (<= b 9.5e+92) (* x 2.0) (* a (* 27.0 b)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.5e-32) {
tmp = 27.0 * (a * b);
} else if (b <= 9.5e+92) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
NOTE: y, z, and t 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 <= (-3.5d-32)) then
tmp = 27.0d0 * (a * b)
else if (b <= 9.5d+92) then
tmp = x * 2.0d0
else
tmp = a * (27.0d0 * b)
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.5e-32) {
tmp = 27.0 * (a * b);
} else if (b <= 9.5e+92) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if b <= -3.5e-32: tmp = 27.0 * (a * b) elif b <= 9.5e+92: tmp = x * 2.0 else: tmp = a * (27.0 * b) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.5e-32) tmp = Float64(27.0 * Float64(a * b)); elseif (b <= 9.5e+92) tmp = Float64(x * 2.0); else tmp = Float64(a * Float64(27.0 * b)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (b <= -3.5e-32)
tmp = 27.0 * (a * b);
elseif (b <= 9.5e+92)
tmp = x * 2.0;
else
tmp = a * (27.0 * b);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.5e-32], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.5e+92], N[(x * 2.0), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{-32}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;b \leq 9.5 \cdot 10^{+92}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if b < -3.4999999999999999e-32Initial program 94.2%
Simplified97.2%
Taylor expanded in a around inf 58.0%
if -3.4999999999999999e-32 < b < 9.4999999999999995e92Initial program 93.0%
Simplified94.1%
Taylor expanded in x around inf 42.0%
if 9.4999999999999995e92 < b Initial program 94.4%
Simplified97.0%
Taylor expanded in a around inf 67.7%
associate-*r*67.6%
*-commutative67.6%
associate-*r*67.6%
Simplified67.6%
Final simplification50.0%
NOTE: y, z, and t 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);
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.
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;
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]) def code(x, y, z, t, a, b): return x * 2.0
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
y, z, t = num2cell(sort([y, z, t])){:}
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. code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
x \cdot 2
\end{array}
Initial program 93.5%
Simplified95.3%
Taylor expanded in x around inf 32.6%
Final simplification32.6%
(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 2023301
(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)))