Curve intersection, scale width based on ribbon orientation

Percentage Accurate: 97.2% → 99.5%
Time: 14.8s
Alternatives: 11
Speedup: 60.1×

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 11 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.5% accurate, 1.0× speedup?

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

\\
\mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}, n0_i\right)
\end{array}
Derivation
  1. Initial program 97.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. Step-by-step derivation
    1. *-commutative97.1%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
    2. associate-*l*85.4%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    3. *-commutative85.4%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    4. associate-*l*73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    5. distribute-lft-out73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    6. associate-*l/74.0%

      \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    7. *-lft-identity74.0%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
    8. fma-def74.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
    9. *-commutative74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    10. distribute-rgt-out--74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    11. *-lft-identity74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
  3. Simplified74.0%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
  4. Taylor expanded in u around 0 87.4%

    \[\leadsto \color{blue}{n0_i + u \cdot \left(-1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}\right)} \]
  5. Step-by-step derivation
    1. +-commutative87.4%

      \[\leadsto \color{blue}{u \cdot \left(-1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}\right) + n0_i} \]
    2. fma-def87.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, -1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}, n0_i\right)} \]
    3. +-commutative87.4%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i \cdot normAngle}{\sin normAngle} + -1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}}, n0_i\right) \]
    4. mul-1-neg87.4%

      \[\leadsto \mathsf{fma}\left(u, \frac{n1_i \cdot normAngle}{\sin normAngle} + \color{blue}{\left(-\frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)}, n0_i\right) \]
    5. unsub-neg87.4%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i \cdot normAngle}{\sin normAngle} - \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}}, n0_i\right) \]
    6. associate-/l*94.5%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i}{\frac{\sin normAngle}{normAngle}}} - \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}, n0_i\right) \]
    7. associate-/l*99.8%

      \[\leadsto \mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \color{blue}{\frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}}, n0_i\right) \]
  6. Simplified99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}, n0_i\right)} \]
  7. Final simplification99.8%

    \[\leadsto \mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}, n0_i\right) \]

Alternative 2: 99.1% accurate, 3.5× speedup?

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

\\
\mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) - u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot -0.16666666666666666 - n0_i \cdot 0.3333333333333333\right)\right)
\end{array}
Derivation
  1. Initial program 97.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. Step-by-step derivation
    1. *-commutative97.1%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
    2. associate-*l*85.4%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    3. *-commutative85.4%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    4. associate-*l*73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    5. distribute-lft-out73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    6. associate-*l/74.0%

      \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    7. *-lft-identity74.0%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
    8. fma-def74.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
    9. *-commutative74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    10. distribute-rgt-out--74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    11. *-lft-identity74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
  3. Simplified74.0%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
  4. Taylor expanded in u around 0 87.4%

    \[\leadsto \color{blue}{n0_i + u \cdot \left(-1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}\right)} \]
  5. Step-by-step derivation
    1. +-commutative87.4%

      \[\leadsto \color{blue}{u \cdot \left(-1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}\right) + n0_i} \]
    2. fma-def87.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, -1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}, n0_i\right)} \]
    3. +-commutative87.4%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i \cdot normAngle}{\sin normAngle} + -1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}}, n0_i\right) \]
    4. mul-1-neg87.4%

      \[\leadsto \mathsf{fma}\left(u, \frac{n1_i \cdot normAngle}{\sin normAngle} + \color{blue}{\left(-\frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)}, n0_i\right) \]
    5. unsub-neg87.4%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i \cdot normAngle}{\sin normAngle} - \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}}, n0_i\right) \]
    6. associate-/l*94.5%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i}{\frac{\sin normAngle}{normAngle}}} - \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}, n0_i\right) \]
    7. associate-/l*99.8%

      \[\leadsto \mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \color{blue}{\frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}}, n0_i\right) \]
  6. Simplified99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}, n0_i\right)} \]
  7. Taylor expanded in normAngle around 0 99.4%

    \[\leadsto \color{blue}{n0_i + \left(u \cdot \left(n1_i - n0_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right)\right)} \]
  8. Step-by-step derivation
    1. +-commutative99.4%

      \[\leadsto \color{blue}{\left(u \cdot \left(n1_i - n0_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right)\right) + n0_i} \]
    2. +-commutative99.4%

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) + u \cdot \left(n1_i - n0_i\right)\right)} + n0_i \]
    3. associate-+l+99.4%

      \[\leadsto \color{blue}{{normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right)} \]
    4. *-commutative99.4%

      \[\leadsto {normAngle}^{2} \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right) \cdot u\right)} + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    5. associate-*r*99.4%

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) \cdot u} + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    6. unpow299.4%

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    7. associate--r+99.4%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot n0_i - -0.5 \cdot n0_i\right) - -0.16666666666666666 \cdot n1_i\right)}\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    8. distribute-rgt-out--99.4%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(\color{blue}{n0_i \cdot \left(-0.16666666666666666 - -0.5\right)} - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    9. metadata-eval99.4%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0_i \cdot \color{blue}{0.3333333333333333} - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    10. fma-def99.6%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0_i \cdot 0.3333333333333333 - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \color{blue}{\mathsf{fma}\left(u, n1_i - n0_i, n0_i\right)} \]
  9. Simplified99.6%

    \[\leadsto \color{blue}{\left(\left(normAngle \cdot normAngle\right) \cdot \left(n0_i \cdot 0.3333333333333333 - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right)} \]
  10. Final simplification99.6%

    \[\leadsto \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) - u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot -0.16666666666666666 - n0_i \cdot 0.3333333333333333\right)\right) \]

Alternative 3: 98.9% accurate, 3.7× speedup?

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

\\
\mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) + u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot 0.16666666666666666\right)\right)
\end{array}
Derivation
  1. Initial program 97.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. Step-by-step derivation
    1. *-commutative97.1%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
    2. associate-*l*85.4%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    3. *-commutative85.4%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    4. associate-*l*73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    5. distribute-lft-out73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    6. associate-*l/74.0%

      \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    7. *-lft-identity74.0%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
    8. fma-def74.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
    9. *-commutative74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    10. distribute-rgt-out--74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    11. *-lft-identity74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
  3. Simplified74.0%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
  4. Taylor expanded in u around 0 87.4%

    \[\leadsto \color{blue}{n0_i + u \cdot \left(-1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}\right)} \]
  5. Step-by-step derivation
    1. +-commutative87.4%

      \[\leadsto \color{blue}{u \cdot \left(-1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}\right) + n0_i} \]
    2. fma-def87.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, -1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}, n0_i\right)} \]
    3. +-commutative87.4%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i \cdot normAngle}{\sin normAngle} + -1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}}, n0_i\right) \]
    4. mul-1-neg87.4%

      \[\leadsto \mathsf{fma}\left(u, \frac{n1_i \cdot normAngle}{\sin normAngle} + \color{blue}{\left(-\frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)}, n0_i\right) \]
    5. unsub-neg87.4%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i \cdot normAngle}{\sin normAngle} - \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}}, n0_i\right) \]
    6. associate-/l*94.5%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i}{\frac{\sin normAngle}{normAngle}}} - \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}, n0_i\right) \]
    7. associate-/l*99.8%

      \[\leadsto \mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \color{blue}{\frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}}, n0_i\right) \]
  6. Simplified99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}, n0_i\right)} \]
  7. Taylor expanded in normAngle around 0 99.4%

    \[\leadsto \color{blue}{n0_i + \left(u \cdot \left(n1_i - n0_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right)\right)} \]
  8. Step-by-step derivation
    1. +-commutative99.4%

      \[\leadsto \color{blue}{\left(u \cdot \left(n1_i - n0_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right)\right) + n0_i} \]
    2. +-commutative99.4%

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) + u \cdot \left(n1_i - n0_i\right)\right)} + n0_i \]
    3. associate-+l+99.4%

      \[\leadsto \color{blue}{{normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right)} \]
    4. *-commutative99.4%

      \[\leadsto {normAngle}^{2} \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right) \cdot u\right)} + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    5. associate-*r*99.4%

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) \cdot u} + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    6. unpow299.4%

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    7. associate--r+99.4%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot n0_i - -0.5 \cdot n0_i\right) - -0.16666666666666666 \cdot n1_i\right)}\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    8. distribute-rgt-out--99.4%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(\color{blue}{n0_i \cdot \left(-0.16666666666666666 - -0.5\right)} - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    9. metadata-eval99.4%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0_i \cdot \color{blue}{0.3333333333333333} - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    10. fma-def99.6%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0_i \cdot 0.3333333333333333 - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \color{blue}{\mathsf{fma}\left(u, n1_i - n0_i, n0_i\right)} \]
  9. Simplified99.6%

    \[\leadsto \color{blue}{\left(\left(normAngle \cdot normAngle\right) \cdot \left(n0_i \cdot 0.3333333333333333 - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right)} \]
  10. Taylor expanded in n0_i around 0 99.2%

    \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot \left(n1_i \cdot {normAngle}^{2}\right)\right)} \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
  11. Step-by-step derivation
    1. associate-*r*99.2%

      \[\leadsto \color{blue}{\left(\left(0.16666666666666666 \cdot n1_i\right) \cdot {normAngle}^{2}\right)} \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
    2. *-commutative99.2%

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(0.16666666666666666 \cdot n1_i\right)\right)} \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
    3. unpow299.2%

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
    4. *-commutative99.2%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \color{blue}{\left(n1_i \cdot 0.16666666666666666\right)}\right) \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
  12. Simplified99.2%

    \[\leadsto \color{blue}{\left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot 0.16666666666666666\right)\right)} \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
  13. Final simplification99.2%

    \[\leadsto \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) + u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot 0.16666666666666666\right)\right) \]

Alternative 4: 98.8% accurate, 24.8× speedup?

\[\begin{array}{l} \\ u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot 0.16666666666666666\right)\right) + \left(n0_i + u \cdot \left(n1_i - n0_i\right)\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (+
  (* u (* (* normAngle normAngle) (* n1_i 0.16666666666666666)))
  (+ n0_i (* u (- n1_i n0_i)))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return (u * ((normAngle * normAngle) * (n1_i * 0.16666666666666666f))) + (n0_i + (u * (n1_i - 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 = (u * ((normangle * normangle) * (n1_i * 0.16666666666666666e0))) + (n0_i + (u * (n1_i - n0_i)))
end function
function code(normAngle, u, n0_i, n1_i)
	return Float32(Float32(u * Float32(Float32(normAngle * normAngle) * Float32(n1_i * Float32(0.16666666666666666)))) + Float32(n0_i + Float32(u * Float32(n1_i - n0_i))))
end
function tmp = code(normAngle, u, n0_i, n1_i)
	tmp = (u * ((normAngle * normAngle) * (n1_i * single(0.16666666666666666)))) + (n0_i + (u * (n1_i - n0_i)));
end
\begin{array}{l}

\\
u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot 0.16666666666666666\right)\right) + \left(n0_i + u \cdot \left(n1_i - n0_i\right)\right)
\end{array}
Derivation
  1. Initial program 97.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. Step-by-step derivation
    1. *-commutative97.1%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
    2. associate-*l*85.4%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    3. *-commutative85.4%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    4. associate-*l*73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    5. distribute-lft-out73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    6. associate-*l/74.0%

      \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    7. *-lft-identity74.0%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
    8. fma-def74.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
    9. *-commutative74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    10. distribute-rgt-out--74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    11. *-lft-identity74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
  3. Simplified74.0%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
  4. Taylor expanded in u around 0 87.4%

    \[\leadsto \color{blue}{n0_i + u \cdot \left(-1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}\right)} \]
  5. Step-by-step derivation
    1. +-commutative87.4%

      \[\leadsto \color{blue}{u \cdot \left(-1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}\right) + n0_i} \]
    2. fma-def87.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, -1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}, n0_i\right)} \]
    3. +-commutative87.4%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i \cdot normAngle}{\sin normAngle} + -1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}}, n0_i\right) \]
    4. mul-1-neg87.4%

      \[\leadsto \mathsf{fma}\left(u, \frac{n1_i \cdot normAngle}{\sin normAngle} + \color{blue}{\left(-\frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)}, n0_i\right) \]
    5. unsub-neg87.4%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i \cdot normAngle}{\sin normAngle} - \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}}, n0_i\right) \]
    6. associate-/l*94.5%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i}{\frac{\sin normAngle}{normAngle}}} - \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}, n0_i\right) \]
    7. associate-/l*99.8%

      \[\leadsto \mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \color{blue}{\frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}}, n0_i\right) \]
  6. Simplified99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}, n0_i\right)} \]
  7. Taylor expanded in normAngle around 0 99.4%

    \[\leadsto \color{blue}{n0_i + \left(u \cdot \left(n1_i - n0_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right)\right)} \]
  8. Step-by-step derivation
    1. +-commutative99.4%

      \[\leadsto \color{blue}{\left(u \cdot \left(n1_i - n0_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right)\right) + n0_i} \]
    2. +-commutative99.4%

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) + u \cdot \left(n1_i - n0_i\right)\right)} + n0_i \]
    3. associate-+l+99.4%

      \[\leadsto \color{blue}{{normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right)} \]
    4. *-commutative99.4%

      \[\leadsto {normAngle}^{2} \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right) \cdot u\right)} + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    5. associate-*r*99.4%

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) \cdot u} + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    6. unpow299.4%

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    7. associate--r+99.4%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \color{blue}{\left(\left(-0.16666666666666666 \cdot n0_i - -0.5 \cdot n0_i\right) - -0.16666666666666666 \cdot n1_i\right)}\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    8. distribute-rgt-out--99.4%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(\color{blue}{n0_i \cdot \left(-0.16666666666666666 - -0.5\right)} - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    9. metadata-eval99.4%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0_i \cdot \color{blue}{0.3333333333333333} - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \left(u \cdot \left(n1_i - n0_i\right) + n0_i\right) \]
    10. fma-def99.6%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0_i \cdot 0.3333333333333333 - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \color{blue}{\mathsf{fma}\left(u, n1_i - n0_i, n0_i\right)} \]
  9. Simplified99.6%

    \[\leadsto \color{blue}{\left(\left(normAngle \cdot normAngle\right) \cdot \left(n0_i \cdot 0.3333333333333333 - -0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right)} \]
  10. Taylor expanded in n0_i around 0 99.2%

    \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot \left(n1_i \cdot {normAngle}^{2}\right)\right)} \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
  11. Step-by-step derivation
    1. associate-*r*99.2%

      \[\leadsto \color{blue}{\left(\left(0.16666666666666666 \cdot n1_i\right) \cdot {normAngle}^{2}\right)} \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
    2. *-commutative99.2%

      \[\leadsto \color{blue}{\left({normAngle}^{2} \cdot \left(0.16666666666666666 \cdot n1_i\right)\right)} \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
    3. unpow299.2%

      \[\leadsto \left(\color{blue}{\left(normAngle \cdot normAngle\right)} \cdot \left(0.16666666666666666 \cdot n1_i\right)\right) \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
    4. *-commutative99.2%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \color{blue}{\left(n1_i \cdot 0.16666666666666666\right)}\right) \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
  12. Simplified99.2%

    \[\leadsto \color{blue}{\left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot 0.16666666666666666\right)\right)} \cdot u + \mathsf{fma}\left(u, n1_i - n0_i, n0_i\right) \]
  13. Step-by-step derivation
    1. fma-udef99.1%

      \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot 0.16666666666666666\right)\right) \cdot u + \color{blue}{\left(u \cdot \left(n1_i - n0_i\right) + n0_i\right)} \]
  14. Applied egg-rr99.1%

    \[\leadsto \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot 0.16666666666666666\right)\right) \cdot u + \color{blue}{\left(u \cdot \left(n1_i - n0_i\right) + n0_i\right)} \]
  15. Final simplification99.1%

    \[\leadsto u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1_i \cdot 0.16666666666666666\right)\right) + \left(n0_i + u \cdot \left(n1_i - n0_i\right)\right) \]

Alternative 5: 98.3% accurate, 28.1× speedup?

\[\begin{array}{l} \\ n0_i + u \cdot \left(\left(n1_i - n0_i\right) - n0_i \cdot \left(\left(normAngle \cdot normAngle\right) \cdot -0.3333333333333333\right)\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (+
  n0_i
  (*
   u
   (-
    (- n1_i n0_i)
    (* n0_i (* (* normAngle normAngle) -0.3333333333333333))))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return n0_i + (u * ((n1_i - n0_i) - (n0_i * ((normAngle * normAngle) * -0.3333333333333333f))));
}
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 + (u * ((n1_i - n0_i) - (n0_i * ((normangle * normangle) * (-0.3333333333333333e0)))))
end function
function code(normAngle, u, n0_i, n1_i)
	return Float32(n0_i + Float32(u * Float32(Float32(n1_i - n0_i) - Float32(n0_i * Float32(Float32(normAngle * normAngle) * Float32(-0.3333333333333333))))))
end
function tmp = code(normAngle, u, n0_i, n1_i)
	tmp = n0_i + (u * ((n1_i - n0_i) - (n0_i * ((normAngle * normAngle) * single(-0.3333333333333333)))));
end
\begin{array}{l}

\\
n0_i + u \cdot \left(\left(n1_i - n0_i\right) - n0_i \cdot \left(\left(normAngle \cdot normAngle\right) \cdot -0.3333333333333333\right)\right)
\end{array}
Derivation
  1. Initial program 97.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. Step-by-step derivation
    1. *-commutative97.1%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
    2. associate-*l*85.4%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    3. *-commutative85.4%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    4. associate-*l*73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    5. distribute-lft-out73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    6. associate-*l/74.0%

      \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    7. *-lft-identity74.0%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
    8. fma-def74.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
    9. *-commutative74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    10. distribute-rgt-out--74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    11. *-lft-identity74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
  3. Simplified74.0%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
  4. Taylor expanded in u around 0 87.4%

    \[\leadsto \color{blue}{n0_i + u \cdot \left(-1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}\right)} \]
  5. Step-by-step derivation
    1. +-commutative87.4%

      \[\leadsto \color{blue}{u \cdot \left(-1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}\right) + n0_i} \]
    2. fma-def87.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(u, -1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle} + \frac{n1_i \cdot normAngle}{\sin normAngle}, n0_i\right)} \]
    3. +-commutative87.4%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i \cdot normAngle}{\sin normAngle} + -1 \cdot \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}}, n0_i\right) \]
    4. mul-1-neg87.4%

      \[\leadsto \mathsf{fma}\left(u, \frac{n1_i \cdot normAngle}{\sin normAngle} + \color{blue}{\left(-\frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)}, n0_i\right) \]
    5. unsub-neg87.4%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i \cdot normAngle}{\sin normAngle} - \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}}, n0_i\right) \]
    6. associate-/l*94.5%

      \[\leadsto \mathsf{fma}\left(u, \color{blue}{\frac{n1_i}{\frac{\sin normAngle}{normAngle}}} - \frac{n0_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}, n0_i\right) \]
    7. associate-/l*99.8%

      \[\leadsto \mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \color{blue}{\frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}}, n0_i\right) \]
  6. Simplified99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(u, \frac{n1_i}{\frac{\sin normAngle}{normAngle}} - \frac{n0_i}{\frac{\sin normAngle}{normAngle \cdot \cos normAngle}}, n0_i\right)} \]
  7. Taylor expanded in normAngle around 0 99.4%

    \[\leadsto \color{blue}{n0_i + \left(u \cdot \left(n1_i - n0_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(-0.16666666666666666 \cdot n0_i - \left(-0.5 \cdot n0_i + -0.16666666666666666 \cdot n1_i\right)\right)\right)\right)} \]
  8. Taylor expanded in n0_i around inf 98.8%

    \[\leadsto n0_i + \left(u \cdot \left(n1_i - n0_i\right) + {normAngle}^{2} \cdot \color{blue}{\left(0.3333333333333333 \cdot \left(n0_i \cdot u\right)\right)}\right) \]
  9. Taylor expanded in u around -inf 98.8%

    \[\leadsto \color{blue}{n0_i + -1 \cdot \left(u \cdot \left(-1 \cdot \left(n1_i - n0_i\right) + -0.3333333333333333 \cdot \left(n0_i \cdot {normAngle}^{2}\right)\right)\right)} \]
  10. Step-by-step derivation
    1. mul-1-neg98.8%

      \[\leadsto n0_i + \color{blue}{\left(-u \cdot \left(-1 \cdot \left(n1_i - n0_i\right) + -0.3333333333333333 \cdot \left(n0_i \cdot {normAngle}^{2}\right)\right)\right)} \]
    2. unsub-neg98.8%

      \[\leadsto \color{blue}{n0_i - u \cdot \left(-1 \cdot \left(n1_i - n0_i\right) + -0.3333333333333333 \cdot \left(n0_i \cdot {normAngle}^{2}\right)\right)} \]
    3. +-commutative98.8%

      \[\leadsto n0_i - u \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(n0_i \cdot {normAngle}^{2}\right) + -1 \cdot \left(n1_i - n0_i\right)\right)} \]
    4. mul-1-neg98.8%

      \[\leadsto n0_i - u \cdot \left(-0.3333333333333333 \cdot \left(n0_i \cdot {normAngle}^{2}\right) + \color{blue}{\left(-\left(n1_i - n0_i\right)\right)}\right) \]
    5. unsub-neg98.8%

      \[\leadsto n0_i - u \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(n0_i \cdot {normAngle}^{2}\right) - \left(n1_i - n0_i\right)\right)} \]
    6. *-commutative98.8%

      \[\leadsto n0_i - u \cdot \left(\color{blue}{\left(n0_i \cdot {normAngle}^{2}\right) \cdot -0.3333333333333333} - \left(n1_i - n0_i\right)\right) \]
    7. unpow298.8%

      \[\leadsto n0_i - u \cdot \left(\left(n0_i \cdot \color{blue}{\left(normAngle \cdot normAngle\right)}\right) \cdot -0.3333333333333333 - \left(n1_i - n0_i\right)\right) \]
    8. associate-*l*98.8%

      \[\leadsto n0_i - u \cdot \left(\color{blue}{n0_i \cdot \left(\left(normAngle \cdot normAngle\right) \cdot -0.3333333333333333\right)} - \left(n1_i - n0_i\right)\right) \]
    9. *-commutative98.8%

      \[\leadsto n0_i - u \cdot \left(n0_i \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(normAngle \cdot normAngle\right)\right)} - \left(n1_i - n0_i\right)\right) \]
  11. Simplified98.8%

    \[\leadsto \color{blue}{n0_i - u \cdot \left(n0_i \cdot \left(-0.3333333333333333 \cdot \left(normAngle \cdot normAngle\right)\right) - \left(n1_i - n0_i\right)\right)} \]
  12. Final simplification98.8%

    \[\leadsto n0_i + u \cdot \left(\left(n1_i - n0_i\right) - n0_i \cdot \left(\left(normAngle \cdot normAngle\right) \cdot -0.3333333333333333\right)\right) \]

Alternative 6: 70.1% accurate, 45.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n0_i \leq -1.999999936531045 \cdot 10^{-21} \lor \neg \left(n0_i \leq 1.999999936531045 \cdot 10^{-21}\right):\\ \;\;\;\;n0_i \cdot \left(1 - u\right)\\ \mathbf{else}:\\ \;\;\;\;u \cdot n1_i\\ \end{array} \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (if (or (<= n0_i -1.999999936531045e-21)
         (not (<= n0_i 1.999999936531045e-21)))
   (* n0_i (- 1.0 u))
   (* u n1_i)))
float code(float normAngle, float u, float n0_i, float n1_i) {
	float tmp;
	if ((n0_i <= -1.999999936531045e-21f) || !(n0_i <= 1.999999936531045e-21f)) {
		tmp = n0_i * (1.0f - u);
	} else {
		tmp = u * n1_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 <= (-1.999999936531045e-21)) .or. (.not. (n0_i <= 1.999999936531045e-21))) then
        tmp = n0_i * (1.0e0 - u)
    else
        tmp = u * n1_i
    end if
    code = tmp
end function
function code(normAngle, u, n0_i, n1_i)
	tmp = Float32(0.0)
	if ((n0_i <= Float32(-1.999999936531045e-21)) || !(n0_i <= Float32(1.999999936531045e-21)))
		tmp = Float32(n0_i * Float32(Float32(1.0) - u));
	else
		tmp = Float32(u * n1_i);
	end
	return tmp
end
function tmp_2 = code(normAngle, u, n0_i, n1_i)
	tmp = single(0.0);
	if ((n0_i <= single(-1.999999936531045e-21)) || ~((n0_i <= single(1.999999936531045e-21))))
		tmp = n0_i * (single(1.0) - u);
	else
		tmp = u * n1_i;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n0_i \leq -1.999999936531045 \cdot 10^{-21} \lor \neg \left(n0_i \leq 1.999999936531045 \cdot 10^{-21}\right):\\
\;\;\;\;n0_i \cdot \left(1 - u\right)\\

\mathbf{else}:\\
\;\;\;\;u \cdot n1_i\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n0_i < -1.9999999e-21 or 1.9999999e-21 < n0_i

    1. Initial program 97.8%

      \[\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. Step-by-step derivation
      1. *-commutative97.8%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
      2. associate-*l*96.6%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      3. *-commutative96.6%

        \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      4. associate-*l*85.6%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      5. distribute-lft-out85.6%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      6. associate-*l/85.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
      7. *-lft-identity85.8%

        \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
      8. fma-def85.7%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
      9. *-commutative85.7%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      10. distribute-rgt-out--85.8%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      11. *-lft-identity85.8%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    3. Simplified85.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    4. Taylor expanded in normAngle around 0 99.0%

      \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right) + n1_i \cdot u} \]
    5. Taylor expanded in n0_i around inf 84.6%

      \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right)} \]

    if -1.9999999e-21 < n0_i < 1.9999999e-21

    1. Initial program 96.2%

      \[\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. Step-by-step derivation
      1. *-commutative96.2%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
      2. associate-*l*70.8%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      3. *-commutative70.8%

        \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      4. associate-*l*58.5%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      5. distribute-lft-out58.5%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      6. associate-*l/58.7%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
      7. *-lft-identity58.7%

        \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
      8. fma-def58.7%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
      9. *-commutative58.7%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      10. distribute-rgt-out--58.7%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      11. *-lft-identity58.7%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    3. Simplified58.7%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    4. Taylor expanded in normAngle around 0 97.2%

      \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right) + n1_i \cdot u} \]
    5. Taylor expanded in n0_i around 0 60.4%

      \[\leadsto \color{blue}{n1_i \cdot u} \]
    6. Step-by-step derivation
      1. *-commutative60.4%

        \[\leadsto \color{blue}{u \cdot n1_i} \]
    7. Simplified60.4%

      \[\leadsto \color{blue}{u \cdot n1_i} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n0_i \leq -1.999999936531045 \cdot 10^{-21} \lor \neg \left(n0_i \leq 1.999999936531045 \cdot 10^{-21}\right):\\ \;\;\;\;n0_i \cdot \left(1 - u\right)\\ \mathbf{else}:\\ \;\;\;\;u \cdot n1_i\\ \end{array} \]

Alternative 7: 85.1% accurate, 45.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n0_i \leq -1.99999996490334 \cdot 10^{-13} \lor \neg \left(n0_i \leq 3.99999987306209 \cdot 10^{-20}\right):\\ \;\;\;\;n0_i \cdot \left(1 - u\right)\\ \mathbf{else}:\\ \;\;\;\;n0_i + u \cdot n1_i\\ \end{array} \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (if (or (<= n0_i -1.99999996490334e-13) (not (<= n0_i 3.99999987306209e-20)))
   (* n0_i (- 1.0 u))
   (+ n0_i (* u n1_i))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	float tmp;
	if ((n0_i <= -1.99999996490334e-13f) || !(n0_i <= 3.99999987306209e-20f)) {
		tmp = n0_i * (1.0f - u);
	} else {
		tmp = n0_i + (u * n1_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 <= (-1.99999996490334e-13)) .or. (.not. (n0_i <= 3.99999987306209e-20))) then
        tmp = n0_i * (1.0e0 - u)
    else
        tmp = n0_i + (u * n1_i)
    end if
    code = tmp
end function
function code(normAngle, u, n0_i, n1_i)
	tmp = Float32(0.0)
	if ((n0_i <= Float32(-1.99999996490334e-13)) || !(n0_i <= Float32(3.99999987306209e-20)))
		tmp = Float32(n0_i * Float32(Float32(1.0) - u));
	else
		tmp = Float32(n0_i + Float32(u * n1_i));
	end
	return tmp
end
function tmp_2 = code(normAngle, u, n0_i, n1_i)
	tmp = single(0.0);
	if ((n0_i <= single(-1.99999996490334e-13)) || ~((n0_i <= single(3.99999987306209e-20))))
		tmp = n0_i * (single(1.0) - u);
	else
		tmp = n0_i + (u * n1_i);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n0_i \leq -1.99999996490334 \cdot 10^{-13} \lor \neg \left(n0_i \leq 3.99999987306209 \cdot 10^{-20}\right):\\
\;\;\;\;n0_i \cdot \left(1 - u\right)\\

\mathbf{else}:\\
\;\;\;\;n0_i + u \cdot n1_i\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n0_i < -1.99999996e-13 or 3.99999987e-20 < n0_i

    1. Initial program 98.6%

      \[\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. Step-by-step derivation
      1. *-commutative98.6%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
      2. associate-*l*98.3%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      3. *-commutative98.3%

        \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      4. associate-*l*89.3%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      5. distribute-lft-out89.3%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      6. associate-*l/89.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
      7. *-lft-identity89.5%

        \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
      8. fma-def89.4%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
      9. *-commutative89.4%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      10. distribute-rgt-out--89.4%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      11. *-lft-identity89.4%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    3. Simplified89.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    4. Taylor expanded in normAngle around 0 99.4%

      \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right) + n1_i \cdot u} \]
    5. Taylor expanded in n0_i around inf 89.6%

      \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right)} \]

    if -1.99999996e-13 < n0_i < 3.99999987e-20

    1. Initial program 95.9%

      \[\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. Taylor expanded in normAngle around 0 97.6%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{u} \cdot n1_i \]
    3. Taylor expanded in u around 0 85.5%

      \[\leadsto \color{blue}{n0_i} + u \cdot n1_i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n0_i \leq -1.99999996490334 \cdot 10^{-13} \lor \neg \left(n0_i \leq 3.99999987306209 \cdot 10^{-20}\right):\\ \;\;\;\;n0_i \cdot \left(1 - u\right)\\ \mathbf{else}:\\ \;\;\;\;n0_i + u \cdot n1_i\\ \end{array} \]

Alternative 8: 85.2% accurate, 45.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n0_i \leq -1.99999996490334 \cdot 10^{-13} \lor \neg \left(n0_i \leq 3.99999987306209 \cdot 10^{-20}\right):\\ \;\;\;\;n0_i - u \cdot n0_i\\ \mathbf{else}:\\ \;\;\;\;n0_i + u \cdot n1_i\\ \end{array} \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (if (or (<= n0_i -1.99999996490334e-13) (not (<= n0_i 3.99999987306209e-20)))
   (- n0_i (* u n0_i))
   (+ n0_i (* u n1_i))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	float tmp;
	if ((n0_i <= -1.99999996490334e-13f) || !(n0_i <= 3.99999987306209e-20f)) {
		tmp = n0_i - (u * n0_i);
	} else {
		tmp = n0_i + (u * n1_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 <= (-1.99999996490334e-13)) .or. (.not. (n0_i <= 3.99999987306209e-20))) then
        tmp = n0_i - (u * n0_i)
    else
        tmp = n0_i + (u * n1_i)
    end if
    code = tmp
end function
function code(normAngle, u, n0_i, n1_i)
	tmp = Float32(0.0)
	if ((n0_i <= Float32(-1.99999996490334e-13)) || !(n0_i <= Float32(3.99999987306209e-20)))
		tmp = Float32(n0_i - Float32(u * n0_i));
	else
		tmp = Float32(n0_i + Float32(u * n1_i));
	end
	return tmp
end
function tmp_2 = code(normAngle, u, n0_i, n1_i)
	tmp = single(0.0);
	if ((n0_i <= single(-1.99999996490334e-13)) || ~((n0_i <= single(3.99999987306209e-20))))
		tmp = n0_i - (u * n0_i);
	else
		tmp = n0_i + (u * n1_i);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n0_i \leq -1.99999996490334 \cdot 10^{-13} \lor \neg \left(n0_i \leq 3.99999987306209 \cdot 10^{-20}\right):\\
\;\;\;\;n0_i - u \cdot n0_i\\

\mathbf{else}:\\
\;\;\;\;n0_i + u \cdot n1_i\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n0_i < -1.99999996e-13 or 3.99999987e-20 < n0_i

    1. Initial program 98.6%

      \[\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. Step-by-step derivation
      1. *-commutative98.6%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
      2. associate-*l*98.3%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      3. *-commutative98.3%

        \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      4. associate-*l*89.3%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      5. distribute-lft-out89.3%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      6. associate-*l/89.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
      7. *-lft-identity89.5%

        \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
      8. fma-def89.4%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
      9. *-commutative89.4%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      10. distribute-rgt-out--89.4%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      11. *-lft-identity89.4%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    3. Simplified89.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    4. Taylor expanded in normAngle around 0 99.4%

      \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right) + n1_i \cdot u} \]
    5. Taylor expanded in n0_i around inf 89.6%

      \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right)} \]
    6. Taylor expanded in u around 0 89.7%

      \[\leadsto \color{blue}{n0_i + -1 \cdot \left(n0_i \cdot u\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg89.7%

        \[\leadsto n0_i + \color{blue}{\left(-n0_i \cdot u\right)} \]
      2. unsub-neg89.7%

        \[\leadsto \color{blue}{n0_i - n0_i \cdot u} \]
    8. Simplified89.7%

      \[\leadsto \color{blue}{n0_i - n0_i \cdot u} \]

    if -1.99999996e-13 < n0_i < 3.99999987e-20

    1. Initial program 95.9%

      \[\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. Taylor expanded in normAngle around 0 97.6%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{u} \cdot n1_i \]
    3. Taylor expanded in u around 0 85.5%

      \[\leadsto \color{blue}{n0_i} + u \cdot n1_i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n0_i \leq -1.99999996490334 \cdot 10^{-13} \lor \neg \left(n0_i \leq 3.99999987306209 \cdot 10^{-20}\right):\\ \;\;\;\;n0_i - u \cdot n0_i\\ \mathbf{else}:\\ \;\;\;\;n0_i + u \cdot n1_i\\ \end{array} \]

Alternative 9: 60.9% accurate, 58.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n0_i \leq -1.999999936531045 \cdot 10^{-21}:\\ \;\;\;\;n0_i\\ \mathbf{elif}\;n0_i \leq 1.999999936531045 \cdot 10^{-21}:\\ \;\;\;\;u \cdot n1_i\\ \mathbf{else}:\\ \;\;\;\;n0_i\\ \end{array} \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (if (<= n0_i -1.999999936531045e-21)
   n0_i
   (if (<= n0_i 1.999999936531045e-21) (* u n1_i) n0_i)))
float code(float normAngle, float u, float n0_i, float n1_i) {
	float tmp;
	if (n0_i <= -1.999999936531045e-21f) {
		tmp = n0_i;
	} else if (n0_i <= 1.999999936531045e-21f) {
		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 <= (-1.999999936531045e-21)) then
        tmp = n0_i
    else if (n0_i <= 1.999999936531045e-21) 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(-1.999999936531045e-21))
		tmp = n0_i;
	elseif (n0_i <= Float32(1.999999936531045e-21))
		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(-1.999999936531045e-21))
		tmp = n0_i;
	elseif (n0_i <= single(1.999999936531045e-21))
		tmp = u * n1_i;
	else
		tmp = n0_i;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n0_i \leq -1.999999936531045 \cdot 10^{-21}:\\
\;\;\;\;n0_i\\

\mathbf{elif}\;n0_i \leq 1.999999936531045 \cdot 10^{-21}:\\
\;\;\;\;u \cdot n1_i\\

\mathbf{else}:\\
\;\;\;\;n0_i\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n0_i < -1.9999999e-21 or 1.9999999e-21 < n0_i

    1. Initial program 97.8%

      \[\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. Step-by-step derivation
      1. *-commutative97.8%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
      2. associate-*l*96.6%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      3. *-commutative96.6%

        \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      4. associate-*l*85.6%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      5. distribute-lft-out85.6%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      6. associate-*l/85.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
      7. *-lft-identity85.8%

        \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
      8. fma-def85.7%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
      9. *-commutative85.7%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      10. distribute-rgt-out--85.8%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      11. *-lft-identity85.8%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    3. Simplified85.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    4. Taylor expanded in normAngle around 0 99.0%

      \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right) + n1_i \cdot u} \]
    5. Step-by-step derivation
      1. flip-+97.6%

        \[\leadsto \color{blue}{\frac{\left(n0_i \cdot \left(1 - u\right)\right) \cdot \left(n0_i \cdot \left(1 - u\right)\right) - \left(n1_i \cdot u\right) \cdot \left(n1_i \cdot u\right)}{n0_i \cdot \left(1 - u\right) - n1_i \cdot u}} \]
      2. *-commutative97.6%

        \[\leadsto \frac{\left(n0_i \cdot \left(1 - u\right)\right) \cdot \left(n0_i \cdot \left(1 - u\right)\right) - \color{blue}{\left(u \cdot n1_i\right)} \cdot \left(n1_i \cdot u\right)}{n0_i \cdot \left(1 - u\right) - n1_i \cdot u} \]
      3. *-commutative97.6%

        \[\leadsto \frac{\left(n0_i \cdot \left(1 - u\right)\right) \cdot \left(n0_i \cdot \left(1 - u\right)\right) - \left(u \cdot n1_i\right) \cdot \color{blue}{\left(u \cdot n1_i\right)}}{n0_i \cdot \left(1 - u\right) - n1_i \cdot u} \]
      4. *-commutative97.6%

        \[\leadsto \frac{\left(n0_i \cdot \left(1 - u\right)\right) \cdot \left(n0_i \cdot \left(1 - u\right)\right) - \left(u \cdot n1_i\right) \cdot \left(u \cdot n1_i\right)}{n0_i \cdot \left(1 - u\right) - \color{blue}{u \cdot n1_i}} \]
    6. Applied egg-rr97.6%

      \[\leadsto \color{blue}{\frac{\left(n0_i \cdot \left(1 - u\right)\right) \cdot \left(n0_i \cdot \left(1 - u\right)\right) - \left(u \cdot n1_i\right) \cdot \left(u \cdot n1_i\right)}{n0_i \cdot \left(1 - u\right) - u \cdot n1_i}} \]
    7. Taylor expanded in u around 0 62.6%

      \[\leadsto \color{blue}{n0_i} \]

    if -1.9999999e-21 < n0_i < 1.9999999e-21

    1. Initial program 96.2%

      \[\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. Step-by-step derivation
      1. *-commutative96.2%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
      2. associate-*l*70.8%

        \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      3. *-commutative70.8%

        \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      4. associate-*l*58.5%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
      5. distribute-lft-out58.5%

        \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
      6. associate-*l/58.7%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
      7. *-lft-identity58.7%

        \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
      8. fma-def58.7%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
      9. *-commutative58.7%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      10. distribute-rgt-out--58.7%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
      11. *-lft-identity58.7%

        \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    3. Simplified58.7%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    4. Taylor expanded in normAngle around 0 97.2%

      \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right) + n1_i \cdot u} \]
    5. Taylor expanded in n0_i around 0 60.4%

      \[\leadsto \color{blue}{n1_i \cdot u} \]
    6. Step-by-step derivation
      1. *-commutative60.4%

        \[\leadsto \color{blue}{u \cdot n1_i} \]
    7. Simplified60.4%

      \[\leadsto \color{blue}{u \cdot n1_i} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n0_i \leq -1.999999936531045 \cdot 10^{-21}:\\ \;\;\;\;n0_i\\ \mathbf{elif}\;n0_i \leq 1.999999936531045 \cdot 10^{-21}:\\ \;\;\;\;u \cdot n1_i\\ \mathbf{else}:\\ \;\;\;\;n0_i\\ \end{array} \]

Alternative 10: 98.2% accurate, 60.1× speedup?

\[\begin{array}{l} \\ n0_i + u \cdot \left(n1_i - n0_i\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (+ n0_i (* u (- n1_i n0_i))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return n0_i + (u * (n1_i - 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 + (u * (n1_i - n0_i))
end function
function code(normAngle, u, n0_i, n1_i)
	return Float32(n0_i + Float32(u * Float32(n1_i - n0_i)))
end
function tmp = code(normAngle, u, n0_i, n1_i)
	tmp = n0_i + (u * (n1_i - n0_i));
end
\begin{array}{l}

\\
n0_i + u \cdot \left(n1_i - n0_i\right)
\end{array}
Derivation
  1. Initial program 97.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. Step-by-step derivation
    1. *-commutative97.1%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
    2. associate-*l*85.4%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    3. *-commutative85.4%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    4. associate-*l*73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    5. distribute-lft-out73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    6. associate-*l/74.0%

      \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    7. *-lft-identity74.0%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
    8. fma-def74.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
    9. *-commutative74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    10. distribute-rgt-out--74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    11. *-lft-identity74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
  3. Simplified74.0%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
  4. Taylor expanded in normAngle around 0 98.2%

    \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right) + n1_i \cdot u} \]
  5. Taylor expanded in u around -inf 98.5%

    \[\leadsto \color{blue}{n0_i + -1 \cdot \left(u \cdot \left(n0_i + -1 \cdot n1_i\right)\right)} \]
  6. Step-by-step derivation
    1. mul-1-neg98.5%

      \[\leadsto n0_i + \color{blue}{\left(-u \cdot \left(n0_i + -1 \cdot n1_i\right)\right)} \]
    2. unsub-neg98.5%

      \[\leadsto \color{blue}{n0_i - u \cdot \left(n0_i + -1 \cdot n1_i\right)} \]
    3. mul-1-neg98.5%

      \[\leadsto n0_i - u \cdot \left(n0_i + \color{blue}{\left(-n1_i\right)}\right) \]
    4. unsub-neg98.5%

      \[\leadsto n0_i - u \cdot \color{blue}{\left(n0_i - n1_i\right)} \]
  7. Simplified98.5%

    \[\leadsto \color{blue}{n0_i - u \cdot \left(n0_i - n1_i\right)} \]
  8. Final simplification98.5%

    \[\leadsto n0_i + u \cdot \left(n1_i - n0_i\right) \]

Alternative 11: 47.0% accurate, 421.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.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. Step-by-step derivation
    1. *-commutative97.1%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(u \cdot normAngle\right)\right)} \cdot n1_i \]
    2. associate-*l*85.4%

      \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    3. *-commutative85.4%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin normAngle} \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)} \cdot n0_i + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    4. associate-*l*73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i\right)} + \frac{1}{\sin normAngle} \cdot \left(\sin \left(u \cdot normAngle\right) \cdot n1_i\right) \]
    5. distribute-lft-out73.9%

      \[\leadsto \color{blue}{\frac{1}{\sin normAngle} \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)} \]
    6. associate-*l/74.0%

      \[\leadsto \color{blue}{\frac{1 \cdot \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
    7. *-lft-identity74.0%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot n0_i + \sin \left(u \cdot normAngle\right) \cdot n1_i}}{\sin normAngle} \]
    8. fma-def74.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\left(1 - u\right) \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}}{\sin normAngle} \]
    9. *-commutative74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(normAngle \cdot \left(1 - u\right)\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    10. distribute-rgt-out--74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \color{blue}{\left(1 \cdot normAngle - u \cdot normAngle\right)}, n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
    11. *-lft-identity74.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sin \left(\color{blue}{normAngle} - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle} \]
  3. Simplified74.0%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sin \left(normAngle - u \cdot normAngle\right), n0_i, \sin \left(u \cdot normAngle\right) \cdot n1_i\right)}{\sin normAngle}} \]
  4. Taylor expanded in normAngle around 0 98.2%

    \[\leadsto \color{blue}{n0_i \cdot \left(1 - u\right) + n1_i \cdot u} \]
  5. Step-by-step derivation
    1. flip-+78.8%

      \[\leadsto \color{blue}{\frac{\left(n0_i \cdot \left(1 - u\right)\right) \cdot \left(n0_i \cdot \left(1 - u\right)\right) - \left(n1_i \cdot u\right) \cdot \left(n1_i \cdot u\right)}{n0_i \cdot \left(1 - u\right) - n1_i \cdot u}} \]
    2. *-commutative78.8%

      \[\leadsto \frac{\left(n0_i \cdot \left(1 - u\right)\right) \cdot \left(n0_i \cdot \left(1 - u\right)\right) - \color{blue}{\left(u \cdot n1_i\right)} \cdot \left(n1_i \cdot u\right)}{n0_i \cdot \left(1 - u\right) - n1_i \cdot u} \]
    3. *-commutative78.8%

      \[\leadsto \frac{\left(n0_i \cdot \left(1 - u\right)\right) \cdot \left(n0_i \cdot \left(1 - u\right)\right) - \left(u \cdot n1_i\right) \cdot \color{blue}{\left(u \cdot n1_i\right)}}{n0_i \cdot \left(1 - u\right) - n1_i \cdot u} \]
    4. *-commutative78.8%

      \[\leadsto \frac{\left(n0_i \cdot \left(1 - u\right)\right) \cdot \left(n0_i \cdot \left(1 - u\right)\right) - \left(u \cdot n1_i\right) \cdot \left(u \cdot n1_i\right)}{n0_i \cdot \left(1 - u\right) - \color{blue}{u \cdot n1_i}} \]
  6. Applied egg-rr78.8%

    \[\leadsto \color{blue}{\frac{\left(n0_i \cdot \left(1 - u\right)\right) \cdot \left(n0_i \cdot \left(1 - u\right)\right) - \left(u \cdot n1_i\right) \cdot \left(u \cdot n1_i\right)}{n0_i \cdot \left(1 - u\right) - u \cdot n1_i}} \]
  7. Taylor expanded in u around 0 47.3%

    \[\leadsto \color{blue}{n0_i} \]
  8. Final simplification47.3%

    \[\leadsto n0_i \]

Reproduce

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