Curve intersection, scale width based on ribbon orientation

Percentage Accurate: 97.1% → 99.1%
Time: 15.8s
Alternatives: 9
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 9 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.1% 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.1% accurate, 9.4× speedup?

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

\\
n0\_i + \left(\left(normAngle \cdot normAngle\right) \cdot \left(\left(n0\_i \cdot 0.3333333333333333 + n1\_i \cdot 0.16666666666666666\right) \cdot u + \left(\left(normAngle \cdot normAngle\right) \cdot u\right) \cdot \left(-0.16666666666666666 \cdot \left(n0\_i \cdot -0.3333333333333333\right) + \left(n0\_i \cdot 0.008333333333333333 - \left(n1\_i \cdot -0.019444444444444445 + n0\_i \cdot 0.041666666666666664\right)\right)\right)\right) + u \cdot \left(n1\_i - n0\_i\right)\right)
\end{array}
Derivation
  1. Initial program 97.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. Add Preprocessing
  3. Taylor expanded in u around 0

    \[\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)} \]
  4. Step-by-step derivation
    1. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \color{blue}{\left(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)\right)}\right) \]
    2. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \left(\frac{n1\_i \cdot normAngle}{\sin normAngle} + \left(\mathsf{neg}\left(\frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)\right)\right)\right)\right) \]
    5. unsub-negN/A

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(\frac{n1\_i \cdot normAngle}{\sin normAngle}\right), \color{blue}{\left(\frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)}\right)\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(\frac{normAngle \cdot n1\_i}{\sin normAngle}\right), \left(\frac{\color{blue}{n0\_i} \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)\right)\right)\right) \]
    8. associate-/l*N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(normAngle \cdot \frac{n1\_i}{\sin normAngle}\right), \left(\frac{\color{blue}{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}}{\sin normAngle}\right)\right)\right)\right) \]
    9. *-lowering-*.f32N/A

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \sin normAngle\right)\right), \left(\frac{n0\_i \cdot \color{blue}{\left(normAngle \cdot \cos normAngle\right)}}{\sin normAngle}\right)\right)\right)\right) \]
    11. sin-lowering-sin.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\frac{n0\_i \cdot \left(normAngle \cdot \color{blue}{\cos normAngle}\right)}{\sin normAngle}\right)\right)\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\frac{\left(normAngle \cdot \cos normAngle\right) \cdot n0\_i}{\sin \color{blue}{normAngle}}\right)\right)\right)\right) \]
    13. associate-/l*N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\left(normAngle \cdot \cos normAngle\right) \cdot \color{blue}{\frac{n0\_i}{\sin normAngle}}\right)\right)\right)\right) \]
    14. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\left(normAngle \cdot \cos normAngle\right), \color{blue}{\left(\frac{n0\_i}{\sin normAngle}\right)}\right)\right)\right)\right) \]
    15. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \cos normAngle\right), \left(\frac{\color{blue}{n0\_i}}{\sin normAngle}\right)\right)\right)\right)\right) \]
    16. cos-lowering-cos.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right), \left(\frac{n0\_i}{\sin normAngle}\right)\right)\right)\right)\right) \]
    17. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right), \mathsf{/.f32}\left(n0\_i, \color{blue}{\sin normAngle}\right)\right)\right)\right)\right) \]
  5. Simplified99.2%

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

    \[\leadsto \color{blue}{n0\_i + \left(u \cdot \left(n1\_i - n0\_i\right) + {normAngle}^{2} \cdot \left(u \cdot \left(\frac{-1}{6} \cdot n0\_i - \left(\frac{-1}{2} \cdot n0\_i + \frac{-1}{6} \cdot n1\_i\right)\right) + {normAngle}^{2} \cdot \left(u \cdot \left(\left(\frac{-1}{6} \cdot \left(\frac{-1}{2} \cdot n0\_i - \frac{-1}{6} \cdot n0\_i\right) + \frac{1}{120} \cdot n0\_i\right) - \left(\frac{-1}{36} \cdot n1\_i + \left(\frac{1}{120} \cdot n1\_i + \frac{1}{24} \cdot n0\_i\right)\right)\right)\right)\right)\right)} \]
  7. Simplified99.4%

    \[\leadsto \color{blue}{n0\_i + \left(\left(normAngle \cdot normAngle\right) \cdot \left(\left(n0\_i \cdot 0.3333333333333333 + n1\_i \cdot 0.16666666666666666\right) \cdot u + \left(\left(normAngle \cdot normAngle\right) \cdot u\right) \cdot \left(-0.16666666666666666 \cdot \left(n0\_i \cdot -0.3333333333333333\right) + \left(n0\_i \cdot 0.008333333333333333 - \left(n1\_i \cdot -0.019444444444444445 + n0\_i \cdot 0.041666666666666664\right)\right)\right)\right) + u \cdot \left(n1\_i - n0\_i\right)\right)} \]
  8. Add Preprocessing

Alternative 2: 98.9% accurate, 11.4× speedup?

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

\\
\begin{array}{l}
t_0 := u \cdot \left(n1\_i - n0\_i\right)\\
n0\_i + \left(t\_0 + \left(normAngle \cdot normAngle\right) \cdot \left(u \cdot \left(u \cdot \left(n0\_i \cdot -0.5\right) + n0\_i \cdot 0.5\right) + \left(n0\_i \cdot -0.16666666666666666 + 0.16666666666666666 \cdot \left(n0\_i + t\_0\right)\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 97.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. +-commutativeN/A

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

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

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

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

      \[\leadsto \left(n1\_i \cdot \sin \left(u \cdot normAngle\right)\right) \cdot \frac{1}{\sin normAngle} + \left(n0\_i \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right) \cdot \color{blue}{\frac{1}{\sin normAngle}} \]
    6. distribute-rgt-outN/A

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

      \[\leadsto \frac{1 \cdot \left(n1\_i \cdot \sin \left(u \cdot normAngle\right) + n0\_i \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right)}{\color{blue}{\sin normAngle}} \]
    8. *-lft-identityN/A

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

      \[\leadsto \mathsf{/.f32}\left(\left(n1\_i \cdot \sin \left(u \cdot normAngle\right) + n0\_i \cdot \sin \left(\left(1 - u\right) \cdot normAngle\right)\right), \color{blue}{\sin normAngle}\right) \]
  3. Simplified75.6%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \mathsf{\_.f32}\left(1, u\right)\right), \left(n1\_i \cdot u\right)\right), \left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot \left(n0\_i \cdot {\left(1 - u\right)}^{3}\right) + \frac{-1}{6} \cdot \left(n1\_i \cdot {u}^{3}\right)\right)\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right) \]
    7. *-commutativeN/A

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \mathsf{\_.f32}\left(1, u\right)\right), \mathsf{*.f32}\left(u, n1\_i\right)\right), \left({normAngle}^{2} \cdot \left(\frac{-1}{6} \cdot \left(n0\_i \cdot {\left(1 - u\right)}^{3}\right) + \frac{-1}{6} \cdot \left(n1\_i \cdot {u}^{3}\right)\right)\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \mathsf{\_.f32}\left(1, u\right)\right), \mathsf{*.f32}\left(u, n1\_i\right)\right), \left(\left(\frac{-1}{6} \cdot \left(n0\_i \cdot {\left(1 - u\right)}^{3}\right) + \frac{-1}{6} \cdot \left(n1\_i \cdot {u}^{3}\right)\right) \cdot {normAngle}^{2}\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right) \]
    10. distribute-lft-outN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \mathsf{\_.f32}\left(1, u\right)\right), \mathsf{*.f32}\left(u, n1\_i\right)\right), \left(\left(\frac{-1}{6} \cdot \left(n0\_i \cdot {\left(1 - u\right)}^{3} + n1\_i \cdot {u}^{3}\right)\right) \cdot {normAngle}^{2}\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right) \]
    11. associate-*l*N/A

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \mathsf{\_.f32}\left(1, u\right)\right), \mathsf{*.f32}\left(u, n1\_i\right)\right), \mathsf{*.f32}\left(\frac{-1}{6}, \mathsf{*.f32}\left(\left(n0\_i \cdot {\left(1 - u\right)}^{3} + n1\_i \cdot {u}^{3}\right), \left({normAngle}^{2}\right)\right)\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right) \]
  7. Simplified75.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\frac{-1}{6}, \mathsf{*.f32}\left(n0\_i, \mathsf{*.f32}\left(normAngle, normAngle\right)\right)\right)\right)\right), \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\left(normAngle \cdot \left(n1\_i + \left(-1 \cdot n0\_i + \frac{1}{2} \cdot \left(n0\_i \cdot {normAngle}^{2}\right)\right)\right)\right), \left(\frac{-1}{2} \cdot \left(n0\_i \cdot \left({normAngle}^{3} \cdot u\right)\right)\right)\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right) \]
  10. Simplified75.0%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{+.f32}\left(\mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(n1\_i, n0\_i\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \left(\color{blue}{\left(\frac{-1}{6} \cdot n0\_i + u \cdot \left(\frac{-1}{2} \cdot \left(n0\_i \cdot u\right) + \frac{1}{2} \cdot n0\_i\right)\right)} - \frac{-1}{6} \cdot \left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right)\right)\right)\right)\right) \]
    8. sub-negN/A

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{+.f32}\left(\mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(n1\_i, n0\_i\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \left(\left(u \cdot \left(\frac{-1}{2} \cdot \left(n0\_i \cdot u\right) + \frac{1}{2} \cdot n0\_i\right) + \frac{-1}{6} \cdot n0\_i\right) + \left(\mathsf{neg}\left(\color{blue}{\frac{-1}{6} \cdot \left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right)}\right)\right)\right)\right)\right)\right) \]
    10. associate-+l+N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{+.f32}\left(\mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(n1\_i, n0\_i\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \left(u \cdot \left(\frac{-1}{2} \cdot \left(n0\_i \cdot u\right) + \frac{1}{2} \cdot n0\_i\right) + \color{blue}{\left(\frac{-1}{6} \cdot n0\_i + \left(\mathsf{neg}\left(\frac{-1}{6} \cdot \left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right)\right)\right)\right)}\right)\right)\right)\right) \]
    11. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{+.f32}\left(\mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(n1\_i, n0\_i\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\left(u \cdot \left(\frac{-1}{2} \cdot \left(n0\_i \cdot u\right) + \frac{1}{2} \cdot n0\_i\right)\right), \color{blue}{\left(\frac{-1}{6} \cdot n0\_i + \left(\mathsf{neg}\left(\frac{-1}{6} \cdot \left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right)\right)\right)\right)}\right)\right)\right)\right) \]
  13. Simplified99.3%

    \[\leadsto \color{blue}{n0\_i + \left(u \cdot \left(n1\_i - n0\_i\right) + \left(normAngle \cdot normAngle\right) \cdot \left(u \cdot \left(u \cdot \left(n0\_i \cdot -0.5\right) + n0\_i \cdot 0.5\right) + \left(n0\_i \cdot -0.16666666666666666 + 0.16666666666666666 \cdot \left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right)\right)\right)\right)} \]
  14. Add Preprocessing

Alternative 3: 98.9% accurate, 22.2× speedup?

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

\\
n0\_i + u \cdot \left(n1\_i + \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot 0.3333333333333333 + n1\_i \cdot 0.16666666666666666\right) - n0\_i\right)\right)
\end{array}
Derivation
  1. Initial program 97.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. Add Preprocessing
  3. Taylor expanded in u around 0

    \[\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)} \]
  4. Step-by-step derivation
    1. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \color{blue}{\left(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)\right)}\right) \]
    2. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \left(\frac{n1\_i \cdot normAngle}{\sin normAngle} + \left(\mathsf{neg}\left(\frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)\right)\right)\right)\right) \]
    5. unsub-negN/A

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(\frac{n1\_i \cdot normAngle}{\sin normAngle}\right), \color{blue}{\left(\frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)}\right)\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(\frac{normAngle \cdot n1\_i}{\sin normAngle}\right), \left(\frac{\color{blue}{n0\_i} \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)\right)\right)\right) \]
    8. associate-/l*N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(normAngle \cdot \frac{n1\_i}{\sin normAngle}\right), \left(\frac{\color{blue}{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}}{\sin normAngle}\right)\right)\right)\right) \]
    9. *-lowering-*.f32N/A

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \sin normAngle\right)\right), \left(\frac{n0\_i \cdot \color{blue}{\left(normAngle \cdot \cos normAngle\right)}}{\sin normAngle}\right)\right)\right)\right) \]
    11. sin-lowering-sin.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\frac{n0\_i \cdot \left(normAngle \cdot \color{blue}{\cos normAngle}\right)}{\sin normAngle}\right)\right)\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\frac{\left(normAngle \cdot \cos normAngle\right) \cdot n0\_i}{\sin \color{blue}{normAngle}}\right)\right)\right)\right) \]
    13. associate-/l*N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\left(normAngle \cdot \cos normAngle\right) \cdot \color{blue}{\frac{n0\_i}{\sin normAngle}}\right)\right)\right)\right) \]
    14. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\left(normAngle \cdot \cos normAngle\right), \color{blue}{\left(\frac{n0\_i}{\sin normAngle}\right)}\right)\right)\right)\right) \]
    15. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \cos normAngle\right), \left(\frac{\color{blue}{n0\_i}}{\sin normAngle}\right)\right)\right)\right)\right) \]
    16. cos-lowering-cos.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right), \left(\frac{n0\_i}{\sin normAngle}\right)\right)\right)\right)\right) \]
    17. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right), \mathsf{/.f32}\left(n0\_i, \color{blue}{\sin normAngle}\right)\right)\right)\right)\right) \]
  5. Simplified99.2%

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left({normAngle}^{2}\right), \left(\frac{-1}{6} \cdot n0\_i - \left(\frac{-1}{2} \cdot n0\_i + \frac{-1}{6} \cdot n1\_i\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(normAngle \cdot normAngle\right), \left(\frac{-1}{6} \cdot n0\_i - \left(\frac{-1}{2} \cdot n0\_i + \frac{-1}{6} \cdot n1\_i\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    6. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \left(\frac{-1}{6} \cdot n0\_i - \left(\frac{-1}{2} \cdot n0\_i + \frac{-1}{6} \cdot n1\_i\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    7. associate--r+N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \left(\left(\frac{-1}{6} \cdot n0\_i - \frac{-1}{2} \cdot n0\_i\right) - \frac{-1}{6} \cdot n1\_i\right)\right), n0\_i\right)\right)\right)\right) \]
    8. sub-negN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \left(\left(\frac{-1}{6} \cdot n0\_i - \frac{-1}{2} \cdot n0\_i\right) + \left(\mathsf{neg}\left(\frac{-1}{6} \cdot n1\_i\right)\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    9. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\left(\frac{-1}{6} \cdot n0\_i - \frac{-1}{2} \cdot n0\_i\right), \left(\mathsf{neg}\left(\frac{-1}{6} \cdot n1\_i\right)\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    10. distribute-rgt-out--N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\left(n0\_i \cdot \left(\frac{-1}{6} - \frac{-1}{2}\right)\right), \left(\mathsf{neg}\left(\frac{-1}{6} \cdot n1\_i\right)\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \left(\frac{-1}{6} - \frac{-1}{2}\right)\right), \left(\mathsf{neg}\left(\frac{-1}{6} \cdot n1\_i\right)\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \frac{1}{3}\right), \left(\mathsf{neg}\left(\frac{-1}{6} \cdot n1\_i\right)\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    13. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \frac{1}{3}\right), \left(\mathsf{neg}\left(n1\_i \cdot \frac{-1}{6}\right)\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    14. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \frac{1}{3}\right), \left(n1\_i \cdot \left(\mathsf{neg}\left(\frac{-1}{6}\right)\right)\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \frac{1}{3}\right), \left(n1\_i \cdot \frac{1}{6}\right)\right)\right), n0\_i\right)\right)\right)\right) \]
    16. *-lowering-*.f3299.3%

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(n1\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \frac{1}{3}\right), \mathsf{*.f32}\left(n1\_i, \frac{1}{6}\right)\right)\right), n0\_i\right)\right)\right)\right) \]
  8. Simplified99.3%

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

Alternative 4: 69.7% accurate, 28.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n1\_i \leq -3.499999942646603 \cdot 10^{-11}:\\ \;\;\;\;n1\_i \cdot u\\ \mathbf{elif}\;n1\_i \leq 5.00000006675716 \cdot 10^{-11}:\\ \;\;\;\;n0\_i \cdot \left(1 - u\right)\\ \mathbf{else}:\\ \;\;\;\;n1\_i \cdot u\\ \end{array} \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (if (<= n1_i -3.499999942646603e-11)
   (* n1_i u)
   (if (<= n1_i 5.00000006675716e-11) (* n0_i (- 1.0 u)) (* n1_i u))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	float tmp;
	if (n1_i <= -3.499999942646603e-11f) {
		tmp = n1_i * u;
	} else if (n1_i <= 5.00000006675716e-11f) {
		tmp = n0_i * (1.0f - u);
	} else {
		tmp = n1_i * u;
	}
	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 (n1_i <= (-3.499999942646603e-11)) then
        tmp = n1_i * u
    else if (n1_i <= 5.00000006675716e-11) then
        tmp = n0_i * (1.0e0 - u)
    else
        tmp = n1_i * u
    end if
    code = tmp
end function
function code(normAngle, u, n0_i, n1_i)
	tmp = Float32(0.0)
	if (n1_i <= Float32(-3.499999942646603e-11))
		tmp = Float32(n1_i * u);
	elseif (n1_i <= Float32(5.00000006675716e-11))
		tmp = Float32(n0_i * Float32(Float32(1.0) - u));
	else
		tmp = Float32(n1_i * u);
	end
	return tmp
end
function tmp_2 = code(normAngle, u, n0_i, n1_i)
	tmp = single(0.0);
	if (n1_i <= single(-3.499999942646603e-11))
		tmp = n1_i * u;
	elseif (n1_i <= single(5.00000006675716e-11))
		tmp = n0_i * (single(1.0) - u);
	else
		tmp = n1_i * u;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n1\_i \leq -3.499999942646603 \cdot 10^{-11}:\\
\;\;\;\;n1\_i \cdot u\\

\mathbf{elif}\;n1\_i \leq 5.00000006675716 \cdot 10^{-11}:\\
\;\;\;\;n0\_i \cdot \left(1 - u\right)\\

\mathbf{else}:\\
\;\;\;\;n1\_i \cdot u\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n1_i < -3.49999994e-11 or 5.00000007e-11 < n1_i

    1. Initial program 97.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. Add Preprocessing
    3. Taylor expanded in u around 0

      \[\leadsto \mathsf{+.f32}\left(\color{blue}{n0\_i}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(u, normAngle\right)\right), \mathsf{/.f32}\left(1, \mathsf{sin.f32}\left(normAngle\right)\right)\right), n1\_i\right)\right) \]
    4. Step-by-step derivation
      1. Simplified91.4%

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

        \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\color{blue}{u}, n1\_i\right)\right) \]
      3. Step-by-step derivation
        1. Simplified92.6%

          \[\leadsto n0\_i + \color{blue}{u} \cdot n1\_i \]
        2. Taylor expanded in n0_i around 0

          \[\leadsto \color{blue}{n1\_i \cdot u} \]
        3. Step-by-step derivation
          1. *-lowering-*.f3275.8%

            \[\leadsto \mathsf{*.f32}\left(n1\_i, \color{blue}{u}\right) \]
        4. Simplified75.8%

          \[\leadsto \color{blue}{n1\_i \cdot u} \]

        if -3.49999994e-11 < n1_i < 5.00000007e-11

        1. Initial program 97.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. Add Preprocessing
        3. Taylor expanded in u around 0

          \[\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)} \]
        4. Step-by-step derivation
          1. +-lowering-+.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \color{blue}{\left(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)\right)}\right) \]
          2. *-lowering-*.f32N/A

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

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

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \left(\frac{n1\_i \cdot normAngle}{\sin normAngle} + \left(\mathsf{neg}\left(\frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)\right)\right)\right)\right) \]
          5. unsub-negN/A

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

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(\frac{n1\_i \cdot normAngle}{\sin normAngle}\right), \color{blue}{\left(\frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)}\right)\right)\right) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(\frac{normAngle \cdot n1\_i}{\sin normAngle}\right), \left(\frac{\color{blue}{n0\_i} \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)\right)\right)\right) \]
          8. associate-/l*N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(normAngle \cdot \frac{n1\_i}{\sin normAngle}\right), \left(\frac{\color{blue}{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}}{\sin normAngle}\right)\right)\right)\right) \]
          9. *-lowering-*.f32N/A

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

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \sin normAngle\right)\right), \left(\frac{n0\_i \cdot \color{blue}{\left(normAngle \cdot \cos normAngle\right)}}{\sin normAngle}\right)\right)\right)\right) \]
          11. sin-lowering-sin.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\frac{n0\_i \cdot \left(normAngle \cdot \color{blue}{\cos normAngle}\right)}{\sin normAngle}\right)\right)\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\frac{\left(normAngle \cdot \cos normAngle\right) \cdot n0\_i}{\sin \color{blue}{normAngle}}\right)\right)\right)\right) \]
          13. associate-/l*N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\left(normAngle \cdot \cos normAngle\right) \cdot \color{blue}{\frac{n0\_i}{\sin normAngle}}\right)\right)\right)\right) \]
          14. *-lowering-*.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\left(normAngle \cdot \cos normAngle\right), \color{blue}{\left(\frac{n0\_i}{\sin normAngle}\right)}\right)\right)\right)\right) \]
          15. *-lowering-*.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \cos normAngle\right), \left(\frac{\color{blue}{n0\_i}}{\sin normAngle}\right)\right)\right)\right)\right) \]
          16. cos-lowering-cos.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right), \left(\frac{n0\_i}{\sin normAngle}\right)\right)\right)\right)\right) \]
          17. /-lowering-/.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right), \mathsf{/.f32}\left(n0\_i, \color{blue}{\sin normAngle}\right)\right)\right)\right)\right) \]
        5. Simplified99.2%

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

          \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \color{blue}{n0\_i}\right)\right)\right) \]
        7. Step-by-step derivation
          1. Simplified99.0%

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

            \[\leadsto \color{blue}{n0\_i \cdot \left(1 + -1 \cdot u\right)} \]
          3. Step-by-step derivation
            1. *-lowering-*.f32N/A

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

              \[\leadsto \mathsf{*.f32}\left(n0\_i, \left(1 + \left(\mathsf{neg}\left(u\right)\right)\right)\right) \]
            3. unsub-negN/A

              \[\leadsto \mathsf{*.f32}\left(n0\_i, \left(1 - \color{blue}{u}\right)\right) \]
            4. --lowering--.f3273.9%

              \[\leadsto \mathsf{*.f32}\left(n0\_i, \mathsf{\_.f32}\left(1, \color{blue}{u}\right)\right) \]
          4. Simplified73.9%

            \[\leadsto \color{blue}{n0\_i \cdot \left(1 - u\right)} \]
        8. Recombined 2 regimes into one program.
        9. Add Preprocessing

        Alternative 5: 98.7% accurate, 28.1× speedup?

        \[\begin{array}{l} \\ n0\_i + u \cdot \left(n1\_i \cdot \left(1 + \left(normAngle \cdot normAngle\right) \cdot 0.16666666666666666\right) - n0\_i\right) \end{array} \]
        (FPCore (normAngle u n0_i n1_i)
         :precision binary32
         (+
          n0_i
          (*
           u
           (- (* n1_i (+ 1.0 (* (* normAngle normAngle) 0.16666666666666666))) n0_i))))
        float code(float normAngle, float u, float n0_i, float n1_i) {
        	return n0_i + (u * ((n1_i * (1.0f + ((normAngle * normAngle) * 0.16666666666666666f))) - 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 * (1.0e0 + ((normangle * normangle) * 0.16666666666666666e0))) - n0_i))
        end function
        
        function code(normAngle, u, n0_i, n1_i)
        	return Float32(n0_i + Float32(u * Float32(Float32(n1_i * Float32(Float32(1.0) + Float32(Float32(normAngle * normAngle) * Float32(0.16666666666666666)))) - n0_i)))
        end
        
        function tmp = code(normAngle, u, n0_i, n1_i)
        	tmp = n0_i + (u * ((n1_i * (single(1.0) + ((normAngle * normAngle) * single(0.16666666666666666)))) - n0_i));
        end
        
        \begin{array}{l}
        
        \\
        n0\_i + u \cdot \left(n1\_i \cdot \left(1 + \left(normAngle \cdot normAngle\right) \cdot 0.16666666666666666\right) - n0\_i\right)
        \end{array}
        
        Derivation
        1. Initial program 97.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. Add Preprocessing
        3. Taylor expanded in u around 0

          \[\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)} \]
        4. Step-by-step derivation
          1. +-lowering-+.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \color{blue}{\left(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)\right)}\right) \]
          2. *-lowering-*.f32N/A

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

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

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \left(\frac{n1\_i \cdot normAngle}{\sin normAngle} + \left(\mathsf{neg}\left(\frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)\right)\right)\right)\right) \]
          5. unsub-negN/A

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

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(\frac{n1\_i \cdot normAngle}{\sin normAngle}\right), \color{blue}{\left(\frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)}\right)\right)\right) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(\frac{normAngle \cdot n1\_i}{\sin normAngle}\right), \left(\frac{\color{blue}{n0\_i} \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)\right)\right)\right) \]
          8. associate-/l*N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(normAngle \cdot \frac{n1\_i}{\sin normAngle}\right), \left(\frac{\color{blue}{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}}{\sin normAngle}\right)\right)\right)\right) \]
          9. *-lowering-*.f32N/A

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

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \sin normAngle\right)\right), \left(\frac{n0\_i \cdot \color{blue}{\left(normAngle \cdot \cos normAngle\right)}}{\sin normAngle}\right)\right)\right)\right) \]
          11. sin-lowering-sin.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\frac{n0\_i \cdot \left(normAngle \cdot \color{blue}{\cos normAngle}\right)}{\sin normAngle}\right)\right)\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\frac{\left(normAngle \cdot \cos normAngle\right) \cdot n0\_i}{\sin \color{blue}{normAngle}}\right)\right)\right)\right) \]
          13. associate-/l*N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\left(normAngle \cdot \cos normAngle\right) \cdot \color{blue}{\frac{n0\_i}{\sin normAngle}}\right)\right)\right)\right) \]
          14. *-lowering-*.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\left(normAngle \cdot \cos normAngle\right), \color{blue}{\left(\frac{n0\_i}{\sin normAngle}\right)}\right)\right)\right)\right) \]
          15. *-lowering-*.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \cos normAngle\right), \left(\frac{\color{blue}{n0\_i}}{\sin normAngle}\right)\right)\right)\right)\right) \]
          16. cos-lowering-cos.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right), \left(\frac{n0\_i}{\sin normAngle}\right)\right)\right)\right)\right) \]
          17. /-lowering-/.f32N/A

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right), \mathsf{/.f32}\left(n0\_i, \color{blue}{\sin normAngle}\right)\right)\right)\right)\right) \]
        5. Simplified99.2%

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

          \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \color{blue}{n0\_i}\right)\right)\right) \]
        7. Step-by-step derivation
          1. Simplified99.1%

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

            \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \color{blue}{\left(\left(n1\_i + \frac{1}{6} \cdot \left(n1\_i \cdot {normAngle}^{2}\right)\right) - n0\_i\right)}\right)\right) \]
          3. Step-by-step derivation
            1. *-lft-identityN/A

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

              \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \left(\left(1 \cdot n1\_i + \frac{1}{6} \cdot \left({normAngle}^{2} \cdot n1\_i\right)\right) - n0\_i\right)\right)\right) \]
            3. associate-*r*N/A

              \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \left(\left(1 \cdot n1\_i + \left(\frac{1}{6} \cdot {normAngle}^{2}\right) \cdot n1\_i\right) - n0\_i\right)\right)\right) \]
            4. distribute-rgt-inN/A

              \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \left(n1\_i \cdot \left(1 + \frac{1}{6} \cdot {normAngle}^{2}\right) - n0\_i\right)\right)\right) \]
            5. --lowering--.f32N/A

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

              \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(n1\_i, \left(1 + \frac{1}{6} \cdot {normAngle}^{2}\right)\right), n0\_i\right)\right)\right) \]
            7. +-lowering-+.f32N/A

              \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(n1\_i, \mathsf{+.f32}\left(1, \left(\frac{1}{6} \cdot {normAngle}^{2}\right)\right)\right), n0\_i\right)\right)\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(n1\_i, \mathsf{+.f32}\left(1, \left({normAngle}^{2} \cdot \frac{1}{6}\right)\right)\right), n0\_i\right)\right)\right) \]
            9. *-lowering-*.f32N/A

              \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(n1\_i, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\left({normAngle}^{2}\right), \frac{1}{6}\right)\right)\right), n0\_i\right)\right)\right) \]
            10. unpow2N/A

              \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(n1\_i, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\left(normAngle \cdot normAngle\right), \frac{1}{6}\right)\right)\right), n0\_i\right)\right)\right) \]
            11. *-lowering-*.f3299.2%

              \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(n1\_i, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \frac{1}{6}\right)\right)\right), n0\_i\right)\right)\right) \]
          4. Simplified99.2%

            \[\leadsto n0\_i + u \cdot \color{blue}{\left(n1\_i \cdot \left(1 + \left(normAngle \cdot normAngle\right) \cdot 0.16666666666666666\right) - n0\_i\right)} \]
          5. Add Preprocessing

          Alternative 6: 59.4% accurate, 32.2× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n1\_i \leq -1.000000045813705 \cdot 10^{-18}:\\ \;\;\;\;n1\_i \cdot u\\ \mathbf{elif}\;n1\_i \leq 5.00000006675716 \cdot 10^{-11}:\\ \;\;\;\;n0\_i\\ \mathbf{else}:\\ \;\;\;\;n1\_i \cdot u\\ \end{array} \end{array} \]
          (FPCore (normAngle u n0_i n1_i)
           :precision binary32
           (if (<= n1_i -1.000000045813705e-18)
             (* n1_i u)
             (if (<= n1_i 5.00000006675716e-11) n0_i (* n1_i u))))
          float code(float normAngle, float u, float n0_i, float n1_i) {
          	float tmp;
          	if (n1_i <= -1.000000045813705e-18f) {
          		tmp = n1_i * u;
          	} else if (n1_i <= 5.00000006675716e-11f) {
          		tmp = n0_i;
          	} else {
          		tmp = n1_i * u;
          	}
          	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 (n1_i <= (-1.000000045813705e-18)) then
                  tmp = n1_i * u
              else if (n1_i <= 5.00000006675716e-11) then
                  tmp = n0_i
              else
                  tmp = n1_i * u
              end if
              code = tmp
          end function
          
          function code(normAngle, u, n0_i, n1_i)
          	tmp = Float32(0.0)
          	if (n1_i <= Float32(-1.000000045813705e-18))
          		tmp = Float32(n1_i * u);
          	elseif (n1_i <= Float32(5.00000006675716e-11))
          		tmp = n0_i;
          	else
          		tmp = Float32(n1_i * u);
          	end
          	return tmp
          end
          
          function tmp_2 = code(normAngle, u, n0_i, n1_i)
          	tmp = single(0.0);
          	if (n1_i <= single(-1.000000045813705e-18))
          		tmp = n1_i * u;
          	elseif (n1_i <= single(5.00000006675716e-11))
          		tmp = n0_i;
          	else
          		tmp = n1_i * u;
          	end
          	tmp_2 = tmp;
          end
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;n1\_i \leq -1.000000045813705 \cdot 10^{-18}:\\
          \;\;\;\;n1\_i \cdot u\\
          
          \mathbf{elif}\;n1\_i \leq 5.00000006675716 \cdot 10^{-11}:\\
          \;\;\;\;n0\_i\\
          
          \mathbf{else}:\\
          \;\;\;\;n1\_i \cdot u\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if n1_i < -1.00000005e-18 or 5.00000007e-11 < n1_i

            1. Initial program 97.3%

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

              \[\leadsto \mathsf{+.f32}\left(\color{blue}{n0\_i}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(u, normAngle\right)\right), \mathsf{/.f32}\left(1, \mathsf{sin.f32}\left(normAngle\right)\right)\right), n1\_i\right)\right) \]
            4. Step-by-step derivation
              1. Simplified88.4%

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

                \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\color{blue}{u}, n1\_i\right)\right) \]
              3. Step-by-step derivation
                1. Simplified89.6%

                  \[\leadsto n0\_i + \color{blue}{u} \cdot n1\_i \]
                2. Taylor expanded in n0_i around 0

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

                    \[\leadsto \mathsf{*.f32}\left(n1\_i, \color{blue}{u}\right) \]
                4. Simplified66.6%

                  \[\leadsto \color{blue}{n1\_i \cdot u} \]

                if -1.00000005e-18 < n1_i < 5.00000007e-11

                1. Initial program 97.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. Add Preprocessing
                3. Taylor expanded in u around 0

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

                    \[\leadsto \color{blue}{n0\_i} \]
                5. Recombined 2 regimes into one program.
                6. Add Preprocessing

                Alternative 7: 98.0% 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.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. Add Preprocessing
                3. Taylor expanded in u around 0

                  \[\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)} \]
                4. Step-by-step derivation
                  1. +-lowering-+.f32N/A

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \color{blue}{\left(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)\right)}\right) \]
                  2. *-lowering-*.f32N/A

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

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

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \left(\frac{n1\_i \cdot normAngle}{\sin normAngle} + \left(\mathsf{neg}\left(\frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)\right)\right)\right)\right) \]
                  5. unsub-negN/A

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

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(\frac{n1\_i \cdot normAngle}{\sin normAngle}\right), \color{blue}{\left(\frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)}\right)\right)\right) \]
                  7. *-commutativeN/A

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(\frac{normAngle \cdot n1\_i}{\sin normAngle}\right), \left(\frac{\color{blue}{n0\_i} \cdot \left(normAngle \cdot \cos normAngle\right)}{\sin normAngle}\right)\right)\right)\right) \]
                  8. associate-/l*N/A

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(normAngle \cdot \frac{n1\_i}{\sin normAngle}\right), \left(\frac{\color{blue}{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}}{\sin normAngle}\right)\right)\right)\right) \]
                  9. *-lowering-*.f32N/A

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

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \sin normAngle\right)\right), \left(\frac{n0\_i \cdot \color{blue}{\left(normAngle \cdot \cos normAngle\right)}}{\sin normAngle}\right)\right)\right)\right) \]
                  11. sin-lowering-sin.f32N/A

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\frac{n0\_i \cdot \left(normAngle \cdot \color{blue}{\cos normAngle}\right)}{\sin normAngle}\right)\right)\right)\right) \]
                  12. *-commutativeN/A

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\frac{\left(normAngle \cdot \cos normAngle\right) \cdot n0\_i}{\sin \color{blue}{normAngle}}\right)\right)\right)\right) \]
                  13. associate-/l*N/A

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \left(\left(normAngle \cdot \cos normAngle\right) \cdot \color{blue}{\frac{n0\_i}{\sin normAngle}}\right)\right)\right)\right) \]
                  14. *-lowering-*.f32N/A

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\left(normAngle \cdot \cos normAngle\right), \color{blue}{\left(\frac{n0\_i}{\sin normAngle}\right)}\right)\right)\right)\right) \]
                  15. *-lowering-*.f32N/A

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \cos normAngle\right), \left(\frac{\color{blue}{n0\_i}}{\sin normAngle}\right)\right)\right)\right)\right) \]
                  16. cos-lowering-cos.f32N/A

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right), \left(\frac{n0\_i}{\sin normAngle}\right)\right)\right)\right)\right) \]
                  17. /-lowering-/.f32N/A

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{/.f32}\left(n1\_i, \mathsf{sin.f32}\left(normAngle\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right), \mathsf{/.f32}\left(n0\_i, \color{blue}{\sin normAngle}\right)\right)\right)\right)\right) \]
                5. Simplified99.2%

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

                  \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \color{blue}{\left(n1\_i - n0\_i\right)}\right)\right) \]
                7. Step-by-step derivation
                  1. --lowering--.f3298.4%

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(n1\_i, \color{blue}{n0\_i}\right)\right)\right) \]
                8. Simplified98.4%

                  \[\leadsto n0\_i + u \cdot \color{blue}{\left(n1\_i - n0\_i\right)} \]
                9. Add Preprocessing

                Alternative 8: 81.5% accurate, 84.2× speedup?

                \[\begin{array}{l} \\ n0\_i + n1\_i \cdot u \end{array} \]
                (FPCore (normAngle u n0_i n1_i) :precision binary32 (+ n0_i (* n1_i u)))
                float code(float normAngle, float u, float n0_i, float n1_i) {
                	return n0_i + (n1_i * u);
                }
                
                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 + (n1_i * u)
                end function
                
                function code(normAngle, u, n0_i, n1_i)
                	return Float32(n0_i + Float32(n1_i * u))
                end
                
                function tmp = code(normAngle, u, n0_i, n1_i)
                	tmp = n0_i + (n1_i * u);
                end
                
                \begin{array}{l}
                
                \\
                n0\_i + n1\_i \cdot u
                \end{array}
                
                Derivation
                1. Initial program 97.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. Add Preprocessing
                3. Taylor expanded in u around 0

                  \[\leadsto \mathsf{+.f32}\left(\color{blue}{n0\_i}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(u, normAngle\right)\right), \mathsf{/.f32}\left(1, \mathsf{sin.f32}\left(normAngle\right)\right)\right), n1\_i\right)\right) \]
                4. Step-by-step derivation
                  1. Simplified81.5%

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

                    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\color{blue}{u}, n1\_i\right)\right) \]
                  3. Step-by-step derivation
                    1. Simplified82.6%

                      \[\leadsto n0\_i + \color{blue}{u} \cdot n1\_i \]
                    2. Final simplification82.6%

                      \[\leadsto n0\_i + n1\_i \cdot u \]
                    3. Add Preprocessing

                    Alternative 9: 46.2% 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.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. Add Preprocessing
                    3. Taylor expanded in u around 0

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

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

                      Reproduce

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