?

Average Error: 0.3 → 0.3
Time: 23.3s
Precision: binary32
Cost: 40096

?

\[\left(\left(\left(\left(\left(-10000 \leq xi \land xi \leq 10000\right) \land \left(-10000 \leq yi \land yi \leq 10000\right)\right) \land \left(-10000 \leq zi \land zi \leq 10000\right)\right) \land \left(2.328306437 \cdot 10^{-10} \leq ux \land ux \leq 1\right)\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)\]
\[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
\[\begin{array}{l} t_0 := {\left(\frac{-1}{uy}\right)}^{-1}\\ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(ux + -1\right) \cdot \left(\left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right) \cdot \left(ux + -1\right)\right)} \cdot \left(\cos \left(\mathsf{fma}\left(t_0, \pi \cdot -2, \mathsf{fma}\left(0.5, \frac{t_0}{\pi} \cdot \frac{\pi \cdot -2}{uy}, -1\right)\right)\right) \cdot xi + \sin \left(uy \cdot \left(\pi \cdot 2\right)\right) \cdot yi\right)\right) \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (+
  (+
   (*
    (*
     (cos (* (* uy 2.0) PI))
     (sqrt
      (- 1.0 (* (* (* (- 1.0 ux) maxCos) ux) (* (* (- 1.0 ux) maxCos) ux)))))
    xi)
   (*
    (*
     (sin (* (* uy 2.0) PI))
     (sqrt
      (- 1.0 (* (* (* (- 1.0 ux) maxCos) ux) (* (* (- 1.0 ux) maxCos) ux)))))
    yi))
  (* (* (* (- 1.0 ux) maxCos) ux) zi)))
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (pow (/ -1.0 uy) -1.0)))
   (fma
    ux
    (* (- 1.0 ux) (* maxCos zi))
    (*
     (sqrt
      (- 1.0 (* (+ ux -1.0) (* (* (* ux maxCos) (* ux maxCos)) (+ ux -1.0)))))
     (+
      (*
       (cos
        (fma t_0 (* PI -2.0) (fma 0.5 (* (/ t_0 PI) (/ (* PI -2.0) uy)) -1.0)))
       xi)
      (* (sin (* uy (* PI 2.0))) yi))))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	return (((cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - ((((1.0f - ux) * maxCos) * ux) * (((1.0f - ux) * maxCos) * ux))))) * xi) + ((sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - ((((1.0f - ux) * maxCos) * ux) * (((1.0f - ux) * maxCos) * ux))))) * yi)) + ((((1.0f - ux) * maxCos) * ux) * zi);
}
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = powf((-1.0f / uy), -1.0f);
	return fmaf(ux, ((1.0f - ux) * (maxCos * zi)), (sqrtf((1.0f - ((ux + -1.0f) * (((ux * maxCos) * (ux * maxCos)) * (ux + -1.0f))))) * ((cosf(fmaf(t_0, (((float) M_PI) * -2.0f), fmaf(0.5f, ((t_0 / ((float) M_PI)) * ((((float) M_PI) * -2.0f) / uy)), -1.0f))) * xi) + (sinf((uy * (((float) M_PI) * 2.0f))) * yi))));
}
function code(xi, yi, zi, ux, uy, maxCos)
	return Float32(Float32(Float32(Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(Float32(Float32(Float32(Float32(1.0) - ux) * maxCos) * ux) * Float32(Float32(Float32(Float32(1.0) - ux) * maxCos) * ux))))) * xi) + Float32(Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(Float32(Float32(Float32(Float32(1.0) - ux) * maxCos) * ux) * Float32(Float32(Float32(Float32(1.0) - ux) * maxCos) * ux))))) * yi)) + Float32(Float32(Float32(Float32(Float32(1.0) - ux) * maxCos) * ux) * zi))
end
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(-1.0) / uy) ^ Float32(-1.0)
	return fma(ux, Float32(Float32(Float32(1.0) - ux) * Float32(maxCos * zi)), Float32(sqrt(Float32(Float32(1.0) - Float32(Float32(ux + Float32(-1.0)) * Float32(Float32(Float32(ux * maxCos) * Float32(ux * maxCos)) * Float32(ux + Float32(-1.0)))))) * Float32(Float32(cos(fma(t_0, Float32(Float32(pi) * Float32(-2.0)), fma(Float32(0.5), Float32(Float32(t_0 / Float32(pi)) * Float32(Float32(Float32(pi) * Float32(-2.0)) / uy)), Float32(-1.0)))) * xi) + Float32(sin(Float32(uy * Float32(Float32(pi) * Float32(2.0)))) * yi))))
end
\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\begin{array}{l}
t_0 := {\left(\frac{-1}{uy}\right)}^{-1}\\
\mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(ux + -1\right) \cdot \left(\left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right) \cdot \left(ux + -1\right)\right)} \cdot \left(\cos \left(\mathsf{fma}\left(t_0, \pi \cdot -2, \mathsf{fma}\left(0.5, \frac{t_0}{\pi} \cdot \frac{\pi \cdot -2}{uy}, -1\right)\right)\right) \cdot xi + \sin \left(uy \cdot \left(\pi \cdot 2\right)\right) \cdot yi\right)\right)
\end{array}

Error?

Derivation?

  1. Initial program 0.3

    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  2. Simplified0.3

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

    [Start]0.3

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

    +-commutative [=>]0.3

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

    *-commutative [=>]0.3

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

    associate-*l* [=>]0.3

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

    fma-def [=>]0.3

    \[ \color{blue}{\mathsf{fma}\left(ux, \left(\left(1 - ux\right) \cdot maxCos\right) \cdot zi, \left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right)} \]
  3. Applied egg-rr0.4

    \[\leadsto \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \color{blue}{\left(e^{\mathsf{log1p}\left(\left(uy \cdot \pi\right) \cdot 2\right)} - 1\right)} \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]
  4. Taylor expanded in uy around -inf 32.0

    \[\leadsto \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \color{blue}{\left(\left(e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)} + 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi}\right) - 1\right)} \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]
  5. Simplified0.3

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

    [Start]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \left(\left(e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)} + 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi}\right) - 1\right) \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

    associate--l+ [=>]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \color{blue}{\left(e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)} + \left(0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right)} \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

    exp-sum [=>]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \left(\color{blue}{e^{-1 \cdot \log \left(\frac{-1}{uy}\right)} \cdot e^{\log \left(-2 \cdot \pi\right)}} + \left(0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right) \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

    fma-def [=>]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \color{blue}{\left(\mathsf{fma}\left(e^{-1 \cdot \log \left(\frac{-1}{uy}\right)}, e^{\log \left(-2 \cdot \pi\right)}, 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right)} \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

    *-commutative [=>]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \left(\mathsf{fma}\left(e^{\color{blue}{\log \left(\frac{-1}{uy}\right) \cdot -1}}, e^{\log \left(-2 \cdot \pi\right)}, 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right) \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

    exp-to-pow [=>]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \left(\mathsf{fma}\left(\color{blue}{{\left(\frac{-1}{uy}\right)}^{-1}}, e^{\log \left(-2 \cdot \pi\right)}, 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right) \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

    metadata-eval [<=]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \left(\mathsf{fma}\left({\left(\frac{-1}{uy}\right)}^{-1}, e^{\log \left(\color{blue}{\left(-2\right)} \cdot \pi\right)}, 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right) \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

    distribute-lft-neg-in [<=]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \left(\mathsf{fma}\left({\left(\frac{-1}{uy}\right)}^{-1}, e^{\log \color{blue}{\left(-2 \cdot \pi\right)}}, 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right) \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

    *-commutative [<=]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \left(\mathsf{fma}\left({\left(\frac{-1}{uy}\right)}^{-1}, e^{\log \left(-\color{blue}{\pi \cdot 2}\right)}, 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right) \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

    rem-exp-log [=>]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \left(\mathsf{fma}\left({\left(\frac{-1}{uy}\right)}^{-1}, \color{blue}{-\pi \cdot 2}, 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right) \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

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

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \left(\mathsf{fma}\left({\left(\frac{-1}{uy}\right)}^{-1}, \color{blue}{\pi \cdot \left(-2\right)}, 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right) \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]

    metadata-eval [=>]32.0

    \[ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(1 - ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right)\right)} \cdot \left(\cos \left(\mathsf{fma}\left({\left(\frac{-1}{uy}\right)}^{-1}, \pi \cdot \color{blue}{-2}, 0.5 \cdot \frac{e^{-1 \cdot \log \left(\frac{-1}{uy}\right) + \log \left(-2 \cdot \pi\right)}}{uy \cdot \pi} - 1\right)\right) \cdot xi + \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\right)\right) \]
  6. Final simplification0.3

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

Alternatives

Alternative 1
Error0.3
Cost26848
\[\mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(ux + -1\right) \cdot \left(\left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right) \cdot \left(ux + -1\right)\right)} \cdot \left(\sin \left(uy \cdot \left(\pi \cdot 2\right)\right) \cdot yi + xi \cdot \cos \left(e^{\log \left(2 \cdot \left(uy \cdot \pi\right)\right)}\right)\right)\right) \]
Alternative 2
Error0.4
Cost20448
\[\begin{array}{l} t_0 := \left(1 - ux\right) \cdot maxCos\\ \mathsf{fma}\left(\cos \left(uy \cdot \left(\pi \cdot 2\right)\right) \cdot \sqrt{1 + \left(ux \cdot t_0\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right) + t_0 \cdot \left(ux \cdot zi\right) \end{array} \]
Alternative 3
Error0.3
Cost20448
\[\begin{array}{l} t_0 := uy \cdot \left(\pi \cdot 2\right)\\ \mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), \sqrt{1 - \left(ux + -1\right) \cdot \left(\left(\left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right) \cdot \left(ux + -1\right)\right)} \cdot \left(\sin t_0 \cdot yi + xi \cdot \cos t_0\right)\right) \end{array} \]
Alternative 4
Error0.4
Cost17312
\[\begin{array}{l} t_0 := ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\\ \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + xi \cdot \left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{1 + t_0 \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right)\right) + zi \cdot t_0 \end{array} \]
Alternative 5
Error1.3
Cost17184
\[\left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + xi \cdot \left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{1 + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right)\right) + zi \cdot \left(ux \cdot maxCos\right) \]
Alternative 6
Error3.2
Cost17120
\[\left(\left(1 - ux\right) \cdot maxCos\right) \cdot \left(ux \cdot zi\right) + \mathsf{fma}\left(\cos \left(uy \cdot \left(\pi \cdot 2\right)\right) \cdot \sqrt{1 + \left(ux \cdot maxCos\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}, xi, \left(uy \cdot 2\right) \cdot \left(\pi \cdot yi\right)\right) \]
Alternative 7
Error4.1
Cost13984
\[\begin{array}{l} t_0 := \pi \cdot \left(uy \cdot 2\right)\\ zi \cdot \left(ux \cdot maxCos\right) + \left(xi \cdot \left(\cos t_0 \cdot \sqrt{1 + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) + yi \cdot t_0\right) \end{array} \]
Alternative 8
Error4.1
Cost13984
\[zi \cdot \left(ux \cdot maxCos\right) + \left(xi \cdot \left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{1 + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) + \left(uy \cdot 2\right) \cdot \left(\pi \cdot yi\right)\right) \]
Alternative 9
Error13.0
Cost13824
\[\mathsf{fma}\left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right), xi \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(maxCos \cdot \left(\left(ux \cdot ux\right) \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)\right)}, maxCos \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot zi\right)\right)\right) \]
Alternative 10
Error13.0
Cost13824
\[\mathsf{fma}\left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right), xi \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(maxCos \cdot \left(\left(ux \cdot ux\right) \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)\right)}, \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)\right) \]
Alternative 11
Error13.1
Cost13760
\[\mathsf{fma}\left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right), xi \cdot \sqrt{1 + \left(maxCos \cdot \left(maxCos \cdot \left(ux \cdot ux\right)\right)\right) \cdot \left(ux + -1\right)}, maxCos \cdot \left(ux \cdot zi - ux \cdot \left(ux \cdot zi\right)\right)\right) \]
Alternative 12
Error13.1
Cost13568
\[\mathsf{fma}\left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right), xi \cdot \sqrt{1 - \left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}, maxCos \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot zi\right)\right)\right) \]
Alternative 13
Error13.1
Cost13568
\[\mathsf{fma}\left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right), xi \cdot \sqrt{1 - \left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}, ux \cdot \left(maxCos \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\right) \]
Alternative 14
Error13.1
Cost13568
\[\mathsf{fma}\left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right), xi \cdot \sqrt{1 - \left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}, \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)\right) \]
Alternative 15
Error13.8
Cost13440
\[\mathsf{fma}\left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right), xi \cdot \sqrt{1 - \left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}, maxCos \cdot \left(ux \cdot zi\right)\right) \]

Error

Reproduce?

herbie shell --seed 2023025 
(FPCore (xi yi zi ux uy maxCos)
  :name "UniformSampleCone 2"
  :precision binary32
  :pre (and (and (and (and (and (and (<= -10000.0 xi) (<= xi 10000.0)) (and (<= -10000.0 yi) (<= yi 10000.0))) (and (<= -10000.0 zi) (<= zi 10000.0))) (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) maxCos) ux) (* (* (- 1.0 ux) maxCos) ux))))) xi) (* (* (sin (* (* uy 2.0) PI)) (sqrt (- 1.0 (* (* (* (- 1.0 ux) maxCos) ux) (* (* (- 1.0 ux) maxCos) ux))))) yi)) (* (* (* (- 1.0 ux) maxCos) ux) zi)))