
(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 16 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. (FPCore (x y z t a b) :precision binary64 (if (<= t 2.1e-116) (fma (* t y) (* -9.0 z) (+ (fma (* a 27.0) b x) x)) (+ x (- x (fma (* -27.0 a) b (* t (* z (* 9.0 y))))))))
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 (t <= 2.1e-116) {
tmp = fma((t * y), (-9.0 * z), (fma((a * 27.0), b, x) + x));
} else {
tmp = x + (x - fma((-27.0 * a), b, (t * (z * (9.0 * y)))));
}
return tmp;
}
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 (t <= 2.1e-116) tmp = fma(Float64(t * y), Float64(-9.0 * z), Float64(fma(Float64(a * 27.0), b, x) + x)); else tmp = Float64(x + Float64(x - fma(Float64(-27.0 * a), b, Float64(t * Float64(z * Float64(9.0 * y)))))); end return tmp end
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[t, 2.1e-116], N[(N[(t * y), $MachinePrecision] * N[(-9.0 * z), $MachinePrecision] + N[(N[(N[(a * 27.0), $MachinePrecision] * b + x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + N[(x - N[(N[(-27.0 * a), $MachinePrecision] * b + N[(t * N[(z * N[(9.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.1 \cdot 10^{-116}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot y, -9 \cdot z, \mathsf{fma}\left(a \cdot 27, b, x\right) + x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(x - \mathsf{fma}\left(-27 \cdot a, b, t \cdot \left(z \cdot \left(9 \cdot y\right)\right)\right)\right)\\
\end{array}
\end{array}
if t < 2.0999999999999999e-116Initial program 96.1%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites96.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6496.2
Applied rewrites96.2%
lift-fma.f64N/A
lift-+.f64N/A
associate-+r+N/A
lower-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6496.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.8
Applied rewrites96.8%
if 2.0999999999999999e-116 < t Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
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 (* (* (* y 9.0) z) t)))
(if (or (<= t_1 -1e+82) (not (<= t_1 4e-110)))
(+ x (fma -9.0 (* (* y t) z) x))
(+ (fma (* 27.0 b) a x) x))))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 = ((y * 9.0) * z) * t;
double tmp;
if ((t_1 <= -1e+82) || !(t_1 <= 4e-110)) {
tmp = x + fma(-9.0, ((y * t) * z), x);
} else {
tmp = fma((27.0 * b), a, x) + x;
}
return tmp;
}
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(Float64(y * 9.0) * z) * t) tmp = 0.0 if ((t_1 <= -1e+82) || !(t_1 <= 4e-110)) tmp = Float64(x + fma(-9.0, Float64(Float64(y * t) * z), x)); else tmp = Float64(fma(Float64(27.0 * b), a, x) + x); end return tmp end
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[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+82], N[Not[LessEqual[t$95$1, 4e-110]], $MachinePrecision]], N[(x + N[(-9.0 * N[(N[(y * t), $MachinePrecision] * z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(27.0 * b), $MachinePrecision] * a + x), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+82} \lor \neg \left(t\_1 \leq 4 \cdot 10^{-110}\right):\\
\;\;\;\;x + \mathsf{fma}\left(-9, \left(y \cdot t\right) \cdot z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x\right) + x\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.9999999999999996e81 or 4.0000000000000002e-110 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 95.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval96.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.9
Applied rewrites96.9%
Taylor expanded in a around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6485.4
Applied rewrites85.4%
Applied rewrites80.1%
if -9.9999999999999996e81 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 4.0000000000000002e-110Initial program 99.8%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6494.9
Applied rewrites94.9%
Applied rewrites94.9%
Final simplification87.1%
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 (* (* (* y 9.0) z) t)))
(if (<= t_1 -5e+33)
(fma -9.0 (* (* z y) t) (* (* b a) 27.0))
(if (<= t_1 4e-110)
(+ (fma (* 27.0 b) a x) x)
(+ x (fma -9.0 (* (* y t) z) x))))))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 = ((y * 9.0) * z) * t;
double tmp;
if (t_1 <= -5e+33) {
tmp = fma(-9.0, ((z * y) * t), ((b * a) * 27.0));
} else if (t_1 <= 4e-110) {
tmp = fma((27.0 * b), a, x) + x;
} else {
tmp = x + fma(-9.0, ((y * t) * z), x);
}
return tmp;
}
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(Float64(y * 9.0) * z) * t) tmp = 0.0 if (t_1 <= -5e+33) tmp = fma(-9.0, Float64(Float64(z * y) * t), Float64(Float64(b * a) * 27.0)); elseif (t_1 <= 4e-110) tmp = Float64(fma(Float64(27.0 * b), a, x) + x); else tmp = Float64(x + fma(-9.0, Float64(Float64(y * t) * z), x)); end return tmp end
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[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+33], N[(-9.0 * N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] + N[(N[(b * a), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-110], N[(N[(N[(27.0 * b), $MachinePrecision] * a + x), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(-9.0 * N[(N[(y * t), $MachinePrecision] * z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(-9, \left(z \cdot y\right) \cdot t, \left(b \cdot a\right) \cdot 27\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-110}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x\right) + x\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(-9, \left(y \cdot t\right) \cdot z, x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -4.99999999999999973e33Initial program 96.9%
Taylor expanded in x around 0
fp-cancel-sub-sign-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-*.f6484.8
Applied rewrites84.8%
if -4.99999999999999973e33 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 4.0000000000000002e-110Initial program 99.8%
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.5%
if 4.0000000000000002e-110 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval97.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.2
Applied rewrites97.2%
Taylor expanded in a around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.0
Applied rewrites82.0%
Applied rewrites78.6%
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 (* (* (* y 9.0) z) t)))
(if (<= t_1 -1e+82)
(+ x (fma -9.0 (* (* y z) t) x))
(if (<= t_1 4e-110)
(+ (fma (* 27.0 b) a x) x)
(+ x (fma -9.0 (* (* y t) z) x))))))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 = ((y * 9.0) * z) * t;
double tmp;
if (t_1 <= -1e+82) {
tmp = x + fma(-9.0, ((y * z) * t), x);
} else if (t_1 <= 4e-110) {
tmp = fma((27.0 * b), a, x) + x;
} else {
tmp = x + fma(-9.0, ((y * t) * z), x);
}
return tmp;
}
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(Float64(y * 9.0) * z) * t) tmp = 0.0 if (t_1 <= -1e+82) tmp = Float64(x + fma(-9.0, Float64(Float64(y * z) * t), x)); elseif (t_1 <= 4e-110) tmp = Float64(fma(Float64(27.0 * b), a, x) + x); else tmp = Float64(x + fma(-9.0, Float64(Float64(y * t) * z), x)); end return tmp end
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[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+82], N[(x + N[(-9.0 * N[(N[(y * z), $MachinePrecision] * t), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-110], N[(N[(N[(27.0 * b), $MachinePrecision] * a + x), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(-9.0 * N[(N[(y * t), $MachinePrecision] * z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+82}:\\
\;\;\;\;x + \mathsf{fma}\left(-9, \left(y \cdot z\right) \cdot t, x\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-110}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x\right) + x\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(-9, \left(y \cdot t\right) \cdot z, x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.9999999999999996e81Initial program 96.5%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval96.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.5
Applied rewrites96.5%
Taylor expanded in a around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6490.0
Applied rewrites90.0%
if -9.9999999999999996e81 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 4.0000000000000002e-110Initial program 99.8%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6494.9
Applied rewrites94.9%
Applied rewrites94.9%
if 4.0000000000000002e-110 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval97.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.2
Applied rewrites97.2%
Taylor expanded in a around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.0
Applied rewrites82.0%
Applied rewrites78.6%
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 (* (* (* y 9.0) z) t)))
(if (or (<= t_1 -2e+116) (not (<= t_1 4e+123)))
(+ x (* (* (* z y) t) -9.0))
(fma 2.0 x (* (* b a) 27.0)))))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 = ((y * 9.0) * z) * t;
double tmp;
if ((t_1 <= -2e+116) || !(t_1 <= 4e+123)) {
tmp = x + (((z * y) * t) * -9.0);
} else {
tmp = fma(2.0, x, ((b * a) * 27.0));
}
return tmp;
}
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(Float64(y * 9.0) * z) * t) tmp = 0.0 if ((t_1 <= -2e+116) || !(t_1 <= 4e+123)) tmp = Float64(x + Float64(Float64(Float64(z * y) * t) * -9.0)); else tmp = fma(2.0, x, Float64(Float64(b * a) * 27.0)); end return tmp end
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[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+116], N[Not[LessEqual[t$95$1, 4e+123]], $MachinePrecision]], N[(x + N[(N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision], N[(2.0 * x + N[(N[(b * a), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+116} \lor \neg \left(t\_1 \leq 4 \cdot 10^{+123}\right):\\
\;\;\;\;x + \left(\left(z \cdot y\right) \cdot t\right) \cdot -9\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, x, \left(b \cdot a\right) \cdot 27\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -2.00000000000000003e116 or 3.99999999999999991e123 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 93.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval95.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
Taylor expanded in a around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6490.2
Applied rewrites90.2%
Taylor expanded in x around 0
Applied rewrites83.6%
if -2.00000000000000003e116 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 3.99999999999999991e123Initial program 99.7%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6486.5
Applied rewrites86.5%
Final simplification85.4%
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 (* (* (* y 9.0) z) t)))
(if (or (<= t_1 -5e+145) (not (<= t_1 4e+123)))
(* (* (* z y) t) -9.0)
(fma 2.0 x (* (* b a) 27.0)))))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 = ((y * 9.0) * z) * t;
double tmp;
if ((t_1 <= -5e+145) || !(t_1 <= 4e+123)) {
tmp = ((z * y) * t) * -9.0;
} else {
tmp = fma(2.0, x, ((b * a) * 27.0));
}
return tmp;
}
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(Float64(y * 9.0) * z) * t) tmp = 0.0 if ((t_1 <= -5e+145) || !(t_1 <= 4e+123)) tmp = Float64(Float64(Float64(z * y) * t) * -9.0); else tmp = fma(2.0, x, Float64(Float64(b * a) * 27.0)); end return tmp end
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[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+145], N[Not[LessEqual[t$95$1, 4e+123]], $MachinePrecision]], N[(N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] * -9.0), $MachinePrecision], N[(2.0 * x + N[(N[(b * a), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+145} \lor \neg \left(t\_1 \leq 4 \cdot 10^{+123}\right):\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot t\right) \cdot -9\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, x, \left(b \cdot a\right) \cdot 27\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -4.99999999999999967e145 or 3.99999999999999991e123 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 93.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites89.9%
lift-*.f64N/A
count-2-revN/A
lower-+.f6489.9
Applied rewrites89.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6483.7
Applied rewrites83.7%
if -4.99999999999999967e145 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 3.99999999999999991e123Initial program 99.7%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6485.6
Applied rewrites85.6%
Final simplification84.9%
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 (* (* y 9.0) z)))
(if (<= t_1 -4e-42)
(+ (* (* (* -9.0 z) y) t) (* (* a 27.0) b))
(if (<= t_1 2e-23)
(+ (fma (* 27.0 b) a x) x)
(fma (* 27.0 a) b (* (* (* -9.0 y) t) z))))))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 = (y * 9.0) * z;
double tmp;
if (t_1 <= -4e-42) {
tmp = (((-9.0 * z) * y) * t) + ((a * 27.0) * b);
} else if (t_1 <= 2e-23) {
tmp = fma((27.0 * b), a, x) + x;
} else {
tmp = fma((27.0 * a), b, (((-9.0 * y) * t) * z));
}
return tmp;
}
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(y * 9.0) * z) tmp = 0.0 if (t_1 <= -4e-42) tmp = Float64(Float64(Float64(Float64(-9.0 * z) * y) * t) + Float64(Float64(a * 27.0) * b)); elseif (t_1 <= 2e-23) tmp = Float64(fma(Float64(27.0 * b), a, x) + x); else tmp = fma(Float64(27.0 * a), b, Float64(Float64(Float64(-9.0 * y) * t) * z)); end return tmp end
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[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-42], N[(N[(N[(N[(-9.0 * z), $MachinePrecision] * y), $MachinePrecision] * t), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-23], N[(N[(N[(27.0 * b), $MachinePrecision] * a + x), $MachinePrecision] + x), $MachinePrecision], N[(N[(27.0 * a), $MachinePrecision] * b + N[(N[(N[(-9.0 * y), $MachinePrecision] * t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(y \cdot 9\right) \cdot z\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\left(\left(-9 \cdot z\right) \cdot y\right) \cdot t + \left(a \cdot 27\right) \cdot b\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot a, b, \left(\left(-9 \cdot y\right) \cdot t\right) \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < -4.00000000000000015e-42Initial program 97.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6474.5
Applied rewrites74.5%
Applied rewrites74.5%
if -4.00000000000000015e-42 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 1.99999999999999992e-23Initial program 99.8%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6489.9
Applied rewrites89.9%
Applied rewrites89.9%
if 1.99999999999999992e-23 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) Initial program 94.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6482.9
Applied rewrites82.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6482.9
lift-*.f64N/A
*-commutativeN/A
lift-*.f6482.9
Applied rewrites80.4%
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 (* (* y 9.0) z)))
(if (<= t_1 -4e-42)
(+ (* (* -9.0 (* z y)) t) (* (* a 27.0) b))
(if (<= t_1 2e-23)
(+ (fma (* 27.0 b) a x) x)
(fma (* 27.0 a) b (* (* (* -9.0 y) t) z))))))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 = (y * 9.0) * z;
double tmp;
if (t_1 <= -4e-42) {
tmp = ((-9.0 * (z * y)) * t) + ((a * 27.0) * b);
} else if (t_1 <= 2e-23) {
tmp = fma((27.0 * b), a, x) + x;
} else {
tmp = fma((27.0 * a), b, (((-9.0 * y) * t) * z));
}
return tmp;
}
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(y * 9.0) * z) tmp = 0.0 if (t_1 <= -4e-42) tmp = Float64(Float64(Float64(-9.0 * Float64(z * y)) * t) + Float64(Float64(a * 27.0) * b)); elseif (t_1 <= 2e-23) tmp = Float64(fma(Float64(27.0 * b), a, x) + x); else tmp = fma(Float64(27.0 * a), b, Float64(Float64(Float64(-9.0 * y) * t) * z)); end return tmp end
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[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-42], N[(N[(N[(-9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-23], N[(N[(N[(27.0 * b), $MachinePrecision] * a + x), $MachinePrecision] + x), $MachinePrecision], N[(N[(27.0 * a), $MachinePrecision] * b + N[(N[(N[(-9.0 * y), $MachinePrecision] * t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(y \cdot 9\right) \cdot z\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\left(-9 \cdot \left(z \cdot y\right)\right) \cdot t + \left(a \cdot 27\right) \cdot b\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot a, b, \left(\left(-9 \cdot y\right) \cdot t\right) \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < -4.00000000000000015e-42Initial program 97.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6474.5
Applied rewrites74.5%
if -4.00000000000000015e-42 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 1.99999999999999992e-23Initial program 99.8%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6489.9
Applied rewrites89.9%
Applied rewrites89.9%
if 1.99999999999999992e-23 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) Initial program 94.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6482.9
Applied rewrites82.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6482.9
lift-*.f64N/A
*-commutativeN/A
lift-*.f6482.9
Applied rewrites80.4%
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 (* (* y 9.0) z)))
(if (<= t_1 -4e-42)
(fma -9.0 (* (* z y) t) (* (* b a) 27.0))
(if (<= t_1 2e-23)
(+ (fma (* 27.0 b) a x) x)
(fma (* 27.0 a) b (* (* (* -9.0 y) t) z))))))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 = (y * 9.0) * z;
double tmp;
if (t_1 <= -4e-42) {
tmp = fma(-9.0, ((z * y) * t), ((b * a) * 27.0));
} else if (t_1 <= 2e-23) {
tmp = fma((27.0 * b), a, x) + x;
} else {
tmp = fma((27.0 * a), b, (((-9.0 * y) * t) * z));
}
return tmp;
}
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(y * 9.0) * z) tmp = 0.0 if (t_1 <= -4e-42) tmp = fma(-9.0, Float64(Float64(z * y) * t), Float64(Float64(b * a) * 27.0)); elseif (t_1 <= 2e-23) tmp = Float64(fma(Float64(27.0 * b), a, x) + x); else tmp = fma(Float64(27.0 * a), b, Float64(Float64(Float64(-9.0 * y) * t) * z)); end return tmp end
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[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-42], N[(-9.0 * N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] + N[(N[(b * a), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-23], N[(N[(N[(27.0 * b), $MachinePrecision] * a + x), $MachinePrecision] + x), $MachinePrecision], N[(N[(27.0 * a), $MachinePrecision] * b + N[(N[(N[(-9.0 * y), $MachinePrecision] * t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(y \cdot 9\right) \cdot z\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\mathsf{fma}\left(-9, \left(z \cdot y\right) \cdot t, \left(b \cdot a\right) \cdot 27\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot a, b, \left(\left(-9 \cdot y\right) \cdot t\right) \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < -4.00000000000000015e-42Initial program 97.2%
Taylor expanded in x around 0
fp-cancel-sub-sign-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-*.f6474.5
Applied rewrites74.5%
if -4.00000000000000015e-42 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 1.99999999999999992e-23Initial program 99.8%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6489.9
Applied rewrites89.9%
Applied rewrites89.9%
if 1.99999999999999992e-23 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) Initial program 94.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6482.9
Applied rewrites82.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6482.9
lift-*.f64N/A
*-commutativeN/A
lift-*.f6482.9
Applied rewrites80.4%
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 (* (* (* y 9.0) z) t)))
(if (or (<= t_1 -5e+145) (not (<= t_1 4e+123)))
(* (* (* z y) t) -9.0)
(fma (* 27.0 a) b (+ x x)))))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 = ((y * 9.0) * z) * t;
double tmp;
if ((t_1 <= -5e+145) || !(t_1 <= 4e+123)) {
tmp = ((z * y) * t) * -9.0;
} else {
tmp = fma((27.0 * a), b, (x + x));
}
return tmp;
}
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(Float64(y * 9.0) * z) * t) tmp = 0.0 if ((t_1 <= -5e+145) || !(t_1 <= 4e+123)) tmp = Float64(Float64(Float64(z * y) * t) * -9.0); else tmp = fma(Float64(27.0 * a), b, Float64(x + x)); end return tmp end
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[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+145], N[Not[LessEqual[t$95$1, 4e+123]], $MachinePrecision]], N[(N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] * -9.0), $MachinePrecision], N[(N[(27.0 * a), $MachinePrecision] * b + N[(x + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+145} \lor \neg \left(t\_1 \leq 4 \cdot 10^{+123}\right):\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot t\right) \cdot -9\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot a, b, x + x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -4.99999999999999967e145 or 3.99999999999999991e123 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 93.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites89.9%
lift-*.f64N/A
count-2-revN/A
lower-+.f6489.9
Applied rewrites89.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6483.7
Applied rewrites83.7%
if -4.99999999999999967e145 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 3.99999999999999991e123Initial program 99.7%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6485.6
Applied rewrites85.6%
Applied rewrites85.6%
Applied rewrites85.6%
Final simplification84.9%
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 (* t y) (* -9.0 z) (+ (fma (* a 27.0) b x) x)))
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((t * y), (-9.0 * z), (fma((a * 27.0), b, x) + x));
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return fma(Float64(t * y), Float64(-9.0 * z), Float64(fma(Float64(a * 27.0), b, x) + x)) end
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[(N[(t * y), $MachinePrecision] * N[(-9.0 * z), $MachinePrecision] + N[(N[(N[(a * 27.0), $MachinePrecision] * b + x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(t \cdot y, -9 \cdot z, \mathsf{fma}\left(a \cdot 27, b, x\right) + x\right)
\end{array}
Initial program 97.5%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.3%
lift-*.f64N/A
count-2-revN/A
lower-+.f6494.3
Applied rewrites94.3%
lift-fma.f64N/A
lift-+.f64N/A
associate-+r+N/A
lower-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6494.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6494.6
Applied rewrites94.6%
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 (or (<= x -7.2e+26) (not (<= x 1.9e+76))) (* 2.0 x) (* (* a 27.0) 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 ((x <= -7.2e+26) || !(x <= 1.9e+76)) {
tmp = 2.0 * x;
} else {
tmp = (a * 27.0) * b;
}
return tmp;
}
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) :: tmp
if ((x <= (-7.2d+26)) .or. (.not. (x <= 1.9d+76))) then
tmp = 2.0d0 * x
else
tmp = (a * 27.0d0) * b
end if
code = tmp
end function
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 tmp;
if ((x <= -7.2e+26) || !(x <= 1.9e+76)) {
tmp = 2.0 * x;
} else {
tmp = (a * 27.0) * b;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (x <= -7.2e+26) or not (x <= 1.9e+76): tmp = 2.0 * x else: tmp = (a * 27.0) * b return tmp
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 ((x <= -7.2e+26) || !(x <= 1.9e+76)) tmp = Float64(2.0 * x); else tmp = Float64(Float64(a * 27.0) * b); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((x <= -7.2e+26) || ~((x <= 1.9e+76)))
tmp = 2.0 * x;
else
tmp = (a * 27.0) * b;
end
tmp_2 = tmp;
end
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[Or[LessEqual[x, -7.2e+26], N[Not[LessEqual[x, 1.9e+76]], $MachinePrecision]], N[(2.0 * x), $MachinePrecision], N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+26} \lor \neg \left(x \leq 1.9 \cdot 10^{+76}\right):\\
\;\;\;\;2 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
if x < -7.20000000000000048e26 or 1.90000000000000012e76 < x Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.5
Applied rewrites77.5%
Taylor expanded in x around inf
Applied rewrites77.5%
Taylor expanded in x around inf
Applied rewrites58.8%
if -7.20000000000000048e26 < x < 1.90000000000000012e76Initial program 99.0%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.1
Applied rewrites49.1%
Taylor expanded in x around 0
Applied rewrites43.0%
Applied rewrites43.0%
Final simplification49.7%
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 (or (<= x -7.2e+26) (not (<= x 1.9e+76))) (* 2.0 x) (* (* 27.0 b) a)))
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 ((x <= -7.2e+26) || !(x <= 1.9e+76)) {
tmp = 2.0 * x;
} else {
tmp = (27.0 * b) * a;
}
return tmp;
}
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) :: tmp
if ((x <= (-7.2d+26)) .or. (.not. (x <= 1.9d+76))) then
tmp = 2.0d0 * x
else
tmp = (27.0d0 * b) * a
end if
code = tmp
end function
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 tmp;
if ((x <= -7.2e+26) || !(x <= 1.9e+76)) {
tmp = 2.0 * x;
} else {
tmp = (27.0 * b) * a;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (x <= -7.2e+26) or not (x <= 1.9e+76): tmp = 2.0 * x else: tmp = (27.0 * b) * a return tmp
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 ((x <= -7.2e+26) || !(x <= 1.9e+76)) tmp = Float64(2.0 * x); else tmp = Float64(Float64(27.0 * b) * a); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((x <= -7.2e+26) || ~((x <= 1.9e+76)))
tmp = 2.0 * x;
else
tmp = (27.0 * b) * a;
end
tmp_2 = tmp;
end
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[Or[LessEqual[x, -7.2e+26], N[Not[LessEqual[x, 1.9e+76]], $MachinePrecision]], N[(2.0 * x), $MachinePrecision], N[(N[(27.0 * b), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+26} \lor \neg \left(x \leq 1.9 \cdot 10^{+76}\right):\\
\;\;\;\;2 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(27 \cdot b\right) \cdot a\\
\end{array}
\end{array}
if x < -7.20000000000000048e26 or 1.90000000000000012e76 < x Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.5
Applied rewrites77.5%
Taylor expanded in x around inf
Applied rewrites77.5%
Taylor expanded in x around inf
Applied rewrites58.8%
if -7.20000000000000048e26 < x < 1.90000000000000012e76Initial program 99.0%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.1
Applied rewrites49.1%
Taylor expanded in x around 0
Applied rewrites43.0%
Applied rewrites42.4%
Final simplification49.4%
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 (* 27.0 a) b (+ x x)))
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((27.0 * a), b, (x + x));
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return fma(Float64(27.0 * a), b, Float64(x + x)) end
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[(N[(27.0 * a), $MachinePrecision] * b + N[(x + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(27 \cdot a, b, x + x\right)
\end{array}
Initial program 97.5%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6461.2
Applied rewrites61.2%
Applied rewrites61.2%
Applied rewrites61.2%
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 (* 27.0 b) a x) x))
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((27.0 * b), a, x) + x;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(fma(Float64(27.0 * b), a, x) + x) end
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[(N[(N[(27.0 * b), $MachinePrecision] * a + x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(27 \cdot b, a, x\right) + x
\end{array}
Initial program 97.5%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6461.2
Applied rewrites61.2%
Applied rewrites60.9%
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 (* 2.0 x))
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 2.0 * x;
}
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 = 2.0d0 * x
end function
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 2.0 * x;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return 2.0 * x
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(2.0 * x) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = 2.0 * x;
end
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), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
2 \cdot x
\end{array}
Initial program 97.5%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6461.2
Applied rewrites61.2%
Taylor expanded in x around inf
Applied rewrites58.8%
Taylor expanded in x around inf
Applied rewrites29.6%
(FPCore (x y z t a b) :precision binary64 (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y < 7.590524218811189d-161) then
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y < 7.590524218811189e-161: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y < 7.590524218811189e-161) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y < 7.590524218811189e-161) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)); else tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
herbie shell --seed 2024337
(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)))