
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (fma z t (fma y x (* (- c) (* (fma c b a) i)))) 2.0)))
(if (<= c -1.95e-87)
t_1
(if (<= c -4e-288)
(* (- (+ (* x y) (* t z)) (* (* (+ (* b c) a) c) i)) 2.0)
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(z, t, fma(y, x, (-c * (fma(c, b, a) * i)))) * 2.0;
double tmp;
if (c <= -1.95e-87) {
tmp = t_1;
} else if (c <= -4e-288) {
tmp = (((x * y) + (t * z)) - ((((b * c) + a) * c) * i)) * 2.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(fma(z, t, fma(y, x, Float64(Float64(-c) * Float64(fma(c, b, a) * i)))) * 2.0) tmp = 0.0 if (c <= -1.95e-87) tmp = t_1; elseif (c <= -4e-288) tmp = Float64(Float64(Float64(Float64(x * y) + Float64(t * z)) - Float64(Float64(Float64(Float64(b * c) + a) * c) * i)) * 2.0); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(z * t + N[(y * x + N[((-c) * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[c, -1.95e-87], t$95$1, If[LessEqual[c, -4e-288], N[(N[(N[(N[(x * y), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \left(-c\right) \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right)\right) \cdot 2\\
\mathbf{if}\;c \leq -1.95 \cdot 10^{-87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -4 \cdot 10^{-288}:\\
\;\;\;\;\left(\left(x \cdot y + t \cdot z\right) - \left(\left(b \cdot c + a\right) \cdot c\right) \cdot i\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -1.9499999999999999e-87 or -4.00000000000000023e-288 < c Initial program 85.7%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied rewrites97.1%
if -1.9499999999999999e-87 < c < -4.00000000000000023e-288Initial program 99.8%
Final simplification97.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (fma (- i) (* (fma c b a) c) (* x y)) 2.0))
(t_2 (* (* (+ (* b c) a) c) i)))
(if (<= t_2 -1e-6)
t_1
(if (<= t_2 1e+51)
(* (fma y x (* t z)) 2.0)
(if (<= t_2 1e+242) t_1 (* (* (* (fma c b a) i) c) -2.0))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(-i, (fma(c, b, a) * c), (x * y)) * 2.0;
double t_2 = (((b * c) + a) * c) * i;
double tmp;
if (t_2 <= -1e-6) {
tmp = t_1;
} else if (t_2 <= 1e+51) {
tmp = fma(y, x, (t * z)) * 2.0;
} else if (t_2 <= 1e+242) {
tmp = t_1;
} else {
tmp = ((fma(c, b, a) * i) * c) * -2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(fma(Float64(-i), Float64(fma(c, b, a) * c), Float64(x * y)) * 2.0) t_2 = Float64(Float64(Float64(Float64(b * c) + a) * c) * i) tmp = 0.0 if (t_2 <= -1e-6) tmp = t_1; elseif (t_2 <= 1e+51) tmp = Float64(fma(y, x, Float64(t * z)) * 2.0); elseif (t_2 <= 1e+242) tmp = t_1; else tmp = Float64(Float64(Float64(fma(c, b, a) * i) * c) * -2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[((-i) * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-6], t$95$1, If[LessEqual[t$95$2, 1e+51], N[(N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$2, 1e+242], t$95$1, N[(N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision] * -2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, \mathsf{fma}\left(c, b, a\right) \cdot c, x \cdot y\right) \cdot 2\\
t_2 := \left(\left(b \cdot c + a\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right) \cdot 2\\
\mathbf{elif}\;t\_2 \leq 10^{+242}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -9.99999999999999955e-7 or 1e51 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.00000000000000005e242Initial program 89.1%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6481.8
Applied rewrites81.8%
if -9.99999999999999955e-7 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e51Initial program 98.1%
Taylor expanded in c around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6495.7
Applied rewrites95.7%
if 1.00000000000000005e242 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 67.0%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6484.3
Applied rewrites84.3%
Final simplification87.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ (* b c) a) c) i)))
(if (<= t_1 (- INFINITY))
(* (* (* (* c c) i) -2.0) b)
(if (<= t_1 1e+51)
(* (fma y x (* t z)) 2.0)
(if (<= t_1 2e+197)
(* -2.0 (* (* i c) a))
(* (* (* (* i c) c) b) -2.0))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((b * c) + a) * c) * i;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (((c * c) * i) * -2.0) * b;
} else if (t_1 <= 1e+51) {
tmp = fma(y, x, (t * z)) * 2.0;
} else if (t_1 <= 2e+197) {
tmp = -2.0 * ((i * c) * a);
} else {
tmp = (((i * c) * c) * b) * -2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(b * c) + a) * c) * i) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(c * c) * i) * -2.0) * b); elseif (t_1 <= 1e+51) tmp = Float64(fma(y, x, Float64(t * z)) * 2.0); elseif (t_1 <= 2e+197) tmp = Float64(-2.0 * Float64(Float64(i * c) * a)); else tmp = Float64(Float64(Float64(Float64(i * c) * c) * b) * -2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(c * c), $MachinePrecision] * i), $MachinePrecision] * -2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[t$95$1, 1e+51], N[(N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+197], N[(-2.0 * N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(i * c), $MachinePrecision] * c), $MachinePrecision] * b), $MachinePrecision] * -2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(b \cdot c + a\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\left(\left(c \cdot c\right) \cdot i\right) \cdot -2\right) \cdot b\\
\mathbf{elif}\;t\_1 \leq 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right) \cdot 2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+197}:\\
\;\;\;\;-2 \cdot \left(\left(i \cdot c\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(i \cdot c\right) \cdot c\right) \cdot b\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 74.8%
Taylor expanded in c around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.4
Applied rewrites70.4%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e51Initial program 98.5%
Taylor expanded in c around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.2
Applied rewrites87.2%
if 1e51 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.9999999999999999e197Initial program 99.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
if 1.9999999999999999e197 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 70.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6417.1
Applied rewrites17.1%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.4
Applied rewrites57.4%
Applied rewrites64.5%
Final simplification76.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ (* b c) a) c) i)))
(if (<= t_1 (- INFINITY))
(* (* (* (* c c) i) -2.0) b)
(if (<= t_1 1e+51)
(* (fma y x (* t z)) 2.0)
(if (<= t_1 2e+230)
(* -2.0 (* (* i c) a))
(* (* (* -2.0 b) (* i c)) c))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((b * c) + a) * c) * i;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (((c * c) * i) * -2.0) * b;
} else if (t_1 <= 1e+51) {
tmp = fma(y, x, (t * z)) * 2.0;
} else if (t_1 <= 2e+230) {
tmp = -2.0 * ((i * c) * a);
} else {
tmp = ((-2.0 * b) * (i * c)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(b * c) + a) * c) * i) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(c * c) * i) * -2.0) * b); elseif (t_1 <= 1e+51) tmp = Float64(fma(y, x, Float64(t * z)) * 2.0); elseif (t_1 <= 2e+230) tmp = Float64(-2.0 * Float64(Float64(i * c) * a)); else tmp = Float64(Float64(Float64(-2.0 * b) * Float64(i * c)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(c * c), $MachinePrecision] * i), $MachinePrecision] * -2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[t$95$1, 1e+51], N[(N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+230], N[(-2.0 * N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * b), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(b \cdot c + a\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\left(\left(c \cdot c\right) \cdot i\right) \cdot -2\right) \cdot b\\
\mathbf{elif}\;t\_1 \leq 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right) \cdot 2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+230}:\\
\;\;\;\;-2 \cdot \left(\left(i \cdot c\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-2 \cdot b\right) \cdot \left(i \cdot c\right)\right) \cdot c\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 74.8%
Taylor expanded in c around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.4
Applied rewrites70.4%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e51Initial program 98.5%
Taylor expanded in c around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.2
Applied rewrites87.2%
if 1e51 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.0000000000000002e230Initial program 99.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.6
Applied rewrites49.6%
if 2.0000000000000002e230 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 67.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6414.9
Applied rewrites14.9%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.1
Applied rewrites60.1%
Applied rewrites67.9%
Final simplification76.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ (* b c) a) c) i)))
(if (<= t_1 (- INFINITY))
(* (* (* (* c c) b) i) -2.0)
(if (<= t_1 1e+51)
(* (fma y x (* t z)) 2.0)
(if (<= t_1 2e+230)
(* -2.0 (* (* i c) a))
(* (* (* -2.0 b) (* i c)) c))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((b * c) + a) * c) * i;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (((c * c) * b) * i) * -2.0;
} else if (t_1 <= 1e+51) {
tmp = fma(y, x, (t * z)) * 2.0;
} else if (t_1 <= 2e+230) {
tmp = -2.0 * ((i * c) * a);
} else {
tmp = ((-2.0 * b) * (i * c)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(b * c) + a) * c) * i) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(c * c) * b) * i) * -2.0); elseif (t_1 <= 1e+51) tmp = Float64(fma(y, x, Float64(t * z)) * 2.0); elseif (t_1 <= 2e+230) tmp = Float64(-2.0 * Float64(Float64(i * c) * a)); else tmp = Float64(Float64(Float64(-2.0 * b) * Float64(i * c)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(c * c), $MachinePrecision] * b), $MachinePrecision] * i), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$1, 1e+51], N[(N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+230], N[(-2.0 * N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * b), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(b \cdot c + a\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\left(\left(c \cdot c\right) \cdot b\right) \cdot i\right) \cdot -2\\
\mathbf{elif}\;t\_1 \leq 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right) \cdot 2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+230}:\\
\;\;\;\;-2 \cdot \left(\left(i \cdot c\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-2 \cdot b\right) \cdot \left(i \cdot c\right)\right) \cdot c\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 74.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6421.2
Applied rewrites21.2%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.4
Applied rewrites70.4%
Applied rewrites68.4%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e51Initial program 98.5%
Taylor expanded in c around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.2
Applied rewrites87.2%
if 1e51 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.0000000000000002e230Initial program 99.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.6
Applied rewrites49.6%
if 2.0000000000000002e230 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 67.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6414.9
Applied rewrites14.9%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.1
Applied rewrites60.1%
Applied rewrites67.9%
Final simplification76.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (* -2.0 b) (* i c)) c)) (t_2 (* (* (+ (* b c) a) c) i)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 1e+51)
(* (fma y x (* t z)) 2.0)
(if (<= t_2 2e+230) (* -2.0 (* (* i c) a)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((-2.0 * b) * (i * c)) * c;
double t_2 = (((b * c) + a) * c) * i;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+51) {
tmp = fma(y, x, (t * z)) * 2.0;
} else if (t_2 <= 2e+230) {
tmp = -2.0 * ((i * c) * a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(-2.0 * b) * Float64(i * c)) * c) t_2 = Float64(Float64(Float64(Float64(b * c) + a) * c) * i) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+51) tmp = Float64(fma(y, x, Float64(t * z)) * 2.0); elseif (t_2 <= 2e+230) tmp = Float64(-2.0 * Float64(Float64(i * c) * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(-2.0 * b), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+51], N[(N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$2, 2e+230], N[(-2.0 * N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-2 \cdot b\right) \cdot \left(i \cdot c\right)\right) \cdot c\\
t_2 := \left(\left(b \cdot c + a\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right) \cdot 2\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+230}:\\
\;\;\;\;-2 \cdot \left(\left(i \cdot c\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0 or 2.0000000000000002e230 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 70.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6417.7
Applied rewrites17.7%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.7
Applied rewrites64.7%
Applied rewrites67.1%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e51Initial program 98.5%
Taylor expanded in c around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.2
Applied rewrites87.2%
if 1e51 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.0000000000000002e230Initial program 99.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.6
Applied rewrites49.6%
Final simplification75.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ (* b c) a) c) i)))
(if (<= t_1 (- INFINITY))
(* (* -2.0 i) (* (fma b c a) c))
(if (<= t_1 5e+77)
(* (fma z t (fma y x (* (* a i) (- c)))) 2.0)
(* (fma (* (fma b c a) i) (- c) (* x y)) 2.0)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((b * c) + a) * c) * i;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (-2.0 * i) * (fma(b, c, a) * c);
} else if (t_1 <= 5e+77) {
tmp = fma(z, t, fma(y, x, ((a * i) * -c))) * 2.0;
} else {
tmp = fma((fma(b, c, a) * i), -c, (x * y)) * 2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(b * c) + a) * c) * i) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(-2.0 * i) * Float64(fma(b, c, a) * c)); elseif (t_1 <= 5e+77) tmp = Float64(fma(z, t, fma(y, x, Float64(Float64(a * i) * Float64(-c)))) * 2.0); else tmp = Float64(fma(Float64(fma(b, c, a) * i), Float64(-c), Float64(x * y)) * 2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(-2.0 * i), $MachinePrecision] * N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+77], N[(N[(z * t + N[(y * x + N[(N[(a * i), $MachinePrecision] * (-c)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] * (-c) + N[(x * y), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(b \cdot c + a\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(-2 \cdot i\right) \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot c\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \left(a \cdot i\right) \cdot \left(-c\right)\right)\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right) \cdot i, -c, x \cdot y\right) \cdot 2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 74.8%
lift-*.f64N/A
lift--.f64N/A
flip--N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites81.5%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6479.8
Applied rewrites79.8%
Applied rewrites84.2%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000004e77Initial program 98.5%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied rewrites97.1%
Taylor expanded in c around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6490.0
Applied rewrites90.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-*.f6492.7
Applied rewrites92.7%
if 5.00000000000000004e77 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 76.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6418.0
Applied rewrites18.0%
Taylor expanded in t around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6489.0
Applied rewrites89.0%
Final simplification90.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ (* b c) a) c) i)))
(if (<= t_1 -1e-6)
(* (fma (- i) (* (fma c b a) c) (* x y)) 2.0)
(if (<= t_1 1e+51)
(* (fma y x (* t z)) 2.0)
(* (fma (* (fma b c a) i) (- c) (* x y)) 2.0)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((b * c) + a) * c) * i;
double tmp;
if (t_1 <= -1e-6) {
tmp = fma(-i, (fma(c, b, a) * c), (x * y)) * 2.0;
} else if (t_1 <= 1e+51) {
tmp = fma(y, x, (t * z)) * 2.0;
} else {
tmp = fma((fma(b, c, a) * i), -c, (x * y)) * 2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(b * c) + a) * c) * i) tmp = 0.0 if (t_1 <= -1e-6) tmp = Float64(fma(Float64(-i), Float64(fma(c, b, a) * c), Float64(x * y)) * 2.0); elseif (t_1 <= 1e+51) tmp = Float64(fma(y, x, Float64(t * z)) * 2.0); else tmp = Float64(fma(Float64(fma(b, c, a) * i), Float64(-c), Float64(x * y)) * 2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-6], N[(N[((-i) * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$1, 1e+51], N[(N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] * (-c) + N[(x * y), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(b \cdot c + a\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(-i, \mathsf{fma}\left(c, b, a\right) \cdot c, x \cdot y\right) \cdot 2\\
\mathbf{elif}\;t\_1 \leq 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right) \cdot i, -c, x \cdot y\right) \cdot 2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -9.99999999999999955e-7Initial program 85.3%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6477.9
Applied rewrites77.9%
if -9.99999999999999955e-7 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e51Initial program 98.1%
Taylor expanded in c around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6495.7
Applied rewrites95.7%
if 1e51 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6417.0
Applied rewrites17.0%
Taylor expanded in t around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6487.3
Applied rewrites87.3%
Final simplification88.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ (* b c) a) c) i)))
(if (<= t_1 -4e+248)
(* (* -2.0 i) (* (fma b c a) c))
(if (<= t_1 1e+51)
(* (fma y x (* t z)) 2.0)
(* (* (* (fma c b a) i) c) -2.0)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((b * c) + a) * c) * i;
double tmp;
if (t_1 <= -4e+248) {
tmp = (-2.0 * i) * (fma(b, c, a) * c);
} else if (t_1 <= 1e+51) {
tmp = fma(y, x, (t * z)) * 2.0;
} else {
tmp = ((fma(c, b, a) * i) * c) * -2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(b * c) + a) * c) * i) tmp = 0.0 if (t_1 <= -4e+248) tmp = Float64(Float64(-2.0 * i) * Float64(fma(b, c, a) * c)); elseif (t_1 <= 1e+51) tmp = Float64(fma(y, x, Float64(t * z)) * 2.0); else tmp = Float64(Float64(Float64(fma(c, b, a) * i) * c) * -2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+248], N[(N[(-2.0 * i), $MachinePrecision] * N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+51], N[(N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision] * -2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(b \cdot c + a\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+248}:\\
\;\;\;\;\left(-2 \cdot i\right) \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot c\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.00000000000000018e248Initial program 76.9%
lift-*.f64N/A
lift--.f64N/A
flip--N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites83.1%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6477.8
Applied rewrites77.8%
Applied rewrites81.7%
if -4.00000000000000018e248 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e51Initial program 98.5%
Taylor expanded in c around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.1
Applied rewrites89.1%
if 1e51 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.1%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6475.2
Applied rewrites75.2%
Final simplification83.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (* (fma c b a) i) c) -2.0)) (t_2 (* (* (+ (* b c) a) c) i)))
(if (<= t_2 -5e+212)
t_1
(if (<= t_2 1e+51) (* (fma y x (* t z)) 2.0) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((fma(c, b, a) * i) * c) * -2.0;
double t_2 = (((b * c) + a) * c) * i;
double tmp;
if (t_2 <= -5e+212) {
tmp = t_1;
} else if (t_2 <= 1e+51) {
tmp = fma(y, x, (t * z)) * 2.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(fma(c, b, a) * i) * c) * -2.0) t_2 = Float64(Float64(Float64(Float64(b * c) + a) * c) * i) tmp = 0.0 if (t_2 <= -5e+212) tmp = t_1; elseif (t_2 <= 1e+51) tmp = Float64(fma(y, x, Float64(t * z)) * 2.0); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision] * -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+212], t$95$1, If[LessEqual[t$95$2, 1e+51], N[(N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \cdot -2\\
t_2 := \left(\left(b \cdot c + a\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+212}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.99999999999999992e212 or 1e51 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.2%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6476.0
Applied rewrites76.0%
if -4.99999999999999992e212 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e51Initial program 98.4%
Taylor expanded in c around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.6
Applied rewrites89.6%
Final simplification82.7%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= c -1.6e+83)
(* (fma z t (fma y x (* (* (* i c) b) (- c)))) 2.0)
(if (<= c 5000000.0)
(* (- (+ (* x y) (* t z)) (* (* i c) a)) 2.0)
(* (fma (* (fma b c a) i) (- c) (* x y)) 2.0))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (c <= -1.6e+83) {
tmp = fma(z, t, fma(y, x, (((i * c) * b) * -c))) * 2.0;
} else if (c <= 5000000.0) {
tmp = (((x * y) + (t * z)) - ((i * c) * a)) * 2.0;
} else {
tmp = fma((fma(b, c, a) * i), -c, (x * y)) * 2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (c <= -1.6e+83) tmp = Float64(fma(z, t, fma(y, x, Float64(Float64(Float64(i * c) * b) * Float64(-c)))) * 2.0); elseif (c <= 5000000.0) tmp = Float64(Float64(Float64(Float64(x * y) + Float64(t * z)) - Float64(Float64(i * c) * a)) * 2.0); else tmp = Float64(fma(Float64(fma(b, c, a) * i), Float64(-c), Float64(x * y)) * 2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[c, -1.6e+83], N[(N[(z * t + N[(y * x + N[(N[(N[(i * c), $MachinePrecision] * b), $MachinePrecision] * (-c)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[c, 5000000.0], N[(N[(N[(N[(x * y), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] * (-c) + N[(x * y), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.6 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \left(\left(i \cdot c\right) \cdot b\right) \cdot \left(-c\right)\right)\right) \cdot 2\\
\mathbf{elif}\;c \leq 5000000:\\
\;\;\;\;\left(\left(x \cdot y + t \cdot z\right) - \left(i \cdot c\right) \cdot a\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right) \cdot i, -c, x \cdot y\right) \cdot 2\\
\end{array}
\end{array}
if c < -1.5999999999999999e83Initial program 70.2%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied rewrites95.4%
Taylor expanded in c around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6495.3
Applied rewrites95.3%
if -1.5999999999999999e83 < c < 5e6Initial program 97.2%
Taylor expanded in c around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6491.3
Applied rewrites91.3%
if 5e6 < c Initial program 80.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6434.2
Applied rewrites34.2%
Taylor expanded in t around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6485.9
Applied rewrites85.9%
Final simplification90.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* (* (+ (* b c) a) c) i) 1e+51) (* (fma y x (* t z)) 2.0) (* -2.0 (* (* i c) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((b * c) + a) * c) * i) <= 1e+51) {
tmp = fma(y, x, (t * z)) * 2.0;
} else {
tmp = -2.0 * ((i * c) * a);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(b * c) + a) * c) * i) <= 1e+51) tmp = Float64(fma(y, x, Float64(t * z)) * 2.0); else tmp = Float64(-2.0 * Float64(Float64(i * c) * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(N[(N[(b * c), $MachinePrecision] + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision], 1e+51], N[(N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(-2.0 * N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(b \cdot c + a\right) \cdot c\right) \cdot i \leq 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(\left(i \cdot c\right) \cdot a\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e51Initial program 92.8%
Taylor expanded in c around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6475.0
Applied rewrites75.0%
if 1e51 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6442.9
Applied rewrites42.9%
Final simplification65.1%
(FPCore (x y z t a b c i) :precision binary64 (* (fma z t (fma y x (* (- c) (* (fma c b a) i)))) 2.0))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(z, t, fma(y, x, (-c * (fma(c, b, a) * i)))) * 2.0;
}
function code(x, y, z, t, a, b, c, i) return Float64(fma(z, t, fma(y, x, Float64(Float64(-c) * Float64(fma(c, b, a) * i)))) * 2.0) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(z * t + N[(y * x + N[((-c) * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \left(-c\right) \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right)\right) \cdot 2
\end{array}
Initial program 88.2%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied rewrites94.2%
Final simplification94.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* t z) 2.0)))
(if (<= (* t z) -1.2e+50)
t_1
(if (<= (* t z) 1.36e+75) (* (* x y) 2.0) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (t * z) * 2.0;
double tmp;
if ((t * z) <= -1.2e+50) {
tmp = t_1;
} else if ((t * z) <= 1.36e+75) {
tmp = (x * y) * 2.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (t * z) * 2.0d0
if ((t * z) <= (-1.2d+50)) then
tmp = t_1
else if ((t * z) <= 1.36d+75) then
tmp = (x * y) * 2.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (t * z) * 2.0;
double tmp;
if ((t * z) <= -1.2e+50) {
tmp = t_1;
} else if ((t * z) <= 1.36e+75) {
tmp = (x * y) * 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (t * z) * 2.0 tmp = 0 if (t * z) <= -1.2e+50: tmp = t_1 elif (t * z) <= 1.36e+75: tmp = (x * y) * 2.0 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(t * z) * 2.0) tmp = 0.0 if (Float64(t * z) <= -1.2e+50) tmp = t_1; elseif (Float64(t * z) <= 1.36e+75) tmp = Float64(Float64(x * y) * 2.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (t * z) * 2.0; tmp = 0.0; if ((t * z) <= -1.2e+50) tmp = t_1; elseif ((t * z) <= 1.36e+75) tmp = (x * y) * 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(t * z), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -1.2e+50], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 1.36e+75], N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t \cdot z\right) \cdot 2\\
\mathbf{if}\;t \cdot z \leq -1.2 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 1.36 \cdot 10^{+75}:\\
\;\;\;\;\left(x \cdot y\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.2000000000000001e50 or 1.36e75 < (*.f64 z t) Initial program 88.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6463.7
Applied rewrites63.7%
if -1.2000000000000001e50 < (*.f64 z t) < 1.36e75Initial program 88.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6446.8
Applied rewrites46.8%
Final simplification53.0%
(FPCore (x y z t a b c i) :precision binary64 (* (* x y) 2.0))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (x * y) * 2.0;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = (x * y) * 2.0d0
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (x * y) * 2.0;
}
def code(x, y, z, t, a, b, c, i): return (x * y) * 2.0
function code(x, y, z, t, a, b, c, i) return Float64(Float64(x * y) * 2.0) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (x * y) * 2.0; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y\right) \cdot 2
\end{array}
Initial program 88.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6435.8
Applied rewrites35.8%
Final simplification35.8%
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(a + Float64(b * c)) * Float64(c * i)))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)
\end{array}
herbie shell --seed 2024268
(FPCore (x y z t a b c i)
:name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(! :herbie-platform default (* 2 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i)))))
(* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))