
(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 13 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) -5e-130) (fma a (* 27.0 b) (- (* x 2.0) (* 9.0 (* y (* z t))))) (+ (- (* x 2.0) (* t (* 9.0 (* y z)))) (* 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 ((y * 9.0) <= -5e-130) {
tmp = fma(a, (27.0 * b), ((x * 2.0) - (9.0 * (y * (z * t)))));
} else {
tmp = ((x * 2.0) - (t * (9.0 * (y * z)))) + (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 (Float64(y * 9.0) <= -5e-130) tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t))))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(y * z)))) + Float64(b * Float64(a * 27.0))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(y * 9.0), $MachinePrecision], -5e-130], N[(a * N[(27.0 * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}\;y \cdot 9 \leq -5 \cdot 10^{-130}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if (*.f64 y 9) < -4.9999999999999996e-130Initial program 93.7%
+-commutative93.7%
associate-*l*93.6%
fma-def95.8%
associate-*l*97.8%
*-commutative97.8%
associate-*l*97.8%
Simplified97.8%
if -4.9999999999999996e-130 < (*.f64 y 9) Initial program 95.1%
Taylor expanded in y around 0 95.1%
Final simplification96.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
(let* ((t_1 (* (* y 9.0) z)))
(if (<= t_1 5e+287)
(+ (* b (* a 27.0)) (- (* x 2.0) (* t t_1)))
(- (* 27.0 (* a b)) (* 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 t_1 = (y * 9.0) * z;
double tmp;
if (t_1 <= 5e+287) {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * t_1));
} else {
tmp = (27.0 * (a * b)) - (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) :: t_1
real(8) :: tmp
t_1 = (y * 9.0d0) * z
if (t_1 <= 5d+287) then
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * t_1))
else
tmp = (27.0d0 * (a * b)) - (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 t_1 = (y * 9.0) * z;
double tmp;
if (t_1 <= 5e+287) {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * t_1));
} else {
tmp = (27.0 * (a * b)) - (9.0 * (y * (z * t)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = (y * 9.0) * z tmp = 0 if t_1 <= 5e+287: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * t_1)) else: tmp = (27.0 * (a * b)) - (9.0 * (y * (z * t))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(y * 9.0) * z) tmp = 0.0 if (t_1 <= 5e+287) tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * t_1))); else tmp = Float64(Float64(27.0 * Float64(a * b)) - 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)
t_1 = (y * 9.0) * z;
tmp = 0.0;
if (t_1 <= 5e+287)
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * t_1));
else
tmp = (27.0 * (a * b)) - (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_] := Block[{t$95$1 = N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+287], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $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}
t_1 := \left(y \cdot 9\right) \cdot z\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+287}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 5e287Initial program 97.0%
if 5e287 < (*.f64 (*.f64 y 9) z) Initial program 64.5%
Taylor expanded in x around 0 89.2%
Final simplification96.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 (* y (* z t))))
(t_2 (- (* x 2.0) (* a (* b -27.0))))
(t_3 (* 27.0 (* a b))))
(if (<= z -3.6e-39)
(- t_3 t_1)
(if (<= z -3.4e-120)
t_2
(if (<= z -5.5e-177)
(- (* x 2.0) t_1)
(if (<= z 6.8e-40) t_2 (- t_3 (* 9.0 (* t (* y z))))))))))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 t_2 = (x * 2.0) - (a * (b * -27.0));
double t_3 = 27.0 * (a * b);
double tmp;
if (z <= -3.6e-39) {
tmp = t_3 - t_1;
} else if (z <= -3.4e-120) {
tmp = t_2;
} else if (z <= -5.5e-177) {
tmp = (x * 2.0) - t_1;
} else if (z <= 6.8e-40) {
tmp = t_2;
} else {
tmp = t_3 - (9.0 * (t * (y * z)));
}
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = 9.0d0 * (y * (z * t))
t_2 = (x * 2.0d0) - (a * (b * (-27.0d0)))
t_3 = 27.0d0 * (a * b)
if (z <= (-3.6d-39)) then
tmp = t_3 - t_1
else if (z <= (-3.4d-120)) then
tmp = t_2
else if (z <= (-5.5d-177)) then
tmp = (x * 2.0d0) - t_1
else if (z <= 6.8d-40) then
tmp = t_2
else
tmp = t_3 - (9.0d0 * (t * (y * z)))
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 t_2 = (x * 2.0) - (a * (b * -27.0));
double t_3 = 27.0 * (a * b);
double tmp;
if (z <= -3.6e-39) {
tmp = t_3 - t_1;
} else if (z <= -3.4e-120) {
tmp = t_2;
} else if (z <= -5.5e-177) {
tmp = (x * 2.0) - t_1;
} else if (z <= 6.8e-40) {
tmp = t_2;
} else {
tmp = t_3 - (9.0 * (t * (y * z)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = 9.0 * (y * (z * t)) t_2 = (x * 2.0) - (a * (b * -27.0)) t_3 = 27.0 * (a * b) tmp = 0 if z <= -3.6e-39: tmp = t_3 - t_1 elif z <= -3.4e-120: tmp = t_2 elif z <= -5.5e-177: tmp = (x * 2.0) - t_1 elif z <= 6.8e-40: tmp = t_2 else: tmp = t_3 - (9.0 * (t * (y * z))) 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))) t_2 = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))) t_3 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (z <= -3.6e-39) tmp = Float64(t_3 - t_1); elseif (z <= -3.4e-120) tmp = t_2; elseif (z <= -5.5e-177) tmp = Float64(Float64(x * 2.0) - t_1); elseif (z <= 6.8e-40) tmp = t_2; else tmp = Float64(t_3 - Float64(9.0 * Float64(t * Float64(y * z)))); 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));
t_2 = (x * 2.0) - (a * (b * -27.0));
t_3 = 27.0 * (a * b);
tmp = 0.0;
if (z <= -3.6e-39)
tmp = t_3 - t_1;
elseif (z <= -3.4e-120)
tmp = t_2;
elseif (z <= -5.5e-177)
tmp = (x * 2.0) - t_1;
elseif (z <= 6.8e-40)
tmp = t_2;
else
tmp = t_3 - (9.0 * (t * (y * z)));
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]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e-39], N[(t$95$3 - t$95$1), $MachinePrecision], If[LessEqual[z, -3.4e-120], t$95$2, If[LessEqual[z, -5.5e-177], N[(N[(x * 2.0), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[z, 6.8e-40], t$95$2, N[(t$95$3 - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\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)\\
t_2 := x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
t_3 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{-39}:\\
\;\;\;\;t_3 - t_1\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-120}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-177}:\\
\;\;\;\;x \cdot 2 - t_1\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-40}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -3.6000000000000001e-39Initial program 96.1%
Taylor expanded in x around 0 68.8%
if -3.6000000000000001e-39 < z < -3.4000000000000001e-120 or -5.4999999999999996e-177 < z < 6.79999999999999968e-40Initial program 98.7%
associate-+l-98.7%
sub-neg98.7%
neg-mul-198.7%
metadata-eval98.7%
metadata-eval98.7%
cancel-sign-sub-inv98.7%
metadata-eval98.7%
*-lft-identity98.7%
associate-*l*99.2%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in y around 0 87.7%
*-commutative87.7%
associate-*l*87.6%
Simplified87.6%
if -3.4000000000000001e-120 < z < -5.4999999999999996e-177Initial program 99.6%
Taylor expanded in a around 0 47.7%
if 6.79999999999999968e-40 < z Initial program 88.4%
Taylor expanded in x around 0 65.5%
expm1-log1p-u40.4%
expm1-udef40.4%
*-commutative40.4%
Applied egg-rr40.4%
expm1-def40.4%
expm1-log1p65.5%
associate-*r*68.7%
*-commutative68.7%
Simplified68.7%
Final simplification73.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 -1.38e-39)
(* (* y (* z t)) -9.0)
(if (<= z -1.15e-203)
(* x 2.0)
(if (<= z -4.9e-248)
(* 27.0 (* a b))
(if (<= z -1.2e-282)
(* x 2.0)
(if (<= z 6.6e-225)
(* b (* a 27.0))
(if (<= z 4.8e-40) (* x 2.0) (* -9.0 (* t (* y z))))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.38e-39) {
tmp = (y * (z * t)) * -9.0;
} else if (z <= -1.15e-203) {
tmp = x * 2.0;
} else if (z <= -4.9e-248) {
tmp = 27.0 * (a * b);
} else if (z <= -1.2e-282) {
tmp = x * 2.0;
} else if (z <= 6.6e-225) {
tmp = b * (a * 27.0);
} else if (z <= 4.8e-40) {
tmp = x * 2.0;
} else {
tmp = -9.0 * (t * (y * z));
}
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.38d-39)) then
tmp = (y * (z * t)) * (-9.0d0)
else if (z <= (-1.15d-203)) then
tmp = x * 2.0d0
else if (z <= (-4.9d-248)) then
tmp = 27.0d0 * (a * b)
else if (z <= (-1.2d-282)) then
tmp = x * 2.0d0
else if (z <= 6.6d-225) then
tmp = b * (a * 27.0d0)
else if (z <= 4.8d-40) then
tmp = x * 2.0d0
else
tmp = (-9.0d0) * (t * (y * z))
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.38e-39) {
tmp = (y * (z * t)) * -9.0;
} else if (z <= -1.15e-203) {
tmp = x * 2.0;
} else if (z <= -4.9e-248) {
tmp = 27.0 * (a * b);
} else if (z <= -1.2e-282) {
tmp = x * 2.0;
} else if (z <= 6.6e-225) {
tmp = b * (a * 27.0);
} else if (z <= 4.8e-40) {
tmp = x * 2.0;
} else {
tmp = -9.0 * (t * (y * z));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1.38e-39: tmp = (y * (z * t)) * -9.0 elif z <= -1.15e-203: tmp = x * 2.0 elif z <= -4.9e-248: tmp = 27.0 * (a * b) elif z <= -1.2e-282: tmp = x * 2.0 elif z <= 6.6e-225: tmp = b * (a * 27.0) elif z <= 4.8e-40: tmp = x * 2.0 else: tmp = -9.0 * (t * (y * z)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.38e-39) tmp = Float64(Float64(y * Float64(z * t)) * -9.0); elseif (z <= -1.15e-203) tmp = Float64(x * 2.0); elseif (z <= -4.9e-248) tmp = Float64(27.0 * Float64(a * b)); elseif (z <= -1.2e-282) tmp = Float64(x * 2.0); elseif (z <= 6.6e-225) tmp = Float64(b * Float64(a * 27.0)); elseif (z <= 4.8e-40) tmp = Float64(x * 2.0); else tmp = Float64(-9.0 * Float64(t * Float64(y * z))); 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.38e-39)
tmp = (y * (z * t)) * -9.0;
elseif (z <= -1.15e-203)
tmp = x * 2.0;
elseif (z <= -4.9e-248)
tmp = 27.0 * (a * b);
elseif (z <= -1.2e-282)
tmp = x * 2.0;
elseif (z <= 6.6e-225)
tmp = b * (a * 27.0);
elseif (z <= 4.8e-40)
tmp = x * 2.0;
else
tmp = -9.0 * (t * (y * z));
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.38e-39], N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision], If[LessEqual[z, -1.15e-203], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, -4.9e-248], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.2e-282], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 6.6e-225], N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-40], N[(x * 2.0), $MachinePrecision], N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.38 \cdot 10^{-39}:\\
\;\;\;\;\left(y \cdot \left(z \cdot t\right)\right) \cdot -9\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-203}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq -4.9 \cdot 10^{-248}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-282}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-225}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-40}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -1.3799999999999999e-39Initial program 96.1%
Taylor expanded in y around inf 49.2%
if -1.3799999999999999e-39 < z < -1.14999999999999996e-203 or -4.8999999999999997e-248 < z < -1.19999999999999998e-282 or 6.6000000000000003e-225 < z < 4.79999999999999982e-40Initial program 98.5%
Taylor expanded in x around inf 49.0%
if -1.14999999999999996e-203 < z < -4.8999999999999997e-248Initial program 100.0%
Taylor expanded in a around inf 99.7%
if -1.19999999999999998e-282 < z < 6.6000000000000003e-225Initial program 99.9%
Taylor expanded in y around 0 99.9%
add-cube-cbrt100.0%
pow3100.0%
associate-*l*100.0%
Applied egg-rr100.0%
Taylor expanded in a around inf 40.4%
*-commutative40.4%
*-commutative40.4%
associate-*r*40.5%
*-commutative40.5%
Simplified40.5%
if 4.79999999999999982e-40 < z Initial program 88.4%
Taylor expanded in y around 0 88.4%
Taylor expanded in y around inf 44.5%
*-commutative44.5%
associate-*r*44.6%
*-commutative44.6%
Simplified44.6%
Final simplification48.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 (<= z -2.55e+121) (* (* y (* z t)) -9.0) (+ (- (* x 2.0) (* t (* 9.0 (* y z)))) (* 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 <= -2.55e+121) {
tmp = (y * (z * t)) * -9.0;
} else {
tmp = ((x * 2.0) - (t * (9.0 * (y * z)))) + (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 <= (-2.55d+121)) then
tmp = (y * (z * t)) * (-9.0d0)
else
tmp = ((x * 2.0d0) - (t * (9.0d0 * (y * z)))) + (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 <= -2.55e+121) {
tmp = (y * (z * t)) * -9.0;
} else {
tmp = ((x * 2.0) - (t * (9.0 * (y * z)))) + (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 <= -2.55e+121: tmp = (y * (z * t)) * -9.0 else: tmp = ((x * 2.0) - (t * (9.0 * (y * z)))) + (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 <= -2.55e+121) tmp = Float64(Float64(y * Float64(z * t)) * -9.0); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(y * z)))) + 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 <= -2.55e+121)
tmp = (y * (z * t)) * -9.0;
else
tmp = ((x * 2.0) - (t * (9.0 * (y * z)))) + (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[LessEqual[z, -2.55e+121], N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -2.55 \cdot 10^{+121}:\\
\;\;\;\;\left(y \cdot \left(z \cdot t\right)\right) \cdot -9\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if z < -2.5500000000000002e121Initial program 94.6%
Taylor expanded in y around inf 61.1%
if -2.5500000000000002e121 < z Initial program 94.6%
Taylor expanded in y around 0 94.6%
Final simplification89.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 (<= z 2e-104) (+ (* x 2.0) (- (* a (* 27.0 b)) (* (* y 9.0) (* z t)))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* (* y 9.0) z))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2e-104) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((y * 9.0) * z)));
}
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 <= 2d-104) then
tmp = (x * 2.0d0) + ((a * (27.0d0 * b)) - ((y * 9.0d0) * (z * t)))
else
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * ((y * 9.0d0) * z)))
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 <= 2e-104) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((y * 9.0) * z)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= 2e-104: tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t))) else: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((y * 9.0) * z))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 2e-104) tmp = Float64(Float64(x * 2.0) + Float64(Float64(a * Float64(27.0 * b)) - Float64(Float64(y * 9.0) * Float64(z * t)))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(Float64(y * 9.0) * z)))); 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 <= 2e-104)
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
else
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((y * 9.0) * z)));
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, 2e-104], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-104}:\\
\;\;\;\;x \cdot 2 + \left(a \cdot \left(27 \cdot b\right) - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\right)\\
\end{array}
\end{array}
if z < 1.99999999999999985e-104Initial program 97.4%
associate-+l-97.4%
sub-neg97.4%
neg-mul-197.4%
metadata-eval97.4%
metadata-eval97.4%
cancel-sign-sub-inv97.4%
metadata-eval97.4%
*-lft-identity97.4%
associate-*l*95.3%
associate-*l*95.2%
Simplified95.2%
if 1.99999999999999985e-104 < z Initial program 90.1%
Final simplification93.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
(let* ((t_1 (* -9.0 (* t (* y z)))) (t_2 (* 27.0 (* a b))))
(if (<= x -5.3e+16)
(* x 2.0)
(if (<= x -2.2e-103)
t_2
(if (<= x -3.8e-173)
t_1
(if (<= x 2.6e-208) t_2 (if (<= x 9e+120) t_1 (* x 2.0))))))))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 * (y * z));
double t_2 = 27.0 * (a * b);
double tmp;
if (x <= -5.3e+16) {
tmp = x * 2.0;
} else if (x <= -2.2e-103) {
tmp = t_2;
} else if (x <= -3.8e-173) {
tmp = t_1;
} else if (x <= 2.6e-208) {
tmp = t_2;
} else if (x <= 9e+120) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-9.0d0) * (t * (y * z))
t_2 = 27.0d0 * (a * b)
if (x <= (-5.3d+16)) then
tmp = x * 2.0d0
else if (x <= (-2.2d-103)) then
tmp = t_2
else if (x <= (-3.8d-173)) then
tmp = t_1
else if (x <= 2.6d-208) then
tmp = t_2
else if (x <= 9d+120) then
tmp = t_1
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 t_1 = -9.0 * (t * (y * z));
double t_2 = 27.0 * (a * b);
double tmp;
if (x <= -5.3e+16) {
tmp = x * 2.0;
} else if (x <= -2.2e-103) {
tmp = t_2;
} else if (x <= -3.8e-173) {
tmp = t_1;
} else if (x <= 2.6e-208) {
tmp = t_2;
} else if (x <= 9e+120) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = -9.0 * (t * (y * z)) t_2 = 27.0 * (a * b) tmp = 0 if x <= -5.3e+16: tmp = x * 2.0 elif x <= -2.2e-103: tmp = t_2 elif x <= -3.8e-173: tmp = t_1 elif x <= 2.6e-208: tmp = t_2 elif x <= 9e+120: tmp = t_1 else: tmp = x * 2.0 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(y * z))) t_2 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (x <= -5.3e+16) tmp = Float64(x * 2.0); elseif (x <= -2.2e-103) tmp = t_2; elseif (x <= -3.8e-173) tmp = t_1; elseif (x <= 2.6e-208) tmp = t_2; elseif (x <= 9e+120) tmp = t_1; 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)
t_1 = -9.0 * (t * (y * z));
t_2 = 27.0 * (a * b);
tmp = 0.0;
if (x <= -5.3e+16)
tmp = x * 2.0;
elseif (x <= -2.2e-103)
tmp = t_2;
elseif (x <= -3.8e-173)
tmp = t_1;
elseif (x <= 2.6e-208)
tmp = t_2;
elseif (x <= 9e+120)
tmp = t_1;
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_] := Block[{t$95$1 = N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.3e+16], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -2.2e-103], t$95$2, If[LessEqual[x, -3.8e-173], t$95$1, If[LessEqual[x, 2.6e-208], t$95$2, If[LessEqual[x, 9e+120], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;x \leq -5.3 \cdot 10^{+16}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-103}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-173}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-208}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+120}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -5.3e16 or 8.99999999999999953e120 < x Initial program 95.1%
Taylor expanded in x around inf 63.5%
if -5.3e16 < x < -2.1999999999999999e-103 or -3.8000000000000003e-173 < x < 2.60000000000000017e-208Initial program 95.9%
Taylor expanded in a around inf 60.0%
if -2.1999999999999999e-103 < x < -3.8000000000000003e-173 or 2.60000000000000017e-208 < x < 8.99999999999999953e120Initial program 92.8%
Taylor expanded in y around 0 92.8%
Taylor expanded in y around inf 54.5%
*-commutative54.5%
associate-*r*55.7%
*-commutative55.7%
Simplified55.7%
Final simplification60.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 -4e-177)
(- (* x 2.0) (* 9.0 (* y (* z t))))
(if (<= z 4e-40)
(- (* x 2.0) (* a (* b -27.0)))
(- (* 27.0 (* a b)) (* 9.0 (* t (* y z)))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4e-177) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (z <= 4e-40) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (27.0 * (a * b)) - (9.0 * (t * (y * z)));
}
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 <= (-4d-177)) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else if (z <= 4d-40) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (27.0d0 * (a * b)) - (9.0d0 * (t * (y * z)))
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 <= -4e-177) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (z <= 4e-40) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (27.0 * (a * b)) - (9.0 * (t * (y * z)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -4e-177: tmp = (x * 2.0) - (9.0 * (y * (z * t))) elif z <= 4e-40: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = (27.0 * (a * b)) - (9.0 * (t * (y * z))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4e-177) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); elseif (z <= 4e-40) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(Float64(27.0 * Float64(a * b)) - Float64(9.0 * Float64(t * Float64(y * z)))); 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 <= -4e-177)
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
elseif (z <= 4e-40)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = (27.0 * (a * b)) - (9.0 * (t * (y * z)));
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, -4e-177], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e-40], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-177}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-40}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -3.99999999999999981e-177Initial program 97.1%
Taylor expanded in a around 0 64.9%
if -3.99999999999999981e-177 < z < 3.9999999999999997e-40Initial program 98.5%
associate-+l-98.5%
sub-neg98.5%
neg-mul-198.5%
metadata-eval98.5%
metadata-eval98.5%
cancel-sign-sub-inv98.5%
metadata-eval98.5%
*-lft-identity98.5%
associate-*l*99.1%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in y around 0 90.4%
*-commutative90.4%
associate-*l*90.4%
Simplified90.4%
if 3.9999999999999997e-40 < z Initial program 88.4%
Taylor expanded in x around 0 65.5%
expm1-log1p-u40.4%
expm1-udef40.4%
*-commutative40.4%
Applied egg-rr40.4%
expm1-def40.4%
expm1-log1p65.5%
associate-*r*68.7%
*-commutative68.7%
Simplified68.7%
Final simplification72.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 -3.9e+40) (* (* y (* z t)) -9.0) (if (<= z 7e-40) (- (* x 2.0) (* a (* b -27.0))) (* -9.0 (* t (* y z))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.9e+40) {
tmp = (y * (z * t)) * -9.0;
} else if (z <= 7e-40) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = -9.0 * (t * (y * z));
}
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.9d+40)) then
tmp = (y * (z * t)) * (-9.0d0)
else if (z <= 7d-40) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (-9.0d0) * (t * (y * z))
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.9e+40) {
tmp = (y * (z * t)) * -9.0;
} else if (z <= 7e-40) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = -9.0 * (t * (y * z));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -3.9e+40: tmp = (y * (z * t)) * -9.0 elif z <= 7e-40: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = -9.0 * (t * (y * z)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.9e+40) tmp = Float64(Float64(y * Float64(z * t)) * -9.0); elseif (z <= 7e-40) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(-9.0 * Float64(t * Float64(y * z))); 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.9e+40)
tmp = (y * (z * t)) * -9.0;
elseif (z <= 7e-40)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = -9.0 * (t * (y * z));
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, -3.9e+40], N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision], If[LessEqual[z, 7e-40], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+40}:\\
\;\;\;\;\left(y \cdot \left(z \cdot t\right)\right) \cdot -9\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-40}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -3.9000000000000001e40Initial program 94.6%
Taylor expanded in y around inf 51.9%
if -3.9000000000000001e40 < z < 7.0000000000000003e-40Initial program 99.0%
associate-+l-99.0%
sub-neg99.0%
neg-mul-199.0%
metadata-eval99.0%
metadata-eval99.0%
cancel-sign-sub-inv99.0%
metadata-eval99.0%
*-lft-identity99.0%
associate-*l*99.4%
associate-*l*99.3%
Simplified99.3%
Taylor expanded in y around 0 81.4%
*-commutative81.4%
associate-*l*81.4%
Simplified81.4%
if 7.0000000000000003e-40 < z Initial program 88.4%
Taylor expanded in y around 0 88.4%
Taylor expanded in y around inf 44.5%
*-commutative44.5%
associate-*r*44.6%
*-commutative44.6%
Simplified44.6%
Final simplification63.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 (<= y -1.35e+103)
(- (* x 2.0) (* 9.0 (* y (* z t))))
(if (<= y 1.02e-80)
(- (* x 2.0) (* a (* b -27.0)))
(* -9.0 (* t (* y z))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.35e+103) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (y <= 1.02e-80) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = -9.0 * (t * (y * z));
}
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 <= (-1.35d+103)) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else if (y <= 1.02d-80) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (-9.0d0) * (t * (y * z))
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 <= -1.35e+103) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (y <= 1.02e-80) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = -9.0 * (t * (y * z));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if y <= -1.35e+103: tmp = (x * 2.0) - (9.0 * (y * (z * t))) elif y <= 1.02e-80: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = -9.0 * (t * (y * z)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.35e+103) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); elseif (y <= 1.02e-80) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(-9.0 * Float64(t * Float64(y * z))); 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 <= -1.35e+103)
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
elseif (y <= 1.02e-80)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = -9.0 * (t * (y * z));
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, -1.35e+103], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.02e-80], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+103}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{-80}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if y < -1.34999999999999996e103Initial program 88.8%
Taylor expanded in a around 0 87.1%
if -1.34999999999999996e103 < y < 1.02000000000000005e-80Initial program 99.2%
associate-+l-99.2%
sub-neg99.2%
neg-mul-199.2%
metadata-eval99.2%
metadata-eval99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
associate-*l*87.7%
associate-*l*87.6%
Simplified87.6%
Taylor expanded in y around 0 80.5%
*-commutative80.5%
associate-*l*80.5%
Simplified80.5%
if 1.02000000000000005e-80 < y Initial program 89.4%
Taylor expanded in y around 0 89.4%
Taylor expanded in y around inf 55.8%
*-commutative55.8%
associate-*r*49.4%
*-commutative49.4%
Simplified49.4%
Final simplification72.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 -1.8e-93) (not (<= b 1650000000000.0))) (* 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 <= -1.8e-93) || !(b <= 1650000000000.0)) {
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 <= (-1.8d-93)) .or. (.not. (b <= 1650000000000.0d0))) 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 <= -1.8e-93) || !(b <= 1650000000000.0)) {
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 <= -1.8e-93) or not (b <= 1650000000000.0): 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 <= -1.8e-93) || !(b <= 1650000000000.0)) 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 <= -1.8e-93) || ~((b <= 1650000000000.0)))
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, -1.8e-93], N[Not[LessEqual[b, 1650000000000.0]], $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 -1.8 \cdot 10^{-93} \lor \neg \left(b \leq 1650000000000\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -1.8000000000000001e-93 or 1.65e12 < b Initial program 93.4%
Taylor expanded in a around inf 51.8%
if -1.8000000000000001e-93 < b < 1.65e12Initial program 95.9%
Taylor expanded in x around inf 48.1%
Final simplification50.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 (<= b -1.72e-93) (* 27.0 (* a b)) (if (<= b 3.1e+14) (* 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 (b <= -1.72e-93) {
tmp = 27.0 * (a * b);
} else if (b <= 3.1e+14) {
tmp = x * 2.0;
} else {
tmp = 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 (b <= (-1.72d-93)) then
tmp = 27.0d0 * (a * b)
else if (b <= 3.1d+14) then
tmp = x * 2.0d0
else
tmp = 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 (b <= -1.72e-93) {
tmp = 27.0 * (a * b);
} else if (b <= 3.1e+14) {
tmp = x * 2.0;
} else {
tmp = b * (a * 27.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if b <= -1.72e-93: tmp = 27.0 * (a * b) elif b <= 3.1e+14: tmp = x * 2.0 else: tmp = 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 (b <= -1.72e-93) tmp = Float64(27.0 * Float64(a * b)); elseif (b <= 3.1e+14) tmp = Float64(x * 2.0); else tmp = 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 (b <= -1.72e-93)
tmp = 27.0 * (a * b);
elseif (b <= 3.1e+14)
tmp = x * 2.0;
else
tmp = 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[LessEqual[b, -1.72e-93], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.1e+14], N[(x * 2.0), $MachinePrecision], N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.72 \cdot 10^{-93}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{+14}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if b < -1.7199999999999999e-93Initial program 93.2%
Taylor expanded in a around inf 51.4%
if -1.7199999999999999e-93 < b < 3.1e14Initial program 95.9%
Taylor expanded in x around inf 48.1%
if 3.1e14 < b Initial program 93.6%
Taylor expanded in y around 0 93.5%
add-cube-cbrt93.3%
pow393.4%
associate-*l*93.4%
Applied egg-rr93.4%
Taylor expanded in a around inf 52.3%
*-commutative52.3%
*-commutative52.3%
associate-*r*52.4%
*-commutative52.4%
Simplified52.4%
Final simplification50.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 (* 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.6%
Taylor expanded in x around inf 32.2%
Final simplification32.2%
(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 2023252
(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)))