Curve intersection, scale width based on ribbon orientation

Percentage Accurate: 97.2% → 99.4%
Time: 16.3s
Alternatives: 13
Speedup: 45.9×

Specification

?
\[\left(\left(\left(0 \leq normAngle \land normAngle \leq \frac{\pi}{2}\right) \land \left(-1 \leq n0\_i \land n0\_i \leq 1\right)\right) \land \left(-1 \leq n1\_i \land n1\_i \leq 1\right)\right) \land \left(2.328306437 \cdot 10^{-10} \leq u \land u \leq 1\right)\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\sin normAngle}\\ \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot t\_0\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot t\_0\right) \cdot n1\_i \end{array} \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (let* ((t_0 (/ 1.0 (sin normAngle))))
   (+
    (* (* (sin (* (- 1.0 u) normAngle)) t_0) n0_i)
    (* (* (sin (* u normAngle)) t_0) n1_i))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	float t_0 = 1.0f / sinf(normAngle);
	return ((sinf(((1.0f - u) * normAngle)) * t_0) * n0_i) + ((sinf((u * normAngle)) * t_0) * n1_i);
}
real(4) function code(normangle, u, n0_i, n1_i)
    real(4), intent (in) :: normangle
    real(4), intent (in) :: u
    real(4), intent (in) :: n0_i
    real(4), intent (in) :: n1_i
    real(4) :: t_0
    t_0 = 1.0e0 / sin(normangle)
    code = ((sin(((1.0e0 - u) * normangle)) * t_0) * n0_i) + ((sin((u * normangle)) * t_0) * n1_i)
end function
function code(normAngle, u, n0_i, n1_i)
	t_0 = Float32(Float32(1.0) / sin(normAngle))
	return Float32(Float32(Float32(sin(Float32(Float32(Float32(1.0) - u) * normAngle)) * t_0) * n0_i) + Float32(Float32(sin(Float32(u * normAngle)) * t_0) * n1_i))
end
function tmp = code(normAngle, u, n0_i, n1_i)
	t_0 = single(1.0) / sin(normAngle);
	tmp = ((sin(((single(1.0) - u) * normAngle)) * t_0) * n0_i) + ((sin((u * normAngle)) * t_0) * n1_i);
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{\sin normAngle}\\
\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot t\_0\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot t\_0\right) \cdot n1\_i
\end{array}
\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 13 alternatives:

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

Initial Program: 97.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\sin normAngle}\\ \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot t\_0\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot t\_0\right) \cdot n1\_i \end{array} \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (let* ((t_0 (/ 1.0 (sin normAngle))))
   (+
    (* (* (sin (* (- 1.0 u) normAngle)) t_0) n0_i)
    (* (* (sin (* u normAngle)) t_0) n1_i))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	float t_0 = 1.0f / sinf(normAngle);
	return ((sinf(((1.0f - u) * normAngle)) * t_0) * n0_i) + ((sinf((u * normAngle)) * t_0) * n1_i);
}
real(4) function code(normangle, u, n0_i, n1_i)
    real(4), intent (in) :: normangle
    real(4), intent (in) :: u
    real(4), intent (in) :: n0_i
    real(4), intent (in) :: n1_i
    real(4) :: t_0
    t_0 = 1.0e0 / sin(normangle)
    code = ((sin(((1.0e0 - u) * normangle)) * t_0) * n0_i) + ((sin((u * normangle)) * t_0) * n1_i)
end function
function code(normAngle, u, n0_i, n1_i)
	t_0 = Float32(Float32(1.0) / sin(normAngle))
	return Float32(Float32(Float32(sin(Float32(Float32(Float32(1.0) - u) * normAngle)) * t_0) * n0_i) + Float32(Float32(sin(Float32(u * normAngle)) * t_0) * n1_i))
end
function tmp = code(normAngle, u, n0_i, n1_i)
	t_0 = single(1.0) / sin(normAngle);
	tmp = ((sin(((single(1.0) - u) * normAngle)) * t_0) * n0_i) + ((sin((u * normAngle)) * t_0) * n1_i);
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{\sin normAngle}\\
\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot t\_0\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot t\_0\right) \cdot n1\_i
\end{array}
\end{array}

Alternative 1: 99.4% accurate, 3.3× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (fma
  u
  (fma
   n0_i
   (fma 0.3333333333333333 (* normAngle normAngle) -1.0)
   (* n1_i (/ normAngle (sin normAngle))))
  n0_i))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return fmaf(u, fmaf(n0_i, fmaf(0.3333333333333333f, (normAngle * normAngle), -1.0f), (n1_i * (normAngle / sinf(normAngle)))), n0_i);
}
function code(normAngle, u, n0_i, n1_i)
	return fma(u, fma(n0_i, fma(Float32(0.3333333333333333), Float32(normAngle * normAngle), Float32(-1.0)), Float32(n1_i * Float32(normAngle / sin(normAngle)))), n0_i)
end
\begin{array}{l}

\\
\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)
\end{array}
Derivation
  1. Initial program 97.4%

    \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  2. Add Preprocessing
  3. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{\left(\left(1 + {normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right) - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + 1\right)} - u\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    2. associate--l+N/A

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    3. unpow2N/A

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    4. associate-*l*N/A

      \[\leadsto \left(\color{blue}{normAngle \cdot \left(normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right)} + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    5. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  5. Simplified97.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\mathsf{fma}\left(u, 0.16666666666666666, -0.16666666666666666\right) \cdot \mathsf{fma}\left(1 - u, 1 - u, -1\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  6. Taylor expanded in u around 0

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right) + n0\_i} \]
    2. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}, n0\_i\right)} \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} - 1, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)}, n0\_i\right) \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\frac{1}{3} \cdot {normAngle}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} + \color{blue}{-1}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {normAngle}^{2}, -1\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    12. sin-lowering-sin.f3299.4

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\color{blue}{\sin normAngle}}\right), n0\_i\right) \]
  8. Simplified99.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)} \]
  9. Add Preprocessing

Alternative 2: 99.3% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(\left(normAngle \cdot normAngle\right) \cdot \left(0 - \mathsf{fma}\left(n1\_i, -0.0032407407407407406, n1\_i \cdot 0.0011904761904761906\right)\right), u, \left(u \cdot n1\_i\right) \cdot 0.019444444444444445\right), u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right)\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (fma
  (* normAngle normAngle)
  (fma
   (* normAngle normAngle)
   (fma
    (*
     (* normAngle normAngle)
     (- 0.0 (fma n1_i -0.0032407407407407406 (* n1_i 0.0011904761904761906))))
    u
    (* (* u n1_i) 0.019444444444444445))
   (* u (fma n1_i 0.16666666666666666 (* n0_i 0.3333333333333333))))
  (fma (- n1_i n0_i) u n0_i)))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return fmaf((normAngle * normAngle), fmaf((normAngle * normAngle), fmaf(((normAngle * normAngle) * (0.0f - fmaf(n1_i, -0.0032407407407407406f, (n1_i * 0.0011904761904761906f)))), u, ((u * n1_i) * 0.019444444444444445f)), (u * fmaf(n1_i, 0.16666666666666666f, (n0_i * 0.3333333333333333f)))), fmaf((n1_i - n0_i), u, n0_i));
}
function code(normAngle, u, n0_i, n1_i)
	return fma(Float32(normAngle * normAngle), fma(Float32(normAngle * normAngle), fma(Float32(Float32(normAngle * normAngle) * Float32(Float32(0.0) - fma(n1_i, Float32(-0.0032407407407407406), Float32(n1_i * Float32(0.0011904761904761906))))), u, Float32(Float32(u * n1_i) * Float32(0.019444444444444445))), Float32(u * fma(n1_i, Float32(0.16666666666666666), Float32(n0_i * Float32(0.3333333333333333))))), fma(Float32(n1_i - n0_i), u, n0_i))
end
\begin{array}{l}

\\
\mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(\left(normAngle \cdot normAngle\right) \cdot \left(0 - \mathsf{fma}\left(n1\_i, -0.0032407407407407406, n1\_i \cdot 0.0011904761904761906\right)\right), u, \left(u \cdot n1\_i\right) \cdot 0.019444444444444445\right), u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right)\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right)
\end{array}
Derivation
  1. Initial program 97.4%

    \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  2. Add Preprocessing
  3. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{\left(\left(1 + {normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right) - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + 1\right)} - u\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    2. associate--l+N/A

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    3. unpow2N/A

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    4. associate-*l*N/A

      \[\leadsto \left(\color{blue}{normAngle \cdot \left(normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right)} + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    5. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  5. Simplified97.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\mathsf{fma}\left(u, 0.16666666666666666, -0.16666666666666666\right) \cdot \mathsf{fma}\left(1 - u, 1 - u, -1\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  6. Taylor expanded in u around 0

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right) + n0\_i} \]
    2. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}, n0\_i\right)} \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} - 1, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)}, n0\_i\right) \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\frac{1}{3} \cdot {normAngle}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} + \color{blue}{-1}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {normAngle}^{2}, -1\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    12. sin-lowering-sin.f3299.4

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\color{blue}{\sin normAngle}}\right), n0\_i\right) \]
  8. Simplified99.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)} \]
  9. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{n0\_i + \left(u \cdot \left(n1\_i + -1 \cdot n0\_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(\frac{1}{3} \cdot n0\_i - \frac{-1}{6} \cdot n1\_i\right) + {normAngle}^{2} \cdot \left(-1 \cdot \left(u \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right) + -1 \cdot \left({normAngle}^{2} \cdot \left(u \cdot \left(\frac{-1}{5040} \cdot n1\_i + \left(\frac{1}{720} \cdot n1\_i + \frac{1}{6} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right)\right)\right)\right)\right)\right)} \]
  10. Simplified98.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(\mathsf{fma}\left(n1\_i, -0.0032407407407407406, n1\_i \cdot 0.0011904761904761906\right) \cdot \left(-normAngle \cdot normAngle\right), u, \left(n1\_i \cdot u\right) \cdot 0.019444444444444445\right), u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right)\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right)} \]
  11. Final simplification98.8%

    \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(\left(normAngle \cdot normAngle\right) \cdot \left(0 - \mathsf{fma}\left(n1\_i, -0.0032407407407407406, n1\_i \cdot 0.0011904761904761906\right)\right), u, \left(u \cdot n1\_i\right) \cdot 0.019444444444444445\right), u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right)\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  12. Add Preprocessing

Alternative 3: 99.3% accurate, 7.4× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle, normAngle \cdot 0.00205026455026455, 0.019444444444444445\right), 0.16666666666666666\right), 1\right)\right), n0\_i\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (fma
  u
  (fma
   n0_i
   (fma 0.3333333333333333 (* normAngle normAngle) -1.0)
   (*
    n1_i
    (fma
     (* normAngle normAngle)
     (fma
      (* normAngle normAngle)
      (fma normAngle (* normAngle 0.00205026455026455) 0.019444444444444445)
      0.16666666666666666)
     1.0)))
  n0_i))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return fmaf(u, fmaf(n0_i, fmaf(0.3333333333333333f, (normAngle * normAngle), -1.0f), (n1_i * fmaf((normAngle * normAngle), fmaf((normAngle * normAngle), fmaf(normAngle, (normAngle * 0.00205026455026455f), 0.019444444444444445f), 0.16666666666666666f), 1.0f))), n0_i);
}
function code(normAngle, u, n0_i, n1_i)
	return fma(u, fma(n0_i, fma(Float32(0.3333333333333333), Float32(normAngle * normAngle), Float32(-1.0)), Float32(n1_i * fma(Float32(normAngle * normAngle), fma(Float32(normAngle * normAngle), fma(normAngle, Float32(normAngle * Float32(0.00205026455026455)), Float32(0.019444444444444445)), Float32(0.16666666666666666)), Float32(1.0)))), n0_i)
end
\begin{array}{l}

\\
\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle, normAngle \cdot 0.00205026455026455, 0.019444444444444445\right), 0.16666666666666666\right), 1\right)\right), n0\_i\right)
\end{array}
Derivation
  1. Initial program 97.4%

    \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  2. Add Preprocessing
  3. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{\left(\left(1 + {normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right) - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + 1\right)} - u\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    2. associate--l+N/A

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    3. unpow2N/A

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    4. associate-*l*N/A

      \[\leadsto \left(\color{blue}{normAngle \cdot \left(normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right)} + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    5. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  5. Simplified97.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\mathsf{fma}\left(u, 0.16666666666666666, -0.16666666666666666\right) \cdot \mathsf{fma}\left(1 - u, 1 - u, -1\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  6. Taylor expanded in u around 0

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right) + n0\_i} \]
    2. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}, n0\_i\right)} \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} - 1, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)}, n0\_i\right) \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\frac{1}{3} \cdot {normAngle}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} + \color{blue}{-1}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {normAngle}^{2}, -1\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    12. sin-lowering-sin.f3299.4

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\color{blue}{\sin normAngle}}\right), n0\_i\right) \]
  8. Simplified99.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)} \]
  9. Taylor expanded in normAngle around 0

    \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\left(1 + {normAngle}^{2} \cdot \left(\frac{1}{6} + {normAngle}^{2} \cdot \left(\frac{7}{360} + \frac{31}{15120} \cdot {normAngle}^{2}\right)\right)\right)}\right), n0\_i\right) \]
  10. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{1}{6} + {normAngle}^{2} \cdot \left(\frac{7}{360} + \frac{31}{15120} \cdot {normAngle}^{2}\right)\right) + 1\right)}\right), n0\_i\right) \]
    2. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\mathsf{fma}\left({normAngle}^{2}, \frac{1}{6} + {normAngle}^{2} \cdot \left(\frac{7}{360} + \frac{31}{15120} \cdot {normAngle}^{2}\right), 1\right)}\right), n0\_i\right) \]
    3. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(\color{blue}{normAngle \cdot normAngle}, \frac{1}{6} + {normAngle}^{2} \cdot \left(\frac{7}{360} + \frac{31}{15120} \cdot {normAngle}^{2}\right), 1\right)\right), n0\_i\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(\color{blue}{normAngle \cdot normAngle}, \frac{1}{6} + {normAngle}^{2} \cdot \left(\frac{7}{360} + \frac{31}{15120} \cdot {normAngle}^{2}\right), 1\right)\right), n0\_i\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{{normAngle}^{2} \cdot \left(\frac{7}{360} + \frac{31}{15120} \cdot {normAngle}^{2}\right) + \frac{1}{6}}, 1\right)\right), n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{\mathsf{fma}\left({normAngle}^{2}, \frac{7}{360} + \frac{31}{15120} \cdot {normAngle}^{2}, \frac{1}{6}\right)}, 1\right)\right), n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(\color{blue}{normAngle \cdot normAngle}, \frac{7}{360} + \frac{31}{15120} \cdot {normAngle}^{2}, \frac{1}{6}\right), 1\right)\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(\color{blue}{normAngle \cdot normAngle}, \frac{7}{360} + \frac{31}{15120} \cdot {normAngle}^{2}, \frac{1}{6}\right), 1\right)\right), n0\_i\right) \]
    9. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{\frac{31}{15120} \cdot {normAngle}^{2} + \frac{7}{360}}, \frac{1}{6}\right), 1\right)\right), n0\_i\right) \]
    10. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{{normAngle}^{2} \cdot \frac{31}{15120}} + \frac{7}{360}, \frac{1}{6}\right), 1\right)\right), n0\_i\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \frac{31}{15120} + \frac{7}{360}, \frac{1}{6}\right), 1\right)\right), n0\_i\right) \]
    12. associate-*l*N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{normAngle \cdot \left(normAngle \cdot \frac{31}{15120}\right)} + \frac{7}{360}, \frac{1}{6}\right), 1\right)\right), n0\_i\right) \]
    13. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \frac{31}{15120}, \frac{7}{360}\right)}, \frac{1}{6}\right), 1\right)\right), n0\_i\right) \]
    14. *-lowering-*.f3298.8

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle, \color{blue}{normAngle \cdot 0.00205026455026455}, 0.019444444444444445\right), 0.16666666666666666\right), 1\right)\right), n0\_i\right) \]
  11. Simplified98.8%

    \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle, normAngle \cdot 0.00205026455026455, 0.019444444444444445\right), 0.16666666666666666\right), 1\right)}\right), n0\_i\right) \]
  12. Add Preprocessing

Alternative 4: 99.2% accurate, 8.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(normAngle \cdot normAngle, n1\_i \cdot \left(u \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(0.00205026455026455, normAngle \cdot normAngle, 0.019444444444444445\right), 0.16666666666666666\right)\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (fma
  (* normAngle normAngle)
  (*
   n1_i
   (*
    u
    (fma
     (* normAngle normAngle)
     (fma 0.00205026455026455 (* normAngle normAngle) 0.019444444444444445)
     0.16666666666666666)))
  (fma (- n1_i n0_i) u n0_i)))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return fmaf((normAngle * normAngle), (n1_i * (u * fmaf((normAngle * normAngle), fmaf(0.00205026455026455f, (normAngle * normAngle), 0.019444444444444445f), 0.16666666666666666f))), fmaf((n1_i - n0_i), u, n0_i));
}
function code(normAngle, u, n0_i, n1_i)
	return fma(Float32(normAngle * normAngle), Float32(n1_i * Float32(u * fma(Float32(normAngle * normAngle), fma(Float32(0.00205026455026455), Float32(normAngle * normAngle), Float32(0.019444444444444445)), Float32(0.16666666666666666)))), fma(Float32(n1_i - n0_i), u, n0_i))
end
\begin{array}{l}

\\
\mathsf{fma}\left(normAngle \cdot normAngle, n1\_i \cdot \left(u \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(0.00205026455026455, normAngle \cdot normAngle, 0.019444444444444445\right), 0.16666666666666666\right)\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right)
\end{array}
Derivation
  1. Initial program 97.4%

    \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  2. Add Preprocessing
  3. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{\left(\left(1 + {normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right) - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + 1\right)} - u\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    2. associate--l+N/A

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    3. unpow2N/A

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    4. associate-*l*N/A

      \[\leadsto \left(\color{blue}{normAngle \cdot \left(normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right)} + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    5. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  5. Simplified97.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\mathsf{fma}\left(u, 0.16666666666666666, -0.16666666666666666\right) \cdot \mathsf{fma}\left(1 - u, 1 - u, -1\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  6. Taylor expanded in u around 0

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right) + n0\_i} \]
    2. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}, n0\_i\right)} \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} - 1, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)}, n0\_i\right) \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\frac{1}{3} \cdot {normAngle}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} + \color{blue}{-1}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {normAngle}^{2}, -1\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    12. sin-lowering-sin.f3299.4

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\color{blue}{\sin normAngle}}\right), n0\_i\right) \]
  8. Simplified99.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)} \]
  9. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{n0\_i + \left(u \cdot \left(n1\_i + -1 \cdot n0\_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(\frac{1}{3} \cdot n0\_i - \frac{-1}{6} \cdot n1\_i\right) + {normAngle}^{2} \cdot \left(-1 \cdot \left(u \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right) + -1 \cdot \left({normAngle}^{2} \cdot \left(u \cdot \left(\frac{-1}{5040} \cdot n1\_i + \left(\frac{1}{720} \cdot n1\_i + \frac{1}{6} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right)\right)\right)\right)\right)\right)} \]
  10. Simplified98.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(\mathsf{fma}\left(n1\_i, -0.0032407407407407406, n1\_i \cdot 0.0011904761904761906\right) \cdot \left(-normAngle \cdot normAngle\right), u, \left(n1\_i \cdot u\right) \cdot 0.019444444444444445\right), u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right)\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right)} \]
  11. Taylor expanded in n1_i around inf

    \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{n1\_i \cdot \left(\frac{1}{6} \cdot u + {normAngle}^{2} \cdot \left(\frac{31}{15120} \cdot \left({normAngle}^{2} \cdot u\right) + \frac{7}{360} \cdot u\right)\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  12. Simplified98.6%

    \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{n1\_i \cdot \left(u \cdot \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(0.00205026455026455, normAngle \cdot normAngle, 0.019444444444444445\right), 0.16666666666666666\right)\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  13. Add Preprocessing

Alternative 5: 99.3% accurate, 9.6× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, n1\_i \cdot 0.019444444444444445, \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right)\right), n1\_i - n0\_i\right), n0\_i\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (fma
  u
  (fma
   (* normAngle normAngle)
   (fma
    (* normAngle normAngle)
    (* n1_i 0.019444444444444445)
    (fma n1_i 0.16666666666666666 (* n0_i 0.3333333333333333)))
   (- n1_i n0_i))
  n0_i))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return fmaf(u, fmaf((normAngle * normAngle), fmaf((normAngle * normAngle), (n1_i * 0.019444444444444445f), fmaf(n1_i, 0.16666666666666666f, (n0_i * 0.3333333333333333f))), (n1_i - n0_i)), n0_i);
}
function code(normAngle, u, n0_i, n1_i)
	return fma(u, fma(Float32(normAngle * normAngle), fma(Float32(normAngle * normAngle), Float32(n1_i * Float32(0.019444444444444445)), fma(n1_i, Float32(0.16666666666666666), Float32(n0_i * Float32(0.3333333333333333)))), Float32(n1_i - n0_i)), n0_i)
end
\begin{array}{l}

\\
\mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, n1\_i \cdot 0.019444444444444445, \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right)\right), n1\_i - n0\_i\right), n0\_i\right)
\end{array}
Derivation
  1. Initial program 97.4%

    \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  2. Add Preprocessing
  3. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{\left(\left(1 + {normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right) - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + 1\right)} - u\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    2. associate--l+N/A

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    3. unpow2N/A

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    4. associate-*l*N/A

      \[\leadsto \left(\color{blue}{normAngle \cdot \left(normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right)} + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    5. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  5. Simplified97.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\mathsf{fma}\left(u, 0.16666666666666666, -0.16666666666666666\right) \cdot \mathsf{fma}\left(1 - u, 1 - u, -1\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  6. Taylor expanded in u around 0

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right) + n0\_i} \]
    2. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}, n0\_i\right)} \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} - 1, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)}, n0\_i\right) \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\frac{1}{3} \cdot {normAngle}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} + \color{blue}{-1}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {normAngle}^{2}, -1\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    12. sin-lowering-sin.f3299.4

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\color{blue}{\sin normAngle}}\right), n0\_i\right) \]
  8. Simplified99.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)} \]
  9. Taylor expanded in normAngle around 0

    \[\leadsto \mathsf{fma}\left(u, \color{blue}{n1\_i + \left(-1 \cdot n0\_i + {normAngle}^{2} \cdot \left(\left(-1 \cdot \left({normAngle}^{2} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right) + \frac{1}{3} \cdot n0\_i\right) - \frac{-1}{6} \cdot n1\_i\right)\right)}, n0\_i\right) \]
  10. Step-by-step derivation
    1. associate-+r+N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\left(n1\_i + -1 \cdot n0\_i\right) + {normAngle}^{2} \cdot \left(\left(-1 \cdot \left({normAngle}^{2} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right) + \frac{1}{3} \cdot n0\_i\right) - \frac{-1}{6} \cdot n1\_i\right)}, n0\_i\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{{normAngle}^{2} \cdot \left(\left(-1 \cdot \left({normAngle}^{2} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right) + \frac{1}{3} \cdot n0\_i\right) - \frac{-1}{6} \cdot n1\_i\right) + \left(n1\_i + -1 \cdot n0\_i\right)}, n0\_i\right) \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left({normAngle}^{2}, \left(-1 \cdot \left({normAngle}^{2} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right) + \frac{1}{3} \cdot n0\_i\right) - \frac{-1}{6} \cdot n1\_i, n1\_i + -1 \cdot n0\_i\right)}, n0\_i\right) \]
  11. Simplified98.6%

    \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, n1\_i \cdot 0.019444444444444445, \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right)\right), n1\_i - n0\_i\right)}, n0\_i\right) \]
  12. Add Preprocessing

Alternative 6: 99.1% accurate, 12.4× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(normAngle \cdot normAngle, u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (fma
  (* normAngle normAngle)
  (* u (fma n1_i 0.16666666666666666 (* n0_i 0.3333333333333333)))
  (fma (- n1_i n0_i) u n0_i)))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return fmaf((normAngle * normAngle), (u * fmaf(n1_i, 0.16666666666666666f, (n0_i * 0.3333333333333333f))), fmaf((n1_i - n0_i), u, n0_i));
}
function code(normAngle, u, n0_i, n1_i)
	return fma(Float32(normAngle * normAngle), Float32(u * fma(n1_i, Float32(0.16666666666666666), Float32(n0_i * Float32(0.3333333333333333)))), fma(Float32(n1_i - n0_i), u, n0_i))
end
\begin{array}{l}

\\
\mathsf{fma}\left(normAngle \cdot normAngle, u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right)
\end{array}
Derivation
  1. Initial program 97.4%

    \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  2. Add Preprocessing
  3. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{\left(\left(1 + {normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right) - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + 1\right)} - u\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    2. associate--l+N/A

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    3. unpow2N/A

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    4. associate-*l*N/A

      \[\leadsto \left(\color{blue}{normAngle \cdot \left(normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right)} + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    5. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  5. Simplified97.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\mathsf{fma}\left(u, 0.16666666666666666, -0.16666666666666666\right) \cdot \mathsf{fma}\left(1 - u, 1 - u, -1\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  6. Taylor expanded in u around 0

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right) + n0\_i} \]
    2. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}, n0\_i\right)} \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} - 1, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)}, n0\_i\right) \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\frac{1}{3} \cdot {normAngle}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} + \color{blue}{-1}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {normAngle}^{2}, -1\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    12. sin-lowering-sin.f3299.4

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\color{blue}{\sin normAngle}}\right), n0\_i\right) \]
  8. Simplified99.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)} \]
  9. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{n0\_i + \left(u \cdot \left(n1\_i + -1 \cdot n0\_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(\frac{1}{3} \cdot n0\_i - \frac{-1}{6} \cdot n1\_i\right) + {normAngle}^{2} \cdot \left(-1 \cdot \left(u \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right) + -1 \cdot \left({normAngle}^{2} \cdot \left(u \cdot \left(\frac{-1}{5040} \cdot n1\_i + \left(\frac{1}{720} \cdot n1\_i + \frac{1}{6} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right)\right)\right)\right)\right)\right)} \]
  10. Simplified98.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(\mathsf{fma}\left(n1\_i, -0.0032407407407407406, n1\_i \cdot 0.0011904761904761906\right) \cdot \left(-normAngle \cdot normAngle\right), u, \left(n1\_i \cdot u\right) \cdot 0.019444444444444445\right), u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right)\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right)} \]
  11. Taylor expanded in normAngle around 0

    \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{u \cdot \left(\frac{1}{6} \cdot n1\_i + \frac{1}{3} \cdot n0\_i\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  12. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{u \cdot \left(\frac{1}{6} \cdot n1\_i + \frac{1}{3} \cdot n0\_i\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, u \cdot \left(\color{blue}{n1\_i \cdot \frac{1}{6}} + \frac{1}{3} \cdot n0\_i\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, u \cdot \color{blue}{\mathsf{fma}\left(n1\_i, \frac{1}{6}, \frac{1}{3} \cdot n0\_i\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
    4. *-lowering-*.f3298.2

      \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, \color{blue}{0.3333333333333333 \cdot n0\_i}\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  13. Simplified98.2%

    \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, 0.3333333333333333 \cdot n0\_i\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  14. Final simplification98.2%

    \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  15. Add Preprocessing

Alternative 7: 99.1% accurate, 14.3× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right), n1\_i - n0\_i\right), n0\_i\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (fma
  u
  (fma
   (* normAngle normAngle)
   (fma n1_i 0.16666666666666666 (* n0_i 0.3333333333333333))
   (- n1_i n0_i))
  n0_i))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return fmaf(u, fmaf((normAngle * normAngle), fmaf(n1_i, 0.16666666666666666f, (n0_i * 0.3333333333333333f)), (n1_i - n0_i)), n0_i);
}
function code(normAngle, u, n0_i, n1_i)
	return fma(u, fma(Float32(normAngle * normAngle), fma(n1_i, Float32(0.16666666666666666), Float32(n0_i * Float32(0.3333333333333333))), Float32(n1_i - n0_i)), n0_i)
end
\begin{array}{l}

\\
\mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right), n1\_i - n0\_i\right), n0\_i\right)
\end{array}
Derivation
  1. Initial program 97.4%

    \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  2. Add Preprocessing
  3. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{\left(\left(1 + {normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right) - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + 1\right)} - u\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    2. associate--l+N/A

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    3. unpow2N/A

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    4. associate-*l*N/A

      \[\leadsto \left(\color{blue}{normAngle \cdot \left(normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right)} + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    5. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  5. Simplified97.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\mathsf{fma}\left(u, 0.16666666666666666, -0.16666666666666666\right) \cdot \mathsf{fma}\left(1 - u, 1 - u, -1\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  6. Taylor expanded in u around 0

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right) + n0\_i} \]
    2. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}, n0\_i\right)} \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} - 1, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)}, n0\_i\right) \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\frac{1}{3} \cdot {normAngle}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} + \color{blue}{-1}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {normAngle}^{2}, -1\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    12. sin-lowering-sin.f3299.4

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\color{blue}{\sin normAngle}}\right), n0\_i\right) \]
  8. Simplified99.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)} \]
  9. Taylor expanded in normAngle around 0

    \[\leadsto \mathsf{fma}\left(u, \color{blue}{n1\_i + \left(-1 \cdot n0\_i + {normAngle}^{2} \cdot \left(\frac{1}{3} \cdot n0\_i - \frac{-1}{6} \cdot n1\_i\right)\right)}, n0\_i\right) \]
  10. Step-by-step derivation
    1. associate-+r+N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\left(n1\_i + -1 \cdot n0\_i\right) + {normAngle}^{2} \cdot \left(\frac{1}{3} \cdot n0\_i - \frac{-1}{6} \cdot n1\_i\right)}, n0\_i\right) \]
    2. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{fma}\left(u, \left(n1\_i + -1 \cdot n0\_i\right) + {normAngle}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot n0\_i + \left(\mathsf{neg}\left(\frac{-1}{6}\right)\right) \cdot n1\_i\right)}, n0\_i\right) \]
    3. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(u, \left(n1\_i + -1 \cdot n0\_i\right) + {normAngle}^{2} \cdot \left(\frac{1}{3} \cdot n0\_i + \color{blue}{\frac{1}{6}} \cdot n1\_i\right), n0\_i\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(u, \left(n1\_i + -1 \cdot n0\_i\right) + {normAngle}^{2} \cdot \color{blue}{\left(\frac{1}{6} \cdot n1\_i + \frac{1}{3} \cdot n0\_i\right)}, n0\_i\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{{normAngle}^{2} \cdot \left(\frac{1}{6} \cdot n1\_i + \frac{1}{3} \cdot n0\_i\right) + \left(n1\_i + -1 \cdot n0\_i\right)}, n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left({normAngle}^{2}, \frac{1}{6} \cdot n1\_i + \frac{1}{3} \cdot n0\_i, n1\_i + -1 \cdot n0\_i\right)}, n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(\color{blue}{normAngle \cdot normAngle}, \frac{1}{6} \cdot n1\_i + \frac{1}{3} \cdot n0\_i, n1\_i + -1 \cdot n0\_i\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(\color{blue}{normAngle \cdot normAngle}, \frac{1}{6} \cdot n1\_i + \frac{1}{3} \cdot n0\_i, n1\_i + -1 \cdot n0\_i\right), n0\_i\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{n1\_i \cdot \frac{1}{6}} + \frac{1}{3} \cdot n0\_i, n1\_i + -1 \cdot n0\_i\right), n0\_i\right) \]
    10. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{\mathsf{fma}\left(n1\_i, \frac{1}{6}, \frac{1}{3} \cdot n0\_i\right)}, n1\_i + -1 \cdot n0\_i\right), n0\_i\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(n1\_i, \frac{1}{6}, \color{blue}{n0\_i \cdot \frac{1}{3}}\right), n1\_i + -1 \cdot n0\_i\right), n0\_i\right) \]
    12. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(n1\_i, \frac{1}{6}, \color{blue}{n0\_i \cdot \frac{1}{3}}\right), n1\_i + -1 \cdot n0\_i\right), n0\_i\right) \]
    13. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(n1\_i, \frac{1}{6}, n0\_i \cdot \frac{1}{3}\right), n1\_i + \color{blue}{\left(\mathsf{neg}\left(n0\_i\right)\right)}\right), n0\_i\right) \]
    14. unsub-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(n1\_i, \frac{1}{6}, n0\_i \cdot \frac{1}{3}\right), \color{blue}{n1\_i - n0\_i}\right), n0\_i\right) \]
    15. --lowering--.f3298.2

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right), \color{blue}{n1\_i - n0\_i}\right), n0\_i\right) \]
  11. Simplified98.2%

    \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right), n1\_i - n0\_i\right)}, n0\_i\right) \]
  12. Add Preprocessing

Alternative 8: 98.3% accurate, 14.8× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(normAngle \cdot normAngle, u \cdot \left(n0\_i \cdot 0.3333333333333333\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (fma
  (* normAngle normAngle)
  (* u (* n0_i 0.3333333333333333))
  (fma (- n1_i n0_i) u n0_i)))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return fmaf((normAngle * normAngle), (u * (n0_i * 0.3333333333333333f)), fmaf((n1_i - n0_i), u, n0_i));
}
function code(normAngle, u, n0_i, n1_i)
	return fma(Float32(normAngle * normAngle), Float32(u * Float32(n0_i * Float32(0.3333333333333333))), fma(Float32(n1_i - n0_i), u, n0_i))
end
\begin{array}{l}

\\
\mathsf{fma}\left(normAngle \cdot normAngle, u \cdot \left(n0\_i \cdot 0.3333333333333333\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right)
\end{array}
Derivation
  1. Initial program 97.4%

    \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  2. Add Preprocessing
  3. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{\left(\left(1 + {normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right) - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + 1\right)} - u\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    2. associate--l+N/A

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    3. unpow2N/A

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    4. associate-*l*N/A

      \[\leadsto \left(\color{blue}{normAngle \cdot \left(normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right)} + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    5. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  5. Simplified97.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\mathsf{fma}\left(u, 0.16666666666666666, -0.16666666666666666\right) \cdot \mathsf{fma}\left(1 - u, 1 - u, -1\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  6. Taylor expanded in u around 0

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right) + n0\_i} \]
    2. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}, n0\_i\right)} \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} - 1, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)}, n0\_i\right) \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\frac{1}{3} \cdot {normAngle}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} + \color{blue}{-1}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {normAngle}^{2}, -1\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    12. sin-lowering-sin.f3299.4

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\color{blue}{\sin normAngle}}\right), n0\_i\right) \]
  8. Simplified99.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)} \]
  9. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{n0\_i + \left(u \cdot \left(n1\_i + -1 \cdot n0\_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(\frac{1}{3} \cdot n0\_i - \frac{-1}{6} \cdot n1\_i\right) + {normAngle}^{2} \cdot \left(-1 \cdot \left(u \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right) + -1 \cdot \left({normAngle}^{2} \cdot \left(u \cdot \left(\frac{-1}{5040} \cdot n1\_i + \left(\frac{1}{720} \cdot n1\_i + \frac{1}{6} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right)\right)\right)\right)\right)\right)} \]
  10. Simplified98.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(normAngle \cdot normAngle, \mathsf{fma}\left(\mathsf{fma}\left(n1\_i, -0.0032407407407407406, n1\_i \cdot 0.0011904761904761906\right) \cdot \left(-normAngle \cdot normAngle\right), u, \left(n1\_i \cdot u\right) \cdot 0.019444444444444445\right), u \cdot \mathsf{fma}\left(n1\_i, 0.16666666666666666, n0\_i \cdot 0.3333333333333333\right)\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right)} \]
  11. Taylor expanded in n1_i around 0

    \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{\frac{1}{3} \cdot \left(n0\_i \cdot u\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  12. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{\left(\frac{1}{3} \cdot n0\_i\right) \cdot u}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{u \cdot \left(\frac{1}{3} \cdot n0\_i\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{u \cdot \left(\frac{1}{3} \cdot n0\_i\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
    4. *-lowering-*.f3297.6

      \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, u \cdot \color{blue}{\left(0.3333333333333333 \cdot n0\_i\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  13. Simplified97.6%

    \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, \color{blue}{u \cdot \left(0.3333333333333333 \cdot n0\_i\right)}, \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  14. Final simplification97.6%

    \[\leadsto \mathsf{fma}\left(normAngle \cdot normAngle, u \cdot \left(n0\_i \cdot 0.3333333333333333\right), \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)\right) \]
  15. Add Preprocessing

Alternative 9: 98.3% accurate, 19.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i\right), n0\_i\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (fma
  u
  (fma n0_i (fma 0.3333333333333333 (* normAngle normAngle) -1.0) n1_i)
  n0_i))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return fmaf(u, fmaf(n0_i, fmaf(0.3333333333333333f, (normAngle * normAngle), -1.0f), n1_i), n0_i);
}
function code(normAngle, u, n0_i, n1_i)
	return fma(u, fma(n0_i, fma(Float32(0.3333333333333333), Float32(normAngle * normAngle), Float32(-1.0)), n1_i), n0_i)
end
\begin{array}{l}

\\
\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i\right), n0\_i\right)
\end{array}
Derivation
  1. Initial program 97.4%

    \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  2. Add Preprocessing
  3. Taylor expanded in normAngle around 0

    \[\leadsto \color{blue}{\left(\left(1 + {normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right) - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + 1\right)} - u\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    2. associate--l+N/A

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    3. unpow2N/A

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    4. associate-*l*N/A

      \[\leadsto \left(\color{blue}{normAngle \cdot \left(normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right)} + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
    5. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  5. Simplified97.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\mathsf{fma}\left(u, 0.16666666666666666, -0.16666666666666666\right) \cdot \mathsf{fma}\left(1 - u, 1 - u, -1\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
  6. Taylor expanded in u around 0

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right) + n0\_i} \]
    2. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}, n0\_i\right)} \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} - 1, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)}, n0\_i\right) \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\frac{1}{3} \cdot {normAngle}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} + \color{blue}{-1}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    6. accelerator-lowering-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {normAngle}^{2}, -1\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
    12. sin-lowering-sin.f3299.4

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\color{blue}{\sin normAngle}}\right), n0\_i\right) \]
  8. Simplified99.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)} \]
  9. Taylor expanded in normAngle around 0

    \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i}\right), n0\_i\right) \]
  10. Step-by-step derivation
    1. Simplified97.6%

      \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i}\right), n0\_i\right) \]
    2. Add Preprocessing

    Alternative 10: 60.1% accurate, 25.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n0\_i \leq -3.99999987306209 \cdot 10^{-20}:\\ \;\;\;\;n0\_i\\ \mathbf{elif}\;n0\_i \leq 3.999999935100636 \cdot 10^{-17}:\\ \;\;\;\;u \cdot n1\_i\\ \mathbf{else}:\\ \;\;\;\;n0\_i\\ \end{array} \end{array} \]
    (FPCore (normAngle u n0_i n1_i)
     :precision binary32
     (if (<= n0_i -3.99999987306209e-20)
       n0_i
       (if (<= n0_i 3.999999935100636e-17) (* u n1_i) n0_i)))
    float code(float normAngle, float u, float n0_i, float n1_i) {
    	float tmp;
    	if (n0_i <= -3.99999987306209e-20f) {
    		tmp = n0_i;
    	} else if (n0_i <= 3.999999935100636e-17f) {
    		tmp = u * n1_i;
    	} else {
    		tmp = n0_i;
    	}
    	return tmp;
    }
    
    real(4) function code(normangle, u, n0_i, n1_i)
        real(4), intent (in) :: normangle
        real(4), intent (in) :: u
        real(4), intent (in) :: n0_i
        real(4), intent (in) :: n1_i
        real(4) :: tmp
        if (n0_i <= (-3.99999987306209e-20)) then
            tmp = n0_i
        else if (n0_i <= 3.999999935100636e-17) then
            tmp = u * n1_i
        else
            tmp = n0_i
        end if
        code = tmp
    end function
    
    function code(normAngle, u, n0_i, n1_i)
    	tmp = Float32(0.0)
    	if (n0_i <= Float32(-3.99999987306209e-20))
    		tmp = n0_i;
    	elseif (n0_i <= Float32(3.999999935100636e-17))
    		tmp = Float32(u * n1_i);
    	else
    		tmp = n0_i;
    	end
    	return tmp
    end
    
    function tmp_2 = code(normAngle, u, n0_i, n1_i)
    	tmp = single(0.0);
    	if (n0_i <= single(-3.99999987306209e-20))
    		tmp = n0_i;
    	elseif (n0_i <= single(3.999999935100636e-17))
    		tmp = u * n1_i;
    	else
    		tmp = n0_i;
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n0\_i \leq -3.99999987306209 \cdot 10^{-20}:\\
    \;\;\;\;n0\_i\\
    
    \mathbf{elif}\;n0\_i \leq 3.999999935100636 \cdot 10^{-17}:\\
    \;\;\;\;u \cdot n1\_i\\
    
    \mathbf{else}:\\
    \;\;\;\;n0\_i\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if n0_i < -3.99999987e-20 or 3.99999994e-17 < n0_i

      1. Initial program 98.1%

        \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
      2. Add Preprocessing
      3. Taylor expanded in u around 0

        \[\leadsto \color{blue}{n0\_i} \]
      4. Step-by-step derivation
        1. Simplified62.6%

          \[\leadsto \color{blue}{n0\_i} \]

        if -3.99999987e-20 < n0_i < 3.99999994e-17

        1. Initial program 96.7%

          \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
        2. Add Preprocessing
        3. Taylor expanded in u around 0

          \[\leadsto \color{blue}{n0\_i} + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
        4. Step-by-step derivation
          1. Simplified86.5%

            \[\leadsto \color{blue}{n0\_i} + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
          2. Taylor expanded in normAngle around 0

            \[\leadsto \color{blue}{n0\_i + n1\_i \cdot u} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{n1\_i \cdot u + n0\_i} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{u \cdot n1\_i} + n0\_i \]
            3. accelerator-lowering-fma.f3285.8

              \[\leadsto \color{blue}{\mathsf{fma}\left(u, n1\_i, n0\_i\right)} \]
          4. Simplified85.8%

            \[\leadsto \color{blue}{\mathsf{fma}\left(u, n1\_i, n0\_i\right)} \]
          5. Taylor expanded in u around inf

            \[\leadsto \color{blue}{n1\_i \cdot u} \]
          6. Step-by-step derivation
            1. *-lowering-*.f3261.1

              \[\leadsto \color{blue}{n1\_i \cdot u} \]
          7. Simplified61.1%

            \[\leadsto \color{blue}{n1\_i \cdot u} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification61.8%

          \[\leadsto \begin{array}{l} \mathbf{if}\;n0\_i \leq -3.99999987306209 \cdot 10^{-20}:\\ \;\;\;\;n0\_i\\ \mathbf{elif}\;n0\_i \leq 3.999999935100636 \cdot 10^{-17}:\\ \;\;\;\;u \cdot n1\_i\\ \mathbf{else}:\\ \;\;\;\;n0\_i\\ \end{array} \]
        7. Add Preprocessing

        Alternative 11: 98.2% accurate, 45.9× speedup?

        \[\begin{array}{l} \\ \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right) \end{array} \]
        (FPCore (normAngle u n0_i n1_i) :precision binary32 (fma (- n1_i n0_i) u n0_i))
        float code(float normAngle, float u, float n0_i, float n1_i) {
        	return fmaf((n1_i - n0_i), u, n0_i);
        }
        
        function code(normAngle, u, n0_i, n1_i)
        	return fma(Float32(n1_i - n0_i), u, n0_i)
        end
        
        \begin{array}{l}
        
        \\
        \mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)
        \end{array}
        
        Derivation
        1. Initial program 97.4%

          \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
        2. Add Preprocessing
        3. Taylor expanded in normAngle around 0

          \[\leadsto \color{blue}{\left(\left(1 + {normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right) - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \left(\color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + 1\right)} - u\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
          2. associate--l+N/A

            \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
          3. unpow2N/A

            \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right) + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
          4. associate-*l*N/A

            \[\leadsto \left(\color{blue}{normAngle \cdot \left(normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right)\right)} + \left(1 - u\right)\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
          5. accelerator-lowering-fma.f32N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\frac{-1}{6} \cdot {\left(1 - u\right)}^{3} - \frac{-1}{6} \cdot \left(1 - u\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
        5. Simplified97.6%

          \[\leadsto \color{blue}{\mathsf{fma}\left(normAngle, normAngle \cdot \left(\mathsf{fma}\left(u, 0.16666666666666666, -0.16666666666666666\right) \cdot \mathsf{fma}\left(1 - u, 1 - u, -1\right)\right), 1 - u\right)} \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
        6. Taylor expanded in u around 0

          \[\leadsto \color{blue}{n0\_i + u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)} \]
        7. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{u \cdot \left(n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}\right) + n0\_i} \]
          2. accelerator-lowering-fma.f32N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(u, n0\_i \cdot \left(\frac{1}{3} \cdot {normAngle}^{2} - 1\right) + \frac{n1\_i \cdot normAngle}{\sin normAngle}, n0\_i\right)} \]
          3. accelerator-lowering-fma.f32N/A

            \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} - 1, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right)}, n0\_i\right) \]
          4. sub-negN/A

            \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\frac{1}{3} \cdot {normAngle}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
          5. metadata-evalN/A

            \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \frac{1}{3} \cdot {normAngle}^{2} + \color{blue}{-1}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
          6. accelerator-lowering-fma.f32N/A

            \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {normAngle}^{2}, -1\right)}, \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
          8. *-lowering-*.f32N/A

            \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, \color{blue}{normAngle \cdot normAngle}, -1\right), \frac{n1\_i \cdot normAngle}{\sin normAngle}\right), n0\_i\right) \]
          9. associate-/l*N/A

            \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
          10. *-lowering-*.f32N/A

            \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), \color{blue}{n1\_i \cdot \frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
          11. /-lowering-/.f32N/A

            \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(\frac{1}{3}, normAngle \cdot normAngle, -1\right), n1\_i \cdot \color{blue}{\frac{normAngle}{\sin normAngle}}\right), n0\_i\right) \]
          12. sin-lowering-sin.f3299.4

            \[\leadsto \mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\color{blue}{\sin normAngle}}\right), n0\_i\right) \]
        8. Simplified99.4%

          \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{fma}\left(n0\_i, \mathsf{fma}\left(0.3333333333333333, normAngle \cdot normAngle, -1\right), n1\_i \cdot \frac{normAngle}{\sin normAngle}\right), n0\_i\right)} \]
        9. Taylor expanded in normAngle around 0

          \[\leadsto \color{blue}{n0\_i + u \cdot \left(n1\_i + -1 \cdot n0\_i\right)} \]
        10. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{u \cdot \left(n1\_i + -1 \cdot n0\_i\right) + n0\_i} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\left(n1\_i + -1 \cdot n0\_i\right) \cdot u} + n0\_i \]
          3. accelerator-lowering-fma.f32N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(n1\_i + -1 \cdot n0\_i, u, n0\_i\right)} \]
          4. mul-1-negN/A

            \[\leadsto \mathsf{fma}\left(n1\_i + \color{blue}{\left(\mathsf{neg}\left(n0\_i\right)\right)}, u, n0\_i\right) \]
          5. unsub-negN/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{n1\_i - n0\_i}, u, n0\_i\right) \]
          6. --lowering--.f3297.4

            \[\leadsto \mathsf{fma}\left(\color{blue}{n1\_i - n0\_i}, u, n0\_i\right) \]
        11. Simplified97.4%

          \[\leadsto \color{blue}{\mathsf{fma}\left(n1\_i - n0\_i, u, n0\_i\right)} \]
        12. Add Preprocessing

        Alternative 12: 82.1% accurate, 65.6× speedup?

        \[\begin{array}{l} \\ \mathsf{fma}\left(u, n1\_i, n0\_i\right) \end{array} \]
        (FPCore (normAngle u n0_i n1_i) :precision binary32 (fma u n1_i n0_i))
        float code(float normAngle, float u, float n0_i, float n1_i) {
        	return fmaf(u, n1_i, n0_i);
        }
        
        function code(normAngle, u, n0_i, n1_i)
        	return fma(u, n1_i, n0_i)
        end
        
        \begin{array}{l}
        
        \\
        \mathsf{fma}\left(u, n1\_i, n0\_i\right)
        \end{array}
        
        Derivation
        1. Initial program 97.4%

          \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
        2. Add Preprocessing
        3. Taylor expanded in u around 0

          \[\leadsto \color{blue}{n0\_i} + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
        4. Step-by-step derivation
          1. Simplified82.1%

            \[\leadsto \color{blue}{n0\_i} + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
          2. Taylor expanded in normAngle around 0

            \[\leadsto \color{blue}{n0\_i + n1\_i \cdot u} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{n1\_i \cdot u + n0\_i} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{u \cdot n1\_i} + n0\_i \]
            3. accelerator-lowering-fma.f3282.0

              \[\leadsto \color{blue}{\mathsf{fma}\left(u, n1\_i, n0\_i\right)} \]
          4. Simplified82.0%

            \[\leadsto \color{blue}{\mathsf{fma}\left(u, n1\_i, n0\_i\right)} \]
          5. Add Preprocessing

          Alternative 13: 47.4% accurate, 459.0× speedup?

          \[\begin{array}{l} \\ n0\_i \end{array} \]
          (FPCore (normAngle u n0_i n1_i) :precision binary32 n0_i)
          float code(float normAngle, float u, float n0_i, float n1_i) {
          	return n0_i;
          }
          
          real(4) function code(normangle, u, n0_i, n1_i)
              real(4), intent (in) :: normangle
              real(4), intent (in) :: u
              real(4), intent (in) :: n0_i
              real(4), intent (in) :: n1_i
              code = n0_i
          end function
          
          function code(normAngle, u, n0_i, n1_i)
          	return n0_i
          end
          
          function tmp = code(normAngle, u, n0_i, n1_i)
          	tmp = n0_i;
          end
          
          \begin{array}{l}
          
          \\
          n0\_i
          \end{array}
          
          Derivation
          1. Initial program 97.4%

            \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0\_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1\_i \]
          2. Add Preprocessing
          3. Taylor expanded in u around 0

            \[\leadsto \color{blue}{n0\_i} \]
          4. Step-by-step derivation
            1. Simplified43.8%

              \[\leadsto \color{blue}{n0\_i} \]
            2. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2024195 
            (FPCore (normAngle u n0_i n1_i)
              :name "Curve intersection, scale width based on ribbon orientation"
              :precision binary32
              :pre (and (and (and (and (<= 0.0 normAngle) (<= normAngle (/ PI 2.0))) (and (<= -1.0 n0_i) (<= n0_i 1.0))) (and (<= -1.0 n1_i) (<= n1_i 1.0))) (and (<= 2.328306437e-10 u) (<= u 1.0)))
              (+ (* (* (sin (* (- 1.0 u) normAngle)) (/ 1.0 (sin normAngle))) n0_i) (* (* (sin (* u normAngle)) (/ 1.0 (sin normAngle))) n1_i)))