Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, C

Percentage Accurate: 97.5% → 98.2%
Time: 10.2s
Alternatives: 12
Speedup: 1.6×

Specification

?
\[\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
 (+ (- (+ (* 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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 97.5% accurate, 1.0× speedup?

\[\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
 (+ (- (+ (* 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}

Alternative 1: 98.2% accurate, 1.6× speedup?

\[\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} \]
(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}
Derivation
  1. Initial program 97.6%

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
  4. Step-by-step derivation
    1. cancel-sign-sub-invN/A

      \[\leadsto \color{blue}{\left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
    2. metadata-evalN/A

      \[\leadsto \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
    3. +-commutativeN/A

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right)} \]
    4. *-commutativeN/A

      \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
    5. associate-*l*N/A

      \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
    6. *-commutativeN/A

      \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
    7. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right)} \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
    9. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
    10. associate-+r+N/A

      \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\left(c + \frac{1}{16} \cdot \left(t \cdot z\right)\right) + x \cdot y}\right) \]
    11. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\left(\frac{1}{16} \cdot \left(t \cdot z\right) + c\right)} + x \cdot y\right) \]
    12. associate-+l+N/A

      \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right) + \left(c + x \cdot y\right)}\right) \]
    13. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\mathsf{fma}\left(\frac{1}{16}, t \cdot z, c + x \cdot y\right)}\right) \]
    14. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \mathsf{fma}\left(\frac{1}{16}, \color{blue}{t \cdot z}, c + x \cdot y\right)\right) \]
    15. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \mathsf{fma}\left(\frac{1}{16}, t \cdot z, \color{blue}{x \cdot y + c}\right)\right) \]
    16. lower-fma.f6498.8

      \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(0.0625, t \cdot z, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right)\right) \]
  5. Applied rewrites98.8%

    \[\leadsto \color{blue}{\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)} \]
  6. Add Preprocessing

Alternative 2: 65.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+164}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \cdot z \leq -0.004:\\ \;\;\;\;\mathsf{fma}\left(y, x, a \cdot \left(b \cdot -0.25\right)\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{elif}\;t \cdot z \leq 10^{+68}:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (fma (* t z) 0.0625 c)))
   (if (<= (* t z) -5e+164)
     t_1
     (if (<= (* t z) -0.004)
       (fma y x (* a (* b -0.25)))
       (if (<= (* t z) 5e-189)
         (fma x y c)
         (if (<= (* t z) 1e+68) (fma a (* b -0.25) c) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = fma((t * z), 0.0625, c);
	double tmp;
	if ((t * z) <= -5e+164) {
		tmp = t_1;
	} else if ((t * z) <= -0.004) {
		tmp = fma(y, x, (a * (b * -0.25)));
	} else if ((t * z) <= 5e-189) {
		tmp = fma(x, y, c);
	} else if ((t * z) <= 1e+68) {
		tmp = fma(a, (b * -0.25), c);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c)
	t_1 = fma(Float64(t * z), 0.0625, c)
	tmp = 0.0
	if (Float64(t * z) <= -5e+164)
		tmp = t_1;
	elseif (Float64(t * z) <= -0.004)
		tmp = fma(y, x, Float64(a * Float64(b * -0.25)));
	elseif (Float64(t * z) <= 5e-189)
		tmp = fma(x, y, c);
	elseif (Float64(t * z) <= 1e+68)
		tmp = fma(a, Float64(b * -0.25), c);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -5e+164], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], -0.004], N[(y * x + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e-189], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e+68], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \cdot z \leq -0.004:\\
\;\;\;\;\mathsf{fma}\left(y, x, a \cdot \left(b \cdot -0.25\right)\right)\\

\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\

\mathbf{elif}\;t \cdot z \leq 10^{+68}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z t) < -4.9999999999999995e164 or 9.99999999999999953e67 < (*.f64 z t)

    1. Initial program 96.7%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
      2. lower-*.f6481.5

        \[\leadsto 0.0625 \cdot \color{blue}{\left(t \cdot z\right)} + c \]
    5. Applied rewrites81.5%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{16} \cdot \color{blue}{\left(t \cdot z\right)} + c \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot \frac{1}{16}} + c \]
      3. lower-fma.f6481.5

        \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]
    7. Applied rewrites81.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]

    if -4.9999999999999995e164 < (*.f64 z t) < -0.0040000000000000001

    1. Initial program 97.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      10. associate-+r+N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\left(c + \frac{1}{16} \cdot \left(t \cdot z\right)\right) + x \cdot y}\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\left(\frac{1}{16} \cdot \left(t \cdot z\right) + c\right)} + x \cdot y\right) \]
      12. associate-+l+N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right) + \left(c + x \cdot y\right)}\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\mathsf{fma}\left(\frac{1}{16}, t \cdot z, c + x \cdot y\right)}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \mathsf{fma}\left(\frac{1}{16}, \color{blue}{t \cdot z}, c + x \cdot y\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \mathsf{fma}\left(\frac{1}{16}, t \cdot z, \color{blue}{x \cdot y + c}\right)\right) \]
      16. lower-fma.f6497.3

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(0.0625, t \cdot z, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right)\right) \]
    5. Applied rewrites97.3%

      \[\leadsto \color{blue}{\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)} \]
    6. Taylor expanded in x around inf

      \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y}\right) \]
    7. Step-by-step derivation
      1. lower-*.f6466.4

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{x \cdot y}\right) \]
    8. Applied rewrites66.4%

      \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{x \cdot y}\right) \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto a \cdot \color{blue}{\left(b \cdot \frac{-1}{4}\right)} + x \cdot y \]
      2. lift-*.f64N/A

        \[\leadsto a \cdot \left(b \cdot \frac{-1}{4}\right) + \color{blue}{x \cdot y} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + x \cdot y \]
      4. +-commutativeN/A

        \[\leadsto \color{blue}{x \cdot y + a \cdot \left(b \cdot \frac{-1}{4}\right)} \]
      5. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot y} + a \cdot \left(b \cdot \frac{-1}{4}\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot x} + a \cdot \left(b \cdot \frac{-1}{4}\right) \]
      7. lower-fma.f6469.1

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, a \cdot \left(b \cdot -0.25\right)\right)} \]
    10. Applied rewrites69.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, a \cdot \left(b \cdot -0.25\right)\right)} \]

    if -0.0040000000000000001 < (*.f64 z t) < 4.9999999999999997e-189

    1. Initial program 97.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6495.4

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites95.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Taylor expanded in a around 0

      \[\leadsto \color{blue}{c + x \cdot y} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x \cdot y + c} \]
      2. lower-fma.f6475.2

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]
    8. Applied rewrites75.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]

    if 4.9999999999999997e-189 < (*.f64 z t) < 9.99999999999999953e67

    1. Initial program 99.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6495.3

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites95.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto a \cdot \color{blue}{\left(b \cdot \frac{-1}{4}\right)} + \left(x \cdot y + c\right) \]
      2. lift-*.f64N/A

        \[\leadsto a \cdot \left(b \cdot \frac{-1}{4}\right) + \left(\color{blue}{x \cdot y} + c\right) \]
      3. associate-+r+N/A

        \[\leadsto \color{blue}{\left(a \cdot \left(b \cdot \frac{-1}{4}\right) + x \cdot y\right) + c} \]
      4. +-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot y + a \cdot \left(b \cdot \frac{-1}{4}\right)\right)} + c \]
      5. associate-+l+N/A

        \[\leadsto \color{blue}{x \cdot y + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot y} + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right) \]
      7. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot x} + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right) \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right)} \]
      9. lower-fma.f6495.3

        \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, c\right)}\right) \]
    7. Applied rewrites95.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)} \]
    8. Taylor expanded in y around 0

      \[\leadsto \color{blue}{c + \frac{-1}{4} \cdot \left(a \cdot b\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto c + \color{blue}{\left(\frac{-1}{4} \cdot a\right) \cdot b} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot a\right) \cdot b + c} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot \frac{-1}{4}\right)} \cdot b + c \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{a \cdot \left(\frac{-1}{4} \cdot b\right)} + c \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c\right)} \]
      6. lower-*.f6485.1

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{-0.25 \cdot b}, c\right) \]
    10. Applied rewrites85.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, -0.25 \cdot b, c\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification78.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+164}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \mathbf{elif}\;t \cdot z \leq -0.004:\\ \;\;\;\;\mathsf{fma}\left(y, x, a \cdot \left(b \cdot -0.25\right)\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{elif}\;t \cdot z \leq 10^{+68}:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 65.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+164}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \cdot z \leq -0.004:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, x \cdot y\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{elif}\;t \cdot z \leq 10^{+68}:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (fma (* t z) 0.0625 c)))
   (if (<= (* t z) -5e+164)
     t_1
     (if (<= (* t z) -0.004)
       (fma a (* b -0.25) (* x y))
       (if (<= (* t z) 5e-189)
         (fma x y c)
         (if (<= (* t z) 1e+68) (fma a (* b -0.25) c) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = fma((t * z), 0.0625, c);
	double tmp;
	if ((t * z) <= -5e+164) {
		tmp = t_1;
	} else if ((t * z) <= -0.004) {
		tmp = fma(a, (b * -0.25), (x * y));
	} else if ((t * z) <= 5e-189) {
		tmp = fma(x, y, c);
	} else if ((t * z) <= 1e+68) {
		tmp = fma(a, (b * -0.25), c);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c)
	t_1 = fma(Float64(t * z), 0.0625, c)
	tmp = 0.0
	if (Float64(t * z) <= -5e+164)
		tmp = t_1;
	elseif (Float64(t * z) <= -0.004)
		tmp = fma(a, Float64(b * -0.25), Float64(x * y));
	elseif (Float64(t * z) <= 5e-189)
		tmp = fma(x, y, c);
	elseif (Float64(t * z) <= 1e+68)
		tmp = fma(a, Float64(b * -0.25), c);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -5e+164], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], -0.004], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e-189], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e+68], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \cdot z \leq -0.004:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, x \cdot y\right)\\

\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\

\mathbf{elif}\;t \cdot z \leq 10^{+68}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z t) < -4.9999999999999995e164 or 9.99999999999999953e67 < (*.f64 z t)

    1. Initial program 96.7%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
      2. lower-*.f6481.5

        \[\leadsto 0.0625 \cdot \color{blue}{\left(t \cdot z\right)} + c \]
    5. Applied rewrites81.5%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{16} \cdot \color{blue}{\left(t \cdot z\right)} + c \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot \frac{1}{16}} + c \]
      3. lower-fma.f6481.5

        \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]
    7. Applied rewrites81.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]

    if -4.9999999999999995e164 < (*.f64 z t) < -0.0040000000000000001

    1. Initial program 97.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      10. associate-+r+N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\left(c + \frac{1}{16} \cdot \left(t \cdot z\right)\right) + x \cdot y}\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\left(\frac{1}{16} \cdot \left(t \cdot z\right) + c\right)} + x \cdot y\right) \]
      12. associate-+l+N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right) + \left(c + x \cdot y\right)}\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\mathsf{fma}\left(\frac{1}{16}, t \cdot z, c + x \cdot y\right)}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \mathsf{fma}\left(\frac{1}{16}, \color{blue}{t \cdot z}, c + x \cdot y\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \mathsf{fma}\left(\frac{1}{16}, t \cdot z, \color{blue}{x \cdot y + c}\right)\right) \]
      16. lower-fma.f6497.3

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(0.0625, t \cdot z, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right)\right) \]
    5. Applied rewrites97.3%

      \[\leadsto \color{blue}{\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)} \]
    6. Taylor expanded in x around inf

      \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y}\right) \]
    7. Step-by-step derivation
      1. lower-*.f6466.4

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{x \cdot y}\right) \]
    8. Applied rewrites66.4%

      \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{x \cdot y}\right) \]

    if -0.0040000000000000001 < (*.f64 z t) < 4.9999999999999997e-189

    1. Initial program 97.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6495.4

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites95.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Taylor expanded in a around 0

      \[\leadsto \color{blue}{c + x \cdot y} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x \cdot y + c} \]
      2. lower-fma.f6475.2

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]
    8. Applied rewrites75.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]

    if 4.9999999999999997e-189 < (*.f64 z t) < 9.99999999999999953e67

    1. Initial program 99.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6495.3

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites95.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto a \cdot \color{blue}{\left(b \cdot \frac{-1}{4}\right)} + \left(x \cdot y + c\right) \]
      2. lift-*.f64N/A

        \[\leadsto a \cdot \left(b \cdot \frac{-1}{4}\right) + \left(\color{blue}{x \cdot y} + c\right) \]
      3. associate-+r+N/A

        \[\leadsto \color{blue}{\left(a \cdot \left(b \cdot \frac{-1}{4}\right) + x \cdot y\right) + c} \]
      4. +-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot y + a \cdot \left(b \cdot \frac{-1}{4}\right)\right)} + c \]
      5. associate-+l+N/A

        \[\leadsto \color{blue}{x \cdot y + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot y} + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right) \]
      7. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot x} + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right) \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right)} \]
      9. lower-fma.f6495.3

        \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, c\right)}\right) \]
    7. Applied rewrites95.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)} \]
    8. Taylor expanded in y around 0

      \[\leadsto \color{blue}{c + \frac{-1}{4} \cdot \left(a \cdot b\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto c + \color{blue}{\left(\frac{-1}{4} \cdot a\right) \cdot b} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot a\right) \cdot b + c} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot \frac{-1}{4}\right)} \cdot b + c \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{a \cdot \left(\frac{-1}{4} \cdot b\right)} + c \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c\right)} \]
      6. lower-*.f6485.1

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{-0.25 \cdot b}, c\right) \]
    10. Applied rewrites85.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, -0.25 \cdot b, c\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification78.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+164}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \mathbf{elif}\;t \cdot z \leq -0.004:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, x \cdot y\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{elif}\;t \cdot z \leq 10^{+68}:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+164}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \cdot z \leq -0.004:\\ \;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, x \cdot y\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{elif}\;t \cdot z \leq 10^{+68}:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (fma (* t z) 0.0625 c)))
   (if (<= (* t z) -5e+164)
     t_1
     (if (<= (* t z) -0.004)
       (fma -0.25 (* a b) (* x y))
       (if (<= (* t z) 5e-189)
         (fma x y c)
         (if (<= (* t z) 1e+68) (fma a (* b -0.25) c) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = fma((t * z), 0.0625, c);
	double tmp;
	if ((t * z) <= -5e+164) {
		tmp = t_1;
	} else if ((t * z) <= -0.004) {
		tmp = fma(-0.25, (a * b), (x * y));
	} else if ((t * z) <= 5e-189) {
		tmp = fma(x, y, c);
	} else if ((t * z) <= 1e+68) {
		tmp = fma(a, (b * -0.25), c);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c)
	t_1 = fma(Float64(t * z), 0.0625, c)
	tmp = 0.0
	if (Float64(t * z) <= -5e+164)
		tmp = t_1;
	elseif (Float64(t * z) <= -0.004)
		tmp = fma(-0.25, Float64(a * b), Float64(x * y));
	elseif (Float64(t * z) <= 5e-189)
		tmp = fma(x, y, c);
	elseif (Float64(t * z) <= 1e+68)
		tmp = fma(a, Float64(b * -0.25), c);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -5e+164], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], -0.004], N[(-0.25 * N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e-189], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e+68], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \cdot z \leq -0.004:\\
\;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, x \cdot y\right)\\

\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\

\mathbf{elif}\;t \cdot z \leq 10^{+68}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z t) < -4.9999999999999995e164 or 9.99999999999999953e67 < (*.f64 z t)

    1. Initial program 96.7%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
      2. lower-*.f6481.5

        \[\leadsto 0.0625 \cdot \color{blue}{\left(t \cdot z\right)} + c \]
    5. Applied rewrites81.5%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{16} \cdot \color{blue}{\left(t \cdot z\right)} + c \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot \frac{1}{16}} + c \]
      3. lower-fma.f6481.5

        \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]
    7. Applied rewrites81.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]

    if -4.9999999999999995e164 < (*.f64 z t) < -0.0040000000000000001

    1. Initial program 97.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6484.3

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites84.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Taylor expanded in c around 0

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + x \cdot y} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{4}, a \cdot b, x \cdot y\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, \color{blue}{a \cdot b}, x \cdot y\right) \]
      3. lower-*.f6466.4

        \[\leadsto \mathsf{fma}\left(-0.25, a \cdot b, \color{blue}{x \cdot y}\right) \]
    8. Applied rewrites66.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25, a \cdot b, x \cdot y\right)} \]

    if -0.0040000000000000001 < (*.f64 z t) < 4.9999999999999997e-189

    1. Initial program 97.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6495.4

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites95.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Taylor expanded in a around 0

      \[\leadsto \color{blue}{c + x \cdot y} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x \cdot y + c} \]
      2. lower-fma.f6475.2

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]
    8. Applied rewrites75.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]

    if 4.9999999999999997e-189 < (*.f64 z t) < 9.99999999999999953e67

    1. Initial program 99.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6495.3

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites95.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto a \cdot \color{blue}{\left(b \cdot \frac{-1}{4}\right)} + \left(x \cdot y + c\right) \]
      2. lift-*.f64N/A

        \[\leadsto a \cdot \left(b \cdot \frac{-1}{4}\right) + \left(\color{blue}{x \cdot y} + c\right) \]
      3. associate-+r+N/A

        \[\leadsto \color{blue}{\left(a \cdot \left(b \cdot \frac{-1}{4}\right) + x \cdot y\right) + c} \]
      4. +-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot y + a \cdot \left(b \cdot \frac{-1}{4}\right)\right)} + c \]
      5. associate-+l+N/A

        \[\leadsto \color{blue}{x \cdot y + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot y} + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right) \]
      7. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot x} + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right) \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right)} \]
      9. lower-fma.f6495.3

        \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, c\right)}\right) \]
    7. Applied rewrites95.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)} \]
    8. Taylor expanded in y around 0

      \[\leadsto \color{blue}{c + \frac{-1}{4} \cdot \left(a \cdot b\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto c + \color{blue}{\left(\frac{-1}{4} \cdot a\right) \cdot b} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot a\right) \cdot b + c} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot \frac{-1}{4}\right)} \cdot b + c \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{a \cdot \left(\frac{-1}{4} \cdot b\right)} + c \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c\right)} \]
      6. lower-*.f6485.1

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{-0.25 \cdot b}, c\right) \]
    10. Applied rewrites85.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, -0.25 \cdot b, c\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification78.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+164}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \mathbf{elif}\;t \cdot z \leq -0.004:\\ \;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, x \cdot y\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{elif}\;t \cdot z \leq 10^{+68}:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 63.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+185}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \cdot z \leq -0.004:\\ \;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{elif}\;t \cdot z \leq 10^{+68}:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (fma (* t z) 0.0625 c)))
   (if (<= (* t z) -5e+185)
     t_1
     (if (<= (* t z) -0.004)
       (fma -0.25 (* a b) c)
       (if (<= (* t z) 5e-189)
         (fma x y c)
         (if (<= (* t z) 1e+68) (fma a (* b -0.25) c) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = fma((t * z), 0.0625, c);
	double tmp;
	if ((t * z) <= -5e+185) {
		tmp = t_1;
	} else if ((t * z) <= -0.004) {
		tmp = fma(-0.25, (a * b), c);
	} else if ((t * z) <= 5e-189) {
		tmp = fma(x, y, c);
	} else if ((t * z) <= 1e+68) {
		tmp = fma(a, (b * -0.25), c);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c)
	t_1 = fma(Float64(t * z), 0.0625, c)
	tmp = 0.0
	if (Float64(t * z) <= -5e+185)
		tmp = t_1;
	elseif (Float64(t * z) <= -0.004)
		tmp = fma(-0.25, Float64(a * b), c);
	elseif (Float64(t * z) <= 5e-189)
		tmp = fma(x, y, c);
	elseif (Float64(t * z) <= 1e+68)
		tmp = fma(a, Float64(b * -0.25), c);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -5e+185], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], -0.004], N[(-0.25 * N[(a * b), $MachinePrecision] + c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e-189], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e+68], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+185}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \cdot z \leq -0.004:\\
\;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\

\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\

\mathbf{elif}\;t \cdot z \leq 10^{+68}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z t) < -4.9999999999999999e185 or 9.99999999999999953e67 < (*.f64 z t)

    1. Initial program 96.7%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
      2. lower-*.f6481.3

        \[\leadsto 0.0625 \cdot \color{blue}{\left(t \cdot z\right)} + c \]
    5. Applied rewrites81.3%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{16} \cdot \color{blue}{\left(t \cdot z\right)} + c \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot \frac{1}{16}} + c \]
      3. lower-fma.f6481.3

        \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]
    7. Applied rewrites81.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]

    if -4.9999999999999999e185 < (*.f64 z t) < -0.0040000000000000001

    1. Initial program 97.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6484.7

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites84.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Taylor expanded in x around 0

      \[\leadsto \color{blue}{c + \frac{-1}{4} \cdot \left(a \cdot b\right)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + c} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{4}, a \cdot b, c\right)} \]
      3. lower-*.f6463.6

        \[\leadsto \mathsf{fma}\left(-0.25, \color{blue}{a \cdot b}, c\right) \]
    8. Applied rewrites63.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25, a \cdot b, c\right)} \]

    if -0.0040000000000000001 < (*.f64 z t) < 4.9999999999999997e-189

    1. Initial program 97.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6495.4

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites95.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Taylor expanded in a around 0

      \[\leadsto \color{blue}{c + x \cdot y} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x \cdot y + c} \]
      2. lower-fma.f6475.2

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]
    8. Applied rewrites75.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]

    if 4.9999999999999997e-189 < (*.f64 z t) < 9.99999999999999953e67

    1. Initial program 99.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6495.3

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites95.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto a \cdot \color{blue}{\left(b \cdot \frac{-1}{4}\right)} + \left(x \cdot y + c\right) \]
      2. lift-*.f64N/A

        \[\leadsto a \cdot \left(b \cdot \frac{-1}{4}\right) + \left(\color{blue}{x \cdot y} + c\right) \]
      3. associate-+r+N/A

        \[\leadsto \color{blue}{\left(a \cdot \left(b \cdot \frac{-1}{4}\right) + x \cdot y\right) + c} \]
      4. +-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot y + a \cdot \left(b \cdot \frac{-1}{4}\right)\right)} + c \]
      5. associate-+l+N/A

        \[\leadsto \color{blue}{x \cdot y + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot y} + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right) \]
      7. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot x} + \left(a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right) \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, a \cdot \left(b \cdot \frac{-1}{4}\right) + c\right)} \]
      9. lower-fma.f6495.3

        \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, c\right)}\right) \]
    7. Applied rewrites95.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)} \]
    8. Taylor expanded in y around 0

      \[\leadsto \color{blue}{c + \frac{-1}{4} \cdot \left(a \cdot b\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto c + \color{blue}{\left(\frac{-1}{4} \cdot a\right) \cdot b} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot a\right) \cdot b + c} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot \frac{-1}{4}\right)} \cdot b + c \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{a \cdot \left(\frac{-1}{4} \cdot b\right)} + c \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c\right)} \]
      6. lower-*.f6485.1

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{-0.25 \cdot b}, c\right) \]
    10. Applied rewrites85.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, -0.25 \cdot b, c\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification77.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+185}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \mathbf{elif}\;t \cdot z \leq -0.004:\\ \;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{elif}\;t \cdot z \leq 10^{+68}:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 62.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(-0.25, a \cdot b, c\right)\\ t_2 := 0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+185}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \cdot z \leq -0.004:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{elif}\;t \cdot z \leq 10^{+124}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (fma -0.25 (* a b) c)) (t_2 (* 0.0625 (* t z))))
   (if (<= (* t z) -5e+185)
     t_2
     (if (<= (* t z) -0.004)
       t_1
       (if (<= (* t z) 5e-189)
         (fma x y c)
         (if (<= (* t z) 1e+124) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = fma(-0.25, (a * b), c);
	double t_2 = 0.0625 * (t * z);
	double tmp;
	if ((t * z) <= -5e+185) {
		tmp = t_2;
	} else if ((t * z) <= -0.004) {
		tmp = t_1;
	} else if ((t * z) <= 5e-189) {
		tmp = fma(x, y, c);
	} else if ((t * z) <= 1e+124) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c)
	t_1 = fma(-0.25, Float64(a * b), c)
	t_2 = Float64(0.0625 * Float64(t * z))
	tmp = 0.0
	if (Float64(t * z) <= -5e+185)
		tmp = t_2;
	elseif (Float64(t * z) <= -0.004)
		tmp = t_1;
	elseif (Float64(t * z) <= 5e-189)
		tmp = fma(x, y, c);
	elseif (Float64(t * z) <= 1e+124)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-0.25 * N[(a * b), $MachinePrecision] + c), $MachinePrecision]}, Block[{t$95$2 = N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -5e+185], t$95$2, If[LessEqual[N[(t * z), $MachinePrecision], -0.004], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 5e-189], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e+124], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.25, a \cdot b, c\right)\\
t_2 := 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+185}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t \cdot z \leq -0.004:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\

\mathbf{elif}\;t \cdot z \leq 10^{+124}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -4.9999999999999999e185 or 9.99999999999999948e123 < (*.f64 z t)

    1. Initial program 96.1%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} \]
      2. lower-*.f6478.2

        \[\leadsto 0.0625 \cdot \color{blue}{\left(t \cdot z\right)} \]
    5. Applied rewrites78.2%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} \]

    if -4.9999999999999999e185 < (*.f64 z t) < -0.0040000000000000001 or 4.9999999999999997e-189 < (*.f64 z t) < 9.99999999999999948e123

    1. Initial program 98.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6487.8

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites87.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Taylor expanded in x around 0

      \[\leadsto \color{blue}{c + \frac{-1}{4} \cdot \left(a \cdot b\right)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + c} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{4}, a \cdot b, c\right)} \]
      3. lower-*.f6471.6

        \[\leadsto \mathsf{fma}\left(-0.25, \color{blue}{a \cdot b}, c\right) \]
    8. Applied rewrites71.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25, a \cdot b, c\right)} \]

    if -0.0040000000000000001 < (*.f64 z t) < 4.9999999999999997e-189

    1. Initial program 97.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6495.4

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites95.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Taylor expanded in a around 0

      \[\leadsto \color{blue}{c + x \cdot y} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x \cdot y + c} \]
      2. lower-fma.f6475.2

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]
    8. Applied rewrites75.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification74.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+185}:\\ \;\;\;\;0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{elif}\;t \cdot z \leq -0.004:\\ \;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{-189}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{elif}\;t \cdot z \leq 10^{+124}:\\ \;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625 \cdot \left(t \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 89.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\ \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+193}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+35}:\\ \;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (fma a (* b -0.25) (fma x y c))))
   (if (<= (* x y) -5e+193)
     t_1
     (if (<= (* x y) 2e+35) (fma 0.0625 (* t z) (fma a (* b -0.25) c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = fma(a, (b * -0.25), fma(x, y, c));
	double tmp;
	if ((x * y) <= -5e+193) {
		tmp = t_1;
	} else if ((x * y) <= 2e+35) {
		tmp = fma(0.0625, (t * z), fma(a, (b * -0.25), c));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c)
	t_1 = fma(a, Float64(b * -0.25), fma(x, y, c))
	tmp = 0.0
	if (Float64(x * y) <= -5e+193)
		tmp = t_1;
	elseif (Float64(x * y) <= 2e+35)
		tmp = fma(0.0625, Float64(t * z), fma(a, Float64(b * -0.25), c));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e+193], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+35], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+193}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -4.99999999999999972e193 or 1.9999999999999999e35 < (*.f64 x y)

    1. Initial program 92.6%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6486.9

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites86.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]

    if -4.99999999999999972e193 < (*.f64 x y) < 1.9999999999999999e35

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(c + \frac{1}{16} \cdot \left(t \cdot z\right)\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + \frac{1}{16} \cdot \left(t \cdot z\right)\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{1}{16} \cdot \left(t \cdot z\right) + c\right)} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right) \]
      3. metadata-evalN/A

        \[\leadsto \left(\frac{1}{16} \cdot \left(t \cdot z\right) + c\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      4. associate-+l+N/A

        \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right) + \left(c + \frac{-1}{4} \cdot \left(a \cdot b\right)\right)} \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{16}, t \cdot z, c + \frac{-1}{4} \cdot \left(a \cdot b\right)\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{16}, \color{blue}{t \cdot z}, c + \frac{-1}{4} \cdot \left(a \cdot b\right)\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{16}, t \cdot z, \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + c}\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{16}, t \cdot z, \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + c\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{16}, t \cdot z, \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + c\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{16}, t \cdot z, a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + c\right) \]
      11. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{16}, t \cdot z, \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c\right)}\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{16}, t \cdot z, \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c\right)\right) \]
      13. lower-*.f6496.2

        \[\leadsto \mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, \color{blue}{b \cdot -0.25}, c\right)\right) \]
    5. Applied rewrites96.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 86.6% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+205}:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, 0.0625 \cdot \left(t \cdot z\right)\right)\\ \mathbf{elif}\;t \cdot z \leq 4 \cdot 10^{+95}:\\ \;\;\;\;\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} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (<= (* t z) -5e+205)
   (fma a (* b -0.25) (* 0.0625 (* t z)))
   (if (<= (* t z) 4e+95)
     (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+205) {
		tmp = fma(a, (b * -0.25), (0.0625 * (t * z)));
	} else if ((t * z) <= 4e+95) {
		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+205)
		tmp = fma(a, Float64(b * -0.25), Float64(0.0625 * Float64(t * z)));
	elseif (Float64(t * z) <= 4e+95)
		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+205], N[(a * N[(b * -0.25), $MachinePrecision] + N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 4e+95], 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^{+205}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, 0.0625 \cdot \left(t \cdot z\right)\right)\\

\mathbf{elif}\;t \cdot z \leq 4 \cdot 10^{+95}:\\
\;\;\;\;\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}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -5.0000000000000002e205

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\right) \]
      10. associate-+r+N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\left(c + \frac{1}{16} \cdot \left(t \cdot z\right)\right) + x \cdot y}\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\left(\frac{1}{16} \cdot \left(t \cdot z\right) + c\right)} + x \cdot y\right) \]
      12. associate-+l+N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right) + \left(c + x \cdot y\right)}\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\mathsf{fma}\left(\frac{1}{16}, t \cdot z, c + x \cdot y\right)}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \mathsf{fma}\left(\frac{1}{16}, \color{blue}{t \cdot z}, c + x \cdot y\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \mathsf{fma}\left(\frac{1}{16}, t \cdot z, \color{blue}{x \cdot y + c}\right)\right) \]
      16. lower-fma.f64100.0

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(0.0625, t \cdot z, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right)\right) \]
    5. Applied rewrites100.0%

      \[\leadsto \color{blue}{\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)} \]
    6. Taylor expanded in t around inf

      \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)}\right) \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)}\right) \]
      2. lower-*.f6496.2

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, 0.0625 \cdot \color{blue}{\left(t \cdot z\right)}\right) \]
    8. Applied rewrites96.2%

      \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{0.0625 \cdot \left(t \cdot z\right)}\right) \]

    if -5.0000000000000002e205 < (*.f64 z t) < 4.00000000000000008e95

    1. Initial program 98.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6491.2

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites91.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]

    if 4.00000000000000008e95 < (*.f64 z t)

    1. Initial program 94.4%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
      2. lower-*.f6481.8

        \[\leadsto 0.0625 \cdot \color{blue}{\left(t \cdot z\right)} + c \]
    5. Applied rewrites81.8%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{16} \cdot \color{blue}{\left(t \cdot z\right)} + c \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot \frac{1}{16}} + c \]
      3. lower-fma.f6481.8

        \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]
    7. Applied rewrites81.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+205}:\\ \;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, 0.0625 \cdot \left(t \cdot z\right)\right)\\ \mathbf{elif}\;t \cdot z \leq 4 \cdot 10^{+95}:\\ \;\;\;\;\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} \]
  5. Add Preprocessing

Alternative 9: 85.9% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+205}:\\ \;\;\;\;0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{elif}\;t \cdot z \leq 4 \cdot 10^{+95}:\\ \;\;\;\;\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} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (<= (* t z) -5e+205)
   (* 0.0625 (* t z))
   (if (<= (* t z) 4e+95)
     (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+205) {
		tmp = 0.0625 * (t * z);
	} else if ((t * z) <= 4e+95) {
		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+205)
		tmp = Float64(0.0625 * Float64(t * z));
	elseif (Float64(t * z) <= 4e+95)
		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+205], N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 4e+95], 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^{+205}:\\
\;\;\;\;0.0625 \cdot \left(t \cdot z\right)\\

\mathbf{elif}\;t \cdot z \leq 4 \cdot 10^{+95}:\\
\;\;\;\;\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}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -5.0000000000000002e205

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} \]
      2. lower-*.f6492.2

        \[\leadsto 0.0625 \cdot \color{blue}{\left(t \cdot z\right)} \]
    5. Applied rewrites92.2%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} \]

    if -5.0000000000000002e205 < (*.f64 z t) < 4.00000000000000008e95

    1. Initial program 98.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6491.2

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites91.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]

    if 4.00000000000000008e95 < (*.f64 z t)

    1. Initial program 94.4%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} + c \]
      2. lower-*.f6481.8

        \[\leadsto 0.0625 \cdot \color{blue}{\left(t \cdot z\right)} + c \]
    5. Applied rewrites81.8%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{16} \cdot \color{blue}{\left(t \cdot z\right)} + c \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot \frac{1}{16}} + c \]
      3. lower-fma.f6481.8

        \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]
    7. Applied rewrites81.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot z, 0.0625, c\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+205}:\\ \;\;\;\;0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{elif}\;t \cdot z \leq 4 \cdot 10^{+95}:\\ \;\;\;\;\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} \]
  5. Add Preprocessing

Alternative 10: 62.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+205}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+220}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (* 0.0625 (* t z))))
   (if (<= (* t z) -5e+205) t_1 (if (<= (* t z) 5e+220) (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) <= -5e+205) {
		tmp = t_1;
	} else if ((t * z) <= 5e+220) {
		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) <= -5e+205)
		tmp = t_1;
	elseif (Float64(t * z) <= 5e+220)
		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], -5e+205], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 5e+220], 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 -5 \cdot 10^{+205}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+220}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -5.0000000000000002e205 or 5.0000000000000002e220 < (*.f64 z t)

    1. Initial program 96.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{16} \cdot \left(t \cdot z\right)} \]
      2. lower-*.f6492.1

        \[\leadsto 0.0625 \cdot \color{blue}{\left(t \cdot z\right)} \]
    5. Applied rewrites92.1%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} \]

    if -5.0000000000000002e205 < (*.f64 z t) < 5.0000000000000002e220

    1. Initial program 98.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
      6. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
      11. lower-fma.f6487.0

        \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    5. Applied rewrites87.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
    6. Taylor expanded in a around 0

      \[\leadsto \color{blue}{c + x \cdot y} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x \cdot y + c} \]
      2. lower-fma.f6462.0

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]
    8. Applied rewrites62.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+205}:\\ \;\;\;\;0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+220}:\\ \;\;\;\;\mathsf{fma}\left(x, y, c\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625 \cdot \left(t \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 48.9% accurate, 6.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(x, y, c\right) \end{array} \]
(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}
Derivation
  1. Initial program 97.6%

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0

    \[\leadsto \color{blue}{\left(c + x \cdot y\right) - \frac{1}{4} \cdot \left(a \cdot b\right)} \]
  4. Step-by-step derivation
    1. cancel-sign-sub-invN/A

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(a \cdot b\right)} \]
    2. metadata-evalN/A

      \[\leadsto \left(c + x \cdot y\right) + \color{blue}{\frac{-1}{4}} \cdot \left(a \cdot b\right) \]
    3. +-commutativeN/A

      \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(a \cdot b\right) + \left(c + x \cdot y\right)} \]
    4. *-commutativeN/A

      \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot \frac{-1}{4}} + \left(c + x \cdot y\right) \]
    5. associate-*l*N/A

      \[\leadsto \color{blue}{a \cdot \left(b \cdot \frac{-1}{4}\right)} + \left(c + x \cdot y\right) \]
    6. *-commutativeN/A

      \[\leadsto a \cdot \color{blue}{\left(\frac{-1}{4} \cdot b\right)} + \left(c + x \cdot y\right) \]
    7. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{-1}{4} \cdot b, c + x \cdot y\right)} \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
    9. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + x \cdot y\right) \]
    10. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(a, b \cdot \frac{-1}{4}, \color{blue}{x \cdot y + c}\right) \]
    11. lower-fma.f6472.2

      \[\leadsto \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
  5. Applied rewrites72.2%

    \[\leadsto \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)} \]
  6. Taylor expanded in a around 0

    \[\leadsto \color{blue}{c + x \cdot y} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{x \cdot y + c} \]
    2. lower-fma.f6450.6

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]
  8. Applied rewrites50.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, c\right)} \]
  9. Add Preprocessing

Alternative 12: 28.4% accurate, 7.8× speedup?

\[\begin{array}{l} \\ x \cdot y \end{array} \]
(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}
Derivation
  1. Initial program 97.6%

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf

    \[\leadsto \color{blue}{x \cdot y} \]
  4. Step-by-step derivation
    1. lower-*.f6426.2

      \[\leadsto \color{blue}{x \cdot y} \]
  5. Applied rewrites26.2%

    \[\leadsto \color{blue}{x \cdot y} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024219 
(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))