?

Average Accuracy: 56.9% → 98.7%
Time: 22.2s
Precision: binary32
Cost: 136096

?

\[\left(\left(2.328306437 \cdot 10^{-10} \leq ux \land ux \leq 1\right) \land \left(2.328306437 \cdot 10^{-10} \leq uy \land uy \leq 1\right)\right) \land \left(0 \leq maxCos \land maxCos \leq 1\right)\]
\[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
\[\begin{array}{l} t_0 := \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}}\\ t_1 := -t_0\\ t_2 := t_0 \cdot t_0\\ \left(\mathsf{fma}\left(1, {\cos \left(uy \cdot \pi\right)}^{2}, t_0 \cdot \left(t_0 \cdot t_1\right)\right) + \mathsf{fma}\left(t_1, t_2, t_0 \cdot t_2\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - \left(1 - maxCos\right) \cdot ux\right)\right)} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (cos (* (* uy 2.0) PI))
  (sqrt
   (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (cbrt (pow (sin (* uy PI)) 2.0))) (t_1 (- t_0)) (t_2 (* t_0 t_0)))
   (*
    (+
     (fma 1.0 (pow (cos (* uy PI)) 2.0) (* t_0 (* t_0 t_1)))
     (fma t_1 t_2 (* t_0 t_2)))
    (sqrt (* (- 1.0 maxCos) (* ux (- 2.0 (* (- 1.0 maxCos) ux))))))))
float code(float ux, float uy, float maxCos) {
	return cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - (((1.0f - ux) + (ux * maxCos)) * ((1.0f - ux) + (ux * maxCos)))));
}
float code(float ux, float uy, float maxCos) {
	float t_0 = cbrtf(powf(sinf((uy * ((float) M_PI))), 2.0f));
	float t_1 = -t_0;
	float t_2 = t_0 * t_0;
	return (fmaf(1.0f, powf(cosf((uy * ((float) M_PI))), 2.0f), (t_0 * (t_0 * t_1))) + fmaf(t_1, t_2, (t_0 * t_2))) * sqrtf(((1.0f - maxCos) * (ux * (2.0f - ((1.0f - maxCos) * ux)))));
}
function code(ux, uy, maxCos)
	return Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos)) * Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos))))))
end
function code(ux, uy, maxCos)
	t_0 = cbrt((sin(Float32(uy * Float32(pi))) ^ Float32(2.0)))
	t_1 = Float32(-t_0)
	t_2 = Float32(t_0 * t_0)
	return Float32(Float32(fma(Float32(1.0), (cos(Float32(uy * Float32(pi))) ^ Float32(2.0)), Float32(t_0 * Float32(t_0 * t_1))) + fma(t_1, t_2, Float32(t_0 * t_2))) * sqrt(Float32(Float32(Float32(1.0) - maxCos) * Float32(ux * Float32(Float32(2.0) - Float32(Float32(Float32(1.0) - maxCos) * ux))))))
end
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)}
\begin{array}{l}
t_0 := \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}}\\
t_1 := -t_0\\
t_2 := t_0 \cdot t_0\\
\left(\mathsf{fma}\left(1, {\cos \left(uy \cdot \pi\right)}^{2}, t_0 \cdot \left(t_0 \cdot t_1\right)\right) + \mathsf{fma}\left(t_1, t_2, t_0 \cdot t_2\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - \left(1 - maxCos\right) \cdot ux\right)\right)}
\end{array}

Error?

Derivation?

  1. Initial program 56.9%

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Simplified56.9%

    \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, ux - \mathsf{fma}\left(ux, maxCos, 1\right), 1\right)}} \]
    Proof

    [Start]56.9

    \[ \cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]

    associate-*l* [=>]56.9

    \[ \cos \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]

    sub-neg [=>]56.9

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]

    +-commutative [=>]56.9

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]

    distribute-rgt-neg-in [=>]56.9

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]

    fma-def [=>]57.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]

    +-commutative [=>]57.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]

    associate-+r- [=>]57.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\left(ux \cdot maxCos + 1\right) - ux}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]

    fma-def [=>]57.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]

    neg-sub0 [=>]57.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{0 - \left(\left(1 - ux\right) + ux \cdot maxCos\right)}, 1\right)} \]

    +-commutative [=>]57.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, 0 - \color{blue}{\left(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]

    associate-+r- [=>]56.9

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, 0 - \color{blue}{\left(\left(ux \cdot maxCos + 1\right) - ux\right)}, 1\right)} \]

    associate--r- [=>]56.9

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(ux \cdot maxCos + 1\right)\right) + ux}, 1\right)} \]

    neg-sub0 [<=]56.9

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(ux \cdot maxCos + 1\right)\right)} + ux, 1\right)} \]

    +-commutative [=>]56.9

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux + \left(-\left(ux \cdot maxCos + 1\right)\right)}, 1\right)} \]

    sub-neg [<=]56.9

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]

    fma-def [=>]56.9

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Taylor expanded in ux around -inf 99.0%

    \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{-1 \cdot \left({ux}^{2} \cdot {\left(1 + -1 \cdot maxCos\right)}^{2}\right) + 2 \cdot \left(ux \cdot \left(1 + -1 \cdot maxCos\right)\right)}} \]
  4. Simplified99.0%

    \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}}} \]
    Proof

    [Start]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{-1 \cdot \left({ux}^{2} \cdot {\left(1 + -1 \cdot maxCos\right)}^{2}\right) + 2 \cdot \left(ux \cdot \left(1 + -1 \cdot maxCos\right)\right)} \]

    +-commutative [=>]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{2 \cdot \left(ux \cdot \left(1 + -1 \cdot maxCos\right)\right) + -1 \cdot \left({ux}^{2} \cdot {\left(1 + -1 \cdot maxCos\right)}^{2}\right)}} \]

    mul-1-neg [=>]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{2 \cdot \left(ux \cdot \left(1 + -1 \cdot maxCos\right)\right) + \color{blue}{\left(-{ux}^{2} \cdot {\left(1 + -1 \cdot maxCos\right)}^{2}\right)}} \]

    unsub-neg [=>]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{2 \cdot \left(ux \cdot \left(1 + -1 \cdot maxCos\right)\right) - {ux}^{2} \cdot {\left(1 + -1 \cdot maxCos\right)}^{2}}} \]

    *-commutative [=>]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + -1 \cdot maxCos\right)\right) \cdot 2} - {ux}^{2} \cdot {\left(1 + -1 \cdot maxCos\right)}^{2}} \]

    mul-1-neg [=>]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot \left(1 + \color{blue}{\left(-maxCos\right)}\right)\right) \cdot 2 - {ux}^{2} \cdot {\left(1 + -1 \cdot maxCos\right)}^{2}} \]

    sub-neg [<=]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot \color{blue}{\left(1 - maxCos\right)}\right) \cdot 2 - {ux}^{2} \cdot {\left(1 + -1 \cdot maxCos\right)}^{2}} \]

    associate-*l* [=>]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right)} - {ux}^{2} \cdot {\left(1 + -1 \cdot maxCos\right)}^{2}} \]

    unpow2 [=>]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \color{blue}{\left(ux \cdot ux\right)} \cdot {\left(1 + -1 \cdot maxCos\right)}^{2}} \]

    mul-1-neg [=>]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 + \color{blue}{\left(-maxCos\right)}\right)}^{2}} \]

    sub-neg [<=]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\color{blue}{\left(1 - maxCos\right)}}^{2}} \]
  5. Applied egg-rr94.8%

    \[\leadsto \color{blue}{\sqrt{\left(2 \cdot \left(ux \cdot \left(1 - maxCos\right)\right) - {\left(ux \cdot \left(1 - maxCos\right)\right)}^{2}\right) \cdot {\cos \left(uy \cdot \left(2 \cdot \pi\right)\right)}^{2}}} \]
    Proof

    [Start]99.0

    \[ \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}} \]

    add-sqr-sqrt [=>]93.5

    \[ \color{blue}{\sqrt{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}}} \cdot \sqrt{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}}}} \]

    sqrt-unprod [=>]94.7

    \[ \color{blue}{\sqrt{\left(\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}}\right) \cdot \left(\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}}\right)}} \]

    *-commutative [=>]94.7

    \[ \sqrt{\color{blue}{\left(\sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}} \cdot \cos \left(uy \cdot \left(2 \cdot \pi\right)\right)\right)} \cdot \left(\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}}\right)} \]

    *-commutative [=>]94.7

    \[ \sqrt{\left(\sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}} \cdot \cos \left(uy \cdot \left(2 \cdot \pi\right)\right)\right) \cdot \color{blue}{\left(\sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}} \cdot \cos \left(uy \cdot \left(2 \cdot \pi\right)\right)\right)}} \]

    swap-sqr [=>]94.6

    \[ \sqrt{\color{blue}{\left(\sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}} \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}}\right) \cdot \left(\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \cos \left(uy \cdot \left(2 \cdot \pi\right)\right)\right)}} \]
  6. Simplified94.8%

    \[\leadsto \color{blue}{\sqrt{\left(2 \cdot \left(\left(1 - maxCos\right) \cdot ux\right) - {\left(\left(1 - maxCos\right) \cdot ux\right)}^{2}\right) \cdot {\cos \left(\left(uy \cdot 2\right) \cdot \pi\right)}^{2}}} \]
    Proof

    [Start]94.8

    \[ \sqrt{\left(2 \cdot \left(ux \cdot \left(1 - maxCos\right)\right) - {\left(ux \cdot \left(1 - maxCos\right)\right)}^{2}\right) \cdot {\cos \left(uy \cdot \left(2 \cdot \pi\right)\right)}^{2}} \]

    *-commutative [=>]94.8

    \[ \sqrt{\left(2 \cdot \color{blue}{\left(\left(1 - maxCos\right) \cdot ux\right)} - {\left(ux \cdot \left(1 - maxCos\right)\right)}^{2}\right) \cdot {\cos \left(uy \cdot \left(2 \cdot \pi\right)\right)}^{2}} \]

    *-commutative [=>]94.8

    \[ \sqrt{\left(2 \cdot \left(\left(1 - maxCos\right) \cdot ux\right) - {\color{blue}{\left(\left(1 - maxCos\right) \cdot ux\right)}}^{2}\right) \cdot {\cos \left(uy \cdot \left(2 \cdot \pi\right)\right)}^{2}} \]

    associate-*r* [=>]94.8

    \[ \sqrt{\left(2 \cdot \left(\left(1 - maxCos\right) \cdot ux\right) - {\left(\left(1 - maxCos\right) \cdot ux\right)}^{2}\right) \cdot {\cos \color{blue}{\left(\left(uy \cdot 2\right) \cdot \pi\right)}}^{2}} \]
  7. Taylor expanded in uy around inf 99.0%

    \[\leadsto \color{blue}{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{2 \cdot \left(\left(1 - maxCos\right) \cdot ux\right) - {\left(1 - maxCos\right)}^{2} \cdot {ux}^{2}}} \]
  8. Simplified99.0%

    \[\leadsto \color{blue}{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - ux \cdot \left(1 - maxCos\right)\right)\right)}} \]
    Proof

    [Start]99.0

    \[ \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{2 \cdot \left(\left(1 - maxCos\right) \cdot ux\right) - {\left(1 - maxCos\right)}^{2} \cdot {ux}^{2}} \]

    unpow2 [=>]99.0

    \[ \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{2 \cdot \left(\left(1 - maxCos\right) \cdot ux\right) - \color{blue}{\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)} \cdot {ux}^{2}} \]

    unpow2 [=>]99.0

    \[ \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{2 \cdot \left(\left(1 - maxCos\right) \cdot ux\right) - \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]

    swap-sqr [<=]99.0

    \[ \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{2 \cdot \left(\left(1 - maxCos\right) \cdot ux\right) - \color{blue}{\left(\left(1 - maxCos\right) \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot ux\right)}} \]

    cancel-sign-sub-inv [=>]99.0

    \[ \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{2 \cdot \left(\left(1 - maxCos\right) \cdot ux\right) + \left(-\left(1 - maxCos\right) \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot ux\right)}} \]

    distribute-rgt-in [<=]99.0

    \[ \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - maxCos\right) \cdot ux\right) \cdot \left(2 + \left(-\left(1 - maxCos\right) \cdot ux\right)\right)}} \]

    sub-neg [<=]99.0

    \[ \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(\left(1 - maxCos\right) \cdot ux\right) \cdot \color{blue}{\left(2 - \left(1 - maxCos\right) \cdot ux\right)}} \]

    associate-*l* [=>]99.0

    \[ \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - \left(1 - maxCos\right) \cdot ux\right)\right)}} \]

    *-commutative [=>]99.0

    \[ \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - \color{blue}{ux \cdot \left(1 - maxCos\right)}\right)\right)} \]
  9. Applied egg-rr98.7%

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(1, {\cos \left(uy \cdot \pi\right)}^{2}, -\sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}} \cdot \left(\sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}} \cdot \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}}, \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}} \cdot \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}}, \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}} \cdot \left(\sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}} \cdot \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}}\right)\right)\right)} \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - ux \cdot \left(1 - maxCos\right)\right)\right)} \]
    Proof

    [Start]99.0

    \[ \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - ux \cdot \left(1 - maxCos\right)\right)\right)} \]

    cos-2 [=>]98.8

    \[ \color{blue}{\left(\cos \left(uy \cdot \pi\right) \cdot \cos \left(uy \cdot \pi\right) - \sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)\right)} \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - ux \cdot \left(1 - maxCos\right)\right)\right)} \]

    *-un-lft-identity [=>]98.8

    \[ \left(\color{blue}{1 \cdot \left(\cos \left(uy \cdot \pi\right) \cdot \cos \left(uy \cdot \pi\right)\right)} - \sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - ux \cdot \left(1 - maxCos\right)\right)\right)} \]

    add-cube-cbrt [=>]98.7

    \[ \left(1 \cdot \left(\cos \left(uy \cdot \pi\right) \cdot \cos \left(uy \cdot \pi\right)\right) - \color{blue}{\left(\sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)} \cdot \sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)}\right) \cdot \sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)}}\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - ux \cdot \left(1 - maxCos\right)\right)\right)} \]

    prod-diff [=>]98.7

    \[ \color{blue}{\left(\mathsf{fma}\left(1, \cos \left(uy \cdot \pi\right) \cdot \cos \left(uy \cdot \pi\right), -\sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)} \cdot \left(\sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)} \cdot \sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)}, \sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)} \cdot \sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)}, \sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)} \cdot \left(\sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)} \cdot \sqrt[3]{\sin \left(uy \cdot \pi\right) \cdot \sin \left(uy \cdot \pi\right)}\right)\right)\right)} \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - ux \cdot \left(1 - maxCos\right)\right)\right)} \]
  10. Final simplification98.7%

    \[\leadsto \left(\mathsf{fma}\left(1, {\cos \left(uy \cdot \pi\right)}^{2}, \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}} \cdot \left(\sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}} \cdot \left(-\sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}}\right)\right)\right) + \mathsf{fma}\left(-\sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}}, \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}} \cdot \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}}, \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}} \cdot \left(\sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}} \cdot \sqrt[3]{{\sin \left(uy \cdot \pi\right)}^{2}}\right)\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - \left(1 - maxCos\right) \cdot ux\right)\right)} \]

Alternatives

Alternative 1
Accuracy99.0%
Cost16576
\[\sqrt{\mathsf{fma}\left(ux, \left(2 - maxCos\right) - maxCos, -{\left(ux \cdot \left(maxCos + -1\right)\right)}^{2}\right)} \cdot \cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \]
Alternative 2
Accuracy99.0%
Cost13600
\[\cos \left(uy \cdot \left(\pi \cdot 2\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot {ux}^{2}\right) - ux \cdot \left(maxCos + \left(-1 - \left(1 - maxCos\right)\right)\right)} \]
Alternative 3
Accuracy99.0%
Cost13568
\[\cos \left(uy \cdot \left(\pi \cdot 2\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \left(1 - maxCos\right) + \left(1 - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)} \]
Alternative 4
Accuracy99.0%
Cost10176
\[\sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - \left(1 - maxCos\right) \cdot ux\right)\right)} \cdot \cos \left(\left(uy \cdot \pi\right) \cdot 2\right) \]
Alternative 5
Accuracy99.0%
Cost10176
\[\begin{array}{l} t_0 := \left(1 - maxCos\right) \cdot ux\\ \cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{t_0 \cdot \left(2 - t_0\right)} \end{array} \]
Alternative 6
Accuracy97.6%
Cost10048
\[\cos \left(\left(uy \cdot \pi\right) \cdot 2\right) \cdot \sqrt{\left(maxCos + -1\right) \cdot \left(ux \cdot \left(ux - 2\right)\right)} \]
Alternative 7
Accuracy90.1%
Cost9988
\[\begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.002199999988079071:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(uy \cdot \left(\pi \cdot 2\right)\right) \cdot \sqrt{2 \cdot ux}\\ \end{array} \]
Alternative 8
Accuracy92.6%
Cost9984
\[\cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{2 \cdot ux - ux \cdot ux} \]
Alternative 9
Accuracy92.6%
Cost9920
\[\cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)} \]
Alternative 10
Accuracy80.4%
Cost7008
\[\sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)} \]
Alternative 11
Accuracy80.4%
Cost6848
\[\sqrt{ux \cdot \left(2 + maxCos \cdot -2\right) - {\left(maxCos \cdot ux - ux\right)}^{2}} \]
Alternative 12
Accuracy80.4%
Cost3616
\[\begin{array}{l} t_0 := \left(1 - maxCos\right) \cdot ux\\ \sqrt{t_0 \cdot \left(2 - t_0\right)} \end{array} \]
Alternative 13
Accuracy75.8%
Cost3424
\[\sqrt{2 \cdot ux - ux \cdot ux} \]
Alternative 14
Accuracy75.7%
Cost3360
\[\sqrt{ux \cdot \left(2 - ux\right)} \]
Alternative 15
Accuracy62.4%
Cost3296
\[\sqrt{2 \cdot ux} \]
Alternative 16
Accuracy6.6%
Cost32
\[0 \]

Error

Reproduce?

herbie shell --seed 2023151 
(FPCore (ux uy maxCos)
  :name "UniformSampleCone, x"
  :precision binary32
  :pre (and (and (and (<= 2.328306437e-10 ux) (<= ux 1.0)) (and (<= 2.328306437e-10 uy) (<= uy 1.0))) (and (<= 0.0 maxCos) (<= maxCos 1.0)))
  (* (cos (* (* uy 2.0) PI)) (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))