?

Average Error: 42.73% → 1.72%
Time: 21.3s
Precision: binary32
Cost: 16672

?

\[\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)\]
\[\sin \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)} \]
\[\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt[3]{{\left(ux \cdot \left(\mathsf{fma}\left(-2, maxCos, 2\right) - \left(1 - maxCos\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right)\right)\right)}^{1.5}} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sin (* (* uy 2.0) PI))
  (sqrt
   (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sin (* uy (* 2.0 PI)))
  (cbrt
   (pow
    (* ux (- (fma -2.0 maxCos 2.0) (* (- 1.0 maxCos) (* ux (- 1.0 maxCos)))))
    1.5))))
float code(float ux, float uy, float maxCos) {
	return sinf(((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) {
	return sinf((uy * (2.0f * ((float) M_PI)))) * cbrtf(powf((ux * (fmaf(-2.0f, maxCos, 2.0f) - ((1.0f - maxCos) * (ux * (1.0f - maxCos))))), 1.5f));
}
function code(ux, uy, maxCos)
	return Float32(sin(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)
	return Float32(sin(Float32(uy * Float32(Float32(2.0) * Float32(pi)))) * cbrt((Float32(ux * Float32(fma(Float32(-2.0), maxCos, Float32(2.0)) - Float32(Float32(Float32(1.0) - maxCos) * Float32(ux * Float32(Float32(1.0) - maxCos))))) ^ Float32(1.5))))
end
\sin \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)}
\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt[3]{{\left(ux \cdot \left(\mathsf{fma}\left(-2, maxCos, 2\right) - \left(1 - maxCos\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right)\right)\right)}^{1.5}}

Error?

Derivation?

  1. Initial program 42.73

    \[\sin \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. Simplified42.74

    \[\leadsto \color{blue}{\sin \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]42.73

    \[ \sin \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* [=>]42.73

    \[ \sin \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)} \]

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

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

    +-commutative [=>]42.73

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

    *-commutative [=>]42.73

    \[ \sin \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 [=>]42.61

    \[ \sin \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 [=>]42.61

    \[ \sin \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- [=>]42.58

    \[ \sin \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 [=>]42.58

    \[ \sin \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 [=>]42.58

    \[ \sin \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 [=>]42.58

    \[ \sin \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- [=>]42.73

    \[ \sin \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- [=>]42.73

    \[ \sin \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)} \]

    +-commutative [=>]42.73

    \[ \sin \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(0 - \left(ux \cdot maxCos + 1\right)\right)}, 1\right)} \]

    sub0-neg [=>]42.73

    \[ \sin \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}{\left(-\left(ux \cdot maxCos + 1\right)\right)}, 1\right)} \]

    sub-neg [<=]42.73

    \[ \sin \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 [=>]42.74

    \[ \sin \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 0 1.71

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(maxCos - 1\right) \cdot \left(\left(1 - maxCos\right) \cdot {ux}^{2}\right) + ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right)}} \]
  4. Simplified1.68

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

    [Start]1.71

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

    +-commutative [=>]1.71

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

    fma-def [=>]1.7

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

    associate--l+ [=>]1.68

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

    sub-neg [=>]1.68

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

    metadata-eval [=>]1.68

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

    distribute-lft-in [=>]1.68

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

    metadata-eval [=>]1.68

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

    +-commutative [<=]1.68

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

    mul-1-neg [=>]1.68

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

    sub-neg [<=]1.68

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

    associate-*r* [=>]1.68

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

    *-commutative [=>]1.68

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

    associate-*l* [=>]1.68

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

    sub-neg [=>]1.68

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

    metadata-eval [=>]1.68

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

    +-commutative [=>]1.68

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

    unpow2 [=>]1.68

    \[ \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(1 - maxCos\right) \cdot \left(\left(-1 + maxCos\right) \cdot \color{blue}{\left(ux \cdot ux\right)}\right)\right)} \]
  5. Applied egg-rr3.97

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \color{blue}{{\left({\left(\mathsf{fma}\left(ux, 2 - \left(maxCos + maxCos\right), \left(1 - maxCos\right) \cdot \left(ux \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333}} \]
  6. Simplified1.71

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

    [Start]3.97

    \[ \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot {\left({\left(\mathsf{fma}\left(ux, 2 - \left(maxCos + maxCos\right), \left(1 - maxCos\right) \cdot \left(ux \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333} \]

    unpow1/3 [=>]1.71

    \[ \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(ux, 2 - \left(maxCos + maxCos\right), \left(1 - maxCos\right) \cdot \left(ux \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)}^{1.5}}} \]
  7. Applied egg-rr57.81

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt[3]{\color{blue}{e^{\mathsf{log1p}\left({\left(ux \cdot \left(\mathsf{fma}\left(maxCos, -2, 2\right) + ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}^{1.5}\right)} - 1}} \]
  8. Simplified1.72

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

    [Start]57.81

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

    expm1-def [=>]1.72

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

    expm1-log1p [=>]1.72

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

    fma-udef [=>]1.72

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

    *-commutative [<=]1.72

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

    fma-def [=>]1.72

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

    associate-*r* [=>]1.72

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

    metadata-eval [<=]1.72

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

    sub-neg [<=]1.72

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

    *-commutative [=>]1.72

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

    associate-*r* [<=]1.72

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

    sub-neg [=>]1.72

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

    metadata-eval [=>]1.72

    \[ \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt[3]{{\left(ux \cdot \left(\mathsf{fma}\left(-2, maxCos, 2\right) + \left(maxCos + \color{blue}{-1}\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right)\right)\right)}^{1.5}} \]
  9. Final simplification1.72

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

Alternatives

Alternative 1
Error4.54%
Cost30984
\[\begin{array}{l} t_0 := \sin \left(\pi \cdot \left(uy \cdot 2\right)\right)\\ t_1 := t_0 \cdot \sqrt{1 + \left(ux \cdot maxCos + \left(1 - ux\right)\right) \cdot \left(\left(ux + -1\right) - ux \cdot maxCos\right)}\\ \mathbf{if}\;t_1 \leq 0:\\ \;\;\;\;t_0 \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\\ \mathbf{elif}\;t_1 \leq 1.13999999484804 \cdot 10^{-6}:\\ \;\;\;\;2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{\mathsf{fma}\left(ux, \left(2 - maxCos\right) - maxCos, \left(1 - maxCos\right) \cdot \left(ux \cdot \left(ux \cdot maxCos - ux\right)\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \end{array} \]
Alternative 2
Error1.72%
Cost16416
\[\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{-\mathsf{expm1}\left(2 \cdot \mathsf{log1p}\left(ux \cdot maxCos - ux\right)\right)} \]
Alternative 3
Error1.68%
Cost13568
\[\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 - \left(maxCos + \left(maxCos + -1\right)\right), \left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot ux\right)\right)\right)} \]
Alternative 4
Error1.69%
Cost10304
\[\sqrt{ux \cdot \left(2 - \left(2 \cdot maxCos + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right)\right)\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \]
Alternative 5
Error4.35%
Cost10052
\[\begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-6}:\\ \;\;\;\;\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{2 \cdot ux - ux \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{ux \cdot \left(2 - \left(2 \cdot maxCos + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right)\right)\right)} \cdot \left(uy \cdot \pi\right)\right)\\ \end{array} \]
Alternative 6
Error10.5%
Cost9988
\[\begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.012000000104308128:\\ \;\;\;\;2 \cdot \left(\sqrt{ux \cdot \left(2 - \left(2 \cdot maxCos + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right)\right)\right)} \cdot \left(uy \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{2 \cdot ux}\\ \end{array} \]
Alternative 7
Error4.35%
Cost9988
\[\begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-6}:\\ \;\;\;\;\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{ux \cdot \left(2 - \left(2 \cdot maxCos + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right)\right)\right)} \cdot \left(uy \cdot \pi\right)\right)\\ \end{array} \]
Alternative 8
Error23.72%
Cost7172
\[\begin{array}{l} \mathbf{if}\;ux \leq 0.00022000000171829015:\\ \;\;\;\;2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{1 + \left(ux + \left(-1 - ux \cdot maxCos\right)\right) \cdot \left(\left(1 + ux \cdot maxCos\right) - ux\right)}\right)\\ \end{array} \]
Alternative 9
Error18.9%
Cost7104
\[2 \cdot \left(\sqrt{ux \cdot \left(2 - \left(2 \cdot maxCos + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right)\right)\right)} \cdot \left(uy \cdot \pi\right)\right) \]
Alternative 10
Error24.79%
Cost6916
\[\begin{array}{l} \mathbf{if}\;ux \leq 0.00022000000171829015:\\ \;\;\;\;2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{1 - \left(1 - ux\right) \cdot \left(1 - ux\right)}\right)\\ \end{array} \]
Alternative 11
Error34.26%
Cost6784
\[2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
Alternative 12
Error34.25%
Cost6784
\[2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right) \]
Alternative 13
Error36.81%
Cost6656
\[2 \cdot \left(\pi \cdot \left(uy \cdot \sqrt{2 \cdot ux}\right)\right) \]

Error

Reproduce?

herbie shell --seed 2023115 
(FPCore (ux uy maxCos)
  :name "UniformSampleCone, y"
  :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)))
  (* (sin (* (* uy 2.0) PI)) (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))