
(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. (FPCore (x y z t a b) :precision binary64 (if (<= (* (* y 9.0) z) 5e+234) (fma x 2.0 (fma t (* (* y z) -9.0) (* (* a 27.0) b))) (- (* x 2.0) (* 9.0 (* y (* z t))))))
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) * z) <= 5e+234) {
tmp = fma(x, 2.0, fma(t, ((y * z) * -9.0), ((a * 27.0) * b)));
} else {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
}
return tmp;
}
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(y * 9.0) * z) <= 5e+234) tmp = fma(x, 2.0, fma(t, Float64(Float64(y * z) * -9.0), Float64(Float64(a * 27.0) * b))); else tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); 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[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 5e+234], N[(x * 2.0 + N[(t * N[(N[(y * z), $MachinePrecision] * -9.0), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq 5 \cdot 10^{+234}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(t, \left(y \cdot z\right) \cdot -9, \left(a \cdot 27\right) \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 5.0000000000000003e234Initial program 96.9%
associate-+l-96.9%
fma-neg96.9%
neg-sub096.9%
associate-+l-96.9%
neg-sub096.9%
*-commutative96.9%
distribute-rgt-neg-in96.9%
fma-def97.3%
*-commutative97.3%
associate-*r*97.3%
distribute-rgt-neg-in97.3%
*-commutative97.3%
metadata-eval97.3%
Simplified97.3%
if 5.0000000000000003e234 < (*.f64 (*.f64 y 9) z) Initial program 74.3%
Taylor expanded in a around 0 91.3%
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 (<= (* (* y 9.0) z) 2e+174) (+ (* (* a 27.0) b) (- (* x 2.0) (* t (* y (* 9.0 z))))) (- (* x 2.0) (* 9.0 (* y (* z t))))))
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) * z) <= 2e+174) {
tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (y * (9.0 * z))));
} else {
tmp = (x * 2.0) - (9.0 * (y * (z * 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 (((y * 9.0d0) * z) <= 2d+174) then
tmp = ((a * 27.0d0) * b) + ((x * 2.0d0) - (t * (y * (9.0d0 * z))))
else
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * 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 (((y * 9.0) * z) <= 2e+174) {
tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (y * (9.0 * z))));
} else {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if ((y * 9.0) * z) <= 2e+174: tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (y * (9.0 * z)))) else: tmp = (x * 2.0) - (9.0 * (y * (z * t))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(y * 9.0) * z) <= 2e+174) tmp = Float64(Float64(Float64(a * 27.0) * b) + Float64(Float64(x * 2.0) - Float64(t * Float64(y * Float64(9.0 * z))))); else tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * 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 (((y * 9.0) * z) <= 2e+174)
tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (y * (9.0 * z))));
else
tmp = (x * 2.0) - (9.0 * (y * (z * 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[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 2e+174], N[(N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(y * N[(9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq 2 \cdot 10^{+174}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - t \cdot \left(y \cdot \left(9 \cdot z\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 2.00000000000000014e174Initial program 96.8%
Taylor expanded in y around 0 96.8%
*-commutative96.8%
associate-*r*96.3%
Simplified96.3%
if 2.00000000000000014e174 < (*.f64 (*.f64 y 9) z) Initial program 82.3%
Taylor expanded in a around 0 91.1%
Final simplification95.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
(let* ((t_1 (* -9.0 (* y (* z t)))))
(if (<= z -4.1e-92)
t_1
(if (<= z -1.36e-155)
(* x 2.0)
(if (<= z -3.7e-266)
(* 27.0 (* a b))
(if (<= z 1.4e-109)
(* x 2.0)
(if (<= z 0.00046) (* a (* 27.0 b)) t_1)))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (y * (z * t));
double tmp;
if (z <= -4.1e-92) {
tmp = t_1;
} else if (z <= -1.36e-155) {
tmp = x * 2.0;
} else if (z <= -3.7e-266) {
tmp = 27.0 * (a * b);
} else if (z <= 1.4e-109) {
tmp = x * 2.0;
} else if (z <= 0.00046) {
tmp = a * (27.0 * b);
} else {
tmp = 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 = (-9.0d0) * (y * (z * t))
if (z <= (-4.1d-92)) then
tmp = t_1
else if (z <= (-1.36d-155)) then
tmp = x * 2.0d0
else if (z <= (-3.7d-266)) then
tmp = 27.0d0 * (a * b)
else if (z <= 1.4d-109) then
tmp = x * 2.0d0
else if (z <= 0.00046d0) then
tmp = a * (27.0d0 * b)
else
tmp = 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 = -9.0 * (y * (z * t));
double tmp;
if (z <= -4.1e-92) {
tmp = t_1;
} else if (z <= -1.36e-155) {
tmp = x * 2.0;
} else if (z <= -3.7e-266) {
tmp = 27.0 * (a * b);
} else if (z <= 1.4e-109) {
tmp = x * 2.0;
} else if (z <= 0.00046) {
tmp = a * (27.0 * b);
} else {
tmp = t_1;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = -9.0 * (y * (z * t)) tmp = 0 if z <= -4.1e-92: tmp = t_1 elif z <= -1.36e-155: tmp = x * 2.0 elif z <= -3.7e-266: tmp = 27.0 * (a * b) elif z <= 1.4e-109: tmp = x * 2.0 elif z <= 0.00046: tmp = a * (27.0 * b) else: tmp = t_1 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(y * Float64(z * t))) tmp = 0.0 if (z <= -4.1e-92) tmp = t_1; elseif (z <= -1.36e-155) tmp = Float64(x * 2.0); elseif (z <= -3.7e-266) tmp = Float64(27.0 * Float64(a * b)); elseif (z <= 1.4e-109) tmp = Float64(x * 2.0); elseif (z <= 0.00046) tmp = Float64(a * Float64(27.0 * b)); else tmp = 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 = -9.0 * (y * (z * t));
tmp = 0.0;
if (z <= -4.1e-92)
tmp = t_1;
elseif (z <= -1.36e-155)
tmp = x * 2.0;
elseif (z <= -3.7e-266)
tmp = 27.0 * (a * b);
elseif (z <= 1.4e-109)
tmp = x * 2.0;
elseif (z <= 0.00046)
tmp = a * (27.0 * b);
else
tmp = 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[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.1e-92], t$95$1, If[LessEqual[z, -1.36e-155], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, -3.7e-266], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e-109], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 0.00046], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{-92}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.36 \cdot 10^{-155}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-266}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-109}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 0.00046:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -4.1000000000000002e-92 or 4.6000000000000001e-4 < z Initial program 91.3%
Taylor expanded in y around 0 91.3%
*-commutative91.3%
associate-*r*90.6%
Simplified90.6%
Taylor expanded in y around inf 43.5%
if -4.1000000000000002e-92 < z < -1.35999999999999996e-155 or -3.7000000000000003e-266 < z < 1.39999999999999989e-109Initial program 99.9%
associate-+l-99.9%
fma-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 58.5%
if -1.35999999999999996e-155 < z < -3.7000000000000003e-266Initial program 99.7%
Taylor expanded in y around 0 99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in a around inf 48.9%
if 1.39999999999999989e-109 < z < 4.6000000000000001e-4Initial program 99.6%
associate-+l-99.6%
sub-neg99.6%
neg-mul-199.6%
metadata-eval99.6%
metadata-eval99.6%
cancel-sign-sub-inv99.6%
metadata-eval99.6%
*-lft-identity99.6%
associate-*l*99.6%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in y around 0 71.9%
*-commutative71.9%
Simplified71.9%
Taylor expanded in a around 0 71.9%
*-commutative71.9%
associate-*r*72.0%
Simplified72.0%
Taylor expanded in x around 0 34.1%
*-commutative34.1%
associate-*r*34.1%
Simplified34.1%
Final simplification47.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 -5.2e-90)
(* -9.0 (* y (* z t)))
(if (<= z -2.8e-159)
(* x 2.0)
(if (<= z -3.6e-265)
(* 27.0 (* a b))
(if (<= z 1.4e-109)
(* x 2.0)
(if (<= z 0.00045) (* a (* 27.0 b)) (* z (* t (* y -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 <= -5.2e-90) {
tmp = -9.0 * (y * (z * t));
} else if (z <= -2.8e-159) {
tmp = x * 2.0;
} else if (z <= -3.6e-265) {
tmp = 27.0 * (a * b);
} else if (z <= 1.4e-109) {
tmp = x * 2.0;
} else if (z <= 0.00045) {
tmp = a * (27.0 * b);
} else {
tmp = z * (t * (y * -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 <= (-5.2d-90)) then
tmp = (-9.0d0) * (y * (z * t))
else if (z <= (-2.8d-159)) then
tmp = x * 2.0d0
else if (z <= (-3.6d-265)) then
tmp = 27.0d0 * (a * b)
else if (z <= 1.4d-109) then
tmp = x * 2.0d0
else if (z <= 0.00045d0) then
tmp = a * (27.0d0 * b)
else
tmp = z * (t * (y * (-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 <= -5.2e-90) {
tmp = -9.0 * (y * (z * t));
} else if (z <= -2.8e-159) {
tmp = x * 2.0;
} else if (z <= -3.6e-265) {
tmp = 27.0 * (a * b);
} else if (z <= 1.4e-109) {
tmp = x * 2.0;
} else if (z <= 0.00045) {
tmp = a * (27.0 * b);
} else {
tmp = z * (t * (y * -9.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -5.2e-90: tmp = -9.0 * (y * (z * t)) elif z <= -2.8e-159: tmp = x * 2.0 elif z <= -3.6e-265: tmp = 27.0 * (a * b) elif z <= 1.4e-109: tmp = x * 2.0 elif z <= 0.00045: tmp = a * (27.0 * b) else: tmp = z * (t * (y * -9.0)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -5.2e-90) tmp = Float64(-9.0 * Float64(y * Float64(z * t))); elseif (z <= -2.8e-159) tmp = Float64(x * 2.0); elseif (z <= -3.6e-265) tmp = Float64(27.0 * Float64(a * b)); elseif (z <= 1.4e-109) tmp = Float64(x * 2.0); elseif (z <= 0.00045) tmp = Float64(a * Float64(27.0 * b)); else tmp = Float64(z * Float64(t * Float64(y * -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 <= -5.2e-90)
tmp = -9.0 * (y * (z * t));
elseif (z <= -2.8e-159)
tmp = x * 2.0;
elseif (z <= -3.6e-265)
tmp = 27.0 * (a * b);
elseif (z <= 1.4e-109)
tmp = x * 2.0;
elseif (z <= 0.00045)
tmp = a * (27.0 * b);
else
tmp = z * (t * (y * -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, -5.2e-90], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.8e-159], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, -3.6e-265], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e-109], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 0.00045], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], N[(z * N[(t * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-90}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-159}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-265}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-109}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 0.00045:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\
\end{array}
\end{array}
if z < -5.2000000000000001e-90Initial program 89.9%
Taylor expanded in y around 0 90.0%
*-commutative90.0%
associate-*r*89.9%
Simplified89.9%
Taylor expanded in y around inf 33.3%
if -5.2000000000000001e-90 < z < -2.8000000000000002e-159 or -3.6000000000000002e-265 < z < 1.39999999999999989e-109Initial program 99.9%
associate-+l-99.9%
fma-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 57.6%
if -2.8000000000000002e-159 < z < -3.6000000000000002e-265Initial program 99.7%
Taylor expanded in y around 0 99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in a around inf 45.0%
if 1.39999999999999989e-109 < z < 4.4999999999999999e-4Initial program 99.6%
associate-+l-99.6%
sub-neg99.6%
neg-mul-199.6%
metadata-eval99.6%
metadata-eval99.6%
cancel-sign-sub-inv99.6%
metadata-eval99.6%
*-lft-identity99.6%
associate-*l*99.6%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in y around 0 71.9%
*-commutative71.9%
Simplified71.9%
Taylor expanded in a around 0 71.9%
*-commutative71.9%
associate-*r*72.0%
Simplified72.0%
Taylor expanded in x around 0 34.1%
*-commutative34.1%
associate-*r*34.1%
Simplified34.1%
if 4.4999999999999999e-4 < z Initial program 92.9%
Taylor expanded in y around 0 92.9%
*-commutative92.9%
associate-*r*91.5%
Simplified91.5%
Taylor expanded in y around inf 55.8%
*-commutative55.8%
associate-*r*58.6%
*-commutative58.6%
associate-*l*58.6%
Simplified58.6%
Taylor expanded in y around 0 58.6%
*-commutative58.6%
*-commutative58.6%
associate-*l*58.6%
Simplified58.6%
Final simplification47.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 (if (or (<= z -3.5e-87) (not (<= z 3.5e-5))) (+ (* x 2.0) (* (* y t) (* z -9.0))) (- (* x 2.0) (* b (* a -27.0)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.5e-87) || !(z <= 3.5e-5)) {
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
} else {
tmp = (x * 2.0) - (b * (a * -27.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 <= (-3.5d-87)) .or. (.not. (z <= 3.5d-5))) then
tmp = (x * 2.0d0) + ((y * t) * (z * (-9.0d0)))
else
tmp = (x * 2.0d0) - (b * (a * (-27.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 <= -3.5e-87) || !(z <= 3.5e-5)) {
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
} else {
tmp = (x * 2.0) - (b * (a * -27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if (z <= -3.5e-87) or not (z <= 3.5e-5): tmp = (x * 2.0) + ((y * t) * (z * -9.0)) else: tmp = (x * 2.0) - (b * (a * -27.0)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.5e-87) || !(z <= 3.5e-5)) tmp = Float64(Float64(x * 2.0) + Float64(Float64(y * t) * Float64(z * -9.0))); else tmp = Float64(Float64(x * 2.0) - Float64(b * Float64(a * -27.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 <= -3.5e-87) || ~((z <= 3.5e-5)))
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
else
tmp = (x * 2.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. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.5e-87], N[Not[LessEqual[z, 3.5e-5]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(y * t), $MachinePrecision] * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(b * N[(a * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-87} \lor \neg \left(z \leq 3.5 \cdot 10^{-5}\right):\\
\;\;\;\;x \cdot 2 + \left(y \cdot t\right) \cdot \left(z \cdot -9\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\
\end{array}
\end{array}
if z < -3.50000000000000012e-87 or 3.4999999999999997e-5 < z Initial program 91.2%
Taylor expanded in a around 0 65.9%
associate-*r*65.9%
*-commutative65.9%
*-commutative65.9%
associate-*l*69.9%
*-commutative69.9%
sub-neg69.9%
+-commutative69.9%
associate-*l*65.9%
*-commutative65.9%
*-commutative65.9%
associate-*r*65.9%
distribute-lft-neg-in65.9%
*-commutative65.9%
associate-*r*73.4%
*-commutative73.4%
metadata-eval73.4%
Applied egg-rr73.4%
Taylor expanded in z around 0 65.9%
associate-*r*73.4%
*-commutative73.4%
*-commutative73.4%
*-commutative73.4%
associate-*l*72.8%
Simplified72.8%
if -3.50000000000000012e-87 < z < 3.4999999999999997e-5Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*98.9%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in a around 0 83.7%
*-commutative83.7%
associate-*r*83.6%
Simplified83.6%
Taylor expanded in a around 0 83.7%
associate-*r*83.7%
*-commutative83.7%
Simplified83.7%
Final simplification77.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
(if (<= z -1.35e-83)
(+ (* x 2.0) (* (* y t) (* z -9.0)))
(if (<= z 3.2e-5)
(- (* x 2.0) (* b (* a -27.0)))
(+ (* x 2.0) (* -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 (z <= -1.35e-83) {
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
} else if (z <= 3.2e-5) {
tmp = (x * 2.0) - (b * (a * -27.0));
} else {
tmp = (x * 2.0) + (-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 (z <= (-1.35d-83)) then
tmp = (x * 2.0d0) + ((y * t) * (z * (-9.0d0)))
else if (z <= 3.2d-5) then
tmp = (x * 2.0d0) - (b * (a * (-27.0d0)))
else
tmp = (x * 2.0d0) + ((-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 (z <= -1.35e-83) {
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
} else if (z <= 3.2e-5) {
tmp = (x * 2.0) - (b * (a * -27.0));
} else {
tmp = (x * 2.0) + (-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 z <= -1.35e-83: tmp = (x * 2.0) + ((y * t) * (z * -9.0)) elif z <= 3.2e-5: tmp = (x * 2.0) - (b * (a * -27.0)) else: tmp = (x * 2.0) + (-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 (z <= -1.35e-83) tmp = Float64(Float64(x * 2.0) + Float64(Float64(y * t) * Float64(z * -9.0))); elseif (z <= 3.2e-5) tmp = Float64(Float64(x * 2.0) - Float64(b * Float64(a * -27.0))); else tmp = Float64(Float64(x * 2.0) + 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 (z <= -1.35e-83)
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
elseif (z <= 3.2e-5)
tmp = (x * 2.0) - (b * (a * -27.0));
else
tmp = (x * 2.0) + (-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[z, -1.35e-83], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(y * t), $MachinePrecision] * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e-5], N[(N[(x * 2.0), $MachinePrecision] - N[(b * N[(a * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $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}\;z \leq -1.35 \cdot 10^{-83}:\\
\;\;\;\;x \cdot 2 + \left(y \cdot t\right) \cdot \left(z \cdot -9\right)\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-5}:\\
\;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + -9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\end{array}
\end{array}
if z < -1.34999999999999996e-83Initial program 89.8%
Taylor expanded in a around 0 54.5%
associate-*r*54.5%
*-commutative54.5%
*-commutative54.5%
associate-*l*61.6%
*-commutative61.6%
sub-neg61.6%
+-commutative61.6%
associate-*l*54.5%
*-commutative54.5%
*-commutative54.5%
associate-*r*54.5%
distribute-lft-neg-in54.5%
*-commutative54.5%
associate-*r*63.4%
*-commutative63.4%
metadata-eval63.4%
Applied egg-rr63.4%
Taylor expanded in z around 0 54.5%
associate-*r*63.4%
*-commutative63.4%
*-commutative63.4%
*-commutative63.4%
associate-*l*63.4%
Simplified63.4%
if -1.34999999999999996e-83 < z < 3.19999999999999986e-5Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*98.9%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in a around 0 83.7%
*-commutative83.7%
associate-*r*83.6%
Simplified83.6%
Taylor expanded in a around 0 83.7%
associate-*r*83.7%
*-commutative83.7%
Simplified83.7%
if 3.19999999999999986e-5 < z Initial program 92.9%
Taylor expanded in a around 0 79.5%
associate-*r*79.5%
*-commutative79.5%
*-commutative79.5%
associate-*l*80.0%
*-commutative80.0%
sub-neg80.0%
+-commutative80.0%
associate-*l*79.5%
*-commutative79.5%
*-commutative79.5%
associate-*r*79.5%
distribute-lft-neg-in79.5%
*-commutative79.5%
associate-*r*85.4%
*-commutative85.4%
metadata-eval85.4%
Applied egg-rr85.4%
Final simplification77.9%
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 -6e-87)
(- (* x 2.0) (* 9.0 (* y (* z t))))
(if (<= z 3.5e-5)
(- (* x 2.0) (* b (* a -27.0)))
(+ (* x 2.0) (* -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 (z <= -6e-87) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (z <= 3.5e-5) {
tmp = (x * 2.0) - (b * (a * -27.0));
} else {
tmp = (x * 2.0) + (-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 (z <= (-6d-87)) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else if (z <= 3.5d-5) then
tmp = (x * 2.0d0) - (b * (a * (-27.0d0)))
else
tmp = (x * 2.0d0) + ((-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 (z <= -6e-87) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (z <= 3.5e-5) {
tmp = (x * 2.0) - (b * (a * -27.0));
} else {
tmp = (x * 2.0) + (-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 z <= -6e-87: tmp = (x * 2.0) - (9.0 * (y * (z * t))) elif z <= 3.5e-5: tmp = (x * 2.0) - (b * (a * -27.0)) else: tmp = (x * 2.0) + (-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 (z <= -6e-87) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); elseif (z <= 3.5e-5) tmp = Float64(Float64(x * 2.0) - Float64(b * Float64(a * -27.0))); else tmp = Float64(Float64(x * 2.0) + 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 (z <= -6e-87)
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
elseif (z <= 3.5e-5)
tmp = (x * 2.0) - (b * (a * -27.0));
else
tmp = (x * 2.0) + (-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[z, -6e-87], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-5], N[(N[(x * 2.0), $MachinePrecision] - N[(b * N[(a * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $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}\;z \leq -6 \cdot 10^{-87}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-5}:\\
\;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + -9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\end{array}
\end{array}
if z < -6.00000000000000033e-87Initial program 89.8%
Taylor expanded in a around 0 54.5%
if -6.00000000000000033e-87 < z < 3.4999999999999997e-5Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*98.9%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in a around 0 83.7%
*-commutative83.7%
associate-*r*83.6%
Simplified83.6%
Taylor expanded in a around 0 83.7%
associate-*r*83.7%
*-commutative83.7%
Simplified83.7%
if 3.4999999999999997e-5 < z Initial program 92.9%
Taylor expanded in a around 0 79.5%
associate-*r*79.5%
*-commutative79.5%
*-commutative79.5%
associate-*l*80.0%
*-commutative80.0%
sub-neg80.0%
+-commutative80.0%
associate-*l*79.5%
*-commutative79.5%
*-commutative79.5%
associate-*r*79.5%
distribute-lft-neg-in79.5%
*-commutative79.5%
associate-*r*85.4%
*-commutative85.4%
metadata-eval85.4%
Applied egg-rr85.4%
Final simplification75.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 -2.5e-83) (* -9.0 (* y (* z t))) (if (<= z 0.046) (- (* x 2.0) (* a (* b -27.0))) (* z (* t (* y -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 <= -2.5e-83) {
tmp = -9.0 * (y * (z * t));
} else if (z <= 0.046) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = z * (t * (y * -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 <= (-2.5d-83)) then
tmp = (-9.0d0) * (y * (z * t))
else if (z <= 0.046d0) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = z * (t * (y * (-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 <= -2.5e-83) {
tmp = -9.0 * (y * (z * t));
} else if (z <= 0.046) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = z * (t * (y * -9.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -2.5e-83: tmp = -9.0 * (y * (z * t)) elif z <= 0.046: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = z * (t * (y * -9.0)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.5e-83) tmp = Float64(-9.0 * Float64(y * Float64(z * t))); elseif (z <= 0.046) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(z * Float64(t * Float64(y * -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 <= -2.5e-83)
tmp = -9.0 * (y * (z * t));
elseif (z <= 0.046)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = z * (t * (y * -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, -2.5e-83], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.046], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(t * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-83}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 0.046:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\
\end{array}
\end{array}
if z < -2.5e-83Initial program 89.8%
Taylor expanded in y around 0 89.8%
*-commutative89.8%
associate-*r*89.8%
Simplified89.8%
Taylor expanded in y around inf 33.7%
if -2.5e-83 < z < 0.045999999999999999Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*98.9%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in a around 0 83.7%
*-commutative83.7%
associate-*r*83.6%
Simplified83.6%
if 0.045999999999999999 < z Initial program 92.9%
Taylor expanded in y around 0 92.9%
*-commutative92.9%
associate-*r*91.5%
Simplified91.5%
Taylor expanded in y around inf 55.8%
*-commutative55.8%
associate-*r*58.6%
*-commutative58.6%
associate-*l*58.6%
Simplified58.6%
Taylor expanded in y around 0 58.6%
*-commutative58.6%
*-commutative58.6%
associate-*l*58.6%
Simplified58.6%
Final simplification61.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 -2.5e-83) (* -9.0 (* y (* z t))) (if (<= z 0.0052) (- (* x 2.0) (* b (* a -27.0))) (* z (* t (* y -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 <= -2.5e-83) {
tmp = -9.0 * (y * (z * t));
} else if (z <= 0.0052) {
tmp = (x * 2.0) - (b * (a * -27.0));
} else {
tmp = z * (t * (y * -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 <= (-2.5d-83)) then
tmp = (-9.0d0) * (y * (z * t))
else if (z <= 0.0052d0) then
tmp = (x * 2.0d0) - (b * (a * (-27.0d0)))
else
tmp = z * (t * (y * (-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 <= -2.5e-83) {
tmp = -9.0 * (y * (z * t));
} else if (z <= 0.0052) {
tmp = (x * 2.0) - (b * (a * -27.0));
} else {
tmp = z * (t * (y * -9.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -2.5e-83: tmp = -9.0 * (y * (z * t)) elif z <= 0.0052: tmp = (x * 2.0) - (b * (a * -27.0)) else: tmp = z * (t * (y * -9.0)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.5e-83) tmp = Float64(-9.0 * Float64(y * Float64(z * t))); elseif (z <= 0.0052) tmp = Float64(Float64(x * 2.0) - Float64(b * Float64(a * -27.0))); else tmp = Float64(z * Float64(t * Float64(y * -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 <= -2.5e-83)
tmp = -9.0 * (y * (z * t));
elseif (z <= 0.0052)
tmp = (x * 2.0) - (b * (a * -27.0));
else
tmp = z * (t * (y * -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, -2.5e-83], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0052], N[(N[(x * 2.0), $MachinePrecision] - N[(b * N[(a * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(t * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-83}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 0.0052:\\
\;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\
\end{array}
\end{array}
if z < -2.5e-83Initial program 89.8%
Taylor expanded in y around 0 89.8%
*-commutative89.8%
associate-*r*89.8%
Simplified89.8%
Taylor expanded in y around inf 33.7%
if -2.5e-83 < z < 0.0051999999999999998Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*98.9%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in a around 0 83.7%
*-commutative83.7%
associate-*r*83.6%
Simplified83.6%
Taylor expanded in a around 0 83.7%
associate-*r*83.7%
*-commutative83.7%
Simplified83.7%
if 0.0051999999999999998 < z Initial program 92.9%
Taylor expanded in y around 0 92.9%
*-commutative92.9%
associate-*r*91.5%
Simplified91.5%
Taylor expanded in y around inf 55.8%
*-commutative55.8%
associate-*r*58.6%
*-commutative58.6%
associate-*l*58.6%
Simplified58.6%
Taylor expanded in y around 0 58.6%
*-commutative58.6%
*-commutative58.6%
associate-*l*58.6%
Simplified58.6%
Final simplification61.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 (<= b -6.2e-59) (not (<= b 2.1e+114))) (* 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 <= -6.2e-59) || !(b <= 2.1e+114)) {
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 <= (-6.2d-59)) .or. (.not. (b <= 2.1d+114))) 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 <= -6.2e-59) || !(b <= 2.1e+114)) {
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 <= -6.2e-59) or not (b <= 2.1e+114): 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 <= -6.2e-59) || !(b <= 2.1e+114)) 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 <= -6.2e-59) || ~((b <= 2.1e+114)))
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, -6.2e-59], N[Not[LessEqual[b, 2.1e+114]], $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 -6.2 \cdot 10^{-59} \lor \neg \left(b \leq 2.1 \cdot 10^{+114}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -6.19999999999999998e-59 or 2.1e114 < b Initial program 91.4%
Taylor expanded in y around 0 91.4%
*-commutative91.4%
associate-*r*90.6%
Simplified90.6%
Taylor expanded in a around inf 47.4%
if -6.19999999999999998e-59 < b < 2.1e114Initial program 97.8%
associate-+l-97.8%
fma-neg97.8%
neg-sub097.8%
associate-+l-97.8%
neg-sub097.8%
*-commutative97.8%
distribute-rgt-neg-in97.8%
fma-def97.8%
*-commutative97.8%
associate-*r*97.8%
distribute-rgt-neg-in97.8%
*-commutative97.8%
metadata-eval97.8%
Simplified97.8%
Taylor expanded in x around inf 45.3%
Final simplification46.3%
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 -1.35e-58) (* a (* 27.0 b)) (if (<= b 2.15e+114) (* 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 (b <= -1.35e-58) {
tmp = a * (27.0 * b);
} else if (b <= 2.15e+114) {
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 (b <= (-1.35d-58)) then
tmp = a * (27.0d0 * b)
else if (b <= 2.15d+114) 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 (b <= -1.35e-58) {
tmp = a * (27.0 * b);
} else if (b <= 2.15e+114) {
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 b <= -1.35e-58: tmp = a * (27.0 * b) elif b <= 2.15e+114: 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 (b <= -1.35e-58) tmp = Float64(a * Float64(27.0 * b)); elseif (b <= 2.15e+114) 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 (b <= -1.35e-58)
tmp = a * (27.0 * b);
elseif (b <= 2.15e+114)
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[b, -1.35e-58], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.15e+114], 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}\;b \leq -1.35 \cdot 10^{-58}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;b \leq 2.15 \cdot 10^{+114}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if b < -1.3499999999999999e-58Initial program 95.2%
associate-+l-95.2%
sub-neg95.2%
neg-mul-195.2%
metadata-eval95.2%
metadata-eval95.2%
cancel-sign-sub-inv95.2%
metadata-eval95.2%
*-lft-identity95.2%
associate-*l*93.9%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in y around 0 70.2%
*-commutative70.2%
Simplified70.2%
Taylor expanded in a around 0 70.2%
*-commutative70.2%
associate-*r*70.2%
Simplified70.2%
Taylor expanded in x around 0 38.1%
*-commutative38.1%
associate-*r*38.1%
Simplified38.1%
if -1.3499999999999999e-58 < b < 2.15e114Initial program 97.8%
associate-+l-97.8%
fma-neg97.8%
neg-sub097.8%
associate-+l-97.8%
neg-sub097.8%
*-commutative97.8%
distribute-rgt-neg-in97.8%
fma-def97.8%
*-commutative97.8%
associate-*r*97.8%
distribute-rgt-neg-in97.8%
*-commutative97.8%
metadata-eval97.8%
Simplified97.8%
Taylor expanded in x around inf 45.3%
if 2.15e114 < b Initial program 82.2%
Taylor expanded in y around 0 82.1%
*-commutative82.1%
associate-*r*82.2%
Simplified82.2%
Taylor expanded in a around inf 70.3%
Final simplification46.3%
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 94.9%
associate-+l-94.9%
fma-neg94.9%
neg-sub094.9%
associate-+l-94.9%
neg-sub094.9%
*-commutative94.9%
distribute-rgt-neg-in94.9%
fma-def95.3%
*-commutative95.3%
associate-*r*95.4%
distribute-rgt-neg-in95.4%
*-commutative95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in x around inf 36.8%
Final simplification36.8%
(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 2023238
(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)))