
(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 11 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 a (* b -0.25) (fma 0.0625 (* t z) (fma x y c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(a, (b * -0.25), fma(0.0625, (t * z), fma(x, y, c)));
}
function code(x, y, z, t, a, b, c) return fma(a, Float64(b * -0.25), fma(0.0625, Float64(t * z), fma(x, y, c))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(a * N[(b * -0.25), $MachinePrecision] + N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(x, y, c\right)\right)\right)
\end{array}
Initial program 98.4%
Taylor expanded in x 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
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6498.8
Applied rewrites98.8%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma x y (* z (* 0.0625 t)))) (t_2 (+ (* x y) (/ (* t z) 16.0)))) (if (<= t_2 -5e-10) t_1 (if (<= t_2 2e+122) (+ c (* a (* b -0.25))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(x, y, (z * (0.0625 * t)));
double t_2 = (x * y) + ((t * z) / 16.0);
double tmp;
if (t_2 <= -5e-10) {
tmp = t_1;
} else if (t_2 <= 2e+122) {
tmp = c + (a * (b * -0.25));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(x, y, Float64(z * Float64(0.0625 * t))) t_2 = Float64(Float64(x * y) + Float64(Float64(t * z) / 16.0)) tmp = 0.0 if (t_2 <= -5e-10) tmp = t_1; elseif (t_2 <= 2e+122) tmp = Float64(c + Float64(a * Float64(b * -0.25))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(x * y + N[(z * N[(0.0625 * t), $MachinePrecision]), $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, -5e-10], t$95$1, If[LessEqual[t$95$2, 2e+122], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, z \cdot \left(0.0625 \cdot t\right)\right)\\
t_2 := x \cdot y + \frac{t \cdot z}{16}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+122}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < -5.00000000000000031e-10 or 2.00000000000000003e122 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) Initial program 97.6%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-+l-N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
sub-negN/A
Applied rewrites98.8%
Taylor expanded in z around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f6478.5
Applied rewrites78.5%
if -5.00000000000000031e-10 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < 2.00000000000000003e122Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
Final simplification78.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* 0.0625 (* t z)))))
(if (<= (* t z) -2e+120)
t_1
(if (<= (* t z) -2e+66)
(+ c (* a (* b -0.25)))
(if (<= (* t z) 1e+85) (fma y x c) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (0.0625 * (t * z));
double tmp;
if ((t * z) <= -2e+120) {
tmp = t_1;
} else if ((t * z) <= -2e+66) {
tmp = c + (a * (b * -0.25));
} else if ((t * z) <= 1e+85) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(0.0625 * Float64(t * z))) tmp = 0.0 if (Float64(t * z) <= -2e+120) tmp = t_1; elseif (Float64(t * z) <= -2e+66) tmp = Float64(c + Float64(a * Float64(b * -0.25))); elseif (Float64(t * z) <= 1e+85) tmp = fma(y, x, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -2e+120], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], -2e+66], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e+85], N[(y * x + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq -2 \cdot 10^{+66}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{elif}\;t \cdot z \leq 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -2e120 or 1e85 < (*.f64 z t) Initial program 95.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6477.7
Applied rewrites77.7%
if -2e120 < (*.f64 z t) < -1.99999999999999989e66Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6488.0
Applied rewrites88.0%
if -1.99999999999999989e66 < (*.f64 z t) < 1e85Initial program 100.0%
Taylor expanded in x around inf
lower-*.f6467.1
Applied rewrites67.1%
*-commutativeN/A
lower-fma.f6467.1
Applied rewrites67.1%
Final simplification71.8%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* t z) -2e+62)
(fma 0.0625 (* t z) (fma a (* b -0.25) c))
(if (<= (* t z) 5e+75)
(fma a (* b -0.25) (fma x y c))
(fma 0.0625 (* t z) (fma x y c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((t * z) <= -2e+62) {
tmp = fma(0.0625, (t * z), fma(a, (b * -0.25), c));
} else if ((t * z) <= 5e+75) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = fma(0.0625, (t * z), fma(x, y, c));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(t * z) <= -2e+62) tmp = fma(0.0625, Float64(t * z), fma(a, Float64(b * -0.25), c)); elseif (Float64(t * z) <= 5e+75) tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); else tmp = fma(0.0625, Float64(t * z), fma(x, y, c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(t * z), $MachinePrecision], -2e+62], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e+75], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)\\
\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+75}:\\
\;\;\;\;\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(x, y, c\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000007e62Initial program 94.6%
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-*.f6492.1
Applied rewrites92.1%
if -2.00000000000000007e62 < (*.f64 z t) < 5.0000000000000002e75Initial program 100.0%
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.f6495.0
Applied rewrites95.0%
if 5.0000000000000002e75 < (*.f64 z t) Initial 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.f6486.4
Applied rewrites86.4%
Final simplification92.7%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* t z) -2e+121)
(fma a (* b -0.25) (* 0.0625 (* t z)))
(if (<= (* t z) 5e+75)
(fma a (* b -0.25) (fma x y c))
(fma 0.0625 (* t z) (fma x y c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((t * z) <= -2e+121) {
tmp = fma(a, (b * -0.25), (0.0625 * (t * z)));
} else if ((t * z) <= 5e+75) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = fma(0.0625, (t * z), fma(x, y, c));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(t * z) <= -2e+121) tmp = fma(a, Float64(b * -0.25), Float64(0.0625 * Float64(t * z))); elseif (Float64(t * z) <= 5e+75) tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); else tmp = fma(0.0625, Float64(t * z), fma(x, y, c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(t * z), $MachinePrecision], -2e+121], N[(a * N[(b * -0.25), $MachinePrecision] + N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e+75], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+121}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, 0.0625 \cdot \left(t \cdot z\right)\right)\\
\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+75}:\\
\;\;\;\;\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(x, y, c\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000007e121Initial program 93.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-+l-N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
sub-negN/A
Applied rewrites97.8%
Applied rewrites95.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6491.5
Applied rewrites91.5%
if -2.00000000000000007e121 < (*.f64 z t) < 5.0000000000000002e75Initial program 100.0%
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.f6494.1
Applied rewrites94.1%
if 5.0000000000000002e75 < (*.f64 z t) Initial 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.f6486.4
Applied rewrites86.4%
Final simplification92.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma 0.0625 (* t z) (fma x y c))))
(if (<= (* t z) -2e+121)
t_1
(if (<= (* t z) 5e+75) (fma a (* b -0.25) (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(0.0625, (t * z), fma(x, y, c));
double tmp;
if ((t * z) <= -2e+121) {
tmp = t_1;
} else if ((t * z) <= 5e+75) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(0.0625, Float64(t * z), fma(x, y, c)) tmp = 0.0 if (Float64(t * z) <= -2e+121) tmp = t_1; elseif (Float64(t * z) <= 5e+75) tmp = fma(a, Float64(b * -0.25), 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] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -2e+121], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 5e+75], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000007e121 or 5.0000000000000002e75 < (*.f64 z t) Initial program 95.8%
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.f6486.4
Applied rewrites86.4%
if -2.00000000000000007e121 < (*.f64 z t) < 5.0000000000000002e75Initial program 100.0%
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.f6494.1
Applied rewrites94.1%
Final simplification91.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma x y (* -0.25 (* a b)))))
(if (<= (* a b) -1e+177)
t_1
(if (<= (* a b) 1e+25) (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, (-0.25 * (a * b)));
double tmp;
if ((a * b) <= -1e+177) {
tmp = t_1;
} else if ((a * b) <= 1e+25) {
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(-0.25 * Float64(a * b))) tmp = 0.0 if (Float64(a * b) <= -1e+177) tmp = t_1; elseif (Float64(a * b) <= 1e+25) 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[(-0.25 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+177], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1e+25], 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, -0.25 \cdot \left(a \cdot b\right)\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+177}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 10^{+25}:\\
\;\;\;\;\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) < -1e177 or 1.00000000000000009e25 < (*.f64 a b) Initial program 97.5%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-+l-N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
sub-negN/A
Applied rewrites98.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6480.4
Applied rewrites80.4%
if -1e177 < (*.f64 a b) < 1.00000000000000009e25Initial program 98.8%
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.f6491.9
Applied rewrites91.9%
Final simplification88.3%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (+ c (* 0.0625 (* t z))))) (if (<= (* t z) -2e+62) t_1 (if (<= (* t z) 1e+85) (fma y x c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (0.0625 * (t * z));
double tmp;
if ((t * z) <= -2e+62) {
tmp = t_1;
} else if ((t * z) <= 1e+85) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(0.0625 * Float64(t * z))) tmp = 0.0 if (Float64(t * z) <= -2e+62) tmp = t_1; elseif (Float64(t * z) <= 1e+85) tmp = fma(y, x, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -2e+62], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 1e+85], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000007e62 or 1e85 < (*.f64 z t) Initial program 96.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
if -2.00000000000000007e62 < (*.f64 z t) < 1e85Initial program 100.0%
Taylor expanded in x around inf
lower-*.f6467.5
Applied rewrites67.5%
*-commutativeN/A
lower-fma.f6467.5
Applied rewrites67.5%
Final simplification70.1%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* 0.0625 (* t z)))) (if (<= (* t z) -2e+121) t_1 (if (<= (* t z) 1e+209) (fma y x 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+121) {
tmp = t_1;
} else if ((t * z) <= 1e+209) {
tmp = fma(y, x, 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+121) tmp = t_1; elseif (Float64(t * z) <= 1e+209) tmp = fma(y, x, 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+121], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 1e+209], N[(y * x + 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^{+121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 10^{+209}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000007e121 or 1.0000000000000001e209 < (*.f64 z t) Initial program 94.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6483.0
Applied rewrites83.0%
if -2.00000000000000007e121 < (*.f64 z t) < 1.0000000000000001e209Initial program 100.0%
Taylor expanded in x around inf
lower-*.f6461.6
Applied rewrites61.6%
*-commutativeN/A
lower-fma.f6461.6
Applied rewrites61.6%
Final simplification67.5%
(FPCore (x y z t a b c) :precision binary64 (fma y x c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(y, x, c);
}
function code(x, y, z, t, a, b, c) return fma(y, x, c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(y * x + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x, c\right)
\end{array}
Initial program 98.4%
Taylor expanded in x around inf
lower-*.f6448.2
Applied rewrites48.2%
*-commutativeN/A
lower-fma.f6448.2
Applied rewrites48.2%
(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 98.4%
Taylor expanded in x around inf
lower-*.f6431.1
Applied rewrites31.1%
herbie shell --seed 2024220
(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))