
(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 11 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: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (* 27.0 b) a (* x 2.0))))
(if (<= (* 9.0 y) -1e-33)
(fma 9.0 (* (* t (- z)) y) t_1)
(fma (* t y) (* -9.0 z) t_1))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((27.0 * b), a, (x * 2.0));
double tmp;
if ((9.0 * y) <= -1e-33) {
tmp = fma(9.0, ((t * -z) * y), t_1);
} else {
tmp = fma((t * y), (-9.0 * z), t_1);
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = fma(Float64(27.0 * b), a, Float64(x * 2.0)) tmp = 0.0 if (Float64(9.0 * y) <= -1e-33) tmp = fma(9.0, Float64(Float64(t * Float64(-z)) * y), t_1); else tmp = fma(Float64(t * y), Float64(-9.0 * z), t_1); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(27.0 * b), $MachinePrecision] * a + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(9.0 * y), $MachinePrecision], -1e-33], N[(9.0 * N[(N[(t * (-z)), $MachinePrecision] * y), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(t * y), $MachinePrecision] * N[(-9.0 * z), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(27 \cdot b, a, x \cdot 2\right)\\
\mathbf{if}\;9 \cdot y \leq -1 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(9, \left(t \cdot \left(-z\right)\right) \cdot y, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot y, -9 \cdot z, t\_1\right)\\
\end{array}
\end{array}
if (*.f64 y #s(literal 9 binary64)) < -1.0000000000000001e-33Initial program 95.4%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
Applied rewrites98.3%
if -1.0000000000000001e-33 < (*.f64 y #s(literal 9 binary64)) Initial program 95.8%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites96.8%
Final simplification97.2%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* z (* 9.0 y)) t)))
(if (<= t_1 -4e+33)
(fma (* 27.0 b) a (* (* (* z y) t) -9.0))
(if (<= t_1 1e+26)
(fma 2.0 x (* (* a 27.0) b))
(fma (* z y) (* -9.0 t) (* (* a b) 27.0))))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * (9.0 * y)) * t;
double tmp;
if (t_1 <= -4e+33) {
tmp = fma((27.0 * b), a, (((z * y) * t) * -9.0));
} else if (t_1 <= 1e+26) {
tmp = fma(2.0, x, ((a * 27.0) * b));
} else {
tmp = fma((z * y), (-9.0 * t), ((a * b) * 27.0));
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(z * Float64(9.0 * y)) * t) tmp = 0.0 if (t_1 <= -4e+33) tmp = fma(Float64(27.0 * b), a, Float64(Float64(Float64(z * y) * t) * -9.0)); elseif (t_1 <= 1e+26) tmp = fma(2.0, x, Float64(Float64(a * 27.0) * b)); else tmp = fma(Float64(z * y), Float64(-9.0 * t), Float64(Float64(a * b) * 27.0)); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * N[(9.0 * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+33], N[(N[(27.0 * b), $MachinePrecision] * a + N[(N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+26], N[(2.0 * x + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(-9.0 * t), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot \left(9 \cdot y\right)\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, \left(\left(z \cdot y\right) \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(2, x, \left(a \cdot 27\right) \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot y, -9 \cdot t, \left(a \cdot b\right) \cdot 27\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -3.9999999999999998e33Initial program 91.1%
Taylor expanded in x around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6488.9
Applied rewrites88.9%
Applied rewrites88.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6490.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.7
Applied rewrites90.8%
if -3.9999999999999998e33 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.00000000000000005e26Initial program 99.9%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6496.5
Applied rewrites96.5%
Applied rewrites96.6%
if 1.00000000000000005e26 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 90.7%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6432.1
Applied rewrites32.1%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.6
Applied rewrites79.6%
Applied rewrites78.2%
Applied rewrites82.7%
Final simplification91.9%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* a b) 27.0)) (t_2 (* (* z (* 9.0 y)) t)))
(if (<= t_2 -4e+33)
(fma -9.0 (* (* z y) t) t_1)
(if (<= t_2 1e+26)
(fma 2.0 x (* (* a 27.0) b))
(fma (* z y) (* -9.0 t) t_1)))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) * 27.0;
double t_2 = (z * (9.0 * y)) * t;
double tmp;
if (t_2 <= -4e+33) {
tmp = fma(-9.0, ((z * y) * t), t_1);
} else if (t_2 <= 1e+26) {
tmp = fma(2.0, x, ((a * 27.0) * b));
} else {
tmp = fma((z * y), (-9.0 * t), t_1);
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) * 27.0) t_2 = Float64(Float64(z * Float64(9.0 * y)) * t) tmp = 0.0 if (t_2 <= -4e+33) tmp = fma(-9.0, Float64(Float64(z * y) * t), t_1); elseif (t_2 <= 1e+26) tmp = fma(2.0, x, Float64(Float64(a * 27.0) * b)); else tmp = fma(Float64(z * y), Float64(-9.0 * t), t_1); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] * 27.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * N[(9.0 * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+33], N[(-9.0 * N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 1e+26], N[(2.0 * x + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(-9.0 * t), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot b\right) \cdot 27\\
t_2 := \left(z \cdot \left(9 \cdot y\right)\right) \cdot t\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(-9, \left(z \cdot y\right) \cdot t, t\_1\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(2, x, \left(a \cdot 27\right) \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot y, -9 \cdot t, t\_1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -3.9999999999999998e33Initial program 91.1%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6489.0
Applied rewrites89.0%
if -3.9999999999999998e33 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.00000000000000005e26Initial program 99.9%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6496.5
Applied rewrites96.5%
Applied rewrites96.6%
if 1.00000000000000005e26 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 90.7%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6432.1
Applied rewrites32.1%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.6
Applied rewrites79.6%
Applied rewrites78.2%
Applied rewrites82.7%
Final simplification91.5%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma -9.0 (* (* z y) t) (* (* a b) 27.0)))
(t_2 (* (* z (* 9.0 y)) t)))
(if (<= t_2 -4e+33)
t_1
(if (<= t_2 1e+26) (fma 2.0 x (* (* a 27.0) b)) t_1))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(-9.0, ((z * y) * t), ((a * b) * 27.0));
double t_2 = (z * (9.0 * y)) * t;
double tmp;
if (t_2 <= -4e+33) {
tmp = t_1;
} else if (t_2 <= 1e+26) {
tmp = fma(2.0, x, ((a * 27.0) * b));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = fma(-9.0, Float64(Float64(z * y) * t), Float64(Float64(a * b) * 27.0)) t_2 = Float64(Float64(z * Float64(9.0 * y)) * t) tmp = 0.0 if (t_2 <= -4e+33) tmp = t_1; elseif (t_2 <= 1e+26) tmp = fma(2.0, x, Float64(Float64(a * 27.0) * b)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(-9.0 * N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * N[(9.0 * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+33], t$95$1, If[LessEqual[t$95$2, 1e+26], N[(2.0 * x + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-9, \left(z \cdot y\right) \cdot t, \left(a \cdot b\right) \cdot 27\right)\\
t_2 := \left(z \cdot \left(9 \cdot y\right)\right) \cdot t\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(2, x, \left(a \cdot 27\right) \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -3.9999999999999998e33 or 1.00000000000000005e26 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 90.9%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6483.9
Applied rewrites83.9%
if -3.9999999999999998e33 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.00000000000000005e26Initial program 99.9%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6496.5
Applied rewrites96.5%
Applied rewrites96.6%
Final simplification90.7%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (* a 27.0) b)) (t_2 (* (* a b) 27.0))) (if (<= t_1 -5e+97) t_2 (if (<= t_1 5e+46) (* x 2.0) t_2))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double t_2 = (a * b) * 27.0;
double tmp;
if (t_1 <= -5e+97) {
tmp = t_2;
} else if (t_1 <= 5e+46) {
tmp = x * 2.0;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (a * 27.0d0) * b
t_2 = (a * b) * 27.0d0
if (t_1 <= (-5d+97)) then
tmp = t_2
else if (t_1 <= 5d+46) then
tmp = x * 2.0d0
else
tmp = t_2
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double t_2 = (a * b) * 27.0;
double tmp;
if (t_1 <= -5e+97) {
tmp = t_2;
} else if (t_1 <= 5e+46) {
tmp = x * 2.0;
} else {
tmp = t_2;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = (a * 27.0) * b t_2 = (a * b) * 27.0 tmp = 0 if t_1 <= -5e+97: tmp = t_2 elif t_1 <= 5e+46: tmp = x * 2.0 else: tmp = t_2 return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * 27.0) * b) t_2 = Float64(Float64(a * b) * 27.0) tmp = 0.0 if (t_1 <= -5e+97) tmp = t_2; elseif (t_1 <= 5e+46) tmp = Float64(x * 2.0); else tmp = t_2; end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (a * 27.0) * b;
t_2 = (a * b) * 27.0;
tmp = 0.0;
if (t_1 <= -5e+97)
tmp = t_2;
elseif (t_1 <= 5e+46)
tmp = x * 2.0;
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] * 27.0), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+97], t$95$2, If[LessEqual[t$95$1, 5e+46], N[(x * 2.0), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
t_2 := \left(a \cdot b\right) \cdot 27\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+97}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+46}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -4.99999999999999999e97 or 5.0000000000000002e46 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) Initial program 92.4%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.3
Applied rewrites78.3%
Applied rewrites78.4%
Applied rewrites78.4%
Taylor expanded in x around 0
Applied rewrites66.2%
if -4.99999999999999999e97 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 5.0000000000000002e46Initial program 97.9%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites96.1%
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6498.0
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6498.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.0
Applied rewrites98.0%
Taylor expanded in x around inf
lower-*.f6449.0
Applied rewrites49.0%
Final simplification56.0%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (* 27.0 b) a (* x 2.0))))
(if (<= z 5e-50)
(fma y (* (* -9.0 z) t) t_1)
(fma (* t y) (* -9.0 z) t_1))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((27.0 * b), a, (x * 2.0));
double tmp;
if (z <= 5e-50) {
tmp = fma(y, ((-9.0 * z) * t), t_1);
} else {
tmp = fma((t * y), (-9.0 * z), t_1);
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = fma(Float64(27.0 * b), a, Float64(x * 2.0)) tmp = 0.0 if (z <= 5e-50) tmp = fma(y, Float64(Float64(-9.0 * z) * t), t_1); else tmp = fma(Float64(t * y), Float64(-9.0 * z), t_1); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(27.0 * b), $MachinePrecision] * a + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 5e-50], N[(y * N[(N[(-9.0 * z), $MachinePrecision] * t), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(t * y), $MachinePrecision] * N[(-9.0 * z), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(27 \cdot b, a, x \cdot 2\right)\\
\mathbf{if}\;z \leq 5 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(y, \left(-9 \cdot z\right) \cdot t, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot y, -9 \cdot z, t\_1\right)\\
\end{array}
\end{array}
if z < 4.99999999999999968e-50Initial program 97.7%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
associate-*l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites96.7%
if 4.99999999999999968e-50 < z Initial program 90.8%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites97.2%
Final simplification96.8%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 4.6e-49) (fma y (* (* -9.0 z) t) (fma (* 27.0 b) a (* x 2.0))) (fma (* 27.0 b) a (fma (* (* -9.0 y) t) z (* x 2.0)))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 4.6e-49) {
tmp = fma(y, ((-9.0 * z) * t), fma((27.0 * b), a, (x * 2.0)));
} else {
tmp = fma((27.0 * b), a, fma(((-9.0 * y) * t), z, (x * 2.0)));
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 4.6e-49) tmp = fma(y, Float64(Float64(-9.0 * z) * t), fma(Float64(27.0 * b), a, Float64(x * 2.0))); else tmp = fma(Float64(27.0 * b), a, fma(Float64(Float64(-9.0 * y) * t), z, Float64(x * 2.0))); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 4.6e-49], N[(y * N[(N[(-9.0 * z), $MachinePrecision] * t), $MachinePrecision] + N[(N[(27.0 * b), $MachinePrecision] * a + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * b), $MachinePrecision] * a + N[(N[(N[(-9.0 * y), $MachinePrecision] * t), $MachinePrecision] * z + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.6 \cdot 10^{-49}:\\
\;\;\;\;\mathsf{fma}\left(y, \left(-9 \cdot z\right) \cdot t, \mathsf{fma}\left(27 \cdot b, a, x \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, \mathsf{fma}\left(\left(-9 \cdot y\right) \cdot t, z, x \cdot 2\right)\right)\\
\end{array}
\end{array}
if z < 4.5999999999999998e-49Initial program 97.7%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
associate-*l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites96.7%
if 4.5999999999999998e-49 < z Initial program 90.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.4
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites97.1%
Final simplification96.8%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 2.65e+57) (fma y (* (* -9.0 z) t) (fma (* 27.0 b) a (* x 2.0))) (fma (* t y) (* -9.0 z) (* (* a b) 27.0))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2.65e+57) {
tmp = fma(y, ((-9.0 * z) * t), fma((27.0 * b), a, (x * 2.0)));
} else {
tmp = fma((t * y), (-9.0 * z), ((a * b) * 27.0));
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 2.65e+57) tmp = fma(y, Float64(Float64(-9.0 * z) * t), fma(Float64(27.0 * b), a, Float64(x * 2.0))); else tmp = fma(Float64(t * y), Float64(-9.0 * z), Float64(Float64(a * b) * 27.0)); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 2.65e+57], N[(y * N[(N[(-9.0 * z), $MachinePrecision] * t), $MachinePrecision] + N[(N[(27.0 * b), $MachinePrecision] * a + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t * y), $MachinePrecision] * N[(-9.0 * z), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.65 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(y, \left(-9 \cdot z\right) \cdot t, \mathsf{fma}\left(27 \cdot b, a, x \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot y, -9 \cdot z, \left(a \cdot b\right) \cdot 27\right)\\
\end{array}
\end{array}
if z < 2.64999999999999993e57Initial program 97.4%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
associate-*l*N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites96.5%
if 2.64999999999999993e57 < z Initial program 89.2%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites98.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.8
Applied rewrites82.8%
Final simplification93.6%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (fma a (* 27.0 b) (* x 2.0)))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return fma(a, (27.0 * b), (x * 2.0));
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return fma(a, Float64(27.0 * b), Float64(x * 2.0)) end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2\right)
\end{array}
Initial program 95.7%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6465.4
Applied rewrites65.4%
Applied rewrites65.4%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (fma 2.0 x (* (* a 27.0) b)))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return fma(2.0, x, ((a * 27.0) * b));
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return fma(2.0, x, Float64(Float64(a * 27.0) * b)) end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(2.0 * x + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(2, x, \left(a \cdot 27\right) \cdot b\right)
\end{array}
Initial program 95.7%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6465.4
Applied rewrites65.4%
Applied rewrites65.5%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (* x 2.0))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * 2.0d0
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return x * 2.0
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = x * 2.0;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
x \cdot 2
\end{array}
Initial program 95.7%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites95.7%
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6495.7
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6495.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.7
Applied rewrites95.7%
Taylor expanded in x around inf
lower-*.f6434.8
Applied rewrites34.8%
Final simplification34.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 2024294
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< y 7590524218811189/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x 2) (* (* (* y 9) z) t)) (* a (* 27 b))) (+ (- (* x 2) (* 9 (* y (* t z)))) (* (* a 27) b))))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))