Average Error: 13.5 → 0.5
Time: 18.6s
Precision: binary32
Cost: 16640
\[\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)} \]
\[\sqrt[3]{{\left(\left(1 - maxCos\right) \cdot \left(ux \cdot \left(\left(2 - ux\right) + maxCos \cdot ux\right)\right)\right)}^{1.5} \cdot {\sin \left(2 \cdot \left(\pi \cdot uy\right)\right)}^{3}} \]
(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
 (cbrt
  (*
   (pow (* (- 1.0 maxCos) (* ux (+ (- 2.0 ux) (* maxCos ux)))) 1.5)
   (pow (sin (* 2.0 (* PI uy))) 3.0))))
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 cbrtf((powf(((1.0f - maxCos) * (ux * ((2.0f - ux) + (maxCos * ux)))), 1.5f) * powf(sinf((2.0f * (((float) M_PI) * uy))), 3.0f)));
}
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 cbrt(Float32((Float32(Float32(Float32(1.0) - maxCos) * Float32(ux * Float32(Float32(Float32(2.0) - ux) + Float32(maxCos * ux)))) ^ Float32(1.5)) * (sin(Float32(Float32(2.0) * Float32(Float32(pi) * uy))) ^ Float32(3.0))))
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)}
\sqrt[3]{{\left(\left(1 - maxCos\right) \cdot \left(ux \cdot \left(\left(2 - ux\right) + maxCos \cdot ux\right)\right)\right)}^{1.5} \cdot {\sin \left(2 \cdot \left(\pi \cdot uy\right)\right)}^{3}}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 13.5

    \[\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. Simplified13.5

    \[\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
    (*.f32 (sin.f32 (*.f32 uy (*.f32 2 (PI.f32)))) (sqrt.f32 (fma.f32 (-.f32 (fma.f32 ux maxCos 1) ux) (-.f32 ux (fma.f32 ux maxCos 1)) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (Rewrite<= associate-*l*_binary32 (*.f32 (*.f32 uy 2) (PI.f32)))) (sqrt.f32 (fma.f32 (-.f32 (fma.f32 ux maxCos 1) ux) (-.f32 ux (fma.f32 ux maxCos 1)) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (-.f32 (Rewrite<= fma-def_binary32 (+.f32 (*.f32 ux maxCos) 1)) ux) (-.f32 ux (fma.f32 ux maxCos 1)) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (Rewrite<= associate-+r-_binary32 (+.f32 (*.f32 ux maxCos) (-.f32 1 ux))) (-.f32 ux (fma.f32 ux maxCos 1)) 1))): 1 points increase in error, 12 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (Rewrite<= +-commutative_binary32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos))) (-.f32 ux (fma.f32 ux maxCos 1)) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)) (-.f32 ux (Rewrite<= fma-def_binary32 (+.f32 (*.f32 ux maxCos) 1))) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)) (Rewrite<= unsub-neg_binary32 (+.f32 ux (neg.f32 (+.f32 (*.f32 ux maxCos) 1)))) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)) (+.f32 (Rewrite<= remove-double-neg_binary32 (neg.f32 (neg.f32 ux))) (neg.f32 (+.f32 (*.f32 ux maxCos) 1))) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)) (Rewrite<= distribute-neg-in_binary32 (neg.f32 (+.f32 (neg.f32 ux) (+.f32 (*.f32 ux maxCos) 1)))) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)) (neg.f32 (Rewrite<= +-commutative_binary32 (+.f32 (+.f32 (*.f32 ux maxCos) 1) (neg.f32 ux)))) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)) (neg.f32 (Rewrite<= associate-+r+_binary32 (+.f32 (*.f32 ux maxCos) (+.f32 1 (neg.f32 ux))))) 1))): 7 points increase in error, 5 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)) (neg.f32 (+.f32 (*.f32 ux maxCos) (Rewrite<= sub-neg_binary32 (-.f32 1 ux)))) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (fma.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)) (neg.f32 (Rewrite<= +-commutative_binary32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)))) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (Rewrite<= fma-def_binary32 (+.f32 (*.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)) (neg.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)))) 1)))): 83 points increase in error, 70 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (+.f32 (Rewrite<= *-commutative_binary32 (*.f32 (neg.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos))) (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)))) 1))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (Rewrite<= +-commutative_binary32 (+.f32 1 (*.f32 (neg.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos))) (+.f32 (-.f32 1 ux) (*.f32 ux maxCos))))))): 0 points increase in error, 0 points decrease in error
    (*.f32 (sin.f32 (*.f32 (*.f32 uy 2) (PI.f32))) (sqrt.f32 (Rewrite<= cancel-sign-sub-inv_binary32 (-.f32 1 (*.f32 (+.f32 (-.f32 1 ux) (*.f32 ux maxCos)) (+.f32 (-.f32 1 ux) (*.f32 ux maxCos))))))): 0 points increase in error, 0 points decrease in error
  3. Taylor expanded in ux around 0 0.5

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(1 - maxCos\right) \cdot \left(ux \cdot 2 - ux \cdot \left(ux - ux \cdot maxCos\right)\right)}} \]
    Proof
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 ux 2) (*.f32 ux (-.f32 ux (*.f32 ux maxCos))))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (Rewrite<= *-commutative_binary32 (*.f32 2 ux)) (*.f32 ux (-.f32 ux (*.f32 ux maxCos))))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (Rewrite<= remove-double-div_binary32 (/.f32 1 (/.f32 1 ux))) (-.f32 ux (*.f32 ux maxCos))))): 2 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (Rewrite<= unpow-1_binary32 (pow.f32 (/.f32 1 ux) -1)) (-.f32 ux (*.f32 ux maxCos))))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (pow.f32 (/.f32 1 ux) (Rewrite<= metadata-eval (/.f32 -2 2))) (-.f32 ux (*.f32 ux maxCos))))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (pow.f32 (/.f32 1 ux) (/.f32 -2 2)) (-.f32 (Rewrite<= *-rgt-identity_binary32 (*.f32 ux 1)) (*.f32 ux maxCos))))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (pow.f32 (/.f32 1 ux) (/.f32 -2 2)) (Rewrite=> distribute-lft-out--_binary32 (*.f32 ux (-.f32 1 maxCos)))))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (pow.f32 (/.f32 1 ux) (/.f32 -2 2)) (*.f32 (Rewrite<= remove-double-div_binary32 (/.f32 1 (/.f32 1 ux))) (-.f32 1 maxCos))))): 1 points increase in error, 1 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (pow.f32 (/.f32 1 ux) (/.f32 -2 2)) (*.f32 (Rewrite<= unpow-1_binary32 (pow.f32 (/.f32 1 ux) -1)) (-.f32 1 maxCos))))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (pow.f32 (/.f32 1 ux) (/.f32 -2 2)) (*.f32 (pow.f32 (/.f32 1 ux) (Rewrite<= metadata-eval (/.f32 -2 2))) (-.f32 1 maxCos))))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (Rewrite<= associate-*l*_binary32 (*.f32 (*.f32 (pow.f32 (/.f32 1 ux) (/.f32 -2 2)) (pow.f32 (/.f32 1 ux) (/.f32 -2 2))) (-.f32 1 maxCos))))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (pow.f32 (/.f32 1 ux) (Rewrite=> metadata-eval -1)) (pow.f32 (/.f32 1 ux) (/.f32 -2 2))) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (pow.f32 (/.f32 1 ux) -1) (pow.f32 (/.f32 1 ux) (Rewrite=> metadata-eval -1))) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (Rewrite=> unpow-1_binary32 (/.f32 1 (/.f32 1 ux))) (pow.f32 (/.f32 1 ux) -1)) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (Rewrite=> remove-double-div_binary32 ux) (pow.f32 (/.f32 1 ux) -1)) (-.f32 1 maxCos)))): 1 points increase in error, 1 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 ux (Rewrite=> unpow-1_binary32 (/.f32 1 (/.f32 1 ux)))) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 ux (Rewrite=> remove-double-div_binary32 ux)) (-.f32 1 maxCos)))): 0 points increase in error, 2 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (Rewrite<= sqr-neg_binary32 (*.f32 (neg.f32 ux) (neg.f32 ux))) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (Rewrite=> neg-mul-1_binary32 (*.f32 -1 ux)) (neg.f32 ux)) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (*.f32 (Rewrite<= metadata-eval (/.f32 1 -1)) ux) (neg.f32 ux)) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (Rewrite<= associate-/r/_binary32 (/.f32 1 (/.f32 -1 ux))) (neg.f32 ux)) (-.f32 1 maxCos)))): 2 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (Rewrite<= unpow-1_binary32 (pow.f32 (/.f32 -1 ux) -1)) (neg.f32 ux)) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (pow.f32 (/.f32 -1 ux) -1) (Rewrite=> neg-mul-1_binary32 (*.f32 -1 ux))) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (pow.f32 (/.f32 -1 ux) -1) (*.f32 (Rewrite<= metadata-eval (/.f32 1 -1)) ux)) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (pow.f32 (/.f32 -1 ux) -1) (Rewrite<= associate-/r/_binary32 (/.f32 1 (/.f32 -1 ux)))) (-.f32 1 maxCos)))): 1 points increase in error, 1 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (*.f32 (pow.f32 (/.f32 -1 ux) -1) (Rewrite<= unpow-1_binary32 (pow.f32 (/.f32 -1 ux) -1))) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (Rewrite=> pow-sqr_binary32 (pow.f32 (/.f32 -1 ux) (*.f32 2 -1))) (-.f32 1 maxCos)))): 2 points increase in error, 3 points decrease in error
    (*.f32 (-.f32 1 maxCos) (-.f32 (*.f32 2 ux) (*.f32 (pow.f32 (/.f32 -1 ux) (Rewrite=> metadata-eval -2)) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= distribute-rgt-out--_binary32 (-.f32 (*.f32 (*.f32 2 ux) (-.f32 1 maxCos)) (*.f32 (*.f32 (pow.f32 (/.f32 -1 ux) -2) (-.f32 1 maxCos)) (-.f32 1 maxCos)))): 2 points increase in error, 4 points decrease in error
    (-.f32 (*.f32 (*.f32 2 ux) (Rewrite=> sub-neg_binary32 (+.f32 1 (neg.f32 maxCos)))) (*.f32 (*.f32 (pow.f32 (/.f32 -1 ux) -2) (-.f32 1 maxCos)) (-.f32 1 maxCos))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 (*.f32 2 ux) (+.f32 1 (Rewrite<= mul-1-neg_binary32 (*.f32 -1 maxCos)))) (*.f32 (*.f32 (pow.f32 (/.f32 -1 ux) -2) (-.f32 1 maxCos)) (-.f32 1 maxCos))): 0 points increase in error, 0 points decrease in error
    (-.f32 (Rewrite<= associate-*r*_binary32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos))))) (*.f32 (*.f32 (pow.f32 (/.f32 -1 ux) -2) (-.f32 1 maxCos)) (-.f32 1 maxCos))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (Rewrite<= associate-*r*_binary32 (*.f32 (pow.f32 (/.f32 -1 ux) -2) (*.f32 (-.f32 1 maxCos) (-.f32 1 maxCos))))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (pow.f32 (/.f32 -1 ux) -2) (Rewrite<= unpow2_binary32 (pow.f32 (-.f32 1 maxCos) 2)))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (pow.f32 (/.f32 -1 ux) -2) (pow.f32 (Rewrite=> sub-neg_binary32 (+.f32 1 (neg.f32 maxCos))) 2))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (pow.f32 (/.f32 -1 ux) -2) (pow.f32 (+.f32 1 (Rewrite<= mul-1-neg_binary32 (*.f32 -1 maxCos))) 2))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (Rewrite=> *-commutative_binary32 (*.f32 (pow.f32 (+.f32 1 (*.f32 -1 maxCos)) 2) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (pow.f32 (+.f32 1 (Rewrite=> mul-1-neg_binary32 (neg.f32 maxCos))) 2) (pow.f32 (/.f32 -1 ux) -2))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (pow.f32 (Rewrite<= sub-neg_binary32 (-.f32 1 maxCos)) 2) (pow.f32 (/.f32 -1 ux) -2))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (Rewrite=> unpow2_binary32 (*.f32 (-.f32 1 maxCos) (-.f32 1 maxCos))) (pow.f32 (/.f32 -1 ux) -2))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (Rewrite=> associate-*l*_binary32 (*.f32 (-.f32 1 maxCos) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2))))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (Rewrite=> sub-neg_binary32 (+.f32 1 (neg.f32 maxCos))) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (Rewrite=> +-commutative_binary32 (+.f32 (neg.f32 maxCos) 1)) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (+.f32 (Rewrite=> neg-sub0_binary32 (-.f32 0 maxCos)) 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (Rewrite<= associate--r-_binary32 (-.f32 0 (-.f32 maxCos 1))) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (-.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (Rewrite<= neg-sub0_binary32 (neg.f32 (-.f32 maxCos 1))) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (Rewrite=> cancel-sign-sub_binary32 (+.f32 (*.f32 2 (*.f32 ux (+.f32 1 (*.f32 -1 maxCos)))) (*.f32 (-.f32 maxCos 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 2 (Rewrite=> *-commutative_binary32 (*.f32 (+.f32 1 (*.f32 -1 maxCos)) ux))) (*.f32 (-.f32 maxCos 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 2 (*.f32 (+.f32 1 (Rewrite=> mul-1-neg_binary32 (neg.f32 maxCos))) ux)) (*.f32 (-.f32 maxCos 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 2 (*.f32 (Rewrite<= sub-neg_binary32 (-.f32 1 maxCos)) ux)) (*.f32 (-.f32 maxCos 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (Rewrite=> associate-*r*_binary32 (*.f32 (*.f32 2 (-.f32 1 maxCos)) ux)) (*.f32 (-.f32 maxCos 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (Rewrite<= count-2_binary32 (+.f32 (-.f32 1 maxCos) (-.f32 1 maxCos))) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (Rewrite<= associate--l+_binary32 (-.f32 (+.f32 (-.f32 1 maxCos) 1) maxCos)) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 7 points increase in error, 9 points decrease in error
    (+.f32 (*.f32 (-.f32 (Rewrite<= associate--r-_binary32 (-.f32 1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (Rewrite<= unsub-neg_binary32 (+.f32 1 (neg.f32 (-.f32 maxCos 1)))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (Rewrite<= mul-1-neg_binary32 (*.f32 -1 (-.f32 maxCos 1)))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (-.f32 1 maxCos) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (Rewrite=> sub-neg_binary32 (+.f32 1 (neg.f32 maxCos))) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (Rewrite=> +-commutative_binary32 (+.f32 (neg.f32 maxCos) 1)) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (+.f32 (Rewrite=> neg-sub0_binary32 (-.f32 0 maxCos)) 1) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (Rewrite<= associate--r-_binary32 (-.f32 0 (-.f32 maxCos 1))) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (Rewrite<= neg-sub0_binary32 (neg.f32 (-.f32 maxCos 1))) (pow.f32 (/.f32 -1 ux) -2)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (pow.f32 (/.f32 -1 ux) (Rewrite<= metadata-eval (*.f32 2 -1)))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (Rewrite<= pow-sqr_binary32 (*.f32 (pow.f32 (/.f32 -1 ux) -1) (pow.f32 (/.f32 -1 ux) -1)))))): 3 points increase in error, 2 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (*.f32 (Rewrite=> unpow-1_binary32 (/.f32 1 (/.f32 -1 ux))) (pow.f32 (/.f32 -1 ux) -1))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (*.f32 (Rewrite=> associate-/r/_binary32 (*.f32 (/.f32 1 -1) ux)) (pow.f32 (/.f32 -1 ux) -1))))): 1 points increase in error, 1 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (*.f32 (*.f32 (Rewrite=> metadata-eval -1) ux) (pow.f32 (/.f32 -1 ux) -1))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (*.f32 (Rewrite<= neg-mul-1_binary32 (neg.f32 ux)) (pow.f32 (/.f32 -1 ux) -1))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (*.f32 (neg.f32 ux) (Rewrite=> unpow-1_binary32 (/.f32 1 (/.f32 -1 ux))))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (*.f32 (neg.f32 ux) (Rewrite=> associate-/r/_binary32 (*.f32 (/.f32 1 -1) ux)))))): 0 points increase in error, 2 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (*.f32 (neg.f32 ux) (*.f32 (Rewrite=> metadata-eval -1) ux))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (*.f32 (neg.f32 ux) (Rewrite<= neg-mul-1_binary32 (neg.f32 ux)))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (Rewrite=> sqr-neg_binary32 (*.f32 ux ux))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (neg.f32 (-.f32 maxCos 1)) (Rewrite<= unpow2_binary32 (pow.f32 ux 2))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (Rewrite=> distribute-lft-neg-out_binary32 (neg.f32 (*.f32 (-.f32 maxCos 1) (pow.f32 ux 2)))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (neg.f32 (Rewrite=> *-commutative_binary32 (*.f32 (pow.f32 ux 2) (-.f32 maxCos 1)))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (Rewrite<= distribute-rgt-neg-out_binary32 (*.f32 (pow.f32 ux 2) (neg.f32 (-.f32 maxCos 1)))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (pow.f32 ux 2) (Rewrite=> neg-sub0_binary32 (-.f32 0 (-.f32 maxCos 1)))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (pow.f32 ux 2) (Rewrite=> associate--r-_binary32 (+.f32 (-.f32 0 maxCos) 1))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (pow.f32 ux 2) (+.f32 (Rewrite<= neg-sub0_binary32 (neg.f32 maxCos)) 1)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (pow.f32 ux 2) (Rewrite<= +-commutative_binary32 (+.f32 1 (neg.f32 maxCos)))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (*.f32 (-.f32 maxCos 1) (*.f32 (pow.f32 ux 2) (Rewrite<= sub-neg_binary32 (-.f32 1 maxCos))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (Rewrite<= associate-*l*_binary32 (*.f32 (*.f32 (-.f32 maxCos 1) (pow.f32 ux 2)) (-.f32 1 maxCos)))): 0 points increase in error, 0 points decrease in error
    (+.f32 (*.f32 (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos) ux) (Rewrite<= *-commutative_binary32 (*.f32 (-.f32 1 maxCos) (*.f32 (-.f32 maxCos 1) (pow.f32 ux 2))))): 0 points increase in error, 0 points decrease in error
    (+.f32 (Rewrite<= *-commutative_binary32 (*.f32 ux (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos))) (*.f32 (-.f32 1 maxCos) (*.f32 (-.f32 maxCos 1) (pow.f32 ux 2)))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= +-commutative_binary32 (+.f32 (*.f32 (-.f32 1 maxCos) (*.f32 (-.f32 maxCos 1) (pow.f32 ux 2))) (*.f32 ux (-.f32 (+.f32 1 (*.f32 -1 (-.f32 maxCos 1))) maxCos)))): 0 points increase in error, 0 points decrease in error
  5. Applied egg-rr0.5

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

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

Alternatives

Alternative 1
Error0.5
Cost16608
\[\sqrt[3]{{\left(\sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(\left(2 - ux\right) + maxCos \cdot ux\right)\right)} \cdot \sin \left(2 \cdot \left(\pi \cdot uy\right)\right)\right)}^{3}} \]
Alternative 2
Error0.5
Cost10176
\[\sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(\left(2 - ux\right) + maxCos \cdot ux\right)\right)} \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \]
Alternative 3
Error1.4
Cost10052
\[\begin{array}{l} \mathbf{if}\;2 \cdot uy \leq 0.0006500000017695129:\\ \;\;\;\;2 \cdot \left(\sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(\left(2 + maxCos \cdot ux\right) - ux\right)\right)} \cdot \left(\pi \cdot uy\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{ux \cdot \left(2 - ux\right)} \cdot \sin \left(2 \cdot \left(\pi \cdot uy\right)\right)\\ \end{array} \]
Alternative 4
Error0.9
Cost10048
\[\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(2 - ux\right)\right)} \]
Alternative 5
Error3.4
Cost9988
\[\begin{array}{l} \mathbf{if}\;2 \cdot uy \leq 0.003100000089034438:\\ \;\;\;\;2 \cdot \left(\sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(\left(2 + maxCos \cdot ux\right) - ux\right)\right)} \cdot \left(\pi \cdot uy\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(2 \cdot \left(\pi \cdot uy\right)\right) \cdot \sqrt{ux \cdot 2}\\ \end{array} \]
Alternative 6
Error5.9
Cost6976
\[2 \cdot \left(\sqrt{\left(1 - maxCos\right) \cdot \left(ux \cdot \left(\left(2 + maxCos \cdot ux\right) - ux\right)\right)} \cdot \left(\pi \cdot uy\right)\right) \]
Alternative 7
Error7.4
Cost6912
\[\left(2 \cdot \left(\pi \cdot uy\right)\right) \cdot \sqrt{\frac{ux}{ux + 2} \cdot \left(4 - ux \cdot ux\right)} \]
Alternative 8
Error7.3
Cost6720
\[\sqrt{ux \cdot \left(2 - ux\right)} \cdot \left(2 \cdot \left(\pi \cdot uy\right)\right) \]
Alternative 9
Error7.3
Cost6720
\[\left(2 \cdot uy\right) \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right) \]
Alternative 10
Error11.8
Cost6656
\[\left(2 \cdot \left(\pi \cdot uy\right)\right) \cdot \sqrt{ux \cdot 2} \]
Alternative 11
Error29.7
Cost6592
\[2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{0}\right)\right) \]

Error

Reproduce

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