Average Error: 0.9 → 0.2
Time: 10.3s
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 \]
\[\left(n0_i - n0_i \cdot \frac{\cos normAngle \cdot \left(normAngle \cdot u\right)}{\sin normAngle}\right) + \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({normAngle}^{2} \cdot {u}^{3}\right) + \left(0.0001984126984126984 \cdot \left({normAngle}^{6} \cdot {u}^{7}\right) + \left(0.027777777777777776 \cdot \left({normAngle}^{4} \cdot {u}^{3}\right) + 0.0032407407407407406 \cdot \left({normAngle}^{6} \cdot {u}^{3}\right)\right)\right)\right)\right) \cdot n1_i \]
\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
\left(n0_i - n0_i \cdot \frac{\cos normAngle \cdot \left(normAngle \cdot u\right)}{\sin normAngle}\right) + \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({normAngle}^{2} \cdot {u}^{3}\right) + \left(0.0001984126984126984 \cdot \left({normAngle}^{6} \cdot {u}^{7}\right) + \left(0.027777777777777776 \cdot \left({normAngle}^{4} \cdot {u}^{3}\right) + 0.0032407407407407406 \cdot \left({normAngle}^{6} \cdot {u}^{3}\right)\right)\right)\right)\right) \cdot n1_i
(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
 (+
  (- n0_i (* n0_i (/ (* (cos normAngle) (* normAngle u)) (sin normAngle))))
  (*
   (-
    (+
     (* 0.008333333333333333 (* (pow u 5.0) (pow normAngle 4.0)))
     (+
      (* 0.00205026455026455 (* u (pow normAngle 6.0)))
      (+
       (* 0.001388888888888889 (* (pow u 5.0) (pow normAngle 6.0)))
       (+
        u
        (+
         (* 0.019444444444444445 (* u (pow normAngle 4.0)))
         (* 0.16666666666666666 (* u (pow normAngle 2.0))))))))
    (+
     (* 0.16666666666666666 (* (pow normAngle 2.0) (pow u 3.0)))
     (+
      (* 0.0001984126984126984 (* (pow normAngle 6.0) (pow u 7.0)))
      (+
       (* 0.027777777777777776 (* (pow normAngle 4.0) (pow u 3.0)))
       (* 0.0032407407407407406 (* (pow normAngle 6.0) (pow u 3.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) {
	return (n0_i - (n0_i * ((cosf(normAngle) * (normAngle * u)) / sinf(normAngle)))) + ((((0.008333333333333333f * (powf(u, 5.0f) * powf(normAngle, 4.0f))) + ((0.00205026455026455f * (u * powf(normAngle, 6.0f))) + ((0.001388888888888889f * (powf(u, 5.0f) * powf(normAngle, 6.0f))) + (u + ((0.019444444444444445f * (u * powf(normAngle, 4.0f))) + (0.16666666666666666f * (u * powf(normAngle, 2.0f)))))))) - ((0.16666666666666666f * (powf(normAngle, 2.0f) * powf(u, 3.0f))) + ((0.0001984126984126984f * (powf(normAngle, 6.0f) * powf(u, 7.0f))) + ((0.027777777777777776f * (powf(normAngle, 4.0f) * powf(u, 3.0f))) + (0.0032407407407407406f * (powf(normAngle, 6.0f) * powf(u, 3.0f))))))) * n1_i);
}

Error

Bits error versus normAngle

Bits error versus u

Bits error versus n0_i

Bits error versus n1_i

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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 u around 0 0.3

    \[\leadsto \color{blue}{\left(1 - \frac{\cos normAngle \cdot \left(u \cdot normAngle\right)}{\sin normAngle}\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. Applied egg-rr0.2

    \[\leadsto \color{blue}{\left(n0_i + \frac{-\cos normAngle \cdot \left(normAngle \cdot u\right)}{\sin normAngle} \cdot n0_i\right)} + \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(n0_i - n0_i \cdot \frac{\cos normAngle \cdot \left(normAngle \cdot u\right)}{\sin normAngle}\right) + \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({normAngle}^{2} \cdot {u}^{3}\right) + \left(0.0001984126984126984 \cdot \left({normAngle}^{6} \cdot {u}^{7}\right) + \left(0.027777777777777776 \cdot \left({normAngle}^{4} \cdot {u}^{3}\right) + 0.0032407407407407406 \cdot \left({normAngle}^{6} \cdot {u}^{3}\right)\right)\right)\right)\right) \cdot n1_i \]

Reproduce

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