(/ (+ (+ (+ P0 (* P1 (* amt 65536))) (* (- (- (* 3.0 (- P1 P0)) V1) (* 2.0 V0)) (* (pow amt 2) 65536))) (* (+ (+ (* 2.0 (- P0 P1)) V0) V1) (* (pow amt 3) 65536))) 65536)

Percentage Accurate: 72.7% → 97.8%
Time: 8.5s
Alternatives: 17
Speedup: 5.4×

Specification

?
\[0.85 \leq amt \land amt \leq 1\]
\[\begin{array}{l} \\ \frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \end{array} \]
(FPCore (P0 P1 amt V1 V0)
 :precision binary32
 (/
  (+
   (+
    (+ P0 (* P1 (* amt 65536.0)))
    (* (- (- (* 3.0 (- P1 P0)) V1) (* 2.0 V0)) (* (pow amt 2.0) 65536.0)))
   (* (+ (+ (* 2.0 (- P0 P1)) V0) V1) (* (pow amt 3.0) 65536.0)))
  65536.0))
float code(float P0, float P1, float amt, float V1, float V0) {
	return (((P0 + (P1 * (amt * 65536.0f))) + ((((3.0f * (P1 - P0)) - V1) - (2.0f * V0)) * (powf(amt, 2.0f) * 65536.0f))) + ((((2.0f * (P0 - P1)) + V0) + V1) * (powf(amt, 3.0f) * 65536.0f))) / 65536.0f;
}
real(4) function code(p0, p1, amt, v1, v0)
    real(4), intent (in) :: p0
    real(4), intent (in) :: p1
    real(4), intent (in) :: amt
    real(4), intent (in) :: v1
    real(4), intent (in) :: v0
    code = (((p0 + (p1 * (amt * 65536.0e0))) + ((((3.0e0 * (p1 - p0)) - v1) - (2.0e0 * v0)) * ((amt ** 2.0e0) * 65536.0e0))) + ((((2.0e0 * (p0 - p1)) + v0) + v1) * ((amt ** 3.0e0) * 65536.0e0))) / 65536.0e0
end function
function code(P0, P1, amt, V1, V0)
	return Float32(Float32(Float32(Float32(P0 + Float32(P1 * Float32(amt * Float32(65536.0)))) + Float32(Float32(Float32(Float32(Float32(3.0) * Float32(P1 - P0)) - V1) - Float32(Float32(2.0) * V0)) * Float32((amt ^ Float32(2.0)) * Float32(65536.0)))) + Float32(Float32(Float32(Float32(Float32(2.0) * Float32(P0 - P1)) + V0) + V1) * Float32((amt ^ Float32(3.0)) * Float32(65536.0)))) / Float32(65536.0))
end
function tmp = code(P0, P1, amt, V1, V0)
	tmp = (((P0 + (P1 * (amt * single(65536.0)))) + ((((single(3.0) * (P1 - P0)) - V1) - (single(2.0) * V0)) * ((amt ^ single(2.0)) * single(65536.0)))) + ((((single(2.0) * (P0 - P1)) + V0) + V1) * ((amt ^ single(3.0)) * single(65536.0)))) / single(65536.0);
end
\begin{array}{l}

\\
\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536}
\end{array}

Sampling outcomes in binary32 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 17 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: 72.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \end{array} \]
(FPCore (P0 P1 amt V1 V0)
 :precision binary32
 (/
  (+
   (+
    (+ P0 (* P1 (* amt 65536.0)))
    (* (- (- (* 3.0 (- P1 P0)) V1) (* 2.0 V0)) (* (pow amt 2.0) 65536.0)))
   (* (+ (+ (* 2.0 (- P0 P1)) V0) V1) (* (pow amt 3.0) 65536.0)))
  65536.0))
float code(float P0, float P1, float amt, float V1, float V0) {
	return (((P0 + (P1 * (amt * 65536.0f))) + ((((3.0f * (P1 - P0)) - V1) - (2.0f * V0)) * (powf(amt, 2.0f) * 65536.0f))) + ((((2.0f * (P0 - P1)) + V0) + V1) * (powf(amt, 3.0f) * 65536.0f))) / 65536.0f;
}
real(4) function code(p0, p1, amt, v1, v0)
    real(4), intent (in) :: p0
    real(4), intent (in) :: p1
    real(4), intent (in) :: amt
    real(4), intent (in) :: v1
    real(4), intent (in) :: v0
    code = (((p0 + (p1 * (amt * 65536.0e0))) + ((((3.0e0 * (p1 - p0)) - v1) - (2.0e0 * v0)) * ((amt ** 2.0e0) * 65536.0e0))) + ((((2.0e0 * (p0 - p1)) + v0) + v1) * ((amt ** 3.0e0) * 65536.0e0))) / 65536.0e0
end function
function code(P0, P1, amt, V1, V0)
	return Float32(Float32(Float32(Float32(P0 + Float32(P1 * Float32(amt * Float32(65536.0)))) + Float32(Float32(Float32(Float32(Float32(3.0) * Float32(P1 - P0)) - V1) - Float32(Float32(2.0) * V0)) * Float32((amt ^ Float32(2.0)) * Float32(65536.0)))) + Float32(Float32(Float32(Float32(Float32(2.0) * Float32(P0 - P1)) + V0) + V1) * Float32((amt ^ Float32(3.0)) * Float32(65536.0)))) / Float32(65536.0))
end
function tmp = code(P0, P1, amt, V1, V0)
	tmp = (((P0 + (P1 * (amt * single(65536.0)))) + ((((single(3.0) * (P1 - P0)) - V1) - (single(2.0) * V0)) * ((amt ^ single(2.0)) * single(65536.0)))) + ((((single(2.0) * (P0 - P1)) + V0) + V1) * ((amt ^ single(3.0)) * single(65536.0)))) / single(65536.0);
end
\begin{array}{l}

\\
\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536}
\end{array}

Alternative 1: 97.8% accurate, 5.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V0\right), V1 \cdot \left(amt + -1\right)\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \end{array} \]
(FPCore (P0 P1 amt V1 V0)
 :precision binary32
 (fma
  amt
  (fma
   amt
   (fma
    V0
    -2.0
    (fma 3.0 (- P1 P0) (fma amt (fma 2.0 (- P0 P1) V0) (* V1 (+ amt -1.0)))))
   P1)
  (* P0 1.52587890625e-5)))
float code(float P0, float P1, float amt, float V1, float V0) {
	return fmaf(amt, fmaf(amt, fmaf(V0, -2.0f, fmaf(3.0f, (P1 - P0), fmaf(amt, fmaf(2.0f, (P0 - P1), V0), (V1 * (amt + -1.0f))))), P1), (P0 * 1.52587890625e-5f));
}
function code(P0, P1, amt, V1, V0)
	return fma(amt, fma(amt, fma(V0, Float32(-2.0), fma(Float32(3.0), Float32(P1 - P0), fma(amt, fma(Float32(2.0), Float32(P0 - P1), V0), Float32(V1 * Float32(amt + Float32(-1.0)))))), P1), Float32(P0 * Float32(1.52587890625e-5)))
end
\begin{array}{l}

\\
\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V0\right), V1 \cdot \left(amt + -1\right)\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)
\end{array}
Derivation
  1. Initial program 75.2%

    \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
  2. Add Preprocessing
  3. Taylor expanded in amt around 0

    \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
    2. lower-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
  5. Applied rewrites96.5%

    \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
  6. Taylor expanded in V1 around 0

    \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, -2 \cdot V0 + \color{blue}{\left(3 \cdot \left(P1 - P0\right) + \left(V1 \cdot \left(amt - 1\right) + amt \cdot \left(V0 + 2 \cdot \left(P0 - P1\right)\right)\right)\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
  7. Step-by-step derivation
    1. Applied rewrites98.0%

      \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, \color{blue}{-2}, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V0\right), V1 \cdot \left(amt + -1\right)\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]
    2. Add Preprocessing

    Alternative 2: 84.9% accurate, 4.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;P1 \leq -500000000:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V0\right), 3 \cdot \left(P1 - P0\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{elif}\;P1 \leq 49999999215337470:\\ \;\;\;\;\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(P0, -3, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0, V1\right), V0 \cdot -2\right) - V1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \end{array} \end{array} \]
    (FPCore (P0 P1 amt V1 V0)
     :precision binary32
     (if (<= P1 -500000000.0)
       (fma
        amt
        (fma
         amt
         (fma V0 -2.0 (fma amt (fma 2.0 (- P0 P1) V0) (* 3.0 (- P1 P0))))
         P1)
        (* P0 1.52587890625e-5))
       (if (<= P1 49999999215337470.0)
         (fma
          (* amt amt)
          (fma P0 -3.0 (- (fma amt (+ V0 (fma 2.0 P0 V1)) (* V0 -2.0)) V1))
          (* P0 1.52587890625e-5))
         (fma
          amt
          (fma amt (fma 3.0 (- P1 P0) (fma amt (fma 2.0 (- P0 P1) V1) (- V1))) P1)
          (* P0 1.52587890625e-5)))))
    float code(float P0, float P1, float amt, float V1, float V0) {
    	float tmp;
    	if (P1 <= -500000000.0f) {
    		tmp = fmaf(amt, fmaf(amt, fmaf(V0, -2.0f, fmaf(amt, fmaf(2.0f, (P0 - P1), V0), (3.0f * (P1 - P0)))), P1), (P0 * 1.52587890625e-5f));
    	} else if (P1 <= 49999999215337470.0f) {
    		tmp = fmaf((amt * amt), fmaf(P0, -3.0f, (fmaf(amt, (V0 + fmaf(2.0f, P0, V1)), (V0 * -2.0f)) - V1)), (P0 * 1.52587890625e-5f));
    	} else {
    		tmp = fmaf(amt, fmaf(amt, fmaf(3.0f, (P1 - P0), fmaf(amt, fmaf(2.0f, (P0 - P1), V1), -V1)), P1), (P0 * 1.52587890625e-5f));
    	}
    	return tmp;
    }
    
    function code(P0, P1, amt, V1, V0)
    	tmp = Float32(0.0)
    	if (P1 <= Float32(-500000000.0))
    		tmp = fma(amt, fma(amt, fma(V0, Float32(-2.0), fma(amt, fma(Float32(2.0), Float32(P0 - P1), V0), Float32(Float32(3.0) * Float32(P1 - P0)))), P1), Float32(P0 * Float32(1.52587890625e-5)));
    	elseif (P1 <= Float32(49999999215337470.0))
    		tmp = fma(Float32(amt * amt), fma(P0, Float32(-3.0), Float32(fma(amt, Float32(V0 + fma(Float32(2.0), P0, V1)), Float32(V0 * Float32(-2.0))) - V1)), Float32(P0 * Float32(1.52587890625e-5)));
    	else
    		tmp = fma(amt, fma(amt, fma(Float32(3.0), Float32(P1 - P0), fma(amt, fma(Float32(2.0), Float32(P0 - P1), V1), Float32(-V1))), P1), Float32(P0 * Float32(1.52587890625e-5)));
    	end
    	return tmp
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;P1 \leq -500000000:\\
    \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V0\right), 3 \cdot \left(P1 - P0\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
    
    \mathbf{elif}\;P1 \leq 49999999215337470:\\
    \;\;\;\;\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(P0, -3, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0, V1\right), V0 \cdot -2\right) - V1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if P1 < -5e8

      1. Initial program 74.1%

        \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
      2. Add Preprocessing
      3. Taylor expanded in amt around 0

        \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
        2. lower-fma.f32N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
      5. Applied rewrites96.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
      6. Taylor expanded in V1 around 0

        \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, -2 \cdot V0 + \color{blue}{\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + 2 \cdot \left(P0 - P1\right)\right)\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
      7. Step-by-step derivation
        1. Applied rewrites86.1%

          \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, \color{blue}{-2}, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V0\right), 3 \cdot \left(P1 - P0\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]

        if -5e8 < P1 < 4.99999992e16

        1. Initial program 79.4%

          \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
        2. Add Preprocessing
        3. Taylor expanded in amt around 0

          \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
          2. lower-fma.f32N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
        5. Applied rewrites96.2%

          \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
        6. Taylor expanded in P1 around 0

          \[\leadsto \frac{1}{65536} \cdot P0 + \color{blue}{{amt}^{2} \cdot \left(\left(-3 \cdot P0 + \left(-2 \cdot V0 + amt \cdot \left(V0 + \left(V1 + 2 \cdot P0\right)\right)\right)\right) - V1\right)} \]
        7. Step-by-step derivation
          1. Applied rewrites89.7%

            \[\leadsto \mathsf{fma}\left(amt \cdot amt, \color{blue}{\mathsf{fma}\left(P0, -3, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0, V1\right), V0 \cdot -2\right) - V1\right)}, 1.52587890625 \cdot 10^{-5} \cdot P0\right) \]

          if 4.99999992e16 < P1

          1. Initial program 50.6%

            \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
          2. Add Preprocessing
          3. Taylor expanded in amt around 0

            \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
          4. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
            2. lower-fma.f32N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
          5. Applied rewrites98.3%

            \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
          6. Taylor expanded in V0 around 0

            \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right) - \color{blue}{V1}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
          7. Step-by-step derivation
            1. Applied rewrites93.5%

              \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, \color{blue}{P1 - P0}, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]
          8. Recombined 3 regimes into one program.
          9. Final simplification89.5%

            \[\leadsto \begin{array}{l} \mathbf{if}\;P1 \leq -500000000:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V0\right), 3 \cdot \left(P1 - P0\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{elif}\;P1 \leq 49999999215337470:\\ \;\;\;\;\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(P0, -3, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0, V1\right), V0 \cdot -2\right) - V1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \end{array} \]
          10. Add Preprocessing

          Alternative 3: 84.9% accurate, 4.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;P1 \leq -4999999913984:\\ \;\;\;\;amt \cdot \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(P1, -2, V1\right), P1 \cdot 3\right) - V1\right), P1\right)\\ \mathbf{elif}\;P1 \leq 49999999215337470:\\ \;\;\;\;\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(P0, -3, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0, V1\right), V0 \cdot -2\right) - V1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \end{array} \end{array} \]
          (FPCore (P0 P1 amt V1 V0)
           :precision binary32
           (if (<= P1 -4999999913984.0)
             (*
              amt
              (fma
               amt
               (fma V0 -2.0 (- (fma amt (+ V0 (fma P1 -2.0 V1)) (* P1 3.0)) V1))
               P1))
             (if (<= P1 49999999215337470.0)
               (fma
                (* amt amt)
                (fma P0 -3.0 (- (fma amt (+ V0 (fma 2.0 P0 V1)) (* V0 -2.0)) V1))
                (* P0 1.52587890625e-5))
               (fma
                amt
                (fma amt (fma 3.0 (- P1 P0) (fma amt (fma 2.0 (- P0 P1) V1) (- V1))) P1)
                (* P0 1.52587890625e-5)))))
          float code(float P0, float P1, float amt, float V1, float V0) {
          	float tmp;
          	if (P1 <= -4999999913984.0f) {
          		tmp = amt * fmaf(amt, fmaf(V0, -2.0f, (fmaf(amt, (V0 + fmaf(P1, -2.0f, V1)), (P1 * 3.0f)) - V1)), P1);
          	} else if (P1 <= 49999999215337470.0f) {
          		tmp = fmaf((amt * amt), fmaf(P0, -3.0f, (fmaf(amt, (V0 + fmaf(2.0f, P0, V1)), (V0 * -2.0f)) - V1)), (P0 * 1.52587890625e-5f));
          	} else {
          		tmp = fmaf(amt, fmaf(amt, fmaf(3.0f, (P1 - P0), fmaf(amt, fmaf(2.0f, (P0 - P1), V1), -V1)), P1), (P0 * 1.52587890625e-5f));
          	}
          	return tmp;
          }
          
          function code(P0, P1, amt, V1, V0)
          	tmp = Float32(0.0)
          	if (P1 <= Float32(-4999999913984.0))
          		tmp = Float32(amt * fma(amt, fma(V0, Float32(-2.0), Float32(fma(amt, Float32(V0 + fma(P1, Float32(-2.0), V1)), Float32(P1 * Float32(3.0))) - V1)), P1));
          	elseif (P1 <= Float32(49999999215337470.0))
          		tmp = fma(Float32(amt * amt), fma(P0, Float32(-3.0), Float32(fma(amt, Float32(V0 + fma(Float32(2.0), P0, V1)), Float32(V0 * Float32(-2.0))) - V1)), Float32(P0 * Float32(1.52587890625e-5)));
          	else
          		tmp = fma(amt, fma(amt, fma(Float32(3.0), Float32(P1 - P0), fma(amt, fma(Float32(2.0), Float32(P0 - P1), V1), Float32(-V1))), P1), Float32(P0 * Float32(1.52587890625e-5)));
          	end
          	return tmp
          end
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;P1 \leq -4999999913984:\\
          \;\;\;\;amt \cdot \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(P1, -2, V1\right), P1 \cdot 3\right) - V1\right), P1\right)\\
          
          \mathbf{elif}\;P1 \leq 49999999215337470:\\
          \;\;\;\;\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(P0, -3, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0, V1\right), V0 \cdot -2\right) - V1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if P1 < -4999999910000

            1. Initial program 67.7%

              \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
            2. Add Preprocessing
            3. Taylor expanded in amt around 0

              \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
              2. lower-fma.f32N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
            5. Applied rewrites95.8%

              \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
            6. Taylor expanded in P0 around 0

              \[\leadsto amt \cdot \color{blue}{\left(P1 + amt \cdot \left(\left(-2 \cdot V0 + \left(3 \cdot P1 + amt \cdot \left(V0 + \left(V1 + -2 \cdot P1\right)\right)\right)\right) - V1\right)\right)} \]
            7. Step-by-step derivation
              1. Applied rewrites83.8%

                \[\leadsto amt \cdot \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(P1, -2, V1\right), P1 \cdot 3\right) - V1\right), P1\right)} \]

              if -4999999910000 < P1 < 4.99999992e16

              1. Initial program 80.2%

                \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
              2. Add Preprocessing
              3. Taylor expanded in amt around 0

                \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                2. lower-fma.f32N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
              5. Applied rewrites96.3%

                \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
              6. Taylor expanded in P1 around 0

                \[\leadsto \frac{1}{65536} \cdot P0 + \color{blue}{{amt}^{2} \cdot \left(\left(-3 \cdot P0 + \left(-2 \cdot V0 + amt \cdot \left(V0 + \left(V1 + 2 \cdot P0\right)\right)\right)\right) - V1\right)} \]
              7. Step-by-step derivation
                1. Applied rewrites89.0%

                  \[\leadsto \mathsf{fma}\left(amt \cdot amt, \color{blue}{\mathsf{fma}\left(P0, -3, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0, V1\right), V0 \cdot -2\right) - V1\right)}, 1.52587890625 \cdot 10^{-5} \cdot P0\right) \]

                if 4.99999992e16 < P1

                1. Initial program 50.6%

                  \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                2. Add Preprocessing
                3. Taylor expanded in amt around 0

                  \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                4. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                  2. lower-fma.f32N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                5. Applied rewrites98.3%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                6. Taylor expanded in V0 around 0

                  \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right) - \color{blue}{V1}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                7. Step-by-step derivation
                  1. Applied rewrites93.5%

                    \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, \color{blue}{P1 - P0}, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]
                8. Recombined 3 regimes into one program.
                9. Final simplification88.9%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;P1 \leq -4999999913984:\\ \;\;\;\;amt \cdot \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(P1, -2, V1\right), P1 \cdot 3\right) - V1\right), P1\right)\\ \mathbf{elif}\;P1 \leq 49999999215337470:\\ \;\;\;\;\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(P0, -3, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0, V1\right), V0 \cdot -2\right) - V1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \end{array} \]
                10. Add Preprocessing

                Alternative 4: 85.8% accurate, 5.1× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := amt \cdot \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(P1, -2, V1\right), P1 \cdot 3\right) - V1\right), P1\right)\\ \mathbf{if}\;V0 \leq -2.0000000400817547 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V0 \leq 39999999311872:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
                (FPCore (P0 P1 amt V1 V0)
                 :precision binary32
                 (let* ((t_0
                         (*
                          amt
                          (fma
                           amt
                           (fma V0 -2.0 (- (fma amt (+ V0 (fma P1 -2.0 V1)) (* P1 3.0)) V1))
                           P1))))
                   (if (<= V0 -2.0000000400817547e+20)
                     t_0
                     (if (<= V0 39999999311872.0)
                       (fma
                        amt
                        (fma
                         amt
                         (fma 3.0 (- P1 P0) (fma amt (fma 2.0 (- P0 P1) V1) (- V1)))
                         P1)
                        (* P0 1.52587890625e-5))
                       t_0))))
                float code(float P0, float P1, float amt, float V1, float V0) {
                	float t_0 = amt * fmaf(amt, fmaf(V0, -2.0f, (fmaf(amt, (V0 + fmaf(P1, -2.0f, V1)), (P1 * 3.0f)) - V1)), P1);
                	float tmp;
                	if (V0 <= -2.0000000400817547e+20f) {
                		tmp = t_0;
                	} else if (V0 <= 39999999311872.0f) {
                		tmp = fmaf(amt, fmaf(amt, fmaf(3.0f, (P1 - P0), fmaf(amt, fmaf(2.0f, (P0 - P1), V1), -V1)), P1), (P0 * 1.52587890625e-5f));
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                function code(P0, P1, amt, V1, V0)
                	t_0 = Float32(amt * fma(amt, fma(V0, Float32(-2.0), Float32(fma(amt, Float32(V0 + fma(P1, Float32(-2.0), V1)), Float32(P1 * Float32(3.0))) - V1)), P1))
                	tmp = Float32(0.0)
                	if (V0 <= Float32(-2.0000000400817547e+20))
                		tmp = t_0;
                	elseif (V0 <= Float32(39999999311872.0))
                		tmp = fma(amt, fma(amt, fma(Float32(3.0), Float32(P1 - P0), fma(amt, fma(Float32(2.0), Float32(P0 - P1), V1), Float32(-V1))), P1), Float32(P0 * Float32(1.52587890625e-5)));
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := amt \cdot \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(P1, -2, V1\right), P1 \cdot 3\right) - V1\right), P1\right)\\
                \mathbf{if}\;V0 \leq -2.0000000400817547 \cdot 10^{+20}:\\
                \;\;\;\;t_0\\
                
                \mathbf{elif}\;V0 \leq 39999999311872:\\
                \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;t_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if V0 < -2.00000004e20 or 3.99999993e13 < V0

                  1. Initial program 68.4%

                    \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                  2. Add Preprocessing
                  3. Taylor expanded in amt around 0

                    \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                    2. lower-fma.f32N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                  5. Applied rewrites97.7%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                  6. Taylor expanded in P0 around 0

                    \[\leadsto amt \cdot \color{blue}{\left(P1 + amt \cdot \left(\left(-2 \cdot V0 + \left(3 \cdot P1 + amt \cdot \left(V0 + \left(V1 + -2 \cdot P1\right)\right)\right)\right) - V1\right)\right)} \]
                  7. Step-by-step derivation
                    1. Applied rewrites86.6%

                      \[\leadsto amt \cdot \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(P1, -2, V1\right), P1 \cdot 3\right) - V1\right), P1\right)} \]

                    if -2.00000004e20 < V0 < 3.99999993e13

                    1. Initial program 78.2%

                      \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                    2. Add Preprocessing
                    3. Taylor expanded in amt around 0

                      \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

                        \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                      2. lower-fma.f32N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                    5. Applied rewrites95.9%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                    6. Taylor expanded in V0 around 0

                      \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right) - \color{blue}{V1}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                    7. Step-by-step derivation
                      1. Applied rewrites87.6%

                        \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(3, \color{blue}{P1 - P0}, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1\right), -V1\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]
                    8. Recombined 2 regimes into one program.
                    9. Add Preprocessing

                    Alternative 5: 80.3% accurate, 5.4× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, P0 \cdot \mathsf{fma}\left(amt, 2, -3\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{if}\;P0 \leq -1.0000000200408773 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;P0 \leq 40000001090256900:\\ \;\;\;\;amt \cdot \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(P1, -2, V1\right), P1 \cdot 3\right) - V1\right), P1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
                    (FPCore (P0 P1 amt V1 V0)
                     :precision binary32
                     (let* ((t_0
                             (fma
                              amt
                              (fma amt (* P0 (fma amt 2.0 -3.0)) P1)
                              (* P0 1.52587890625e-5))))
                       (if (<= P0 -1.0000000200408773e+20)
                         t_0
                         (if (<= P0 40000001090256900.0)
                           (*
                            amt
                            (fma
                             amt
                             (fma V0 -2.0 (- (fma amt (+ V0 (fma P1 -2.0 V1)) (* P1 3.0)) V1))
                             P1))
                           t_0))))
                    float code(float P0, float P1, float amt, float V1, float V0) {
                    	float t_0 = fmaf(amt, fmaf(amt, (P0 * fmaf(amt, 2.0f, -3.0f)), P1), (P0 * 1.52587890625e-5f));
                    	float tmp;
                    	if (P0 <= -1.0000000200408773e+20f) {
                    		tmp = t_0;
                    	} else if (P0 <= 40000001090256900.0f) {
                    		tmp = amt * fmaf(amt, fmaf(V0, -2.0f, (fmaf(amt, (V0 + fmaf(P1, -2.0f, V1)), (P1 * 3.0f)) - V1)), P1);
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    function code(P0, P1, amt, V1, V0)
                    	t_0 = fma(amt, fma(amt, Float32(P0 * fma(amt, Float32(2.0), Float32(-3.0))), P1), Float32(P0 * Float32(1.52587890625e-5)))
                    	tmp = Float32(0.0)
                    	if (P0 <= Float32(-1.0000000200408773e+20))
                    		tmp = t_0;
                    	elseif (P0 <= Float32(40000001090256900.0))
                    		tmp = Float32(amt * fma(amt, fma(V0, Float32(-2.0), Float32(fma(amt, Float32(V0 + fma(P1, Float32(-2.0), V1)), Float32(P1 * Float32(3.0))) - V1)), P1));
                    	else
                    		tmp = t_0;
                    	end
                    	return tmp
                    end
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    t_0 := \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, P0 \cdot \mathsf{fma}\left(amt, 2, -3\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                    \mathbf{if}\;P0 \leq -1.0000000200408773 \cdot 10^{+20}:\\
                    \;\;\;\;t_0\\
                    
                    \mathbf{elif}\;P0 \leq 40000001090256900:\\
                    \;\;\;\;amt \cdot \mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(P1, -2, V1\right), P1 \cdot 3\right) - V1\right), P1\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t_0\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if P0 < -1.00000002e20 or 4.00000011e16 < P0

                      1. Initial program 61.0%

                        \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                      2. Add Preprocessing
                      3. Taylor expanded in amt around 0

                        \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                      4. Step-by-step derivation
                        1. +-commutativeN/A

                          \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                        2. lower-fma.f32N/A

                          \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                      5. Applied rewrites93.9%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                      6. Taylor expanded in P0 around inf

                        \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, P0 \cdot \color{blue}{\left(2 \cdot amt - 3\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                      7. Step-by-step derivation
                        1. Applied rewrites73.0%

                          \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, P0 \cdot \color{blue}{\mathsf{fma}\left(amt, 2, -3\right)}, P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]

                        if -1.00000002e20 < P0 < 4.00000011e16

                        1. Initial program 80.9%

                          \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                        2. Add Preprocessing
                        3. Taylor expanded in amt around 0

                          \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                          2. lower-fma.f32N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                        5. Applied rewrites97.5%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                        6. Taylor expanded in P0 around 0

                          \[\leadsto amt \cdot \color{blue}{\left(P1 + amt \cdot \left(\left(-2 \cdot V0 + \left(3 \cdot P1 + amt \cdot \left(V0 + \left(V1 + -2 \cdot P1\right)\right)\right)\right) - V1\right)\right)} \]
                        7. Step-by-step derivation
                          1. Applied rewrites84.0%

                            \[\leadsto amt \cdot \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(V0, -2, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(P1, -2, V1\right), P1 \cdot 3\right) - V1\right), P1\right)} \]
                        8. Recombined 2 regimes into one program.
                        9. Add Preprocessing

                        Alternative 6: 96.4% accurate, 5.4× speedup?

                        \[\begin{array}{l} \\ \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \end{array} \]
                        (FPCore (P0 P1 amt V1 V0)
                         :precision binary32
                         (fma
                          amt
                          (fma
                           amt
                           (fma
                            amt
                            (fma 2.0 (- P0 P1) (+ V1 V0))
                            (fma 3.0 (- P1 P0) (fma V0 -2.0 (- V1))))
                           P1)
                          (* P0 1.52587890625e-5)))
                        float code(float P0, float P1, float amt, float V1, float V0) {
                        	return fmaf(amt, fmaf(amt, fmaf(amt, fmaf(2.0f, (P0 - P1), (V1 + V0)), fmaf(3.0f, (P1 - P0), fmaf(V0, -2.0f, -V1))), P1), (P0 * 1.52587890625e-5f));
                        }
                        
                        function code(P0, P1, amt, V1, V0)
                        	return fma(amt, fma(amt, fma(amt, fma(Float32(2.0), Float32(P0 - P1), Float32(V1 + V0)), fma(Float32(3.0), Float32(P1 - P0), fma(V0, Float32(-2.0), Float32(-V1)))), P1), Float32(P0 * Float32(1.52587890625e-5)))
                        end
                        
                        \begin{array}{l}
                        
                        \\
                        \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)
                        \end{array}
                        
                        Derivation
                        1. Initial program 75.2%

                          \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                        2. Add Preprocessing
                        3. Taylor expanded in amt around 0

                          \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                          2. lower-fma.f32N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                        5. Applied rewrites96.5%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                        6. Add Preprocessing

                        Alternative 7: 96.4% accurate, 5.4× speedup?

                        \[\begin{array}{l} \\ \mathsf{fma}\left(P0, 1.52587890625 \cdot 10^{-5}, amt \cdot \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0 - P1, V1\right), \mathsf{fma}\left(3, P1 - P0, V0 \cdot -2\right) - V1\right), P1\right)\right) \end{array} \]
                        (FPCore (P0 P1 amt V1 V0)
                         :precision binary32
                         (fma
                          P0
                          1.52587890625e-5
                          (*
                           amt
                           (fma
                            amt
                            (fma
                             amt
                             (+ V0 (fma 2.0 (- P0 P1) V1))
                             (- (fma 3.0 (- P1 P0) (* V0 -2.0)) V1))
                            P1))))
                        float code(float P0, float P1, float amt, float V1, float V0) {
                        	return fmaf(P0, 1.52587890625e-5f, (amt * fmaf(amt, fmaf(amt, (V0 + fmaf(2.0f, (P0 - P1), V1)), (fmaf(3.0f, (P1 - P0), (V0 * -2.0f)) - V1)), P1)));
                        }
                        
                        function code(P0, P1, amt, V1, V0)
                        	return fma(P0, Float32(1.52587890625e-5), Float32(amt * fma(amt, fma(amt, Float32(V0 + fma(Float32(2.0), Float32(P0 - P1), V1)), Float32(fma(Float32(3.0), Float32(P1 - P0), Float32(V0 * Float32(-2.0))) - V1)), P1)))
                        end
                        
                        \begin{array}{l}
                        
                        \\
                        \mathsf{fma}\left(P0, 1.52587890625 \cdot 10^{-5}, amt \cdot \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0 - P1, V1\right), \mathsf{fma}\left(3, P1 - P0, V0 \cdot -2\right) - V1\right), P1\right)\right)
                        \end{array}
                        
                        Derivation
                        1. Initial program 75.2%

                          \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                        2. Add Preprocessing
                        3. Taylor expanded in amt around 0

                          \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                          2. lower-fma.f32N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                        5. Applied rewrites96.5%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                        6. Step-by-step derivation
                          1. Applied rewrites96.3%

                            \[\leadsto \mathsf{fma}\left(P0, \color{blue}{1.52587890625 \cdot 10^{-5}}, amt \cdot \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 + \mathsf{fma}\left(2, P0 - P1, V1\right), \mathsf{fma}\left(3, P1 - P0, V0 \cdot -2\right) - V1\right), P1\right)\right) \]
                          2. Add Preprocessing

                          Alternative 8: 45.1% accurate, 6.1× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, P0 \cdot \mathsf{fma}\left(amt, 2, -3\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{if}\;P0 \leq -1000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \left(amt + -1\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{elif}\;P0 \leq 2000000:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \left(amt + -2\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
                          (FPCore (P0 P1 amt V1 V0)
                           :precision binary32
                           (let* ((t_0
                                   (fma
                                    amt
                                    (fma amt (* P0 (fma amt 2.0 -3.0)) P1)
                                    (* P0 1.52587890625e-5))))
                             (if (<= P0 -1000000000.0)
                               t_0
                               (if (<= P0 -5.000000156871975e-23)
                                 (fma amt (fma amt (* V1 (+ amt -1.0)) P1) (* P0 1.52587890625e-5))
                                 (if (<= P0 2000000.0)
                                   (fma amt (fma amt (* V0 (+ amt -2.0)) P1) (* P0 1.52587890625e-5))
                                   t_0)))))
                          float code(float P0, float P1, float amt, float V1, float V0) {
                          	float t_0 = fmaf(amt, fmaf(amt, (P0 * fmaf(amt, 2.0f, -3.0f)), P1), (P0 * 1.52587890625e-5f));
                          	float tmp;
                          	if (P0 <= -1000000000.0f) {
                          		tmp = t_0;
                          	} else if (P0 <= -5.000000156871975e-23f) {
                          		tmp = fmaf(amt, fmaf(amt, (V1 * (amt + -1.0f)), P1), (P0 * 1.52587890625e-5f));
                          	} else if (P0 <= 2000000.0f) {
                          		tmp = fmaf(amt, fmaf(amt, (V0 * (amt + -2.0f)), P1), (P0 * 1.52587890625e-5f));
                          	} else {
                          		tmp = t_0;
                          	}
                          	return tmp;
                          }
                          
                          function code(P0, P1, amt, V1, V0)
                          	t_0 = fma(amt, fma(amt, Float32(P0 * fma(amt, Float32(2.0), Float32(-3.0))), P1), Float32(P0 * Float32(1.52587890625e-5)))
                          	tmp = Float32(0.0)
                          	if (P0 <= Float32(-1000000000.0))
                          		tmp = t_0;
                          	elseif (P0 <= Float32(-5.000000156871975e-23))
                          		tmp = fma(amt, fma(amt, Float32(V1 * Float32(amt + Float32(-1.0))), P1), Float32(P0 * Float32(1.52587890625e-5)));
                          	elseif (P0 <= Float32(2000000.0))
                          		tmp = fma(amt, fma(amt, Float32(V0 * Float32(amt + Float32(-2.0))), P1), Float32(P0 * Float32(1.52587890625e-5)));
                          	else
                          		tmp = t_0;
                          	end
                          	return tmp
                          end
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          t_0 := \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, P0 \cdot \mathsf{fma}\left(amt, 2, -3\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                          \mathbf{if}\;P0 \leq -1000000000:\\
                          \;\;\;\;t_0\\
                          
                          \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\
                          \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \left(amt + -1\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                          
                          \mathbf{elif}\;P0 \leq 2000000:\\
                          \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \left(amt + -2\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;t_0\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if P0 < -1e9 or 2e6 < P0

                            1. Initial program 68.0%

                              \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                            2. Add Preprocessing
                            3. Taylor expanded in amt around 0

                              \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                            4. Step-by-step derivation
                              1. +-commutativeN/A

                                \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                              2. lower-fma.f32N/A

                                \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                            5. Applied rewrites94.9%

                              \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                            6. Taylor expanded in P0 around inf

                              \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, P0 \cdot \color{blue}{\left(2 \cdot amt - 3\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                            7. Step-by-step derivation
                              1. Applied rewrites64.7%

                                \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, P0 \cdot \color{blue}{\mathsf{fma}\left(amt, 2, -3\right)}, P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]

                              if -1e9 < P0 < -5.00000016e-23

                              1. Initial program 80.5%

                                \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                              2. Add Preprocessing
                              3. Taylor expanded in amt around 0

                                \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                              4. Step-by-step derivation
                                1. +-commutativeN/A

                                  \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                2. lower-fma.f32N/A

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                              5. Applied rewrites97.5%

                                \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                              6. Taylor expanded in V1 around inf

                                \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \color{blue}{\left(amt - 1\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                              7. Step-by-step derivation
                                1. Applied rewrites53.0%

                                  \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \color{blue}{\left(amt + -1\right)}, P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]

                                if -5.00000016e-23 < P0 < 2e6

                                1. Initial program 80.1%

                                  \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                2. Add Preprocessing
                                3. Taylor expanded in amt around 0

                                  \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                4. Step-by-step derivation
                                  1. +-commutativeN/A

                                    \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                  2. lower-fma.f32N/A

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                5. Applied rewrites97.5%

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                6. Taylor expanded in V0 around inf

                                  \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \color{blue}{\left(amt - 2\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                                7. Step-by-step derivation
                                  1. Applied rewrites49.8%

                                    \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \color{blue}{\left(amt + -2\right)}, P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]
                                8. Recombined 3 regimes into one program.
                                9. Add Preprocessing

                                Alternative 9: 43.6% accurate, 6.5× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;P0 \leq -1000000000:\\ \;\;\;\;\mathsf{fma}\left(amt, P0 \cdot \left(amt \cdot \mathsf{fma}\left(amt, 2, -3\right)\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \left(amt + -1\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{elif}\;P0 \leq 2000000:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \left(amt + -2\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \end{array} \end{array} \]
                                (FPCore (P0 P1 amt V1 V0)
                                 :precision binary32
                                 (if (<= P0 -1000000000.0)
                                   (fma amt (* P0 (* amt (fma amt 2.0 -3.0))) (* P0 1.52587890625e-5))
                                   (if (<= P0 -5.000000156871975e-23)
                                     (fma amt (fma amt (* V1 (+ amt -1.0)) P1) (* P0 1.52587890625e-5))
                                     (if (<= P0 2000000.0)
                                       (fma amt (fma amt (* V0 (+ amt -2.0)) P1) (* P0 1.52587890625e-5))
                                       (* P0 (fma (* amt amt) (fma amt 2.0 -3.0) 1.52587890625e-5))))))
                                float code(float P0, float P1, float amt, float V1, float V0) {
                                	float tmp;
                                	if (P0 <= -1000000000.0f) {
                                		tmp = fmaf(amt, (P0 * (amt * fmaf(amt, 2.0f, -3.0f))), (P0 * 1.52587890625e-5f));
                                	} else if (P0 <= -5.000000156871975e-23f) {
                                		tmp = fmaf(amt, fmaf(amt, (V1 * (amt + -1.0f)), P1), (P0 * 1.52587890625e-5f));
                                	} else if (P0 <= 2000000.0f) {
                                		tmp = fmaf(amt, fmaf(amt, (V0 * (amt + -2.0f)), P1), (P0 * 1.52587890625e-5f));
                                	} else {
                                		tmp = P0 * fmaf((amt * amt), fmaf(amt, 2.0f, -3.0f), 1.52587890625e-5f);
                                	}
                                	return tmp;
                                }
                                
                                function code(P0, P1, amt, V1, V0)
                                	tmp = Float32(0.0)
                                	if (P0 <= Float32(-1000000000.0))
                                		tmp = fma(amt, Float32(P0 * Float32(amt * fma(amt, Float32(2.0), Float32(-3.0)))), Float32(P0 * Float32(1.52587890625e-5)));
                                	elseif (P0 <= Float32(-5.000000156871975e-23))
                                		tmp = fma(amt, fma(amt, Float32(V1 * Float32(amt + Float32(-1.0))), P1), Float32(P0 * Float32(1.52587890625e-5)));
                                	elseif (P0 <= Float32(2000000.0))
                                		tmp = fma(amt, fma(amt, Float32(V0 * Float32(amt + Float32(-2.0))), P1), Float32(P0 * Float32(1.52587890625e-5)));
                                	else
                                		tmp = Float32(P0 * fma(Float32(amt * amt), fma(amt, Float32(2.0), Float32(-3.0)), Float32(1.52587890625e-5)));
                                	end
                                	return tmp
                                end
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;P0 \leq -1000000000:\\
                                \;\;\;\;\mathsf{fma}\left(amt, P0 \cdot \left(amt \cdot \mathsf{fma}\left(amt, 2, -3\right)\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                                
                                \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\
                                \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \left(amt + -1\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                                
                                \mathbf{elif}\;P0 \leq 2000000:\\
                                \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \left(amt + -2\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 4 regimes
                                2. if P0 < -1e9

                                  1. Initial program 61.0%

                                    \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                  2. Add Preprocessing
                                  3. Taylor expanded in amt around 0

                                    \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                  4. Step-by-step derivation
                                    1. +-commutativeN/A

                                      \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                    2. lower-fma.f32N/A

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                  5. Applied rewrites92.4%

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                  6. Taylor expanded in P0 around inf

                                    \[\leadsto \mathsf{fma}\left(amt, P0 \cdot \color{blue}{\left(amt \cdot \left(2 \cdot amt - 3\right)\right)}, P0 \cdot \frac{1}{65536}\right) \]
                                  7. Step-by-step derivation
                                    1. Applied rewrites60.6%

                                      \[\leadsto \mathsf{fma}\left(amt, P0 \cdot \color{blue}{\left(amt \cdot \mathsf{fma}\left(amt, 2, -3\right)\right)}, P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]

                                    if -1e9 < P0 < -5.00000016e-23

                                    1. Initial program 80.5%

                                      \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in amt around 0

                                      \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                    4. Step-by-step derivation
                                      1. +-commutativeN/A

                                        \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                      2. lower-fma.f32N/A

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                    5. Applied rewrites97.5%

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                    6. Taylor expanded in V1 around inf

                                      \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \color{blue}{\left(amt - 1\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                                    7. Step-by-step derivation
                                      1. Applied rewrites53.0%

                                        \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \color{blue}{\left(amt + -1\right)}, P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]

                                      if -5.00000016e-23 < P0 < 2e6

                                      1. Initial program 80.1%

                                        \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                      2. Add Preprocessing
                                      3. Taylor expanded in amt around 0

                                        \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                      4. Step-by-step derivation
                                        1. +-commutativeN/A

                                          \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                        2. lower-fma.f32N/A

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                      5. Applied rewrites97.5%

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                      6. Taylor expanded in V0 around inf

                                        \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \color{blue}{\left(amt - 2\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                                      7. Step-by-step derivation
                                        1. Applied rewrites49.8%

                                          \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \color{blue}{\left(amt + -2\right)}, P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]

                                        if 2e6 < P0

                                        1. Initial program 75.3%

                                          \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                        2. Add Preprocessing
                                        3. Taylor expanded in amt around 0

                                          \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                        4. Step-by-step derivation
                                          1. +-commutativeN/A

                                            \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                          2. lower-fma.f32N/A

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                        5. Applied rewrites97.6%

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                        6. Taylor expanded in P0 around inf

                                          \[\leadsto P0 \cdot \color{blue}{\left(\frac{1}{65536} + {amt}^{2} \cdot \left(2 \cdot amt - 3\right)\right)} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites62.8%

                                            \[\leadsto P0 \cdot \color{blue}{\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)} \]
                                        8. Recombined 4 regimes into one program.
                                        9. Add Preprocessing

                                        Alternative 10: 43.7% accurate, 6.5× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{if}\;P0 \leq -1000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \left(amt + -1\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{elif}\;P0 \leq 2000000:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \left(amt + -2\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
                                        (FPCore (P0 P1 amt V1 V0)
                                         :precision binary32
                                         (let* ((t_0 (* P0 (fma (* amt amt) (fma amt 2.0 -3.0) 1.52587890625e-5))))
                                           (if (<= P0 -1000000000.0)
                                             t_0
                                             (if (<= P0 -5.000000156871975e-23)
                                               (fma amt (fma amt (* V1 (+ amt -1.0)) P1) (* P0 1.52587890625e-5))
                                               (if (<= P0 2000000.0)
                                                 (fma amt (fma amt (* V0 (+ amt -2.0)) P1) (* P0 1.52587890625e-5))
                                                 t_0)))))
                                        float code(float P0, float P1, float amt, float V1, float V0) {
                                        	float t_0 = P0 * fmaf((amt * amt), fmaf(amt, 2.0f, -3.0f), 1.52587890625e-5f);
                                        	float tmp;
                                        	if (P0 <= -1000000000.0f) {
                                        		tmp = t_0;
                                        	} else if (P0 <= -5.000000156871975e-23f) {
                                        		tmp = fmaf(amt, fmaf(amt, (V1 * (amt + -1.0f)), P1), (P0 * 1.52587890625e-5f));
                                        	} else if (P0 <= 2000000.0f) {
                                        		tmp = fmaf(amt, fmaf(amt, (V0 * (amt + -2.0f)), P1), (P0 * 1.52587890625e-5f));
                                        	} else {
                                        		tmp = t_0;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(P0, P1, amt, V1, V0)
                                        	t_0 = Float32(P0 * fma(Float32(amt * amt), fma(amt, Float32(2.0), Float32(-3.0)), Float32(1.52587890625e-5)))
                                        	tmp = Float32(0.0)
                                        	if (P0 <= Float32(-1000000000.0))
                                        		tmp = t_0;
                                        	elseif (P0 <= Float32(-5.000000156871975e-23))
                                        		tmp = fma(amt, fma(amt, Float32(V1 * Float32(amt + Float32(-1.0))), P1), Float32(P0 * Float32(1.52587890625e-5)));
                                        	elseif (P0 <= Float32(2000000.0))
                                        		tmp = fma(amt, fma(amt, Float32(V0 * Float32(amt + Float32(-2.0))), P1), Float32(P0 * Float32(1.52587890625e-5)));
                                        	else
                                        		tmp = t_0;
                                        	end
                                        	return tmp
                                        end
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        t_0 := P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\
                                        \mathbf{if}\;P0 \leq -1000000000:\\
                                        \;\;\;\;t_0\\
                                        
                                        \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\
                                        \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \left(amt + -1\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                                        
                                        \mathbf{elif}\;P0 \leq 2000000:\\
                                        \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \left(amt + -2\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;t_0\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 3 regimes
                                        2. if P0 < -1e9 or 2e6 < P0

                                          1. Initial program 68.0%

                                            \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in amt around 0

                                            \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                          4. Step-by-step derivation
                                            1. +-commutativeN/A

                                              \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                            2. lower-fma.f32N/A

                                              \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                          5. Applied rewrites94.9%

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                          6. Taylor expanded in P0 around inf

                                            \[\leadsto P0 \cdot \color{blue}{\left(\frac{1}{65536} + {amt}^{2} \cdot \left(2 \cdot amt - 3\right)\right)} \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites61.6%

                                              \[\leadsto P0 \cdot \color{blue}{\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)} \]

                                            if -1e9 < P0 < -5.00000016e-23

                                            1. Initial program 80.5%

                                              \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in amt around 0

                                              \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                            4. Step-by-step derivation
                                              1. +-commutativeN/A

                                                \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                              2. lower-fma.f32N/A

                                                \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                            5. Applied rewrites97.5%

                                              \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                            6. Taylor expanded in V1 around inf

                                              \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \color{blue}{\left(amt - 1\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                                            7. Step-by-step derivation
                                              1. Applied rewrites53.0%

                                                \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V1 \cdot \color{blue}{\left(amt + -1\right)}, P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]

                                              if -5.00000016e-23 < P0 < 2e6

                                              1. Initial program 80.1%

                                                \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                              2. Add Preprocessing
                                              3. Taylor expanded in amt around 0

                                                \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                              4. Step-by-step derivation
                                                1. +-commutativeN/A

                                                  \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                2. lower-fma.f32N/A

                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                              5. Applied rewrites97.5%

                                                \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                              6. Taylor expanded in V0 around inf

                                                \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \color{blue}{\left(amt - 2\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                                              7. Step-by-step derivation
                                                1. Applied rewrites49.8%

                                                  \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \color{blue}{\left(amt + -2\right)}, P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]
                                              8. Recombined 3 regimes into one program.
                                              9. Add Preprocessing

                                              Alternative 11: 42.3% accurate, 6.5× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} t_0 := P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{if}\;P0 \leq -1000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\ \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\ \mathbf{elif}\;P0 \leq 2000000:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \left(amt + -2\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
                                              (FPCore (P0 P1 amt V1 V0)
                                               :precision binary32
                                               (let* ((t_0 (* P0 (fma (* amt amt) (fma amt 2.0 -3.0) 1.52587890625e-5))))
                                                 (if (<= P0 -1000000000.0)
                                                   t_0
                                                   (if (<= P0 -5.000000156871975e-23)
                                                     (* V1 (* (+ amt -1.0) (* amt amt)))
                                                     (if (<= P0 2000000.0)
                                                       (fma amt (fma amt (* V0 (+ amt -2.0)) P1) (* P0 1.52587890625e-5))
                                                       t_0)))))
                                              float code(float P0, float P1, float amt, float V1, float V0) {
                                              	float t_0 = P0 * fmaf((amt * amt), fmaf(amt, 2.0f, -3.0f), 1.52587890625e-5f);
                                              	float tmp;
                                              	if (P0 <= -1000000000.0f) {
                                              		tmp = t_0;
                                              	} else if (P0 <= -5.000000156871975e-23f) {
                                              		tmp = V1 * ((amt + -1.0f) * (amt * amt));
                                              	} else if (P0 <= 2000000.0f) {
                                              		tmp = fmaf(amt, fmaf(amt, (V0 * (amt + -2.0f)), P1), (P0 * 1.52587890625e-5f));
                                              	} else {
                                              		tmp = t_0;
                                              	}
                                              	return tmp;
                                              }
                                              
                                              function code(P0, P1, amt, V1, V0)
                                              	t_0 = Float32(P0 * fma(Float32(amt * amt), fma(amt, Float32(2.0), Float32(-3.0)), Float32(1.52587890625e-5)))
                                              	tmp = Float32(0.0)
                                              	if (P0 <= Float32(-1000000000.0))
                                              		tmp = t_0;
                                              	elseif (P0 <= Float32(-5.000000156871975e-23))
                                              		tmp = Float32(V1 * Float32(Float32(amt + Float32(-1.0)) * Float32(amt * amt)));
                                              	elseif (P0 <= Float32(2000000.0))
                                              		tmp = fma(amt, fma(amt, Float32(V0 * Float32(amt + Float32(-2.0))), P1), Float32(P0 * Float32(1.52587890625e-5)));
                                              	else
                                              		tmp = t_0;
                                              	end
                                              	return tmp
                                              end
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              t_0 := P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\
                                              \mathbf{if}\;P0 \leq -1000000000:\\
                                              \;\;\;\;t_0\\
                                              
                                              \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\
                                              \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\
                                              
                                              \mathbf{elif}\;P0 \leq 2000000:\\
                                              \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \left(amt + -2\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;t_0\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 3 regimes
                                              2. if P0 < -1e9 or 2e6 < P0

                                                1. Initial program 68.0%

                                                  \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                2. Add Preprocessing
                                                3. Taylor expanded in amt around 0

                                                  \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                4. Step-by-step derivation
                                                  1. +-commutativeN/A

                                                    \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                  2. lower-fma.f32N/A

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                5. Applied rewrites94.9%

                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                6. Taylor expanded in P0 around inf

                                                  \[\leadsto P0 \cdot \color{blue}{\left(\frac{1}{65536} + {amt}^{2} \cdot \left(2 \cdot amt - 3\right)\right)} \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites61.6%

                                                    \[\leadsto P0 \cdot \color{blue}{\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)} \]

                                                  if -1e9 < P0 < -5.00000016e-23

                                                  1. Initial program 80.5%

                                                    \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                  2. Add Preprocessing
                                                  3. Taylor expanded in amt around 0

                                                    \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                  4. Step-by-step derivation
                                                    1. +-commutativeN/A

                                                      \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                    2. lower-fma.f32N/A

                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                  5. Applied rewrites97.5%

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                  6. Taylor expanded in V1 around inf

                                                    \[\leadsto V1 \cdot \color{blue}{\left({amt}^{2} \cdot \left(amt - 1\right)\right)} \]
                                                  7. Step-by-step derivation
                                                    1. Applied rewrites45.8%

                                                      \[\leadsto V1 \cdot \color{blue}{\left(\left(amt \cdot amt\right) \cdot \left(amt + -1\right)\right)} \]

                                                    if -5.00000016e-23 < P0 < 2e6

                                                    1. Initial program 80.1%

                                                      \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                    2. Add Preprocessing
                                                    3. Taylor expanded in amt around 0

                                                      \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                    4. Step-by-step derivation
                                                      1. +-commutativeN/A

                                                        \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                      2. lower-fma.f32N/A

                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                    5. Applied rewrites97.5%

                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                    6. Taylor expanded in V0 around inf

                                                      \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \color{blue}{\left(amt - 2\right)}, P1\right), P0 \cdot \frac{1}{65536}\right) \]
                                                    7. Step-by-step derivation
                                                      1. Applied rewrites49.8%

                                                        \[\leadsto \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \color{blue}{\left(amt + -2\right)}, P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]
                                                    8. Recombined 3 regimes into one program.
                                                    9. Final simplification53.8%

                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;P0 \leq -1000000000:\\ \;\;\;\;P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\ \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\ \mathbf{elif}\;P0 \leq 2000000:\\ \;\;\;\;\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, V0 \cdot \left(amt + -2\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \end{array} \]
                                                    10. Add Preprocessing

                                                    Alternative 12: 39.3% accurate, 6.6× speedup?

                                                    \[\begin{array}{l} \\ \begin{array}{l} t_0 := P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{if}\;P0 \leq -1000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\ \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\ \mathbf{elif}\;P0 \leq 2000000:\\ \;\;\;\;\mathsf{fma}\left(amt, V0 \cdot \left(amt \cdot \left(amt + -2\right)\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
                                                    (FPCore (P0 P1 amt V1 V0)
                                                     :precision binary32
                                                     (let* ((t_0 (* P0 (fma (* amt amt) (fma amt 2.0 -3.0) 1.52587890625e-5))))
                                                       (if (<= P0 -1000000000.0)
                                                         t_0
                                                         (if (<= P0 -5.000000156871975e-23)
                                                           (* V1 (* (+ amt -1.0) (* amt amt)))
                                                           (if (<= P0 2000000.0)
                                                             (fma amt (* V0 (* amt (+ amt -2.0))) (* P0 1.52587890625e-5))
                                                             t_0)))))
                                                    float code(float P0, float P1, float amt, float V1, float V0) {
                                                    	float t_0 = P0 * fmaf((amt * amt), fmaf(amt, 2.0f, -3.0f), 1.52587890625e-5f);
                                                    	float tmp;
                                                    	if (P0 <= -1000000000.0f) {
                                                    		tmp = t_0;
                                                    	} else if (P0 <= -5.000000156871975e-23f) {
                                                    		tmp = V1 * ((amt + -1.0f) * (amt * amt));
                                                    	} else if (P0 <= 2000000.0f) {
                                                    		tmp = fmaf(amt, (V0 * (amt * (amt + -2.0f))), (P0 * 1.52587890625e-5f));
                                                    	} else {
                                                    		tmp = t_0;
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    function code(P0, P1, amt, V1, V0)
                                                    	t_0 = Float32(P0 * fma(Float32(amt * amt), fma(amt, Float32(2.0), Float32(-3.0)), Float32(1.52587890625e-5)))
                                                    	tmp = Float32(0.0)
                                                    	if (P0 <= Float32(-1000000000.0))
                                                    		tmp = t_0;
                                                    	elseif (P0 <= Float32(-5.000000156871975e-23))
                                                    		tmp = Float32(V1 * Float32(Float32(amt + Float32(-1.0)) * Float32(amt * amt)));
                                                    	elseif (P0 <= Float32(2000000.0))
                                                    		tmp = fma(amt, Float32(V0 * Float32(amt * Float32(amt + Float32(-2.0)))), Float32(P0 * Float32(1.52587890625e-5)));
                                                    	else
                                                    		tmp = t_0;
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    \begin{array}{l}
                                                    
                                                    \\
                                                    \begin{array}{l}
                                                    t_0 := P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\
                                                    \mathbf{if}\;P0 \leq -1000000000:\\
                                                    \;\;\;\;t_0\\
                                                    
                                                    \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\
                                                    \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\
                                                    
                                                    \mathbf{elif}\;P0 \leq 2000000:\\
                                                    \;\;\;\;\mathsf{fma}\left(amt, V0 \cdot \left(amt \cdot \left(amt + -2\right)\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;t_0\\
                                                    
                                                    
                                                    \end{array}
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 3 regimes
                                                    2. if P0 < -1e9 or 2e6 < P0

                                                      1. Initial program 68.0%

                                                        \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                      2. Add Preprocessing
                                                      3. Taylor expanded in amt around 0

                                                        \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                      4. Step-by-step derivation
                                                        1. +-commutativeN/A

                                                          \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                        2. lower-fma.f32N/A

                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                      5. Applied rewrites94.9%

                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                      6. Taylor expanded in P0 around inf

                                                        \[\leadsto P0 \cdot \color{blue}{\left(\frac{1}{65536} + {amt}^{2} \cdot \left(2 \cdot amt - 3\right)\right)} \]
                                                      7. Step-by-step derivation
                                                        1. Applied rewrites61.6%

                                                          \[\leadsto P0 \cdot \color{blue}{\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)} \]

                                                        if -1e9 < P0 < -5.00000016e-23

                                                        1. Initial program 80.5%

                                                          \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                        2. Add Preprocessing
                                                        3. Taylor expanded in amt around 0

                                                          \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                        4. Step-by-step derivation
                                                          1. +-commutativeN/A

                                                            \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                          2. lower-fma.f32N/A

                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                        5. Applied rewrites97.5%

                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                        6. Taylor expanded in V1 around inf

                                                          \[\leadsto V1 \cdot \color{blue}{\left({amt}^{2} \cdot \left(amt - 1\right)\right)} \]
                                                        7. Step-by-step derivation
                                                          1. Applied rewrites45.8%

                                                            \[\leadsto V1 \cdot \color{blue}{\left(\left(amt \cdot amt\right) \cdot \left(amt + -1\right)\right)} \]

                                                          if -5.00000016e-23 < P0 < 2e6

                                                          1. Initial program 80.1%

                                                            \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                          2. Add Preprocessing
                                                          3. Taylor expanded in amt around 0

                                                            \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                          4. Step-by-step derivation
                                                            1. +-commutativeN/A

                                                              \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                            2. lower-fma.f32N/A

                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                          5. Applied rewrites97.5%

                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                          6. Taylor expanded in V0 around inf

                                                            \[\leadsto \mathsf{fma}\left(amt, V0 \cdot \color{blue}{\left(amt \cdot \left(amt - 2\right)\right)}, P0 \cdot \frac{1}{65536}\right) \]
                                                          7. Step-by-step derivation
                                                            1. Applied rewrites44.9%

                                                              \[\leadsto \mathsf{fma}\left(amt, V0 \cdot \color{blue}{\left(amt \cdot \left(amt + -2\right)\right)}, P0 \cdot 1.52587890625 \cdot 10^{-5}\right) \]
                                                          8. Recombined 3 regimes into one program.
                                                          9. Final simplification51.9%

                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;P0 \leq -1000000000:\\ \;\;\;\;P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\ \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\ \mathbf{elif}\;P0 \leq 2000000:\\ \;\;\;\;\mathsf{fma}\left(amt, V0 \cdot \left(amt \cdot \left(amt + -2\right)\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{else}:\\ \;\;\;\;P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \end{array} \]
                                                          10. Add Preprocessing

                                                          Alternative 13: 39.3% accurate, 7.0× speedup?

                                                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{if}\;P0 \leq -1000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\ \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\ \mathbf{elif}\;P0 \leq 2000000:\\ \;\;\;\;V0 \cdot \left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
                                                          (FPCore (P0 P1 amt V1 V0)
                                                           :precision binary32
                                                           (let* ((t_0 (* P0 (fma (* amt amt) (fma amt 2.0 -3.0) 1.52587890625e-5))))
                                                             (if (<= P0 -1000000000.0)
                                                               t_0
                                                               (if (<= P0 -5.000000156871975e-23)
                                                                 (* V1 (* (+ amt -1.0) (* amt amt)))
                                                                 (if (<= P0 2000000.0) (* V0 (* (* amt amt) (+ amt -2.0))) t_0)))))
                                                          float code(float P0, float P1, float amt, float V1, float V0) {
                                                          	float t_0 = P0 * fmaf((amt * amt), fmaf(amt, 2.0f, -3.0f), 1.52587890625e-5f);
                                                          	float tmp;
                                                          	if (P0 <= -1000000000.0f) {
                                                          		tmp = t_0;
                                                          	} else if (P0 <= -5.000000156871975e-23f) {
                                                          		tmp = V1 * ((amt + -1.0f) * (amt * amt));
                                                          	} else if (P0 <= 2000000.0f) {
                                                          		tmp = V0 * ((amt * amt) * (amt + -2.0f));
                                                          	} else {
                                                          		tmp = t_0;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          function code(P0, P1, amt, V1, V0)
                                                          	t_0 = Float32(P0 * fma(Float32(amt * amt), fma(amt, Float32(2.0), Float32(-3.0)), Float32(1.52587890625e-5)))
                                                          	tmp = Float32(0.0)
                                                          	if (P0 <= Float32(-1000000000.0))
                                                          		tmp = t_0;
                                                          	elseif (P0 <= Float32(-5.000000156871975e-23))
                                                          		tmp = Float32(V1 * Float32(Float32(amt + Float32(-1.0)) * Float32(amt * amt)));
                                                          	elseif (P0 <= Float32(2000000.0))
                                                          		tmp = Float32(V0 * Float32(Float32(amt * amt) * Float32(amt + Float32(-2.0))));
                                                          	else
                                                          		tmp = t_0;
                                                          	end
                                                          	return tmp
                                                          end
                                                          
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          \begin{array}{l}
                                                          t_0 := P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\
                                                          \mathbf{if}\;P0 \leq -1000000000:\\
                                                          \;\;\;\;t_0\\
                                                          
                                                          \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\
                                                          \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\
                                                          
                                                          \mathbf{elif}\;P0 \leq 2000000:\\
                                                          \;\;\;\;V0 \cdot \left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;t_0\\
                                                          
                                                          
                                                          \end{array}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 3 regimes
                                                          2. if P0 < -1e9 or 2e6 < P0

                                                            1. Initial program 68.0%

                                                              \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                            2. Add Preprocessing
                                                            3. Taylor expanded in amt around 0

                                                              \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                            4. Step-by-step derivation
                                                              1. +-commutativeN/A

                                                                \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                              2. lower-fma.f32N/A

                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                            5. Applied rewrites94.9%

                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                            6. Taylor expanded in P0 around inf

                                                              \[\leadsto P0 \cdot \color{blue}{\left(\frac{1}{65536} + {amt}^{2} \cdot \left(2 \cdot amt - 3\right)\right)} \]
                                                            7. Step-by-step derivation
                                                              1. Applied rewrites61.6%

                                                                \[\leadsto P0 \cdot \color{blue}{\mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)} \]

                                                              if -1e9 < P0 < -5.00000016e-23

                                                              1. Initial program 80.5%

                                                                \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                              2. Add Preprocessing
                                                              3. Taylor expanded in amt around 0

                                                                \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                              4. Step-by-step derivation
                                                                1. +-commutativeN/A

                                                                  \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                                2. lower-fma.f32N/A

                                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                              5. Applied rewrites97.5%

                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                              6. Taylor expanded in V1 around inf

                                                                \[\leadsto V1 \cdot \color{blue}{\left({amt}^{2} \cdot \left(amt - 1\right)\right)} \]
                                                              7. Step-by-step derivation
                                                                1. Applied rewrites45.8%

                                                                  \[\leadsto V1 \cdot \color{blue}{\left(\left(amt \cdot amt\right) \cdot \left(amt + -1\right)\right)} \]

                                                                if -5.00000016e-23 < P0 < 2e6

                                                                1. Initial program 80.1%

                                                                  \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                                2. Add Preprocessing
                                                                3. Taylor expanded in amt around 0

                                                                  \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                                4. Step-by-step derivation
                                                                  1. +-commutativeN/A

                                                                    \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                                  2. lower-fma.f32N/A

                                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                                5. Applied rewrites97.5%

                                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                                6. Taylor expanded in V0 around inf

                                                                  \[\leadsto V0 \cdot \color{blue}{\left({amt}^{2} \cdot \left(amt - 2\right)\right)} \]
                                                                7. Step-by-step derivation
                                                                  1. Applied rewrites44.4%

                                                                    \[\leadsto V0 \cdot \color{blue}{\left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)} \]
                                                                8. Recombined 3 regimes into one program.
                                                                9. Final simplification51.7%

                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;P0 \leq -1000000000:\\ \;\;\;\;P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \mathbf{elif}\;P0 \leq -5.000000156871975 \cdot 10^{-23}:\\ \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\ \mathbf{elif}\;P0 \leq 2000000:\\ \;\;\;\;V0 \cdot \left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;P0 \cdot \mathsf{fma}\left(amt \cdot amt, \mathsf{fma}\left(amt, 2, -3\right), 1.52587890625 \cdot 10^{-5}\right)\\ \end{array} \]
                                                                10. Add Preprocessing

                                                                Alternative 14: 38.7% accurate, 9.2× speedup?

                                                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := V0 \cdot \left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)\\ \mathbf{if}\;V0 \leq -20:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V0 \leq 200:\\ \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
                                                                (FPCore (P0 P1 amt V1 V0)
                                                                 :precision binary32
                                                                 (let* ((t_0 (* V0 (* (* amt amt) (+ amt -2.0)))))
                                                                   (if (<= V0 -20.0)
                                                                     t_0
                                                                     (if (<= V0 200.0) (* V1 (* (+ amt -1.0) (* amt amt))) t_0))))
                                                                float code(float P0, float P1, float amt, float V1, float V0) {
                                                                	float t_0 = V0 * ((amt * amt) * (amt + -2.0f));
                                                                	float tmp;
                                                                	if (V0 <= -20.0f) {
                                                                		tmp = t_0;
                                                                	} else if (V0 <= 200.0f) {
                                                                		tmp = V1 * ((amt + -1.0f) * (amt * amt));
                                                                	} else {
                                                                		tmp = t_0;
                                                                	}
                                                                	return tmp;
                                                                }
                                                                
                                                                real(4) function code(p0, p1, amt, v1, v0)
                                                                    real(4), intent (in) :: p0
                                                                    real(4), intent (in) :: p1
                                                                    real(4), intent (in) :: amt
                                                                    real(4), intent (in) :: v1
                                                                    real(4), intent (in) :: v0
                                                                    real(4) :: t_0
                                                                    real(4) :: tmp
                                                                    t_0 = v0 * ((amt * amt) * (amt + (-2.0e0)))
                                                                    if (v0 <= (-20.0e0)) then
                                                                        tmp = t_0
                                                                    else if (v0 <= 200.0e0) then
                                                                        tmp = v1 * ((amt + (-1.0e0)) * (amt * amt))
                                                                    else
                                                                        tmp = t_0
                                                                    end if
                                                                    code = tmp
                                                                end function
                                                                
                                                                function code(P0, P1, amt, V1, V0)
                                                                	t_0 = Float32(V0 * Float32(Float32(amt * amt) * Float32(amt + Float32(-2.0))))
                                                                	tmp = Float32(0.0)
                                                                	if (V0 <= Float32(-20.0))
                                                                		tmp = t_0;
                                                                	elseif (V0 <= Float32(200.0))
                                                                		tmp = Float32(V1 * Float32(Float32(amt + Float32(-1.0)) * Float32(amt * amt)));
                                                                	else
                                                                		tmp = t_0;
                                                                	end
                                                                	return tmp
                                                                end
                                                                
                                                                function tmp_2 = code(P0, P1, amt, V1, V0)
                                                                	t_0 = V0 * ((amt * amt) * (amt + single(-2.0)));
                                                                	tmp = single(0.0);
                                                                	if (V0 <= single(-20.0))
                                                                		tmp = t_0;
                                                                	elseif (V0 <= single(200.0))
                                                                		tmp = V1 * ((amt + single(-1.0)) * (amt * amt));
                                                                	else
                                                                		tmp = t_0;
                                                                	end
                                                                	tmp_2 = tmp;
                                                                end
                                                                
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                \begin{array}{l}
                                                                t_0 := V0 \cdot \left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)\\
                                                                \mathbf{if}\;V0 \leq -20:\\
                                                                \;\;\;\;t_0\\
                                                                
                                                                \mathbf{elif}\;V0 \leq 200:\\
                                                                \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\
                                                                
                                                                \mathbf{else}:\\
                                                                \;\;\;\;t_0\\
                                                                
                                                                
                                                                \end{array}
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Split input into 2 regimes
                                                                2. if V0 < -20 or 200 < V0

                                                                  1. Initial program 75.1%

                                                                    \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                                  2. Add Preprocessing
                                                                  3. Taylor expanded in amt around 0

                                                                    \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                                  4. Step-by-step derivation
                                                                    1. +-commutativeN/A

                                                                      \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                                    2. lower-fma.f32N/A

                                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                                  5. Applied rewrites96.8%

                                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                                  6. Taylor expanded in V0 around inf

                                                                    \[\leadsto V0 \cdot \color{blue}{\left({amt}^{2} \cdot \left(amt - 2\right)\right)} \]
                                                                  7. Step-by-step derivation
                                                                    1. Applied rewrites45.6%

                                                                      \[\leadsto V0 \cdot \color{blue}{\left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)} \]

                                                                    if -20 < V0 < 200

                                                                    1. Initial program 75.3%

                                                                      \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                                    2. Add Preprocessing
                                                                    3. Taylor expanded in amt around 0

                                                                      \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                                    4. Step-by-step derivation
                                                                      1. +-commutativeN/A

                                                                        \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                                      2. lower-fma.f32N/A

                                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                                    5. Applied rewrites96.1%

                                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                                    6. Taylor expanded in V1 around inf

                                                                      \[\leadsto V1 \cdot \color{blue}{\left({amt}^{2} \cdot \left(amt - 1\right)\right)} \]
                                                                    7. Step-by-step derivation
                                                                      1. Applied rewrites36.2%

                                                                        \[\leadsto V1 \cdot \color{blue}{\left(\left(amt \cdot amt\right) \cdot \left(amt + -1\right)\right)} \]
                                                                    8. Recombined 2 regimes into one program.
                                                                    9. Final simplification40.9%

                                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;V0 \leq -20:\\ \;\;\;\;V0 \cdot \left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)\\ \mathbf{elif}\;V0 \leq 200:\\ \;\;\;\;V1 \cdot \left(\left(amt + -1\right) \cdot \left(amt \cdot amt\right)\right)\\ \mathbf{else}:\\ \;\;\;\;V0 \cdot \left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)\\ \end{array} \]
                                                                    10. Add Preprocessing

                                                                    Alternative 15: 26.7% accurate, 15.1× speedup?

                                                                    \[\begin{array}{l} \\ V0 \cdot \left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right) \end{array} \]
                                                                    (FPCore (P0 P1 amt V1 V0)
                                                                     :precision binary32
                                                                     (* V0 (* (* amt amt) (+ amt -2.0))))
                                                                    float code(float P0, float P1, float amt, float V1, float V0) {
                                                                    	return V0 * ((amt * amt) * (amt + -2.0f));
                                                                    }
                                                                    
                                                                    real(4) function code(p0, p1, amt, v1, v0)
                                                                        real(4), intent (in) :: p0
                                                                        real(4), intent (in) :: p1
                                                                        real(4), intent (in) :: amt
                                                                        real(4), intent (in) :: v1
                                                                        real(4), intent (in) :: v0
                                                                        code = v0 * ((amt * amt) * (amt + (-2.0e0)))
                                                                    end function
                                                                    
                                                                    function code(P0, P1, amt, V1, V0)
                                                                    	return Float32(V0 * Float32(Float32(amt * amt) * Float32(amt + Float32(-2.0))))
                                                                    end
                                                                    
                                                                    function tmp = code(P0, P1, amt, V1, V0)
                                                                    	tmp = V0 * ((amt * amt) * (amt + single(-2.0)));
                                                                    end
                                                                    
                                                                    \begin{array}{l}
                                                                    
                                                                    \\
                                                                    V0 \cdot \left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Initial program 75.2%

                                                                      \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                                    2. Add Preprocessing
                                                                    3. Taylor expanded in amt around 0

                                                                      \[\leadsto \color{blue}{\frac{1}{65536} \cdot P0 + amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right)} \]
                                                                    4. Step-by-step derivation
                                                                      1. +-commutativeN/A

                                                                        \[\leadsto \color{blue}{amt \cdot \left(P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right)\right) + \frac{1}{65536} \cdot P0} \]
                                                                      2. lower-fma.f32N/A

                                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(amt, P1 + amt \cdot \left(\left(3 \cdot \left(P1 - P0\right) + amt \cdot \left(V0 + \left(V1 + 2 \cdot \left(P0 - P1\right)\right)\right)\right) - \left(V1 + 2 \cdot V0\right)\right), \frac{1}{65536} \cdot P0\right)} \]
                                                                    5. Applied rewrites96.5%

                                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(amt, \mathsf{fma}\left(2, P0 - P1, V1 + V0\right), \mathsf{fma}\left(3, P1 - P0, \mathsf{fma}\left(V0, -2, -V1\right)\right)\right), P1\right), P0 \cdot 1.52587890625 \cdot 10^{-5}\right)} \]
                                                                    6. Taylor expanded in V0 around inf

                                                                      \[\leadsto V0 \cdot \color{blue}{\left({amt}^{2} \cdot \left(amt - 2\right)\right)} \]
                                                                    7. Step-by-step derivation
                                                                      1. Applied rewrites27.0%

                                                                        \[\leadsto V0 \cdot \color{blue}{\left(\left(amt \cdot amt\right) \cdot \left(amt + -2\right)\right)} \]
                                                                      2. Add Preprocessing

                                                                      Alternative 16: 12.0% accurate, 16.8× speedup?

                                                                      \[\begin{array}{l} \\ amt \cdot \mathsf{fma}\left(P1 \cdot amt, 3, P1\right) \end{array} \]
                                                                      (FPCore (P0 P1 amt V1 V0) :precision binary32 (* amt (fma (* P1 amt) 3.0 P1)))
                                                                      float code(float P0, float P1, float amt, float V1, float V0) {
                                                                      	return amt * fmaf((P1 * amt), 3.0f, P1);
                                                                      }
                                                                      
                                                                      function code(P0, P1, amt, V1, V0)
                                                                      	return Float32(amt * fma(Float32(P1 * amt), Float32(3.0), P1))
                                                                      end
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      amt \cdot \mathsf{fma}\left(P1 \cdot amt, 3, P1\right)
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Initial program 75.2%

                                                                        \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                                      2. Add Preprocessing
                                                                      3. Taylor expanded in P1 around -inf

                                                                        \[\leadsto \color{blue}{\frac{-1}{65536} \cdot \left(P1 \cdot \left(-196608 \cdot {amt}^{2} + \left(-65536 \cdot amt + 131072 \cdot {amt}^{3}\right)\right)\right)} \]
                                                                      4. Step-by-step derivation
                                                                        1. *-commutativeN/A

                                                                          \[\leadsto \color{blue}{\left(P1 \cdot \left(-196608 \cdot {amt}^{2} + \left(-65536 \cdot amt + 131072 \cdot {amt}^{3}\right)\right)\right) \cdot \frac{-1}{65536}} \]
                                                                        2. associate-*l*N/A

                                                                          \[\leadsto \color{blue}{P1 \cdot \left(\left(-196608 \cdot {amt}^{2} + \left(-65536 \cdot amt + 131072 \cdot {amt}^{3}\right)\right) \cdot \frac{-1}{65536}\right)} \]
                                                                        3. lower-*.f32N/A

                                                                          \[\leadsto \color{blue}{P1 \cdot \left(\left(-196608 \cdot {amt}^{2} + \left(-65536 \cdot amt + 131072 \cdot {amt}^{3}\right)\right) \cdot \frac{-1}{65536}\right)} \]
                                                                        4. lower-*.f32N/A

                                                                          \[\leadsto P1 \cdot \color{blue}{\left(\left(-196608 \cdot {amt}^{2} + \left(-65536 \cdot amt + 131072 \cdot {amt}^{3}\right)\right) \cdot \frac{-1}{65536}\right)} \]
                                                                      5. Applied rewrites22.0%

                                                                        \[\leadsto \color{blue}{P1 \cdot \left(\mathsf{fma}\left(amt, \left(amt \cdot amt\right) \cdot 131072, \mathsf{fma}\left(amt, -65536, \left(amt \cdot amt\right) \cdot -196608\right)\right) \cdot -1.52587890625 \cdot 10^{-5}\right)} \]
                                                                      6. Taylor expanded in amt around 0

                                                                        \[\leadsto amt \cdot \color{blue}{\left(P1 + 3 \cdot \left(P1 \cdot amt\right)\right)} \]
                                                                      7. Step-by-step derivation
                                                                        1. Applied rewrites10.8%

                                                                          \[\leadsto amt \cdot \color{blue}{\mathsf{fma}\left(P1 \cdot amt, 3, P1\right)} \]
                                                                        2. Add Preprocessing

                                                                        Alternative 17: 11.5% accurate, 47.7× speedup?

                                                                        \[\begin{array}{l} \\ P1 \cdot amt \end{array} \]
                                                                        (FPCore (P0 P1 amt V1 V0) :precision binary32 (* P1 amt))
                                                                        float code(float P0, float P1, float amt, float V1, float V0) {
                                                                        	return P1 * amt;
                                                                        }
                                                                        
                                                                        real(4) function code(p0, p1, amt, v1, v0)
                                                                            real(4), intent (in) :: p0
                                                                            real(4), intent (in) :: p1
                                                                            real(4), intent (in) :: amt
                                                                            real(4), intent (in) :: v1
                                                                            real(4), intent (in) :: v0
                                                                            code = p1 * amt
                                                                        end function
                                                                        
                                                                        function code(P0, P1, amt, V1, V0)
                                                                        	return Float32(P1 * amt)
                                                                        end
                                                                        
                                                                        function tmp = code(P0, P1, amt, V1, V0)
                                                                        	tmp = P1 * amt;
                                                                        end
                                                                        
                                                                        \begin{array}{l}
                                                                        
                                                                        \\
                                                                        P1 \cdot amt
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Initial program 75.2%

                                                                          \[\frac{\left(\left(P0 + P1 \cdot \left(amt \cdot 65536\right)\right) + \left(\left(3 \cdot \left(P1 - P0\right) - V1\right) - 2 \cdot V0\right) \cdot \left({amt}^{2} \cdot 65536\right)\right) + \left(\left(2 \cdot \left(P0 - P1\right) + V0\right) + V1\right) \cdot \left({amt}^{3} \cdot 65536\right)}{65536} \]
                                                                        2. Add Preprocessing
                                                                        3. Taylor expanded in P1 around -inf

                                                                          \[\leadsto \color{blue}{\frac{-1}{65536} \cdot \left(P1 \cdot \left(-196608 \cdot {amt}^{2} + \left(-65536 \cdot amt + 131072 \cdot {amt}^{3}\right)\right)\right)} \]
                                                                        4. Step-by-step derivation
                                                                          1. *-commutativeN/A

                                                                            \[\leadsto \color{blue}{\left(P1 \cdot \left(-196608 \cdot {amt}^{2} + \left(-65536 \cdot amt + 131072 \cdot {amt}^{3}\right)\right)\right) \cdot \frac{-1}{65536}} \]
                                                                          2. associate-*l*N/A

                                                                            \[\leadsto \color{blue}{P1 \cdot \left(\left(-196608 \cdot {amt}^{2} + \left(-65536 \cdot amt + 131072 \cdot {amt}^{3}\right)\right) \cdot \frac{-1}{65536}\right)} \]
                                                                          3. lower-*.f32N/A

                                                                            \[\leadsto \color{blue}{P1 \cdot \left(\left(-196608 \cdot {amt}^{2} + \left(-65536 \cdot amt + 131072 \cdot {amt}^{3}\right)\right) \cdot \frac{-1}{65536}\right)} \]
                                                                          4. lower-*.f32N/A

                                                                            \[\leadsto P1 \cdot \color{blue}{\left(\left(-196608 \cdot {amt}^{2} + \left(-65536 \cdot amt + 131072 \cdot {amt}^{3}\right)\right) \cdot \frac{-1}{65536}\right)} \]
                                                                        5. Applied rewrites22.0%

                                                                          \[\leadsto \color{blue}{P1 \cdot \left(\mathsf{fma}\left(amt, \left(amt \cdot amt\right) \cdot 131072, \mathsf{fma}\left(amt, -65536, \left(amt \cdot amt\right) \cdot -196608\right)\right) \cdot -1.52587890625 \cdot 10^{-5}\right)} \]
                                                                        6. Taylor expanded in amt around 0

                                                                          \[\leadsto P1 \cdot \color{blue}{amt} \]
                                                                        7. Step-by-step derivation
                                                                          1. Applied rewrites10.6%

                                                                            \[\leadsto P1 \cdot \color{blue}{amt} \]
                                                                          2. Add Preprocessing

                                                                          Reproduce

                                                                          ?
                                                                          herbie shell --seed 5 
                                                                          (FPCore (P0 P1 amt V1 V0)
                                                                            :name "(/ (+ (+ (+ P0 (* P1 (* amt 65536))) (* (- (- (* 3.0 (- P1 P0)) V1) (* 2.0 V0)) (* (pow amt 2) 65536))) (* (+ (+ (* 2.0 (- P0 P1)) V0) V1) (* (pow amt 3) 65536))) 65536)"
                                                                            :precision binary32
                                                                            :pre (and (<= 0.85 amt) (<= amt 1.0))
                                                                            (/ (+ (+ (+ P0 (* P1 (* amt 65536.0))) (* (- (- (* 3.0 (- P1 P0)) V1) (* 2.0 V0)) (* (pow amt 2.0) 65536.0))) (* (+ (+ (* 2.0 (- P0 P1)) V0) V1) (* (pow amt 3.0) 65536.0))) 65536.0))