
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
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
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
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
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
(FPCore (x y z t a b c) :precision binary64 (+ (fma (* t 0.0625) z (fma x y (* (* a b) -0.25))) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma((t * 0.0625), z, fma(x, y, ((a * b) * -0.25))) + c;
}
function code(x, y, z, t, a, b, c) return Float64(fma(Float64(t * 0.0625), z, fma(x, y, Float64(Float64(a * b) * -0.25))) + c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(t \cdot 0.0625, z, \mathsf{fma}\left(x, y, \left(a \cdot b\right) \cdot -0.25\right)\right) + c
\end{array}
Initial program 97.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sub-negN/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
div-invN/A
Applied egg-rr98.4%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma (* t 0.0625) z (* x y))) (t_2 (+ (* x y) (/ (* t z) 16.0)))) (if (<= t_2 -6e+158) t_1 (if (<= t_2 8e+178) (fma (* b -0.25) a c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((t * 0.0625), z, (x * y));
double t_2 = (x * y) + ((t * z) / 16.0);
double tmp;
if (t_2 <= -6e+158) {
tmp = t_1;
} else if (t_2 <= 8e+178) {
tmp = fma((b * -0.25), a, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(t * 0.0625), z, Float64(x * y)) t_2 = Float64(Float64(x * y) + Float64(Float64(t * z) / 16.0)) tmp = 0.0 if (t_2 <= -6e+158) tmp = t_1; elseif (t_2 <= 8e+178) tmp = fma(Float64(b * -0.25), a, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -6e+158], t$95$1, If[LessEqual[t$95$2, 8e+178], N[(N[(b * -0.25), $MachinePrecision] * a + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t \cdot 0.0625, z, x \cdot y\right)\\
t_2 := x \cdot y + \frac{t \cdot z}{16}\\
\mathbf{if}\;t\_2 \leq -6 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 8 \cdot 10^{+178}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot -0.25, a, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < -6e158 or 8.0000000000000004e178 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) Initial program 93.9%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6489.1
Simplified89.1%
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lower-fma.f6490.0
Applied egg-rr90.0%
Taylor expanded in x around inf
lower-*.f6486.7
Simplified86.7%
if -6e158 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < 8.0000000000000004e178Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6473.9
Simplified73.9%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6473.9
Applied egg-rr73.9%
Final simplification79.6%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma 0.0625 (* t z) (* x y))) (t_2 (+ (* x y) (/ (* t z) 16.0)))) (if (<= t_2 -6e+158) t_1 (if (<= t_2 8e+178) (fma (* b -0.25) a c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(0.0625, (t * z), (x * y));
double t_2 = (x * y) + ((t * z) / 16.0);
double tmp;
if (t_2 <= -6e+158) {
tmp = t_1;
} else if (t_2 <= 8e+178) {
tmp = fma((b * -0.25), a, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(0.0625, Float64(t * z), Float64(x * y)) t_2 = Float64(Float64(x * y) + Float64(Float64(t * z) / 16.0)) tmp = 0.0 if (t_2 <= -6e+158) tmp = t_1; elseif (t_2 <= 8e+178) tmp = fma(Float64(b * -0.25), a, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -6e+158], t$95$1, If[LessEqual[t$95$2, 8e+178], N[(N[(b * -0.25), $MachinePrecision] * a + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(0.0625, t \cdot z, x \cdot y\right)\\
t_2 := x \cdot y + \frac{t \cdot z}{16}\\
\mathbf{if}\;t\_2 \leq -6 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 8 \cdot 10^{+178}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot -0.25, a, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < -6e158 or 8.0000000000000004e178 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) Initial program 93.9%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6489.1
Simplified89.1%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6485.8
Simplified85.8%
if -6e158 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < 8.0000000000000004e178Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6473.9
Simplified73.9%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6473.9
Applied egg-rr73.9%
Final simplification79.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* b -0.25) a c)) (t_2 (fma (* t z) 0.0625 c)))
(if (<= (* t z) -5e+50)
t_2
(if (<= (* t z) -5e-284)
t_1
(if (<= (* t z) 2e+36) (fma x y c) (if (<= (* t z) 2e+117) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((b * -0.25), a, c);
double t_2 = fma((t * z), 0.0625, c);
double tmp;
if ((t * z) <= -5e+50) {
tmp = t_2;
} else if ((t * z) <= -5e-284) {
tmp = t_1;
} else if ((t * z) <= 2e+36) {
tmp = fma(x, y, c);
} else if ((t * z) <= 2e+117) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(b * -0.25), a, c) t_2 = fma(Float64(t * z), 0.0625, c) tmp = 0.0 if (Float64(t * z) <= -5e+50) tmp = t_2; elseif (Float64(t * z) <= -5e-284) tmp = t_1; elseif (Float64(t * z) <= 2e+36) tmp = fma(x, y, c); elseif (Float64(t * z) <= 2e+117) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(b * -0.25), $MachinePrecision] * a + c), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -5e+50], t$95$2, If[LessEqual[N[(t * z), $MachinePrecision], -5e-284], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 2e+36], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 2e+117], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b \cdot -0.25, a, c\right)\\
t_2 := \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+50}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \cdot z \leq -5 \cdot 10^{-284}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+36}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 z t) < -5e50 or 2.0000000000000001e117 < (*.f64 z t) Initial program 95.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6477.4
Simplified77.4%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6477.4
Applied egg-rr77.4%
if -5e50 < (*.f64 z t) < -4.99999999999999973e-284 or 2.00000000000000008e36 < (*.f64 z t) < 2.0000000000000001e117Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.3
Simplified71.3%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6471.3
Applied egg-rr71.3%
if -4.99999999999999973e-284 < (*.f64 z t) < 2.00000000000000008e36Initial program 97.9%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6479.0
Simplified79.0%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6477.3
Simplified77.3%
Final simplification75.9%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* b -0.25) a c)) (t_2 (* 0.0625 (* t z))))
(if (<= (* t z) -5e+96)
t_2
(if (<= (* t z) -5e-284)
t_1
(if (<= (* t z) 2e+36) (fma x y c) (if (<= (* t z) 5e+136) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((b * -0.25), a, c);
double t_2 = 0.0625 * (t * z);
double tmp;
if ((t * z) <= -5e+96) {
tmp = t_2;
} else if ((t * z) <= -5e-284) {
tmp = t_1;
} else if ((t * z) <= 2e+36) {
tmp = fma(x, y, c);
} else if ((t * z) <= 5e+136) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(b * -0.25), a, c) t_2 = Float64(0.0625 * Float64(t * z)) tmp = 0.0 if (Float64(t * z) <= -5e+96) tmp = t_2; elseif (Float64(t * z) <= -5e-284) tmp = t_1; elseif (Float64(t * z) <= 2e+36) tmp = fma(x, y, c); elseif (Float64(t * z) <= 5e+136) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(b * -0.25), $MachinePrecision] * a + c), $MachinePrecision]}, Block[{t$95$2 = N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -5e+96], t$95$2, If[LessEqual[N[(t * z), $MachinePrecision], -5e-284], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 2e+36], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e+136], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b \cdot -0.25, a, c\right)\\
t_2 := 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+96}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \cdot z \leq -5 \cdot 10^{-284}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+36}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+136}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 z t) < -5.0000000000000004e96 or 5.0000000000000002e136 < (*.f64 z t) Initial program 94.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6472.8
Simplified72.8%
if -5.0000000000000004e96 < (*.f64 z t) < -4.99999999999999973e-284 or 2.00000000000000008e36 < (*.f64 z t) < 5.0000000000000002e136Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.7
Simplified67.7%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6467.7
Applied egg-rr67.7%
if -4.99999999999999973e-284 < (*.f64 z t) < 2.00000000000000008e36Initial program 97.9%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6479.0
Simplified79.0%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6477.3
Simplified77.3%
Final simplification73.0%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* t z) -5e+50)
(fma (* t 0.0625) z (fma x y c))
(if (<= (* t z) 10000000000000.0)
(fma a (* b -0.25) (fma x y c))
(fma 0.0625 (* t z) (fma a (* b -0.25) c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((t * z) <= -5e+50) {
tmp = fma((t * 0.0625), z, fma(x, y, c));
} else if ((t * z) <= 10000000000000.0) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = fma(0.0625, (t * z), fma(a, (b * -0.25), c));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(t * z) <= -5e+50) tmp = fma(Float64(t * 0.0625), z, fma(x, y, c)); elseif (Float64(t * z) <= 10000000000000.0) tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); else tmp = fma(0.0625, Float64(t * z), fma(a, Float64(b * -0.25), c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(t * z), $MachinePrecision], -5e+50], N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 10000000000000.0], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 0.0625, z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{elif}\;t \cdot z \leq 10000000000000:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5e50Initial program 98.2%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6489.5
Simplified89.5%
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lower-fma.f6489.5
Applied egg-rr89.5%
if -5e50 < (*.f64 z t) < 1e13Initial program 98.5%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6496.9
Simplified96.9%
if 1e13 < (*.f64 z t) Initial program 93.8%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.5
Simplified89.5%
Final simplification93.4%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* t z) -5e+50)
(fma (* t 0.0625) z (fma x y c))
(if (<= (* t z) 5e+156)
(fma a (* b -0.25) (fma x y c))
(fma (* t z) 0.0625 c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((t * z) <= -5e+50) {
tmp = fma((t * 0.0625), z, fma(x, y, c));
} else if ((t * z) <= 5e+156) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = fma((t * z), 0.0625, c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(t * z) <= -5e+50) tmp = fma(Float64(t * 0.0625), z, fma(x, y, c)); elseif (Float64(t * z) <= 5e+156) tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); else tmp = fma(Float64(t * z), 0.0625, c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(t * z), $MachinePrecision], -5e+50], N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e+156], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 0.0625, z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+156}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5e50Initial program 98.2%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6489.5
Simplified89.5%
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lower-fma.f6489.5
Applied egg-rr89.5%
if -5e50 < (*.f64 z t) < 4.99999999999999992e156Initial program 98.8%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6493.8
Simplified93.8%
if 4.99999999999999992e156 < (*.f64 z t) Initial program 90.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6490.5
Simplified90.5%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6490.5
Applied egg-rr90.5%
Final simplification92.3%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* t z) -5e+50)
(fma 0.0625 (* t z) (fma x y c))
(if (<= (* t z) 5e+156)
(fma a (* b -0.25) (fma x y c))
(fma (* t z) 0.0625 c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((t * z) <= -5e+50) {
tmp = fma(0.0625, (t * z), fma(x, y, c));
} else if ((t * z) <= 5e+156) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = fma((t * z), 0.0625, c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(t * z) <= -5e+50) tmp = fma(0.0625, Float64(t * z), fma(x, y, c)); elseif (Float64(t * z) <= 5e+156) tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); else tmp = fma(Float64(t * z), 0.0625, c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(t * z), $MachinePrecision], -5e+50], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e+156], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+156}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5e50Initial program 98.2%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6489.5
Simplified89.5%
if -5e50 < (*.f64 z t) < 4.99999999999999992e156Initial program 98.8%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6493.8
Simplified93.8%
if 4.99999999999999992e156 < (*.f64 z t) Initial program 90.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6490.5
Simplified90.5%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6490.5
Applied egg-rr90.5%
Final simplification92.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma x y (* (* a b) -0.25))))
(if (<= (* a b) -5e+201)
t_1
(if (<= (* a b) 2e+166) (fma 0.0625 (* t z) (fma x y c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(x, y, ((a * b) * -0.25));
double tmp;
if ((a * b) <= -5e+201) {
tmp = t_1;
} else if ((a * b) <= 2e+166) {
tmp = fma(0.0625, (t * z), fma(x, y, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(x, y, Float64(Float64(a * b) * -0.25)) tmp = 0.0 if (Float64(a * b) <= -5e+201) tmp = t_1; elseif (Float64(a * b) <= 2e+166) tmp = fma(0.0625, Float64(t * z), fma(x, y, c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(x * y + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+201], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 2e+166], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, \left(a \cdot b\right) \cdot -0.25\right)\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+201}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+166}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -4.9999999999999995e201 or 1.99999999999999988e166 < (*.f64 a b) Initial program 94.5%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6489.9
Simplified89.9%
Taylor expanded in c around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6484.6
Simplified84.6%
if -4.9999999999999995e201 < (*.f64 a b) < 1.99999999999999988e166Initial program 98.0%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6488.8
Simplified88.8%
Final simplification87.9%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* 0.0625 (* t z)))) (if (<= (* t z) -2e+182) t_1 (if (<= (* t z) 2e+162) (fma x y c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = 0.0625 * (t * z);
double tmp;
if ((t * z) <= -2e+182) {
tmp = t_1;
} else if ((t * z) <= 2e+162) {
tmp = fma(x, y, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(0.0625 * Float64(t * z)) tmp = 0.0 if (Float64(t * z) <= -2e+182) tmp = t_1; elseif (Float64(t * z) <= 2e+162) tmp = fma(x, y, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -2e+182], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 2e+162], N[(x * y + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+182}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+162}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -2.0000000000000001e182 or 1.9999999999999999e162 < (*.f64 z t) Initial program 93.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6483.3
Simplified83.3%
if -2.0000000000000001e182 < (*.f64 z t) < 1.9999999999999999e162Initial program 98.9%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6472.0
Simplified72.0%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6463.1
Simplified63.1%
Final simplification68.8%
(FPCore (x y z t a b c) :precision binary64 (fma x y c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(x, y, c);
}
function code(x, y, z, t, a, b, c) return fma(x, y, c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x * y + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, c\right)
\end{array}
Initial program 97.3%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6476.8
Simplified76.8%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6450.7
Simplified50.7%
(FPCore (x y z t a b c) :precision binary64 (* x y))
double code(double x, double y, double z, double t, double a, double b, double c) {
return x * y;
}
real(8) function code(x, y, z, t, a, b, c)
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
code = x * y
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return x * y;
}
def code(x, y, z, t, a, b, c): return x * y
function code(x, y, z, t, a, b, c) return Float64(x * y) end
function tmp = code(x, y, z, t, a, b, c) tmp = x * y; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x * y), $MachinePrecision]
\begin{array}{l}
\\
x \cdot y
\end{array}
Initial program 97.3%
Taylor expanded in x around inf
lower-*.f6427.5
Simplified27.5%
herbie shell --seed 2024207
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, C"
:precision binary64
(+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))