Average Error: 0.9 → 0.2
Time: 15.1s
Precision: binary32
\[\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)\]
\[\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 \]
\[\begin{array}{l} t_0 := 0.0001984126984126984 \cdot \left({u}^{7} \cdot {normAngle}^{6}\right)\\ t_1 := {normAngle}^{4} \cdot {u}^{5}\\ t_2 := {u}^{3} \cdot {normAngle}^{4}\\ \left(\left(\left(\left(\left(normAngle \cdot normAngle\right) \cdot \left(0.16666666666666666 \cdot {u}^{3} + u \cdot 0.3333333333333333\right) + {normAngle}^{4} \cdot \left(u \cdot 0.022222222222222223 + 0.041666666666666664 \cdot {u}^{4}\right)\right) + t_0\right) + {normAngle}^{6} \cdot \left(u \cdot 0.0021164021164021165 + {u}^{5} \cdot 0.002777777777777778\right)\right) + \left(1 - \left(\mathsf{fma}\left(t_2, 0.05555555555555555, \mathsf{fma}\left(0.5, u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot u\right), {normAngle}^{6} \cdot \left(0.001388888888888889 \cdot {u}^{6} + {u}^{3} \cdot 0.003703703703703704\right)\right)\right) + \mathsf{fma}\left(0.008333333333333333, t_1, u\right)\right)\right)\right) \cdot n0_i + \left(\left(0.008333333333333333 \cdot t_1 + \left(0.00205026455026455 \cdot \left(u \cdot {normAngle}^{6}\right) + \left(0.001388888888888889 \cdot \left({normAngle}^{6} \cdot {u}^{5}\right) + \left(u + \left(0.019444444444444445 \cdot \left(u \cdot {normAngle}^{4}\right) + 0.16666666666666666 \cdot \left(u \cdot {normAngle}^{2}\right)\right)\right)\right)\right)\right) - \left(0.16666666666666666 \cdot \left({u}^{3} \cdot {normAngle}^{2}\right) + \left(t_0 + \left(t_2 \cdot 0.027777777777777776 + 0.0032407407407407406 \cdot \left({u}^{3} \cdot {normAngle}^{6}\right)\right)\right)\right)\right) \cdot n1_i \end{array} \]
\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
\begin{array}{l}
t_0 := 0.0001984126984126984 \cdot \left({u}^{7} \cdot {normAngle}^{6}\right)\\
t_1 := {normAngle}^{4} \cdot {u}^{5}\\
t_2 := {u}^{3} \cdot {normAngle}^{4}\\
\left(\left(\left(\left(\left(normAngle \cdot normAngle\right) \cdot \left(0.16666666666666666 \cdot {u}^{3} + u \cdot 0.3333333333333333\right) + {normAngle}^{4} \cdot \left(u \cdot 0.022222222222222223 + 0.041666666666666664 \cdot {u}^{4}\right)\right) + t_0\right) + {normAngle}^{6} \cdot \left(u \cdot 0.0021164021164021165 + {u}^{5} \cdot 0.002777777777777778\right)\right) + \left(1 - \left(\mathsf{fma}\left(t_2, 0.05555555555555555, \mathsf{fma}\left(0.5, u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot u\right), {normAngle}^{6} \cdot \left(0.001388888888888889 \cdot {u}^{6} + {u}^{3} \cdot 0.003703703703703704\right)\right)\right) + \mathsf{fma}\left(0.008333333333333333, t_1, u\right)\right)\right)\right) \cdot n0_i + \left(\left(0.008333333333333333 \cdot t_1 + \left(0.00205026455026455 \cdot \left(u \cdot {normAngle}^{6}\right) + \left(0.001388888888888889 \cdot \left({normAngle}^{6} \cdot {u}^{5}\right) + \left(u + \left(0.019444444444444445 \cdot \left(u \cdot {normAngle}^{4}\right) + 0.16666666666666666 \cdot \left(u \cdot {normAngle}^{2}\right)\right)\right)\right)\right)\right) - \left(0.16666666666666666 \cdot \left({u}^{3} \cdot {normAngle}^{2}\right) + \left(t_0 + \left(t_2 \cdot 0.027777777777777776 + 0.0032407407407407406 \cdot \left({u}^{3} \cdot {normAngle}^{6}\right)\right)\right)\right)\right) \cdot n1_i
\end{array}
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (+
  (* (* (sin (* (- 1.0 u) normAngle)) (/ 1.0 (sin normAngle))) n0_i)
  (* (* (sin (* u normAngle)) (/ 1.0 (sin normAngle))) n1_i)))
(FPCore (normAngle u n0_i n1_i)
 :precision binary32
 (let* ((t_0 (* 0.0001984126984126984 (* (pow u 7.0) (pow normAngle 6.0))))
        (t_1 (* (pow normAngle 4.0) (pow u 5.0)))
        (t_2 (* (pow u 3.0) (pow normAngle 4.0))))
   (+
    (*
     (+
      (+
       (+
        (+
         (*
          (* normAngle normAngle)
          (+ (* 0.16666666666666666 (pow u 3.0)) (* u 0.3333333333333333)))
         (*
          (pow normAngle 4.0)
          (+ (* u 0.022222222222222223) (* 0.041666666666666664 (pow u 4.0)))))
        t_0)
       (*
        (pow normAngle 6.0)
        (+ (* u 0.0021164021164021165) (* (pow u 5.0) 0.002777777777777778))))
      (-
       1.0
       (+
        (fma
         t_2
         0.05555555555555555
         (fma
          0.5
          (* u (* (* normAngle normAngle) u))
          (*
           (pow normAngle 6.0)
           (+
            (* 0.001388888888888889 (pow u 6.0))
            (* (pow u 3.0) 0.003703703703703704)))))
        (fma 0.008333333333333333 t_1 u))))
     n0_i)
    (*
     (-
      (+
       (* 0.008333333333333333 t_1)
       (+
        (* 0.00205026455026455 (* u (pow normAngle 6.0)))
        (+
         (* 0.001388888888888889 (* (pow normAngle 6.0) (pow u 5.0)))
         (+
          u
          (+
           (* 0.019444444444444445 (* u (pow normAngle 4.0)))
           (* 0.16666666666666666 (* u (pow normAngle 2.0))))))))
      (+
       (* 0.16666666666666666 (* (pow u 3.0) (pow normAngle 2.0)))
       (+
        t_0
        (+
         (* t_2 0.027777777777777776)
         (* 0.0032407407407407406 (* (pow u 3.0) (pow normAngle 6.0)))))))
     n1_i))))
float code(float normAngle, float u, float n0_i, float n1_i) {
	return ((sinf((1.0f - u) * normAngle) * (1.0f / sinf(normAngle))) * n0_i) + ((sinf(u * normAngle) * (1.0f / sinf(normAngle))) * n1_i);
}
float code(float normAngle, float u, float n0_i, float n1_i) {
	float t_0 = 0.0001984126984126984f * (powf(u, 7.0f) * powf(normAngle, 6.0f));
	float t_1 = powf(normAngle, 4.0f) * powf(u, 5.0f);
	float t_2 = powf(u, 3.0f) * powf(normAngle, 4.0f);
	return (((((((normAngle * normAngle) * ((0.16666666666666666f * powf(u, 3.0f)) + (u * 0.3333333333333333f))) + (powf(normAngle, 4.0f) * ((u * 0.022222222222222223f) + (0.041666666666666664f * powf(u, 4.0f))))) + t_0) + (powf(normAngle, 6.0f) * ((u * 0.0021164021164021165f) + (powf(u, 5.0f) * 0.002777777777777778f)))) + (1.0f - (fmaf(t_2, 0.05555555555555555f, fmaf(0.5f, (u * ((normAngle * normAngle) * u)), (powf(normAngle, 6.0f) * ((0.001388888888888889f * powf(u, 6.0f)) + (powf(u, 3.0f) * 0.003703703703703704f))))) + fmaf(0.008333333333333333f, t_1, u)))) * n0_i) + ((((0.008333333333333333f * t_1) + ((0.00205026455026455f * (u * powf(normAngle, 6.0f))) + ((0.001388888888888889f * (powf(normAngle, 6.0f) * powf(u, 5.0f))) + (u + ((0.019444444444444445f * (u * powf(normAngle, 4.0f))) + (0.16666666666666666f * (u * powf(normAngle, 2.0f)))))))) - ((0.16666666666666666f * (powf(u, 3.0f) * powf(normAngle, 2.0f))) + (t_0 + ((t_2 * 0.027777777777777776f) + (0.0032407407407407406f * (powf(u, 3.0f) * powf(normAngle, 6.0f))))))) * n1_i);
}

Error

Bits error versus normAngle

Bits error versus u

Bits error versus n0_i

Bits error versus n1_i

Derivation

  1. Initial program 0.9

    \[\left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \left(\sin \left(u \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n1_i \]
  2. Taylor expanded in normAngle around 0 0.4

    \[\leadsto \left(\sin \left(\left(1 - u\right) \cdot normAngle\right) \cdot \frac{1}{\sin normAngle}\right) \cdot n0_i + \color{blue}{\left(\left(0.008333333333333333 \cdot \left({u}^{5} \cdot {normAngle}^{4}\right) + \left(0.00205026455026455 \cdot \left(u \cdot {normAngle}^{6}\right) + \left(0.001388888888888889 \cdot \left({u}^{5} \cdot {normAngle}^{6}\right) + \left(u + \left(0.019444444444444445 \cdot \left(u \cdot {normAngle}^{4}\right) + 0.16666666666666666 \cdot \left(u \cdot {normAngle}^{2}\right)\right)\right)\right)\right)\right) - \left(0.16666666666666666 \cdot \left({u}^{3} \cdot {normAngle}^{2}\right) + \left(0.0001984126984126984 \cdot \left({u}^{7} \cdot {normAngle}^{6}\right) + \left(0.027777777777777776 \cdot \left({u}^{3} \cdot {normAngle}^{4}\right) + 0.0032407407407407406 \cdot \left({u}^{3} \cdot {normAngle}^{6}\right)\right)\right)\right)\right)} \cdot n1_i \]
  3. Taylor expanded in normAngle around 0 0.2

    \[\leadsto \color{blue}{\left(\left(1 + \left(0.0021164021164021165 \cdot \left(u \cdot {normAngle}^{6}\right) + \left(0.002777777777777778 \cdot \left({u}^{5} \cdot {normAngle}^{6}\right) + \left(0.041666666666666664 \cdot \left({u}^{4} \cdot {normAngle}^{4}\right) + \left(0.022222222222222223 \cdot \left(u \cdot {normAngle}^{4}\right) + \left(0.3333333333333333 \cdot \left(u \cdot {normAngle}^{2}\right) + \left(0.16666666666666666 \cdot \left({u}^{3} \cdot {normAngle}^{2}\right) + 0.0001984126984126984 \cdot \left({u}^{7} \cdot {normAngle}^{6}\right)\right)\right)\right)\right)\right)\right)\right) - \left(0.008333333333333333 \cdot \left({u}^{5} \cdot {normAngle}^{4}\right) + \left(u + \left(0.05555555555555555 \cdot \left({u}^{3} \cdot {normAngle}^{4}\right) + \left(0.5 \cdot \left({u}^{2} \cdot {normAngle}^{2}\right) + \left(0.001388888888888889 \cdot \left({u}^{6} \cdot {normAngle}^{6}\right) + 0.003703703703703704 \cdot \left({u}^{3} \cdot {normAngle}^{6}\right)\right)\right)\right)\right)\right)\right)} \cdot n0_i + \left(\left(0.008333333333333333 \cdot \left({u}^{5} \cdot {normAngle}^{4}\right) + \left(0.00205026455026455 \cdot \left(u \cdot {normAngle}^{6}\right) + \left(0.001388888888888889 \cdot \left({u}^{5} \cdot {normAngle}^{6}\right) + \left(u + \left(0.019444444444444445 \cdot \left(u \cdot {normAngle}^{4}\right) + 0.16666666666666666 \cdot \left(u \cdot {normAngle}^{2}\right)\right)\right)\right)\right)\right) - \left(0.16666666666666666 \cdot \left({u}^{3} \cdot {normAngle}^{2}\right) + \left(0.0001984126984126984 \cdot \left({u}^{7} \cdot {normAngle}^{6}\right) + \left(0.027777777777777776 \cdot \left({u}^{3} \cdot {normAngle}^{4}\right) + 0.0032407407407407406 \cdot \left({u}^{3} \cdot {normAngle}^{6}\right)\right)\right)\right)\right) \cdot n1_i \]
  4. Simplified0.2

    \[\leadsto \color{blue}{\left(\left(\left(\left(\left(normAngle \cdot normAngle\right) \cdot \left(0.16666666666666666 \cdot {u}^{3} + u \cdot 0.3333333333333333\right) + {normAngle}^{4} \cdot \left(u \cdot 0.022222222222222223 + 0.041666666666666664 \cdot {u}^{4}\right)\right) + 0.0001984126984126984 \cdot \left({u}^{7} \cdot {normAngle}^{6}\right)\right) + {normAngle}^{6} \cdot \left(u \cdot 0.0021164021164021165 + {u}^{5} \cdot 0.002777777777777778\right)\right) + \left(1 - \left(\mathsf{fma}\left({u}^{3} \cdot {normAngle}^{4}, 0.05555555555555555, \mathsf{fma}\left(0.5, u \cdot \left(u \cdot \left(normAngle \cdot normAngle\right)\right), {normAngle}^{6} \cdot \left(0.001388888888888889 \cdot {u}^{6} + {u}^{3} \cdot 0.003703703703703704\right)\right)\right) + \mathsf{fma}\left(0.008333333333333333, {u}^{5} \cdot {normAngle}^{4}, u\right)\right)\right)\right)} \cdot n0_i + \left(\left(0.008333333333333333 \cdot \left({u}^{5} \cdot {normAngle}^{4}\right) + \left(0.00205026455026455 \cdot \left(u \cdot {normAngle}^{6}\right) + \left(0.001388888888888889 \cdot \left({u}^{5} \cdot {normAngle}^{6}\right) + \left(u + \left(0.019444444444444445 \cdot \left(u \cdot {normAngle}^{4}\right) + 0.16666666666666666 \cdot \left(u \cdot {normAngle}^{2}\right)\right)\right)\right)\right)\right) - \left(0.16666666666666666 \cdot \left({u}^{3} \cdot {normAngle}^{2}\right) + \left(0.0001984126984126984 \cdot \left({u}^{7} \cdot {normAngle}^{6}\right) + \left(0.027777777777777776 \cdot \left({u}^{3} \cdot {normAngle}^{4}\right) + 0.0032407407407407406 \cdot \left({u}^{3} \cdot {normAngle}^{6}\right)\right)\right)\right)\right) \cdot n1_i \]
  5. Final simplification0.2

    \[\leadsto \left(\left(\left(\left(\left(normAngle \cdot normAngle\right) \cdot \left(0.16666666666666666 \cdot {u}^{3} + u \cdot 0.3333333333333333\right) + {normAngle}^{4} \cdot \left(u \cdot 0.022222222222222223 + 0.041666666666666664 \cdot {u}^{4}\right)\right) + 0.0001984126984126984 \cdot \left({u}^{7} \cdot {normAngle}^{6}\right)\right) + {normAngle}^{6} \cdot \left(u \cdot 0.0021164021164021165 + {u}^{5} \cdot 0.002777777777777778\right)\right) + \left(1 - \left(\mathsf{fma}\left({u}^{3} \cdot {normAngle}^{4}, 0.05555555555555555, \mathsf{fma}\left(0.5, u \cdot \left(\left(normAngle \cdot normAngle\right) \cdot u\right), {normAngle}^{6} \cdot \left(0.001388888888888889 \cdot {u}^{6} + {u}^{3} \cdot 0.003703703703703704\right)\right)\right) + \mathsf{fma}\left(0.008333333333333333, {normAngle}^{4} \cdot {u}^{5}, u\right)\right)\right)\right) \cdot n0_i + \left(\left(0.008333333333333333 \cdot \left({normAngle}^{4} \cdot {u}^{5}\right) + \left(0.00205026455026455 \cdot \left(u \cdot {normAngle}^{6}\right) + \left(0.001388888888888889 \cdot \left({normAngle}^{6} \cdot {u}^{5}\right) + \left(u + \left(0.019444444444444445 \cdot \left(u \cdot {normAngle}^{4}\right) + 0.16666666666666666 \cdot \left(u \cdot {normAngle}^{2}\right)\right)\right)\right)\right)\right) - \left(0.16666666666666666 \cdot \left({u}^{3} \cdot {normAngle}^{2}\right) + \left(0.0001984126984126984 \cdot \left({u}^{7} \cdot {normAngle}^{6}\right) + \left(\left({u}^{3} \cdot {normAngle}^{4}\right) \cdot 0.027777777777777776 + 0.0032407407407407406 \cdot \left({u}^{3} \cdot {normAngle}^{6}\right)\right)\right)\right)\right) \cdot n1_i \]

Reproduce

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