Curve intersection, scale width based on ribbon orientation

Percentage Accurate: 97.3% → 99.3%
Time: 15.4s
Alternatives: 16
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 16 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.3% 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.3% accurate, 1.3× speedup?

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

\\
n0\_i + u \cdot \left(normAngle \cdot \frac{n1\_i}{\sin normAngle} + n0\_i \cdot \left(u \cdot \left(-0.5 \cdot \left(normAngle \cdot normAngle\right)\right) - \frac{normAngle \cdot \cos normAngle}{\sin normAngle}\right)\right)
\end{array}
Derivation
  1. Initial program 98.1%

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

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

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

Alternative 2: 99.2% accurate, 3.1× speedup?

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

\\
n0\_i + u \cdot \left(n1\_i + \left(normAngle \cdot \left(normAngle \cdot \left(normAngle \cdot \left(normAngle \cdot \left(n1\_i \cdot 0.019444444444444445\right)\right) + n1\_i \cdot 0.16666666666666666\right)\right) + n0\_i \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(u \cdot -0.5\right) - \frac{normAngle}{\tan normAngle}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.1%

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\left(u \cdot \left(normAngle \cdot \frac{n1\_i}{\sin normAngle} + n0\_i \cdot \left(u \cdot \left(\frac{-1}{2} \cdot \left(normAngle \cdot normAngle\right)\right) - \frac{normAngle \cdot \cos normAngle}{\sin normAngle}\right)\right)\right), \color{blue}{n0\_i}\right) \]
  6. Applied egg-rr99.5%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\mathsf{+.f32}\left(n1\_i, \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\left(-1 \cdot \left({normAngle}^{2} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right), \left(\frac{1}{6} \cdot n1\_i\right)\right)\right)\right), \mathsf{*.f32}\left(n0\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(u, \mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{*.f32}\left(normAngle, normAngle\right)\right)\right), \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{tan.f32}\left(normAngle\right), normAngle\right)\right)\right)\right)\right)\right), n0\_i\right) \]
  9. Simplified99.6%

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\left(n1\_i + \left(normAngle \cdot normAngle\right) \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1\_i \cdot \frac{7}{360}\right) + n1\_i \cdot \frac{1}{6}\right)\right) + n0\_i \cdot \left(u \cdot \left(\frac{-1}{2} \cdot \left(normAngle \cdot normAngle\right)\right) - \frac{1}{\frac{\tan normAngle}{normAngle}}\right)\right), u\right), n0\_i\right) \]
  11. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\left(n1\_i + \left(normAngle \cdot \left(normAngle \cdot \left(normAngle \cdot \left(normAngle \cdot \left(n1\_i \cdot 0.019444444444444445\right)\right) + n1\_i \cdot 0.16666666666666666\right)\right) + n0\_i \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(u \cdot -0.5\right) - \frac{normAngle}{\tan normAngle}\right)\right)\right) \cdot u} + n0\_i \]
  12. Final simplification99.6%

    \[\leadsto n0\_i + u \cdot \left(n1\_i + \left(normAngle \cdot \left(normAngle \cdot \left(normAngle \cdot \left(normAngle \cdot \left(n1\_i \cdot 0.019444444444444445\right)\right) + n1\_i \cdot 0.16666666666666666\right)\right) + n0\_i \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(u \cdot -0.5\right) - \frac{normAngle}{\tan normAngle}\right)\right)\right) \]
  13. Add Preprocessing

Alternative 3: 99.2% accurate, 8.3× speedup?

\[\begin{array}{l} \\ n0\_i + u \cdot \left(n1\_i + \left(normAngle \cdot \left(normAngle \cdot \left(n0\_i \cdot \left(0.3333333333333333 + u \cdot -0.5\right) + \left(n1\_i \cdot 0.16666666666666666 + \left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot 0.022222222222222223 + \left(n1\_i \cdot 0.019444444444444445 + normAngle \cdot \left(normAngle \cdot \left(n0\_i \cdot 0.0021164021164021165 - \left(n1\_i \cdot -0.0032407407407407406 + n1\_i \cdot 0.0011904761904761906\right)\right)\right)\right)\right)\right)\right)\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 (* u -0.5)))
        (+
         (* n1_i 0.16666666666666666)
         (*
          (* normAngle normAngle)
          (+
           (* n0_i 0.022222222222222223)
           (+
            (* n1_i 0.019444444444444445)
            (*
             normAngle
             (*
              normAngle
              (-
               (* n0_i 0.0021164021164021165)
               (+
                (* n1_i -0.0032407407407407406)
                (* n1_i 0.0011904761904761906))))))))))))
     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 + (u * -0.5f))) + ((n1_i * 0.16666666666666666f) + ((normAngle * normAngle) * ((n0_i * 0.022222222222222223f) + ((n1_i * 0.019444444444444445f) + (normAngle * (normAngle * ((n0_i * 0.0021164021164021165f) - ((n1_i * -0.0032407407407407406f) + (n1_i * 0.0011904761904761906f)))))))))))) - 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 + (u * (-0.5e0)))) + ((n1_i * 0.16666666666666666e0) + ((normangle * normangle) * ((n0_i * 0.022222222222222223e0) + ((n1_i * 0.019444444444444445e0) + (normangle * (normangle * ((n0_i * 0.0021164021164021165e0) - ((n1_i * (-0.0032407407407407406e0)) + (n1_i * 0.0011904761904761906e0)))))))))))) - n0_i)))
end function
function code(normAngle, u, n0_i, n1_i)
	return Float32(n0_i + Float32(u * Float32(n1_i + Float32(Float32(normAngle * Float32(normAngle * Float32(Float32(n0_i * Float32(Float32(0.3333333333333333) + Float32(u * Float32(-0.5)))) + Float32(Float32(n1_i * Float32(0.16666666666666666)) + Float32(Float32(normAngle * normAngle) * Float32(Float32(n0_i * Float32(0.022222222222222223)) + Float32(Float32(n1_i * Float32(0.019444444444444445)) + Float32(normAngle * Float32(normAngle * Float32(Float32(n0_i * Float32(0.0021164021164021165)) - Float32(Float32(n1_i * Float32(-0.0032407407407407406)) + Float32(n1_i * Float32(0.0011904761904761906))))))))))))) - 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) + (u * single(-0.5)))) + ((n1_i * single(0.16666666666666666)) + ((normAngle * normAngle) * ((n0_i * single(0.022222222222222223)) + ((n1_i * single(0.019444444444444445)) + (normAngle * (normAngle * ((n0_i * single(0.0021164021164021165)) - ((n1_i * single(-0.0032407407407407406)) + (n1_i * single(0.0011904761904761906))))))))))))) - n0_i)));
end
\begin{array}{l}

\\
n0\_i + u \cdot \left(n1\_i + \left(normAngle \cdot \left(normAngle \cdot \left(n0\_i \cdot \left(0.3333333333333333 + u \cdot -0.5\right) + \left(n1\_i \cdot 0.16666666666666666 + \left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot 0.022222222222222223 + \left(n1\_i \cdot 0.019444444444444445 + normAngle \cdot \left(normAngle \cdot \left(n0\_i \cdot 0.0021164021164021165 - \left(n1\_i \cdot -0.0032407407407407406 + n1\_i \cdot 0.0011904761904761906\right)\right)\right)\right)\right)\right)\right)\right) - n0\_i\right)\right)
\end{array}
Derivation
  1. Initial program 98.1%

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

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

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

    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \color{blue}{\left(n1\_i + \left(-1 \cdot n0\_i + {normAngle}^{2} \cdot \left(\left(n0\_i \cdot \left(\frac{1}{3} + \frac{-1}{2} \cdot u\right) + {normAngle}^{2} \cdot \left(\left(\frac{1}{45} \cdot n0\_i + {normAngle}^{2} \cdot \left(\frac{2}{945} \cdot n0\_i - \left(\frac{-1}{5040} \cdot n1\_i + \left(\frac{1}{720} \cdot n1\_i + \frac{1}{6} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right)\right)\right) - \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right) - \frac{-1}{6} \cdot n1\_i\right)\right)\right)}\right)\right) \]
  6. Simplified99.5%

    \[\leadsto n0\_i + u \cdot \color{blue}{\left(n1\_i + \left(normAngle \cdot \left(normAngle \cdot \left(n0\_i \cdot \left(0.3333333333333333 + -0.5 \cdot u\right) + \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot 0.022222222222222223 + \left(normAngle \cdot \left(normAngle \cdot \left(n0\_i \cdot 0.0021164021164021165 - \left(n1\_i \cdot -0.0032407407407407406 + n1\_i \cdot 0.0011904761904761906\right)\right)\right) + n1\_i \cdot 0.019444444444444445\right)\right) + n1\_i \cdot 0.16666666666666666\right)\right)\right) - n0\_i\right)\right)} \]
  7. Final simplification99.5%

    \[\leadsto n0\_i + u \cdot \left(n1\_i + \left(normAngle \cdot \left(normAngle \cdot \left(n0\_i \cdot \left(0.3333333333333333 + u \cdot -0.5\right) + \left(n1\_i \cdot 0.16666666666666666 + \left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot 0.022222222222222223 + \left(n1\_i \cdot 0.019444444444444445 + normAngle \cdot \left(normAngle \cdot \left(n0\_i \cdot 0.0021164021164021165 - \left(n1\_i \cdot -0.0032407407407407406 + n1\_i \cdot 0.0011904761904761906\right)\right)\right)\right)\right)\right)\right)\right) - n0\_i\right)\right) \]
  8. Add Preprocessing

Alternative 4: 99.1% accurate, 12.0× speedup?

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

\\
n0\_i + u \cdot \left(\left(n1\_i - n0\_i\right) + \left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot \left(0.3333333333333333 + u \cdot -0.5\right) + \left(n1\_i \cdot 0.16666666666666666 + \left(normAngle \cdot normAngle\right) \cdot \left(n1\_i \cdot 0.019444444444444445 + n0\_i \cdot 0.022222222222222223\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.1%

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\left(n1\_i + \left(\mathsf{neg}\left(n0\_i\right)\right)\right), \left({normAngle}^{\color{blue}{2}} \cdot \left(\left(n0\_i \cdot \left(\frac{1}{3} + \frac{-1}{2} \cdot u\right) + {normAngle}^{2} \cdot \left(\frac{1}{45} \cdot n0\_i - \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right) - \frac{-1}{6} \cdot n1\_i\right)\right)\right)\right)\right) \]
    4. sub-negN/A

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(n1\_i, n0\_i\right), \left(\color{blue}{{normAngle}^{2}} \cdot \left(\left(n0\_i \cdot \left(\frac{1}{3} + \frac{-1}{2} \cdot u\right) + {normAngle}^{2} \cdot \left(\frac{1}{45} \cdot n0\_i - \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right) - \frac{-1}{6} \cdot n1\_i\right)\right)\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, n0\_i\right), \mathsf{*.f32}\left(\left({normAngle}^{2}\right), \color{blue}{\left(\left(n0\_i \cdot \left(\frac{1}{3} + \frac{-1}{2} \cdot u\right) + {normAngle}^{2} \cdot \left(\frac{1}{45} \cdot n0\_i - \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right) - \frac{-1}{6} \cdot n1\_i\right)}\right)\right)\right)\right) \]
    7. unpow2N/A

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

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

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

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

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

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

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

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

    \[\leadsto n0\_i + u \cdot \color{blue}{\left(\left(n1\_i - n0\_i\right) + \left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot \left(0.3333333333333333 + -0.5 \cdot u\right) + \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot 0.022222222222222223 + n1\_i \cdot 0.019444444444444445\right) + n1\_i \cdot 0.16666666666666666\right)\right)\right)} \]
  8. Final simplification99.4%

    \[\leadsto n0\_i + u \cdot \left(\left(n1\_i - n0\_i\right) + \left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot \left(0.3333333333333333 + u \cdot -0.5\right) + \left(n1\_i \cdot 0.16666666666666666 + \left(normAngle \cdot normAngle\right) \cdot \left(n1\_i \cdot 0.019444444444444445 + n0\_i \cdot 0.022222222222222223\right)\right)\right)\right) \]
  9. Add Preprocessing

Alternative 5: 99.1% accurate, 12.8× speedup?

\[\begin{array}{l} \\ n0\_i + u \cdot \left(\left(n1\_i - n0\_i\right) + \left(normAngle \cdot normAngle\right) \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1\_i \cdot \left(0.019444444444444445 + \left(normAngle \cdot normAngle\right) \cdot 0.00205026455026455\right)\right) + \left(n1\_i \cdot 0.16666666666666666 + n0\_i \cdot 0.3333333333333333\right)\right)\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (+
  n0_i
  (*
   u
   (+
    (- n1_i n0_i)
    (*
     (* normAngle normAngle)
     (+
      (*
       (* normAngle normAngle)
       (*
        n1_i
        (+
         0.019444444444444445
         (* (* normAngle normAngle) 0.00205026455026455))))
      (+ (* n1_i 0.16666666666666666) (* n0_i 0.3333333333333333))))))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return n0_i + (u * ((n1_i - n0_i) + ((normAngle * normAngle) * (((normAngle * normAngle) * (n1_i * (0.019444444444444445f + ((normAngle * normAngle) * 0.00205026455026455f)))) + ((n1_i * 0.16666666666666666f) + (n0_i * 0.3333333333333333f))))));
}
real(4) function code(normangle, u, n0_i, n1_i)
    real(4), intent (in) :: normangle
    real(4), intent (in) :: u
    real(4), intent (in) :: n0_i
    real(4), intent (in) :: n1_i
    code = n0_i + (u * ((n1_i - n0_i) + ((normangle * normangle) * (((normangle * normangle) * (n1_i * (0.019444444444444445e0 + ((normangle * normangle) * 0.00205026455026455e0)))) + ((n1_i * 0.16666666666666666e0) + (n0_i * 0.3333333333333333e0))))))
end function
function code(normAngle, u, n0_i, n1_i)
	return Float32(n0_i + Float32(u * Float32(Float32(n1_i - n0_i) + Float32(Float32(normAngle * normAngle) * Float32(Float32(Float32(normAngle * normAngle) * Float32(n1_i * Float32(Float32(0.019444444444444445) + Float32(Float32(normAngle * normAngle) * Float32(0.00205026455026455))))) + Float32(Float32(n1_i * Float32(0.16666666666666666)) + Float32(n0_i * Float32(0.3333333333333333))))))))
end
function tmp = code(normAngle, u, n0_i, n1_i)
	tmp = n0_i + (u * ((n1_i - n0_i) + ((normAngle * normAngle) * (((normAngle * normAngle) * (n1_i * (single(0.019444444444444445) + ((normAngle * normAngle) * single(0.00205026455026455))))) + ((n1_i * single(0.16666666666666666)) + (n0_i * single(0.3333333333333333)))))));
end
\begin{array}{l}

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

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

    \[\leadsto \color{blue}{n0\_i + 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. /-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(n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)\right), \color{blue}{\sin normAngle}\right)\right)\right)\right) \]
    13. *-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(n0\_i, \left(normAngle \cdot \cos normAngle\right)\right), \sin \color{blue}{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(\mathsf{*.f32}\left(n0\_i, \mathsf{*.f32}\left(normAngle, \cos normAngle\right)\right), \sin normAngle\right)\right)\right)\right) \]
    15. 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(n0\_i, \mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right)\right), \sin normAngle\right)\right)\right)\right) \]
    16. sin-lowering-sin.f3296.3%

      \[\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(n0\_i, \mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right)\right)\right)\right) \]
  5. Simplified96.3%

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(normAngle \cdot \frac{n1\_i}{\sin normAngle} - \frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\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(\left(\frac{-1}{6} \cdot n0\_i + {normAngle}^{2} \cdot \left(\left(\frac{-1}{6} \cdot \left(\frac{-1}{2} \cdot n0\_i - \frac{-1}{6} \cdot n0\_i\right) + \left(\frac{1}{120} \cdot n0\_i + {normAngle}^{2} \cdot \left(\left(\frac{-1}{6} \cdot \left(\frac{1}{24} \cdot n0\_i - \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)\right) + \left(\frac{-1}{5040} \cdot n0\_i + \frac{1}{120} \cdot \left(\frac{-1}{2} \cdot n0\_i - \frac{-1}{6} \cdot n0\_i\right)\right)\right) - \left(\frac{-1}{720} \cdot n0\_i + \left(\frac{-1}{5040} \cdot n1\_i + \left(\frac{1}{720} \cdot n1\_i + \frac{1}{6} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right)\right)\right)\right)\right) - \left(\frac{-1}{36} \cdot n1\_i + \left(\frac{1}{120} \cdot n1\_i + \frac{1}{24} \cdot n0\_i\right)\right)\right)\right) - \left(\frac{-1}{2} \cdot n0\_i + \frac{-1}{6} \cdot n1\_i\right)\right)\right) - n0\_i\right)}\right)\right) \]
  7. Simplified99.5%

    \[\leadsto n0\_i + u \cdot \color{blue}{\left(\left(normAngle \cdot normAngle\right) \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot 0.05555555555555555 + \left(normAngle \cdot \left(normAngle \cdot \left(-0.16666666666666666 \cdot \left(n0\_i \cdot 0.041666666666666664 - \left(n0\_i \cdot 0.05555555555555555 + n0\_i \cdot 0.008333333333333333\right)\right) + \left(n0\_i \cdot -0.0001984126984126984 + \left(n0\_i \cdot -0.002777777777777778 - \left(\left(n1\_i \cdot -0.0032407407407407406 + n1\_i \cdot 0.0011904761904761906\right) + n0\_i \cdot -0.001388888888888889\right)\right)\right)\right)\right) + \left(n0\_i \cdot 0.008333333333333333 - \left(n1\_i \cdot -0.019444444444444445 + n0\_i \cdot 0.041666666666666664\right)\right)\right)\right) + \left(n0\_i \cdot 0.3333333333333333 + n1\_i \cdot 0.16666666666666666\right)\right) + \left(n1\_i - n0\_i\right)\right)} \]
  8. Taylor expanded in n0_i around 0

    \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \color{blue}{\left(-1 \cdot \left({normAngle}^{2} \cdot \left(\frac{-7}{2160} \cdot n1\_i + \frac{1}{840} \cdot n1\_i\right)\right) - \frac{-7}{360} \cdot n1\_i\right)}\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \frac{1}{3}\right), \mathsf{*.f32}\left(n1\_i, \frac{1}{6}\right)\right)\right)\right), \mathsf{\_.f32}\left(n1\_i, n0\_i\right)\right)\right)\right) \]
  9. Step-by-step derivation
    1. cancel-sign-sub-invN/A

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

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \left({normAngle}^{2} \cdot \left(\mathsf{neg}\left(\left(\frac{-7}{2160} \cdot n1\_i + \frac{1}{840} \cdot n1\_i\right)\right)\right) + \left(\mathsf{neg}\left(\frac{-7}{360}\right)\right) \cdot n1\_i\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \frac{1}{3}\right), \mathsf{*.f32}\left(n1\_i, \frac{1}{6}\right)\right)\right)\right), \mathsf{\_.f32}\left(n1\_i, n0\_i\right)\right)\right)\right) \]
    4. distribute-rgt-outN/A

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

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \left({normAngle}^{2} \cdot \left(\mathsf{neg}\left(\frac{-31}{15120} \cdot n1\_i\right)\right) + \left(\mathsf{neg}\left(\frac{-7}{360}\right)\right) \cdot n1\_i\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(n0\_i, \frac{1}{3}\right), \mathsf{*.f32}\left(n1\_i, \frac{1}{6}\right)\right)\right)\right), \mathsf{\_.f32}\left(n1\_i, n0\_i\right)\right)\right)\right) \]
    7. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto n0\_i + u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \color{blue}{\left(n1\_i \cdot \left(0.019444444444444445 + \left(normAngle \cdot normAngle\right) \cdot 0.00205026455026455\right)\right)} + \left(n0\_i \cdot 0.3333333333333333 + n1\_i \cdot 0.16666666666666666\right)\right) + \left(n1\_i - n0\_i\right)\right) \]
  11. Final simplification99.4%

    \[\leadsto n0\_i + u \cdot \left(\left(n1\_i - n0\_i\right) + \left(normAngle \cdot normAngle\right) \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n1\_i \cdot \left(0.019444444444444445 + \left(normAngle \cdot normAngle\right) \cdot 0.00205026455026455\right)\right) + \left(n1\_i \cdot 0.16666666666666666 + n0\_i \cdot 0.3333333333333333\right)\right)\right) \]
  12. Add Preprocessing

Alternative 6: 98.8% accurate, 12.8× speedup?

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

\\
n0\_i + u \cdot \left(\left(n1\_i - n0\_i\right) + \left(normAngle \cdot normAngle\right) \cdot \left(\left(n1\_i \cdot 0.16666666666666666 + n0\_i \cdot 0.3333333333333333\right) + \left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot \left(0.022222222222222223 + \left(normAngle \cdot normAngle\right) \cdot 0.0021164021164021165\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.1%

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

    \[\leadsto \color{blue}{n0\_i + 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. /-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(n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)\right), \color{blue}{\sin normAngle}\right)\right)\right)\right) \]
    13. *-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(n0\_i, \left(normAngle \cdot \cos normAngle\right)\right), \sin \color{blue}{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(\mathsf{*.f32}\left(n0\_i, \mathsf{*.f32}\left(normAngle, \cos normAngle\right)\right), \sin normAngle\right)\right)\right)\right) \]
    15. 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(n0\_i, \mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right)\right), \sin normAngle\right)\right)\right)\right) \]
    16. sin-lowering-sin.f3296.3%

      \[\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(n0\_i, \mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right)\right)\right)\right) \]
  5. Simplified96.3%

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(normAngle \cdot \frac{n1\_i}{\sin normAngle} - \frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\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(\left(\frac{-1}{6} \cdot n0\_i + {normAngle}^{2} \cdot \left(\left(\frac{-1}{6} \cdot \left(\frac{-1}{2} \cdot n0\_i - \frac{-1}{6} \cdot n0\_i\right) + \left(\frac{1}{120} \cdot n0\_i + {normAngle}^{2} \cdot \left(\left(\frac{-1}{6} \cdot \left(\frac{1}{24} \cdot n0\_i - \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)\right) + \left(\frac{-1}{5040} \cdot n0\_i + \frac{1}{120} \cdot \left(\frac{-1}{2} \cdot n0\_i - \frac{-1}{6} \cdot n0\_i\right)\right)\right) - \left(\frac{-1}{720} \cdot n0\_i + \left(\frac{-1}{5040} \cdot n1\_i + \left(\frac{1}{720} \cdot n1\_i + \frac{1}{6} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right)\right)\right)\right)\right) - \left(\frac{-1}{36} \cdot n1\_i + \left(\frac{1}{120} \cdot n1\_i + \frac{1}{24} \cdot n0\_i\right)\right)\right)\right) - \left(\frac{-1}{2} \cdot n0\_i + \frac{-1}{6} \cdot n1\_i\right)\right)\right) - n0\_i\right)}\right)\right) \]
  7. Simplified99.5%

    \[\leadsto n0\_i + u \cdot \color{blue}{\left(\left(normAngle \cdot normAngle\right) \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot 0.05555555555555555 + \left(normAngle \cdot \left(normAngle \cdot \left(-0.16666666666666666 \cdot \left(n0\_i \cdot 0.041666666666666664 - \left(n0\_i \cdot 0.05555555555555555 + n0\_i \cdot 0.008333333333333333\right)\right) + \left(n0\_i \cdot -0.0001984126984126984 + \left(n0\_i \cdot -0.002777777777777778 - \left(\left(n1\_i \cdot -0.0032407407407407406 + n1\_i \cdot 0.0011904761904761906\right) + n0\_i \cdot -0.001388888888888889\right)\right)\right)\right)\right) + \left(n0\_i \cdot 0.008333333333333333 - \left(n1\_i \cdot -0.019444444444444445 + n0\_i \cdot 0.041666666666666664\right)\right)\right)\right) + \left(n0\_i \cdot 0.3333333333333333 + n1\_i \cdot 0.16666666666666666\right)\right) + \left(n1\_i - n0\_i\right)\right)} \]
  8. Taylor expanded in n0_i around inf

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

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

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

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

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

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

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

    \[\leadsto n0\_i + u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \left(\left(normAngle \cdot normAngle\right) \cdot \color{blue}{\left(n0\_i \cdot \left(0.022222222222222223 + \left(normAngle \cdot normAngle\right) \cdot 0.0021164021164021165\right)\right)} + \left(n0\_i \cdot 0.3333333333333333 + n1\_i \cdot 0.16666666666666666\right)\right) + \left(n1\_i - n0\_i\right)\right) \]
  11. Final simplification99.3%

    \[\leadsto n0\_i + u \cdot \left(\left(n1\_i - n0\_i\right) + \left(normAngle \cdot normAngle\right) \cdot \left(\left(n1\_i \cdot 0.16666666666666666 + n0\_i \cdot 0.3333333333333333\right) + \left(normAngle \cdot normAngle\right) \cdot \left(n0\_i \cdot \left(0.022222222222222223 + \left(normAngle \cdot normAngle\right) \cdot 0.0021164021164021165\right)\right)\right)\right) \]
  12. Add Preprocessing

Alternative 7: 98.8% accurate, 16.8× speedup?

\[\begin{array}{l} \\ \left(u \cdot \left(normAngle \cdot normAngle\right)\right) \cdot \left(n1\_i \cdot 0.16666666666666666 + n0\_i \cdot \left(0.3333333333333333 + u \cdot -0.5\right)\right) + \left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (+
  (*
   (* u (* normAngle normAngle))
   (+ (* n1_i 0.16666666666666666) (* n0_i (+ 0.3333333333333333 (* u -0.5)))))
  (+ n0_i (* u (- n1_i n0_i)))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return ((u * (normAngle * normAngle)) * ((n1_i * 0.16666666666666666f) + (n0_i * (0.3333333333333333f + (u * -0.5f))))) + (n0_i + (u * (n1_i - n0_i)));
}
real(4) function code(normangle, u, n0_i, n1_i)
    real(4), intent (in) :: normangle
    real(4), intent (in) :: u
    real(4), intent (in) :: n0_i
    real(4), intent (in) :: n1_i
    code = ((u * (normangle * normangle)) * ((n1_i * 0.16666666666666666e0) + (n0_i * (0.3333333333333333e0 + (u * (-0.5e0)))))) + (n0_i + (u * (n1_i - n0_i)))
end function
function code(normAngle, u, n0_i, n1_i)
	return Float32(Float32(Float32(u * Float32(normAngle * normAngle)) * Float32(Float32(n1_i * Float32(0.16666666666666666)) + Float32(n0_i * Float32(Float32(0.3333333333333333) + Float32(u * Float32(-0.5)))))) + Float32(n0_i + Float32(u * Float32(n1_i - n0_i))))
end
function tmp = code(normAngle, u, n0_i, n1_i)
	tmp = ((u * (normAngle * normAngle)) * ((n1_i * single(0.16666666666666666)) + (n0_i * (single(0.3333333333333333) + (u * single(-0.5)))))) + (n0_i + (u * (n1_i - n0_i)));
end
\begin{array}{l}

\\
\left(u \cdot \left(normAngle \cdot normAngle\right)\right) \cdot \left(n1\_i \cdot 0.16666666666666666 + n0\_i \cdot \left(0.3333333333333333 + u \cdot -0.5\right)\right) + \left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right)
\end{array}
Derivation
  1. Initial program 98.1%

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\left(u \cdot \left(normAngle \cdot \frac{n1\_i}{\sin normAngle} + n0\_i \cdot \left(u \cdot \left(\frac{-1}{2} \cdot \left(normAngle \cdot normAngle\right)\right) - \frac{normAngle \cdot \cos normAngle}{\sin normAngle}\right)\right)\right), \color{blue}{n0\_i}\right) \]
  6. Applied egg-rr99.5%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\mathsf{+.f32}\left(n1\_i, \mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), \mathsf{+.f32}\left(\left(-1 \cdot \left({normAngle}^{2} \cdot \left(\frac{-1}{36} \cdot n1\_i + \frac{1}{120} \cdot n1\_i\right)\right)\right), \left(\frac{1}{6} \cdot n1\_i\right)\right)\right)\right), \mathsf{*.f32}\left(n0\_i, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(u, \mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{*.f32}\left(normAngle, normAngle\right)\right)\right), \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{tan.f32}\left(normAngle\right), normAngle\right)\right)\right)\right)\right)\right), n0\_i\right) \]
  9. Simplified99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right) + \left(\left(normAngle \cdot normAngle\right) \cdot u\right) \cdot \left(n1\_i \cdot 0.16666666666666666 + n0\_i \cdot \left(0.3333333333333333 + -0.5 \cdot u\right)\right)} \]
  13. Final simplification99.3%

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

Alternative 8: 98.9% accurate, 18.3× speedup?

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

\\
n0\_i + u \cdot \left(\left(n1\_i - n0\_i\right) + normAngle \cdot \left(normAngle \cdot \left(n1\_i \cdot 0.16666666666666666 + n0\_i \cdot \left(0.3333333333333333 + u \cdot -0.5\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(n1\_i, n0\_i\right), \mathsf{*.f32}\left(normAngle, \color{blue}{\left(normAngle \cdot \left(n0\_i \cdot \left(\frac{1}{3} + \frac{-1}{2} \cdot u\right) - \frac{-1}{6} \cdot n1\_i\right)\right)}\right)\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, n0\_i\right), \mathsf{*.f32}\left(normAngle, \mathsf{*.f32}\left(normAngle, \color{blue}{\left(n0\_i \cdot \left(\frac{1}{3} + \frac{-1}{2} \cdot u\right) - \frac{-1}{6} \cdot n1\_i\right)}\right)\right)\right)\right)\right) \]
    10. sub-negN/A

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

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

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

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

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

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

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

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

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

    \[\leadsto n0\_i + u \cdot \color{blue}{\left(\left(n1\_i - n0\_i\right) + normAngle \cdot \left(normAngle \cdot \left(n0\_i \cdot \left(0.3333333333333333 + -0.5 \cdot u\right) + n1\_i \cdot 0.16666666666666666\right)\right)\right)} \]
  8. Final simplification99.3%

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

Alternative 9: 98.8% accurate, 22.2× speedup?

\[\begin{array}{l} \\ n0\_i + u \cdot \left(\left(n1\_i - n0\_i\right) + \left(normAngle \cdot normAngle\right) \cdot \left(n1\_i \cdot 0.16666666666666666 + n0\_i \cdot 0.3333333333333333\right)\right) \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (+
  n0_i
  (*
   u
   (+
    (- n1_i n0_i)
    (*
     (* normAngle normAngle)
     (+ (* n1_i 0.16666666666666666) (* n0_i 0.3333333333333333)))))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return n0_i + (u * ((n1_i - n0_i) + ((normAngle * normAngle) * ((n1_i * 0.16666666666666666f) + (n0_i * 0.3333333333333333f)))));
}
real(4) function code(normangle, u, n0_i, n1_i)
    real(4), intent (in) :: normangle
    real(4), intent (in) :: u
    real(4), intent (in) :: n0_i
    real(4), intent (in) :: n1_i
    code = n0_i + (u * ((n1_i - n0_i) + ((normangle * normangle) * ((n1_i * 0.16666666666666666e0) + (n0_i * 0.3333333333333333e0)))))
end function
function code(normAngle, u, n0_i, n1_i)
	return Float32(n0_i + Float32(u * Float32(Float32(n1_i - n0_i) + Float32(Float32(normAngle * normAngle) * Float32(Float32(n1_i * Float32(0.16666666666666666)) + Float32(n0_i * Float32(0.3333333333333333)))))))
end
function tmp = code(normAngle, u, n0_i, n1_i)
	tmp = n0_i + (u * ((n1_i - n0_i) + ((normAngle * normAngle) * ((n1_i * single(0.16666666666666666)) + (n0_i * single(0.3333333333333333))))));
end
\begin{array}{l}

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

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

    \[\leadsto \color{blue}{n0\_i + 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. /-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(n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)\right), \color{blue}{\sin normAngle}\right)\right)\right)\right) \]
    13. *-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(n0\_i, \left(normAngle \cdot \cos normAngle\right)\right), \sin \color{blue}{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(\mathsf{*.f32}\left(n0\_i, \mathsf{*.f32}\left(normAngle, \cos normAngle\right)\right), \sin normAngle\right)\right)\right)\right) \]
    15. 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(n0\_i, \mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right)\right), \sin normAngle\right)\right)\right)\right) \]
    16. sin-lowering-sin.f3296.3%

      \[\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(n0\_i, \mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right)\right)\right)\right) \]
  5. Simplified96.3%

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(normAngle \cdot \frac{n1\_i}{\sin normAngle} - \frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\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. sub-negN/A

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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) + n1\_i\right) + \left(\mathsf{neg}\left(\color{blue}{n0\_i}\right)\right)\right)\right)\right) \]
    3. mul-1-negN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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) + n1\_i\right) + -1 \cdot \color{blue}{n0\_i}\right)\right)\right) \]
    4. associate-+l+N/A

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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}{\left(n1\_i + -1 \cdot n0\_i\right)}\right)\right)\right) \]
    6. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(\color{blue}{n1\_i} + -1 \cdot n0\_i\right)\right)\right)\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    9. associate--r+N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    10. sub-negN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    11. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    12. distribute-rgt-out--N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    13. metadata-evalN/A

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

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    16. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    17. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    18. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + -1 \cdot n0\_i\right)\right)\right)\right) \]
    19. mul-1-negN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i + \left(\mathsf{neg}\left(n0\_i\right)\right)\right)\right)\right)\right) \]
    20. sub-negN/A

      \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(u, \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), \left(n1\_i - \color{blue}{n0\_i}\right)\right)\right)\right) \]
  8. Simplified99.3%

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

    \[\leadsto n0\_i + u \cdot \left(\left(n1\_i - n0\_i\right) + \left(normAngle \cdot normAngle\right) \cdot \left(n1\_i \cdot 0.16666666666666666 + n0\_i \cdot 0.3333333333333333\right)\right) \]
  10. Add Preprocessing

Alternative 10: 98.6% accurate, 24.8× speedup?

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

\\
\left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right) + \left(n1\_i \cdot 0.16666666666666666\right) \cdot \left(u \cdot \left(normAngle \cdot normAngle\right)\right)
\end{array}
Derivation
  1. Initial program 98.1%

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

    \[\leadsto \color{blue}{n0\_i + 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. /-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(n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)\right), \color{blue}{\sin normAngle}\right)\right)\right)\right) \]
    13. *-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(n0\_i, \left(normAngle \cdot \cos normAngle\right)\right), \sin \color{blue}{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(\mathsf{*.f32}\left(n0\_i, \mathsf{*.f32}\left(normAngle, \cos normAngle\right)\right), \sin normAngle\right)\right)\right)\right) \]
    15. 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(n0\_i, \mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right)\right), \sin normAngle\right)\right)\right)\right) \]
    16. sin-lowering-sin.f3296.3%

      \[\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(n0\_i, \mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right)\right)\right)\right) \]
  5. Simplified96.3%

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(normAngle \cdot \frac{n1\_i}{\sin normAngle} - \frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\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)\right)\right)} \]
  7. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto n0\_i + \left(u \cdot \left(n1\_i + \left(\mathsf{neg}\left(n0\_i\right)\right)\right) + {normAngle}^{\color{blue}{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)\right)\right) \]
    2. mul-1-negN/A

      \[\leadsto n0\_i + \left(u \cdot \left(n1\_i + -1 \cdot 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)\right)\right) \]
    3. associate-+r+N/A

      \[\leadsto \left(n0\_i + u \cdot \left(n1\_i + -1 \cdot n0\_i\right)\right) + \color{blue}{{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)\right)} \]
    4. +-lowering-+.f32N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(n0\_i, \left(u \cdot \left(n1\_i + -1 \cdot n0\_i\right)\right)\right), \left(\color{blue}{{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)\right)\right)\right) \]
    6. *-commutativeN/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\left(n1\_i + -1 \cdot n0\_i\right), u\right)\right), \left({normAngle}^{\color{blue}{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)\right)\right)\right) \]
    8. mul-1-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\left(n1\_i + \left(\mathsf{neg}\left(n0\_i\right)\right)\right), u\right)\right), \left({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)\right)\right)\right) \]
    9. sub-negN/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(n1\_i, n0\_i\right), u\right)\right), \left({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)\right)\right)\right) \]
    11. associate-*r*N/A

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(n0\_i + \left(n1\_i - n0\_i\right) \cdot u\right) + \left(\left(normAngle \cdot normAngle\right) \cdot u\right) \cdot \left(n0\_i \cdot 0.3333333333333333 + n1\_i \cdot 0.16666666666666666\right)} \]
  9. Taylor expanded in n0_i around 0

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

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

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

    \[\leadsto \left(n0\_i + \left(n1\_i - n0\_i\right) \cdot u\right) + \left(\left(normAngle \cdot normAngle\right) \cdot u\right) \cdot \color{blue}{\left(n1\_i \cdot 0.16666666666666666\right)} \]
  12. Final simplification99.2%

    \[\leadsto \left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right) + \left(n1\_i \cdot 0.16666666666666666\right) \cdot \left(u \cdot \left(normAngle \cdot normAngle\right)\right) \]
  13. Add Preprocessing

Alternative 11: 98.0% accurate, 24.8× speedup?

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

\\
\left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right) + \left(u \cdot \left(normAngle \cdot normAngle\right)\right) \cdot \left(n0\_i \cdot 0.3333333333333333\right)
\end{array}
Derivation
  1. Initial program 98.1%

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

    \[\leadsto \color{blue}{n0\_i + 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. /-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(n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)\right), \color{blue}{\sin normAngle}\right)\right)\right)\right) \]
    13. *-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(n0\_i, \left(normAngle \cdot \cos normAngle\right)\right), \sin \color{blue}{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(\mathsf{*.f32}\left(n0\_i, \mathsf{*.f32}\left(normAngle, \cos normAngle\right)\right), \sin normAngle\right)\right)\right)\right) \]
    15. 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(n0\_i, \mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right)\right), \sin normAngle\right)\right)\right)\right) \]
    16. sin-lowering-sin.f3296.3%

      \[\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(n0\_i, \mathsf{*.f32}\left(normAngle, \mathsf{cos.f32}\left(normAngle\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right)\right)\right)\right) \]
  5. Simplified96.3%

    \[\leadsto \color{blue}{n0\_i + u \cdot \left(normAngle \cdot \frac{n1\_i}{\sin normAngle} - \frac{n0\_i \cdot \left(normAngle \cdot \cos normAngle\right)}{\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)\right)\right)} \]
  7. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto n0\_i + \left(u \cdot \left(n1\_i + \left(\mathsf{neg}\left(n0\_i\right)\right)\right) + {normAngle}^{\color{blue}{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)\right)\right) \]
    2. mul-1-negN/A

      \[\leadsto n0\_i + \left(u \cdot \left(n1\_i + -1 \cdot 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)\right)\right) \]
    3. associate-+r+N/A

      \[\leadsto \left(n0\_i + u \cdot \left(n1\_i + -1 \cdot n0\_i\right)\right) + \color{blue}{{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)\right)} \]
    4. +-lowering-+.f32N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(n0\_i, \left(u \cdot \left(n1\_i + -1 \cdot n0\_i\right)\right)\right), \left(\color{blue}{{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)\right)\right)\right) \]
    6. *-commutativeN/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\left(n1\_i + -1 \cdot n0\_i\right), u\right)\right), \left({normAngle}^{\color{blue}{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)\right)\right)\right) \]
    8. mul-1-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\left(n1\_i + \left(\mathsf{neg}\left(n0\_i\right)\right)\right), u\right)\right), \left({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)\right)\right)\right) \]
    9. sub-negN/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(n1\_i, n0\_i\right), u\right)\right), \left({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)\right)\right)\right) \]
    11. associate-*r*N/A

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

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

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

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

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

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

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

    \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(n1\_i, n0\_i\right), u\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), u\right), \color{blue}{\left(\frac{1}{3} \cdot n0\_i\right)}\right)\right) \]
  10. Step-by-step derivation
    1. *-lowering-*.f3298.9%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(n1\_i, n0\_i\right), u\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(normAngle, normAngle\right), u\right), \mathsf{*.f32}\left(\frac{1}{3}, \color{blue}{n0\_i}\right)\right)\right) \]
  11. Simplified98.9%

    \[\leadsto \left(n0\_i + \left(n1\_i - n0\_i\right) \cdot u\right) + \left(\left(normAngle \cdot normAngle\right) \cdot u\right) \cdot \color{blue}{\left(0.3333333333333333 \cdot n0\_i\right)} \]
  12. Final simplification98.9%

    \[\leadsto \left(n0\_i + u \cdot \left(n1\_i - n0\_i\right)\right) + \left(u \cdot \left(normAngle \cdot normAngle\right)\right) \cdot \left(n0\_i \cdot 0.3333333333333333\right) \]
  13. Add Preprocessing

Alternative 12: 71.0% accurate, 28.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n1\_i \leq -3.7999998655537104 \cdot 10^{-13}:\\ \;\;\;\;u \cdot n1\_i\\ \mathbf{elif}\;n1\_i \leq 4.99999991225835 \cdot 10^{-15}:\\ \;\;\;\;n0\_i \cdot \left(1 - u\right)\\ \mathbf{else}:\\ \;\;\;\;u \cdot n1\_i\\ \end{array} \end{array} \]
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (if (<= n1_i -3.7999998655537104e-13)
   (* u n1_i)
   (if (<= n1_i 4.99999991225835e-15) (* n0_i (- 1.0 u)) (* u n1_i))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	float tmp;
	if (n1_i <= -3.7999998655537104e-13f) {
		tmp = u * n1_i;
	} else if (n1_i <= 4.99999991225835e-15f) {
		tmp = n0_i * (1.0f - u);
	} else {
		tmp = u * n1_i;
	}
	return tmp;
}
real(4) function code(normangle, u, n0_i, n1_i)
    real(4), intent (in) :: normangle
    real(4), intent (in) :: u
    real(4), intent (in) :: n0_i
    real(4), intent (in) :: n1_i
    real(4) :: tmp
    if (n1_i <= (-3.7999998655537104e-13)) then
        tmp = u * n1_i
    else if (n1_i <= 4.99999991225835e-15) then
        tmp = n0_i * (1.0e0 - u)
    else
        tmp = u * n1_i
    end if
    code = tmp
end function
function code(normAngle, u, n0_i, n1_i)
	tmp = Float32(0.0)
	if (n1_i <= Float32(-3.7999998655537104e-13))
		tmp = Float32(u * n1_i);
	elseif (n1_i <= Float32(4.99999991225835e-15))
		tmp = Float32(n0_i * Float32(Float32(1.0) - u));
	else
		tmp = Float32(u * n1_i);
	end
	return tmp
end
function tmp_2 = code(normAngle, u, n0_i, n1_i)
	tmp = single(0.0);
	if (n1_i <= single(-3.7999998655537104e-13))
		tmp = u * n1_i;
	elseif (n1_i <= single(4.99999991225835e-15))
		tmp = n0_i * (single(1.0) - u);
	else
		tmp = u * n1_i;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n1_i < -3.79999987e-13 or 4.99999991e-15 < n1_i

    1. Initial program 97.7%

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

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

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

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

          \[\leadsto u \cdot \color{blue}{n1\_i} \]
        2. *-lowering-*.f3266.7%

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

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

      if -3.79999987e-13 < n1_i < 4.99999991e-15

      1. Initial program 98.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 n0_i around inf

        \[\leadsto \color{blue}{\frac{n0\_i \cdot \sin \left(normAngle \cdot \left(1 - u\right)\right)}{\sin normAngle}} \]
      4. Step-by-step derivation
        1. associate-/l*N/A

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

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

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

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

          \[\leadsto \mathsf{*.f32}\left(n0\_i, \mathsf{/.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(normAngle, \left(1 - u\right)\right)\right), \sin normAngle\right)\right) \]
        6. --lowering--.f32N/A

          \[\leadsto \mathsf{*.f32}\left(n0\_i, \mathsf{/.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{\_.f32}\left(1, u\right)\right)\right), \sin normAngle\right)\right) \]
        7. sin-lowering-sin.f3277.9%

          \[\leadsto \mathsf{*.f32}\left(n0\_i, \mathsf{/.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{\_.f32}\left(1, u\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right)\right) \]
      5. Simplified77.9%

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

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

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

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

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

    Alternative 13: 60.6% accurate, 32.2× speedup?

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

      1. Initial program 97.9%

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

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

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

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

            \[\leadsto u \cdot \color{blue}{n1\_i} \]
          2. *-lowering-*.f3263.6%

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

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

        if -3.79999987e-13 < n1_i < 9.99999984e-18

        1. Initial program 98.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 \color{blue}{n0\_i} \]
        4. Step-by-step derivation
          1. Simplified63.4%

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

        Alternative 14: 84.0% accurate, 42.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n0\_i \leq -1.1999999518369497 \cdot 10^{-12}:\\ \;\;\;\;n0\_i \cdot \left(1 - u\right)\\ \mathbf{else}:\\ \;\;\;\;n0\_i + u \cdot n1\_i\\ \end{array} \end{array} \]
        (FPCore (normAngle u n0_i n1_i)
         :precision binary32
         (if (<= n0_i -1.1999999518369497e-12) (* n0_i (- 1.0 u)) (+ n0_i (* u n1_i))))
        float code(float normAngle, float u, float n0_i, float n1_i) {
        	float tmp;
        	if (n0_i <= -1.1999999518369497e-12f) {
        		tmp = n0_i * (1.0f - u);
        	} else {
        		tmp = n0_i + (u * n1_i);
        	}
        	return tmp;
        }
        
        real(4) function code(normangle, u, n0_i, n1_i)
            real(4), intent (in) :: normangle
            real(4), intent (in) :: u
            real(4), intent (in) :: n0_i
            real(4), intent (in) :: n1_i
            real(4) :: tmp
            if (n0_i <= (-1.1999999518369497e-12)) then
                tmp = n0_i * (1.0e0 - u)
            else
                tmp = n0_i + (u * n1_i)
            end if
            code = tmp
        end function
        
        function code(normAngle, u, n0_i, n1_i)
        	tmp = Float32(0.0)
        	if (n0_i <= Float32(-1.1999999518369497e-12))
        		tmp = Float32(n0_i * Float32(Float32(1.0) - u));
        	else
        		tmp = Float32(n0_i + Float32(u * n1_i));
        	end
        	return tmp
        end
        
        function tmp_2 = code(normAngle, u, n0_i, n1_i)
        	tmp = single(0.0);
        	if (n0_i <= single(-1.1999999518369497e-12))
        		tmp = n0_i * (single(1.0) - u);
        	else
        		tmp = n0_i + (u * n1_i);
        	end
        	tmp_2 = tmp;
        end
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;n0\_i \leq -1.1999999518369497 \cdot 10^{-12}:\\
        \;\;\;\;n0\_i \cdot \left(1 - u\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;n0\_i + u \cdot n1\_i\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if n0_i < -1.19999995e-12

          1. Initial program 98.7%

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

            \[\leadsto \color{blue}{\frac{n0\_i \cdot \sin \left(normAngle \cdot \left(1 - u\right)\right)}{\sin normAngle}} \]
          4. Step-by-step derivation
            1. associate-/l*N/A

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

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

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

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

              \[\leadsto \mathsf{*.f32}\left(n0\_i, \mathsf{/.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(normAngle, \left(1 - u\right)\right)\right), \sin normAngle\right)\right) \]
            6. --lowering--.f32N/A

              \[\leadsto \mathsf{*.f32}\left(n0\_i, \mathsf{/.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{\_.f32}\left(1, u\right)\right)\right), \sin normAngle\right)\right) \]
            7. sin-lowering-sin.f3294.4%

              \[\leadsto \mathsf{*.f32}\left(n0\_i, \mathsf{/.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(normAngle, \mathsf{\_.f32}\left(1, u\right)\right)\right), \mathsf{sin.f32}\left(normAngle\right)\right)\right) \]
          5. Simplified94.4%

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

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

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

              \[\leadsto \mathsf{*.f32}\left(n0\_i, \mathsf{\_.f32}\left(1, \color{blue}{u}\right)\right) \]
          8. Simplified94.0%

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

          if -1.19999995e-12 < n0_i

          1. Initial program 98.0%

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

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

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

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

                \[\leadsto \color{blue}{n0\_i} + u \cdot n1\_i \]
            4. Recombined 2 regimes into one program.
            5. Add Preprocessing

            Alternative 15: 97.9% 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 98.1%

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\left(n1\_i - n0\_i\right), u\right)\right) \]
              6. --lowering--.f3298.9%

                \[\leadsto \mathsf{+.f32}\left(n0\_i, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(n1\_i, n0\_i\right), u\right)\right) \]
            7. Simplified98.9%

              \[\leadsto \color{blue}{n0\_i + \left(n1\_i - n0\_i\right) \cdot u} \]
            8. Final simplification98.9%

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

            Alternative 16: 47.1% 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 98.1%

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

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

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

              Reproduce

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