UniformSampleCone, y

Percentage Accurate: 57.4% → 98.1%
Time: 36.2s
Alternatives: 20
Speedup: 2.0×

Specification

?
\[\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)\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t\_0 \cdot t\_0} \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
   (* (sin (* (* uy 2.0) PI)) (sqrt (- 1.0 (* t_0 t_0))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = (1.0f - ux) + (ux * maxCos);
	return sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - (t_0 * t_0)));
}
function code(ux, uy, maxCos)
	t_0 = Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos))
	return Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0))))
end
function tmp = code(ux, uy, maxCos)
	t_0 = (single(1.0) - ux) + (ux * maxCos);
	tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt((single(1.0) - (t_0 * t_0)));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
\end{array}

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 20 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 57.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t\_0 \cdot t\_0} \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
   (* (sin (* (* uy 2.0) PI)) (sqrt (- 1.0 (* t_0 t_0))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = (1.0f - ux) + (ux * maxCos);
	return sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - (t_0 * t_0)));
}
function code(ux, uy, maxCos)
	t_0 = Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos))
	return Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0))))
end
function tmp = code(ux, uy, maxCos)
	t_0 = (single(1.0) - ux) + (ux * maxCos);
	tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt((single(1.0) - (t_0 * t_0)));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
\end{array}

Alternative 1: 98.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\\ \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \frac{1}{\frac{\left(\frac{-2 \cdot maxCos}{ux} - \frac{2}{ux}\right) + t\_0}{\left(maxCos \cdot maxCos\right) \cdot \frac{4}{ux \cdot ux} + \left(\frac{2}{ux} + \left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right) \cdot \left(t\_0 - \frac{2}{ux}\right)}}} \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* (- 1.0 maxCos) (- 1.0 maxCos))))
   (*
    (sin (* (* uy 2.0) PI))
    (sqrt
     (*
      (* ux ux)
      (/
       1.0
       (/
        (+ (- (/ (* -2.0 maxCos) ux) (/ 2.0 ux)) t_0)
        (+
         (* (* maxCos maxCos) (/ 4.0 (* ux ux)))
         (*
          (+ (/ 2.0 ux) (* (- 1.0 maxCos) (+ maxCos -1.0)))
          (- t_0 (/ 2.0 ux)))))))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = (1.0f - maxCos) * (1.0f - maxCos);
	return sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf(((ux * ux) * (1.0f / (((((-2.0f * maxCos) / ux) - (2.0f / ux)) + t_0) / (((maxCos * maxCos) * (4.0f / (ux * ux))) + (((2.0f / ux) + ((1.0f - maxCos) * (maxCos + -1.0f))) * (t_0 - (2.0f / ux))))))));
}
function code(ux, uy, maxCos)
	t_0 = Float32(Float32(Float32(1.0) - maxCos) * Float32(Float32(1.0) - maxCos))
	return Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(ux * ux) * Float32(Float32(1.0) / Float32(Float32(Float32(Float32(Float32(Float32(-2.0) * maxCos) / ux) - Float32(Float32(2.0) / ux)) + t_0) / Float32(Float32(Float32(maxCos * maxCos) * Float32(Float32(4.0) / Float32(ux * ux))) + Float32(Float32(Float32(Float32(2.0) / ux) + Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0)))) * Float32(t_0 - Float32(Float32(2.0) / ux)))))))))
end
function tmp = code(ux, uy, maxCos)
	t_0 = (single(1.0) - maxCos) * (single(1.0) - maxCos);
	tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt(((ux * ux) * (single(1.0) / (((((single(-2.0) * maxCos) / ux) - (single(2.0) / ux)) + t_0) / (((maxCos * maxCos) * (single(4.0) / (ux * ux))) + (((single(2.0) / ux) + ((single(1.0) - maxCos) * (maxCos + single(-1.0)))) * (t_0 - (single(2.0) / ux))))))));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \frac{1}{\frac{\left(\frac{-2 \cdot maxCos}{ux} - \frac{2}{ux}\right) + t\_0}{\left(maxCos \cdot maxCos\right) \cdot \frac{4}{ux \cdot ux} + \left(\frac{2}{ux} + \left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right) \cdot \left(t\_0 - \frac{2}{ux}\right)}}}
\end{array}
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around -inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    6. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    9. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    11. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    14. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    15. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    18. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    19. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
  6. Taylor expanded in ux around inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    6. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    8. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    9. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    10. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    12. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    13. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    14. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    16. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    17. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    18. --lowering--.f3298.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
  8. Simplified98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
  9. Applied egg-rr98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\frac{1}{\frac{\left(\frac{-2 \cdot maxCos}{ux} - \frac{2}{ux}\right) + \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)}{\left(maxCos \cdot maxCos\right) \cdot \frac{4}{ux \cdot ux} - \left(\frac{2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right) \cdot \left(\frac{2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}}}} \]
  10. Final simplification98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \frac{1}{\frac{\left(\frac{-2 \cdot maxCos}{ux} - \frac{2}{ux}\right) + \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)}{\left(maxCos \cdot maxCos\right) \cdot \frac{4}{ux \cdot ux} + \left(\frac{2}{ux} + \left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right) - \frac{2}{ux}\right)}}} \]
  11. Add Preprocessing

Alternative 2: 98.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sin (* (* uy 2.0) PI))
  (sqrt
   (*
    (* ux ux)
    (+
     (/ (* -2.0 maxCos) ux)
     (+ (/ 2.0 ux) (* (- 1.0 maxCos) (+ maxCos -1.0))))))))
float code(float ux, float uy, float maxCos) {
	return sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf(((ux * ux) * (((-2.0f * maxCos) / ux) + ((2.0f / ux) + ((1.0f - maxCos) * (maxCos + -1.0f))))));
}
function code(ux, uy, maxCos)
	return Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(ux * ux) * Float32(Float32(Float32(Float32(-2.0) * maxCos) / ux) + Float32(Float32(Float32(2.0) / ux) + Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))))))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt(((ux * ux) * (((single(-2.0) * maxCos) / ux) + ((single(2.0) / ux) + ((single(1.0) - maxCos) * (maxCos + single(-1.0)))))));
end
\begin{array}{l}

\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)}
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around -inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    6. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    9. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    11. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    14. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    15. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    18. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    19. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
  6. Taylor expanded in ux around inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    6. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    8. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    9. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    10. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    12. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    13. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    14. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    16. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    17. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    18. --lowering--.f3298.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
  8. Simplified98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
  9. Final simplification98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)} \]
  10. Add Preprocessing

Alternative 3: 98.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \frac{\left(2 + -2 \cdot maxCos\right) + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)}{ux}} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sin (* (* uy 2.0) PI))
  (sqrt
   (*
    (* ux ux)
    (/
     (+ (+ 2.0 (* -2.0 maxCos)) (* ux (* (- 1.0 maxCos) (+ maxCos -1.0))))
     ux)))))
float code(float ux, float uy, float maxCos) {
	return sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf(((ux * ux) * (((2.0f + (-2.0f * maxCos)) + (ux * ((1.0f - maxCos) * (maxCos + -1.0f)))) / ux)));
}
function code(ux, uy, maxCos)
	return Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(ux * ux) * Float32(Float32(Float32(Float32(2.0) + Float32(Float32(-2.0) * maxCos)) + Float32(ux * Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))))) / ux))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt(((ux * ux) * (((single(2.0) + (single(-2.0) * maxCos)) + (ux * ((single(1.0) - maxCos) * (maxCos + single(-1.0))))) / ux)));
end
\begin{array}{l}

\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \frac{\left(2 + -2 \cdot maxCos\right) + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)}{ux}}
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around -inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    6. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    9. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    11. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    14. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    15. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    18. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    19. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
  6. Taylor expanded in ux around inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    6. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    8. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    9. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    10. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    12. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    13. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    14. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    16. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    17. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    18. --lowering--.f3298.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
  8. Simplified98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
  9. Taylor expanded in ux around 0

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\left(\frac{2 + \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)}{ux}\right)}\right)\right)\right) \]
  10. Step-by-step derivation
    1. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\left(2 + \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right), ux\right)\right)\right)\right) \]
    2. associate-+r+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\left(\left(2 + -2 \cdot maxCos\right) + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right), ux\right)\right)\right)\right) \]
    3. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\left(\left(2 + -2 \cdot maxCos\right) + \left(\mathsf{neg}\left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right), ux\right)\right)\right)\right) \]
    4. unsub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\left(\left(2 + -2 \cdot maxCos\right) - ux \cdot {\left(1 - maxCos\right)}^{2}\right), ux\right)\right)\right)\right) \]
    5. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\left(2 + -2 \cdot maxCos\right), \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right), ux\right)\right)\right)\right) \]
    6. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right), ux\right)\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right), ux\right)\right)\right)\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), \mathsf{*.f32}\left(ux, \left({\left(1 - maxCos\right)}^{2}\right)\right)\right), ux\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), \mathsf{*.f32}\left(ux, \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right), ux\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right), ux\right)\right)\right)\right) \]
    11. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right), ux\right)\right)\right)\right) \]
    12. --lowering--.f3298.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right), ux\right)\right)\right)\right) \]
  11. Simplified98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\frac{\left(2 + -2 \cdot maxCos\right) - ux \cdot \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}{ux}}} \]
  12. Final simplification98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \frac{\left(2 + -2 \cdot maxCos\right) + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)}{ux}} \]
  13. Add Preprocessing

Alternative 4: 98.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}\right)} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sin (* (* uy 2.0) PI))
  (sqrt
   (*
    (* ux ux)
    (+ (* (- 1.0 maxCos) (+ maxCos -1.0)) (/ (+ 2.0 (* -2.0 maxCos)) ux))))))
float code(float ux, float uy, float maxCos) {
	return sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf(((ux * ux) * (((1.0f - maxCos) * (maxCos + -1.0f)) + ((2.0f + (-2.0f * maxCos)) / ux))));
}
function code(ux, uy, maxCos)
	return Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(ux * ux) * Float32(Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))) + Float32(Float32(Float32(2.0) + Float32(Float32(-2.0) * maxCos)) / ux)))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt(((ux * ux) * (((single(1.0) - maxCos) * (maxCos + single(-1.0))) + ((single(2.0) + (single(-2.0) * maxCos)) / ux))));
end
\begin{array}{l}

\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}\right)}
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around -inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    6. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    9. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    11. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    14. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    15. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    18. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    19. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
  6. Final simplification98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}\right)} \]
  7. Add Preprocessing

Alternative 5: 98.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt{\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}} \cdot \left(ux \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right) \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sqrt (+ (* (- 1.0 maxCos) (+ maxCos -1.0)) (/ (+ 2.0 (* -2.0 maxCos)) ux)))
  (* ux (sin (* 2.0 (* uy PI))))))
float code(float ux, float uy, float maxCos) {
	return sqrtf((((1.0f - maxCos) * (maxCos + -1.0f)) + ((2.0f + (-2.0f * maxCos)) / ux))) * (ux * sinf((2.0f * (uy * ((float) M_PI)))));
}
function code(ux, uy, maxCos)
	return Float32(sqrt(Float32(Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))) + Float32(Float32(Float32(2.0) + Float32(Float32(-2.0) * maxCos)) / ux))) * Float32(ux * sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sqrt((((single(1.0) - maxCos) * (maxCos + single(-1.0))) + ((single(2.0) + (single(-2.0) * maxCos)) / ux))) * (ux * sin((single(2.0) * (uy * single(pi)))));
end
\begin{array}{l}

\\
\sqrt{\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}} \cdot \left(ux \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around -inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    6. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    9. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    11. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    14. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    15. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    18. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    19. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
  6. Taylor expanded in ux around inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    6. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    8. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    9. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    10. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    12. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    13. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    14. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    16. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    17. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    18. --lowering--.f3298.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
  8. Simplified98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
  9. Taylor expanded in uy around inf

    \[\leadsto \color{blue}{\left(ux \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 - maxCos\right)}^{2}}} \]
  10. Simplified98.2%

    \[\leadsto \color{blue}{\sqrt{\frac{2 + -2 \cdot maxCos}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)} \cdot \left(ux \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} \]
  11. Final simplification98.2%

    \[\leadsto \sqrt{\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}} \cdot \left(ux \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right) \]
  12. Add Preprocessing

Alternative 6: 98.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 + \left(-2 \cdot maxCos + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sin (* (* uy 2.0) PI))
  (sqrt
   (*
    ux
    (+ 2.0 (+ (* -2.0 maxCos) (* ux (* (- 1.0 maxCos) (+ maxCos -1.0)))))))))
float code(float ux, float uy, float maxCos) {
	return sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((ux * (2.0f + ((-2.0f * maxCos) + (ux * ((1.0f - maxCos) * (maxCos + -1.0f)))))));
}
function code(ux, uy, maxCos)
	return Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(2.0) + Float32(Float32(Float32(-2.0) * maxCos) + Float32(ux * Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0)))))))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt((ux * (single(2.0) + ((single(-2.0) * maxCos) + (ux * ((single(1.0) - maxCos) * (maxCos + single(-1.0))))))));
end
\begin{array}{l}

\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 + \left(-2 \cdot maxCos + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)}
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around -inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    6. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    9. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    11. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    14. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    15. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    18. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    19. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
  6. Taylor expanded in ux around 0

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(2 + \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)}\right)\right) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    2. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    3. fma-defineN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(\mathsf{fma}\left(-2, maxCos, -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    4. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(\mathsf{fma}\left(-2, maxCos, \mathsf{neg}\left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    5. fmm-undefN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-2 \cdot maxCos - ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    6. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-2 \cdot maxCos\right), \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    11. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    12. --lowering--.f3298.2%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
  8. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + \left(-2 \cdot maxCos - ux \cdot \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
  9. Final simplification98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 + \left(-2 \cdot maxCos + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)} \]
  10. Add Preprocessing

Alternative 7: 96.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.002199999988079071:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(-2 \cdot maxCos + \left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} + -1\right)}\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= (* uy 2.0) 0.002199999988079071)
   (*
    (*
     uy
     (+ (* (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI))) (* 2.0 PI)))
    (sqrt
     (*
      ux
      (+ (* -2.0 maxCos) (+ 2.0 (* (- 1.0 maxCos) (* ux (+ maxCos -1.0))))))))
   (* (sin (* (* uy 2.0) PI)) (sqrt (* (* ux ux) (+ (/ 2.0 ux) -1.0))))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if ((uy * 2.0f) <= 0.002199999988079071f) {
		tmp = (uy * (((-1.3333333333333333f * (uy * uy)) * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))) + (2.0f * ((float) M_PI)))) * sqrtf((ux * ((-2.0f * maxCos) + (2.0f + ((1.0f - maxCos) * (ux * (maxCos + -1.0f)))))));
	} else {
		tmp = sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf(((ux * ux) * ((2.0f / ux) + -1.0f)));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (Float32(uy * Float32(2.0)) <= Float32(0.002199999988079071))
		tmp = Float32(Float32(uy * Float32(Float32(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))) + Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(ux * Float32(Float32(Float32(-2.0) * maxCos) + Float32(Float32(2.0) + Float32(Float32(Float32(1.0) - maxCos) * Float32(ux * Float32(maxCos + Float32(-1.0)))))))));
	else
		tmp = Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(ux * ux) * Float32(Float32(Float32(2.0) / ux) + Float32(-1.0)))));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if ((uy * single(2.0)) <= single(0.002199999988079071))
		tmp = (uy * (((single(-1.3333333333333333) * (uy * uy)) * (single(pi) * (single(pi) * single(pi)))) + (single(2.0) * single(pi)))) * sqrt((ux * ((single(-2.0) * maxCos) + (single(2.0) + ((single(1.0) - maxCos) * (ux * (maxCos + single(-1.0))))))));
	else
		tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt(((ux * ux) * ((single(2.0) / ux) + single(-1.0))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;uy \cdot 2 \leq 0.002199999988079071:\\
\;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(-2 \cdot maxCos + \left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} + -1\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy #s(literal 2 binary32)) < 0.0022

    1. Initial program 59.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. Add Preprocessing
    3. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(-2 \cdot maxCos\right)\right)\right)\right)\right) \]
    5. Simplified98.3%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)}} \]
    6. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)}\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \color{blue}{\mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)}\right)\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\color{blue}{\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)}, \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\color{blue}{\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)}, \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(\color{blue}{2}, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left(uy \cdot uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      8. cube-multN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \color{blue}{\mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)}\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \color{blue}{\mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)}\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\color{blue}{\mathsf{+.f32}\left(maxCos, -1\right)}, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \color{blue}{\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)}\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      12. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(\color{blue}{ux}, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      13. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \color{blue}{\mathsf{+.f32}\left(maxCos, -1\right)}\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \color{blue}{\mathsf{*.f32}\left(maxCos, -2\right)}\right)\right)\right)\right) \]
      15. PI-lowering-PI.f3298.4%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, \color{blue}{-2}\right)\right)\right)\right)\right) \]
    8. Simplified98.4%

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

    if 0.0022 < (*.f32 uy #s(literal 2 binary32))

    1. Initial program 56.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. Add Preprocessing
    3. Taylor expanded in maxCos around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \color{blue}{\left(\sqrt{1 - {\left(1 - ux\right)}^{2}}\right)}\right) \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \left(\sqrt{1 - {\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right)}^{2}}\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \left(\sqrt{1 - {\left(1 + -1 \cdot ux\right)}^{2}}\right)\right) \]
      3. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\left(1 - {\left(1 + -1 \cdot ux\right)}^{2}\right)\right)\right) \]
      4. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \left({\left(1 + -1 \cdot ux\right)}^{2}\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \left(\left(1 + -1 \cdot ux\right) \cdot \left(1 + -1 \cdot ux\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\left(1 + -1 \cdot ux\right), \left(1 + -1 \cdot ux\right)\right)\right)\right)\right) \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right), \left(1 + -1 \cdot ux\right)\right)\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\left(1 - ux\right), \left(1 + -1 \cdot ux\right)\right)\right)\right)\right) \]
      9. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \left(1 + -1 \cdot ux\right)\right)\right)\right)\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right)\right)\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \left(1 - ux\right)\right)\right)\right)\right) \]
      12. --lowering--.f3255.7%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{\_.f32}\left(1, ux\right)\right)\right)\right)\right) \]
    5. Simplified55.7%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \color{blue}{\sqrt{1 - \left(1 - ux\right) \cdot \left(1 - ux\right)}} \]
    6. Taylor expanded in ux around inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - 1\right)\right)}\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(2 \cdot \frac{1}{ux} - 1\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(2 \cdot \frac{1}{ux} - 1\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(2 \cdot \frac{1}{ux} - 1\right)\right)\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(2 \cdot \frac{1}{ux} + -1\right)\right)\right)\right) \]
      6. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), -1\right)\right)\right)\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), -1\right)\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), -1\right)\right)\right)\right) \]
      9. /-lowering-/.f3292.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), -1\right)\right)\right)\right) \]
    8. Simplified92.5%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} + -1\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.002199999988079071:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(-2 \cdot maxCos + \left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} + -1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 96.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.002199999988079071:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(-2 \cdot maxCos + \left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\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} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= (* uy 2.0) 0.002199999988079071)
   (*
    (*
     uy
     (+ (* (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI))) (* 2.0 PI)))
    (sqrt
     (*
      ux
      (+ (* -2.0 maxCos) (+ 2.0 (* (- 1.0 maxCos) (* ux (+ maxCos -1.0))))))))
   (* (sin (* 2.0 (* uy PI))) (sqrt (* ux (- 2.0 ux))))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if ((uy * 2.0f) <= 0.002199999988079071f) {
		tmp = (uy * (((-1.3333333333333333f * (uy * uy)) * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))) + (2.0f * ((float) M_PI)))) * sqrtf((ux * ((-2.0f * maxCos) + (2.0f + ((1.0f - maxCos) * (ux * (maxCos + -1.0f)))))));
	} else {
		tmp = sinf((2.0f * (uy * ((float) M_PI)))) * sqrtf((ux * (2.0f - ux)));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (Float32(uy * Float32(2.0)) <= Float32(0.002199999988079071))
		tmp = Float32(Float32(uy * Float32(Float32(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))) + Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(ux * Float32(Float32(Float32(-2.0) * maxCos) + Float32(Float32(2.0) + Float32(Float32(Float32(1.0) - maxCos) * Float32(ux * Float32(maxCos + Float32(-1.0)))))))));
	else
		tmp = Float32(sin(Float32(Float32(2.0) * Float32(uy * Float32(pi)))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if ((uy * single(2.0)) <= single(0.002199999988079071))
		tmp = (uy * (((single(-1.3333333333333333) * (uy * uy)) * (single(pi) * (single(pi) * single(pi)))) + (single(2.0) * single(pi)))) * sqrt((ux * ((single(-2.0) * maxCos) + (single(2.0) + ((single(1.0) - maxCos) * (ux * (maxCos + single(-1.0))))))));
	else
		tmp = sin((single(2.0) * (uy * single(pi)))) * sqrt((ux * (single(2.0) - ux)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;uy \cdot 2 \leq 0.002199999988079071:\\
\;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(-2 \cdot maxCos + \left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy #s(literal 2 binary32)) < 0.0022

    1. Initial program 59.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. Add Preprocessing
    3. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(-2 \cdot maxCos\right)\right)\right)\right)\right) \]
    5. Simplified98.3%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)}} \]
    6. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)}\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \color{blue}{\mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)}\right)\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\color{blue}{\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)}, \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\color{blue}{\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)}, \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(\color{blue}{2}, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left(uy \cdot uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      8. cube-multN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \color{blue}{\mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)}\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \color{blue}{\mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)}\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\color{blue}{\mathsf{+.f32}\left(maxCos, -1\right)}, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \color{blue}{\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)}\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      12. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(\color{blue}{ux}, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      13. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \color{blue}{\mathsf{+.f32}\left(maxCos, -1\right)}\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \color{blue}{\mathsf{*.f32}\left(maxCos, -2\right)}\right)\right)\right)\right) \]
      15. PI-lowering-PI.f3298.4%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, \color{blue}{-2}\right)\right)\right)\right)\right) \]
    8. Simplified98.4%

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

    if 0.0022 < (*.f32 uy #s(literal 2 binary32))

    1. Initial program 56.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. Add Preprocessing
    3. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(-2 \cdot maxCos\right)\right)\right)\right)\right) \]
    5. Simplified97.9%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)}} \]
    6. Taylor expanded in maxCos around 0

      \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)}} \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(\sqrt{ux \cdot \left(2 - ux\right)}\right)}\right) \]
      3. sin-lowering-sin.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux \cdot \left(2 - ux\right)}}\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux} \cdot \left(2 - ux\right)}\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
      6. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
      7. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(2 - ux\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 - ux\right)\right)\right)\right) \]
      9. --lowering--.f3292.3%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    8. Simplified92.3%

      \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.002199999988079071:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(-2 \cdot maxCos + \left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\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} \]
  5. Add Preprocessing

Alternative 9: 93.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.029999999329447746:\\ \;\;\;\;\sqrt{\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}\right)} \cdot \left(uy \cdot \left(2 \cdot \pi + -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{2 \cdot ux}\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= (* uy 2.0) 0.029999999329447746)
   (*
    (sqrt
     (*
      (* ux ux)
      (+ (* (- 1.0 maxCos) (+ maxCos -1.0)) (/ (+ 2.0 (* -2.0 maxCos)) ux))))
    (*
     uy
     (+ (* 2.0 PI) (* -1.3333333333333333 (* (* uy uy) (* PI (* PI PI)))))))
   (* (sin (* (* uy 2.0) PI)) (sqrt (* 2.0 ux)))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if ((uy * 2.0f) <= 0.029999999329447746f) {
		tmp = sqrtf(((ux * ux) * (((1.0f - maxCos) * (maxCos + -1.0f)) + ((2.0f + (-2.0f * maxCos)) / ux)))) * (uy * ((2.0f * ((float) M_PI)) + (-1.3333333333333333f * ((uy * uy) * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))))));
	} else {
		tmp = sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((2.0f * ux));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (Float32(uy * Float32(2.0)) <= Float32(0.029999999329447746))
		tmp = Float32(sqrt(Float32(Float32(ux * ux) * Float32(Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))) + Float32(Float32(Float32(2.0) + Float32(Float32(-2.0) * maxCos)) / ux)))) * Float32(uy * Float32(Float32(Float32(2.0) * Float32(pi)) + Float32(Float32(-1.3333333333333333) * Float32(Float32(uy * uy) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))))))));
	else
		tmp = Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(2.0) * ux)));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if ((uy * single(2.0)) <= single(0.029999999329447746))
		tmp = sqrt(((ux * ux) * (((single(1.0) - maxCos) * (maxCos + single(-1.0))) + ((single(2.0) + (single(-2.0) * maxCos)) / ux)))) * (uy * ((single(2.0) * single(pi)) + (single(-1.3333333333333333) * ((uy * uy) * (single(pi) * (single(pi) * single(pi)))))));
	else
		tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt((single(2.0) * ux));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;uy \cdot 2 \leq 0.029999999329447746:\\
\;\;\;\;\sqrt{\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}\right)} \cdot \left(uy \cdot \left(2 \cdot \pi + -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{2 \cdot ux}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy #s(literal 2 binary32)) < 0.0299999993

    1. Initial program 59.2%

      \[\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. Add Preprocessing
    3. Taylor expanded in ux around -inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      6. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      10. div-subN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      11. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      13. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      15. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      19. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. Simplified98.4%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
    6. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)}\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)}\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\color{blue}{\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right)}, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\left({uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \color{blue}{ux}\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\left(uy \cdot uy\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
      7. cube-multN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
      9. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
      11. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
      12. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \color{blue}{\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)}\right)\right)\right)\right) \]
      14. PI-lowering-PI.f3298.2%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \color{blue}{\mathsf{\_.f32}\left(1, maxCos\right)}\right)\right)\right)\right)\right) \]
    8. Simplified98.2%

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

    if 0.0299999993 < (*.f32 uy #s(literal 2 binary32))

    1. Initial program 56.2%

      \[\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. Add Preprocessing
    3. Taylor expanded in maxCos around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \color{blue}{\left(\sqrt{1 - {\left(1 - ux\right)}^{2}}\right)}\right) \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \left(\sqrt{1 - {\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right)}^{2}}\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \left(\sqrt{1 - {\left(1 + -1 \cdot ux\right)}^{2}}\right)\right) \]
      3. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\left(1 - {\left(1 + -1 \cdot ux\right)}^{2}\right)\right)\right) \]
      4. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \left({\left(1 + -1 \cdot ux\right)}^{2}\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \left(\left(1 + -1 \cdot ux\right) \cdot \left(1 + -1 \cdot ux\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\left(1 + -1 \cdot ux\right), \left(1 + -1 \cdot ux\right)\right)\right)\right)\right) \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right), \left(1 + -1 \cdot ux\right)\right)\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\left(1 - ux\right), \left(1 + -1 \cdot ux\right)\right)\right)\right)\right) \]
      9. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \left(1 + -1 \cdot ux\right)\right)\right)\right)\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right)\right)\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \left(1 - ux\right)\right)\right)\right)\right) \]
      12. --lowering--.f3255.0%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{\_.f32}\left(1, ux\right)\right)\right)\right)\right) \]
    5. Simplified55.0%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \color{blue}{\sqrt{1 - \left(1 - ux\right) \cdot \left(1 - ux\right)}} \]
    6. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(2 \cdot ux\right)}\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f3271.7%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(2, ux\right)\right)\right) \]
    8. Simplified71.7%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{2 \cdot ux}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.029999999329447746:\\ \;\;\;\;\sqrt{\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}\right)} \cdot \left(uy \cdot \left(2 \cdot \pi + -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{2 \cdot ux}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 88.7% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}\right)} \cdot \left(uy \cdot \left(2 \cdot \pi + -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right) \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sqrt
   (*
    (* ux ux)
    (+ (* (- 1.0 maxCos) (+ maxCos -1.0)) (/ (+ 2.0 (* -2.0 maxCos)) ux))))
  (*
   uy
   (+ (* 2.0 PI) (* -1.3333333333333333 (* (* uy uy) (* PI (* PI PI))))))))
float code(float ux, float uy, float maxCos) {
	return sqrtf(((ux * ux) * (((1.0f - maxCos) * (maxCos + -1.0f)) + ((2.0f + (-2.0f * maxCos)) / ux)))) * (uy * ((2.0f * ((float) M_PI)) + (-1.3333333333333333f * ((uy * uy) * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))))));
}
function code(ux, uy, maxCos)
	return Float32(sqrt(Float32(Float32(ux * ux) * Float32(Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))) + Float32(Float32(Float32(2.0) + Float32(Float32(-2.0) * maxCos)) / ux)))) * Float32(uy * Float32(Float32(Float32(2.0) * Float32(pi)) + Float32(Float32(-1.3333333333333333) * Float32(Float32(uy * uy) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))))))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sqrt(((ux * ux) * (((single(1.0) - maxCos) * (maxCos + single(-1.0))) + ((single(2.0) + (single(-2.0) * maxCos)) / ux)))) * (uy * ((single(2.0) * single(pi)) + (single(-1.3333333333333333) * ((uy * uy) * (single(pi) * (single(pi) * single(pi)))))));
end
\begin{array}{l}

\\
\sqrt{\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}\right)} \cdot \left(uy \cdot \left(2 \cdot \pi + -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around -inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    6. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    9. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    11. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    14. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    15. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    18. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    19. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
  6. Taylor expanded in uy around 0

    \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)}\right)\right) \]
    2. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)}\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\color{blue}{\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right)}, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\left({uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \color{blue}{ux}\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\left(uy \cdot uy\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    7. cube-multN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    9. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    11. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    12. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right) \]
    13. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \color{blue}{\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)}\right)\right)\right)\right) \]
    14. PI-lowering-PI.f3288.1%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \color{blue}{\mathsf{\_.f32}\left(1, maxCos\right)}\right)\right)\right)\right)\right) \]
  8. Simplified88.1%

    \[\leadsto \color{blue}{\left(uy \cdot \left(-1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right) + 2 \cdot \pi\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)} \]
  9. Final simplification88.1%

    \[\leadsto \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}\right)} \cdot \left(uy \cdot \left(2 \cdot \pi + -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right) \]
  10. Add Preprocessing

Alternative 11: 88.7% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(-2 \cdot maxCos + \left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (* uy (+ (* (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI))) (* 2.0 PI)))
  (sqrt
   (*
    ux
    (+ (* -2.0 maxCos) (+ 2.0 (* (- 1.0 maxCos) (* ux (+ maxCos -1.0)))))))))
float code(float ux, float uy, float maxCos) {
	return (uy * (((-1.3333333333333333f * (uy * uy)) * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))) + (2.0f * ((float) M_PI)))) * sqrtf((ux * ((-2.0f * maxCos) + (2.0f + ((1.0f - maxCos) * (ux * (maxCos + -1.0f)))))));
}
function code(ux, uy, maxCos)
	return Float32(Float32(uy * Float32(Float32(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))) + Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(ux * Float32(Float32(Float32(-2.0) * maxCos) + Float32(Float32(2.0) + Float32(Float32(Float32(1.0) - maxCos) * Float32(ux * Float32(maxCos + Float32(-1.0)))))))))
end
function tmp = code(ux, uy, maxCos)
	tmp = (uy * (((single(-1.3333333333333333) * (uy * uy)) * (single(pi) * (single(pi) * single(pi)))) + (single(2.0) * single(pi)))) * sqrt((ux * ((single(-2.0) * maxCos) + (single(2.0) + ((single(1.0) - maxCos) * (ux * (maxCos + single(-1.0))))))));
end
\begin{array}{l}

\\
\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(-2 \cdot maxCos + \left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)}
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around 0

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)\right)\right) \]
    2. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
    3. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(-2 \cdot maxCos\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)}} \]
  6. Taylor expanded in uy around 0

    \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)}\right)\right) \]
    2. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \color{blue}{\mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)}\right)\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\color{blue}{\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)}, \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\color{blue}{\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)}, \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    5. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(\color{blue}{2}, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    6. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left(uy \cdot uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    8. cube-multN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \color{blue}{\mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)}\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \color{blue}{\mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)}\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    10. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\color{blue}{\mathsf{+.f32}\left(maxCos, -1\right)}, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \color{blue}{\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)}\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    12. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(\color{blue}{ux}, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    13. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \color{blue}{\mathsf{+.f32}\left(maxCos, -1\right)}\right)\right)\right), \mathsf{*.f32}\left(maxCos, -2\right)\right)\right)\right)\right) \]
    14. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \color{blue}{\mathsf{*.f32}\left(maxCos, -2\right)}\right)\right)\right)\right) \]
    15. PI-lowering-PI.f3288.1%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, \color{blue}{-2}\right)\right)\right)\right)\right) \]
  8. Simplified88.1%

    \[\leadsto \color{blue}{\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right)} \cdot \sqrt{ux \cdot \left(\left(2 - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)} \]
  9. Final simplification88.1%

    \[\leadsto \left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(-2 \cdot maxCos + \left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)} \]
  10. Add Preprocessing

Alternative 12: 87.3% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \left(\left(uy \cdot 2\right) \cdot {\left(\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \left(2 + -2 \cdot maxCos\right) \cdot \frac{1}{ux}\right)\right)}^{0.5}\right)\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= maxCos 4.999999873689376e-5)
   (*
    (*
     uy
     (+ (* (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI))) (* 2.0 PI)))
    (sqrt (* ux (- 2.0 ux))))
   (*
    PI
    (*
     (* uy 2.0)
     (pow
      (*
       (* ux ux)
       (+
        (* (- 1.0 maxCos) (+ maxCos -1.0))
        (* (+ 2.0 (* -2.0 maxCos)) (/ 1.0 ux))))
      0.5)))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (maxCos <= 4.999999873689376e-5f) {
		tmp = (uy * (((-1.3333333333333333f * (uy * uy)) * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))) + (2.0f * ((float) M_PI)))) * sqrtf((ux * (2.0f - ux)));
	} else {
		tmp = ((float) M_PI) * ((uy * 2.0f) * powf(((ux * ux) * (((1.0f - maxCos) * (maxCos + -1.0f)) + ((2.0f + (-2.0f * maxCos)) * (1.0f / ux)))), 0.5f));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (maxCos <= Float32(4.999999873689376e-5))
		tmp = Float32(Float32(uy * Float32(Float32(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))) + Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))));
	else
		tmp = Float32(Float32(pi) * Float32(Float32(uy * Float32(2.0)) * (Float32(Float32(ux * ux) * Float32(Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))) + Float32(Float32(Float32(2.0) + Float32(Float32(-2.0) * maxCos)) * Float32(Float32(1.0) / ux)))) ^ Float32(0.5))));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if (maxCos <= single(4.999999873689376e-5))
		tmp = (uy * (((single(-1.3333333333333333) * (uy * uy)) * (single(pi) * (single(pi) * single(pi)))) + (single(2.0) * single(pi)))) * sqrt((ux * (single(2.0) - ux)));
	else
		tmp = single(pi) * ((uy * single(2.0)) * (((ux * ux) * (((single(1.0) - maxCos) * (maxCos + single(-1.0))) + ((single(2.0) + (single(-2.0) * maxCos)) * (single(1.0) / ux)))) ^ single(0.5)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\
\;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \left(\left(uy \cdot 2\right) \cdot {\left(\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \left(2 + -2 \cdot maxCos\right) \cdot \frac{1}{ux}\right)\right)}^{0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if maxCos < 4.99999987e-5

    1. Initial program 59.2%

      \[\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. Add Preprocessing
    3. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(-2 \cdot maxCos\right)\right)\right)\right)\right) \]
    5. Simplified98.2%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)}} \]
    6. Taylor expanded in maxCos around 0

      \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)}} \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(\sqrt{ux \cdot \left(2 - ux\right)}\right)}\right) \]
      3. sin-lowering-sin.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux \cdot \left(2 - ux\right)}}\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux} \cdot \left(2 - ux\right)}\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
      6. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
      7. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(2 - ux\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 - ux\right)\right)\right)\right) \]
      9. --lowering--.f3297.6%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    8. Simplified97.6%

      \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}} \]
    9. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)}\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \color{blue}{\mathsf{\_.f32}\left(2, ux\right)}\right)\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\color{blue}{2}, ux\right)\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\color{blue}{2}, ux\right)\right)\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left(uy \cdot uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      8. cube-multN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      12. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      13. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      14. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, \color{blue}{ux}\right)\right)\right)\right) \]
      15. PI-lowering-PI.f3288.1%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    11. Simplified88.1%

      \[\leadsto \color{blue}{\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right)} \cdot \sqrt{ux \cdot \left(2 - ux\right)} \]

    if 4.99999987e-5 < maxCos

    1. Initial program 55.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in ux around -inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      6. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      10. div-subN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      11. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      13. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      15. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      19. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. Simplified97.8%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
    6. Taylor expanded in ux around inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      6. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      10. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      12. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      14. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      18. --lowering--.f3298.1%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    8. Simplified98.1%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
    9. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)}\right)\right) \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)}\right)\right)\right) \]
      3. PI-lowering-PI.f3281.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)}\right)\right)\right)\right) \]
    11. Simplified81.5%

      \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)} \]
    12. Applied egg-rr81.5%

      \[\leadsto \color{blue}{\left({\left(\left(ux \cdot ux\right) \cdot \left(\frac{1}{ux} \cdot \left(-2 \cdot maxCos + 2\right) - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)}^{0.5} \cdot \left(uy \cdot 2\right)\right) \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \left(\left(uy \cdot 2\right) \cdot {\left(\left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \left(2 + -2 \cdot maxCos\right) \cdot \frac{1}{ux}\right)\right)}^{0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 87.3% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \frac{2 + \left(-2 \cdot maxCos + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)}{ux}}\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= maxCos 4.999999873689376e-5)
   (*
    (*
     uy
     (+ (* (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI))) (* 2.0 PI)))
    (sqrt (* ux (- 2.0 ux))))
   (*
    (* 2.0 (* uy PI))
    (sqrt
     (*
      (* ux ux)
      (/
       (+ 2.0 (+ (* -2.0 maxCos) (* ux (* (- 1.0 maxCos) (+ maxCos -1.0)))))
       ux))))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (maxCos <= 4.999999873689376e-5f) {
		tmp = (uy * (((-1.3333333333333333f * (uy * uy)) * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))) + (2.0f * ((float) M_PI)))) * sqrtf((ux * (2.0f - ux)));
	} else {
		tmp = (2.0f * (uy * ((float) M_PI))) * sqrtf(((ux * ux) * ((2.0f + ((-2.0f * maxCos) + (ux * ((1.0f - maxCos) * (maxCos + -1.0f))))) / ux)));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (maxCos <= Float32(4.999999873689376e-5))
		tmp = Float32(Float32(uy * Float32(Float32(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))) + Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))));
	else
		tmp = Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(Float32(ux * ux) * Float32(Float32(Float32(2.0) + Float32(Float32(Float32(-2.0) * maxCos) + Float32(ux * Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0)))))) / ux))));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if (maxCos <= single(4.999999873689376e-5))
		tmp = (uy * (((single(-1.3333333333333333) * (uy * uy)) * (single(pi) * (single(pi) * single(pi)))) + (single(2.0) * single(pi)))) * sqrt((ux * (single(2.0) - ux)));
	else
		tmp = (single(2.0) * (uy * single(pi))) * sqrt(((ux * ux) * ((single(2.0) + ((single(-2.0) * maxCos) + (ux * ((single(1.0) - maxCos) * (maxCos + single(-1.0)))))) / ux)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\
\;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \frac{2 + \left(-2 \cdot maxCos + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)}{ux}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if maxCos < 4.99999987e-5

    1. Initial program 59.2%

      \[\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. Add Preprocessing
    3. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(-2 \cdot maxCos\right)\right)\right)\right)\right) \]
    5. Simplified98.2%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)}} \]
    6. Taylor expanded in maxCos around 0

      \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)}} \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(\sqrt{ux \cdot \left(2 - ux\right)}\right)}\right) \]
      3. sin-lowering-sin.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux \cdot \left(2 - ux\right)}}\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux} \cdot \left(2 - ux\right)}\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
      6. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
      7. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(2 - ux\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 - ux\right)\right)\right)\right) \]
      9. --lowering--.f3297.6%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    8. Simplified97.6%

      \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}} \]
    9. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)}\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \color{blue}{\mathsf{\_.f32}\left(2, ux\right)}\right)\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\color{blue}{2}, ux\right)\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\color{blue}{2}, ux\right)\right)\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left(uy \cdot uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      8. cube-multN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      12. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      13. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      14. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, \color{blue}{ux}\right)\right)\right)\right) \]
      15. PI-lowering-PI.f3288.1%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    11. Simplified88.1%

      \[\leadsto \color{blue}{\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right)} \cdot \sqrt{ux \cdot \left(2 - ux\right)} \]

    if 4.99999987e-5 < maxCos

    1. Initial program 55.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in ux around -inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      6. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      10. div-subN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      11. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      13. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      15. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      19. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. Simplified97.8%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
    6. Taylor expanded in ux around inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      6. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      10. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      12. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      14. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      18. --lowering--.f3298.1%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    8. Simplified98.1%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
    9. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)}\right)\right) \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)}\right)\right)\right) \]
      3. PI-lowering-PI.f3281.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)}\right)\right)\right)\right) \]
    11. Simplified81.5%

      \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)} \]
    12. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\left(\frac{2 + \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)}{ux}\right)}\right)\right)\right) \]
    13. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\left(2 + \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right), ux\right)\right)\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right), ux\right)\right)\right)\right) \]
      3. fma-defineN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(\mathsf{fma}\left(-2, maxCos, -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right), ux\right)\right)\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(\mathsf{fma}\left(-2, maxCos, \mathsf{neg}\left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right), ux\right)\right)\right)\right) \]
      5. fmm-undefN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos - ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right), ux\right)\right)\right)\right) \]
      6. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-2 \cdot maxCos\right), \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right), ux\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right), ux\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right), ux\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right), ux\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right), ux\right)\right)\right)\right) \]
      11. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right), ux\right)\right)\right)\right) \]
      12. --lowering--.f3281.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right), ux\right)\right)\right)\right) \]
    14. Simplified81.5%

      \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\frac{2 + \left(-2 \cdot maxCos - ux \cdot \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)}{ux}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \frac{2 + \left(-2 \cdot maxCos + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)}{ux}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 87.3% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} + \left(-1 + maxCos \cdot \left(2 - \left(maxCos + \frac{2}{ux}\right)\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= maxCos 4.999999873689376e-5)
   (*
    (*
     uy
     (+ (* (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI))) (* 2.0 PI)))
    (sqrt (* ux (- 2.0 ux))))
   (*
    (* 2.0 (* uy PI))
    (sqrt
     (*
      (* ux ux)
      (+ (/ 2.0 ux) (+ -1.0 (* maxCos (- 2.0 (+ maxCos (/ 2.0 ux)))))))))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (maxCos <= 4.999999873689376e-5f) {
		tmp = (uy * (((-1.3333333333333333f * (uy * uy)) * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))) + (2.0f * ((float) M_PI)))) * sqrtf((ux * (2.0f - ux)));
	} else {
		tmp = (2.0f * (uy * ((float) M_PI))) * sqrtf(((ux * ux) * ((2.0f / ux) + (-1.0f + (maxCos * (2.0f - (maxCos + (2.0f / ux))))))));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (maxCos <= Float32(4.999999873689376e-5))
		tmp = Float32(Float32(uy * Float32(Float32(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))) + Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))));
	else
		tmp = Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(Float32(ux * ux) * Float32(Float32(Float32(2.0) / ux) + Float32(Float32(-1.0) + Float32(maxCos * Float32(Float32(2.0) - Float32(maxCos + Float32(Float32(2.0) / ux)))))))));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if (maxCos <= single(4.999999873689376e-5))
		tmp = (uy * (((single(-1.3333333333333333) * (uy * uy)) * (single(pi) * (single(pi) * single(pi)))) + (single(2.0) * single(pi)))) * sqrt((ux * (single(2.0) - ux)));
	else
		tmp = (single(2.0) * (uy * single(pi))) * sqrt(((ux * ux) * ((single(2.0) / ux) + (single(-1.0) + (maxCos * (single(2.0) - (maxCos + (single(2.0) / ux))))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\
\;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} + \left(-1 + maxCos \cdot \left(2 - \left(maxCos + \frac{2}{ux}\right)\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if maxCos < 4.99999987e-5

    1. Initial program 59.2%

      \[\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. Add Preprocessing
    3. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(-2 \cdot maxCos\right)\right)\right)\right)\right) \]
    5. Simplified98.2%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)}} \]
    6. Taylor expanded in maxCos around 0

      \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)}} \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(\sqrt{ux \cdot \left(2 - ux\right)}\right)}\right) \]
      3. sin-lowering-sin.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux \cdot \left(2 - ux\right)}}\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux} \cdot \left(2 - ux\right)}\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
      6. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
      7. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(2 - ux\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 - ux\right)\right)\right)\right) \]
      9. --lowering--.f3297.6%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    8. Simplified97.6%

      \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}} \]
    9. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)}\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \color{blue}{\mathsf{\_.f32}\left(2, ux\right)}\right)\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\color{blue}{2}, ux\right)\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\color{blue}{2}, ux\right)\right)\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left(uy \cdot uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      8. cube-multN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      12. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      13. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      14. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, \color{blue}{ux}\right)\right)\right)\right) \]
      15. PI-lowering-PI.f3288.1%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    11. Simplified88.1%

      \[\leadsto \color{blue}{\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right)} \cdot \sqrt{ux \cdot \left(2 - ux\right)} \]

    if 4.99999987e-5 < maxCos

    1. Initial program 55.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in ux around -inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      6. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      10. div-subN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      11. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      13. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      15. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      19. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. Simplified97.8%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
    6. Taylor expanded in ux around inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      6. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      10. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      12. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      14. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      18. --lowering--.f3298.1%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    8. Simplified98.1%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
    9. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)}\right)\right) \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)}\right)\right)\right) \]
      3. PI-lowering-PI.f3281.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)}\right)\right)\right)\right) \]
    11. Simplified81.5%

      \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)} \]
    12. Taylor expanded in maxCos around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\left(\left(2 \cdot \frac{1}{ux} + maxCos \cdot \left(\left(2 + -1 \cdot maxCos\right) - 2 \cdot \frac{1}{ux}\right)\right) - 1\right)}\right)\right)\right) \]
    13. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(2 \cdot \frac{1}{ux} + \left(maxCos \cdot \left(\left(2 + -1 \cdot maxCos\right) - 2 \cdot \frac{1}{ux}\right) - 1\right)\right)\right)\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(maxCos \cdot \left(\left(2 + -1 \cdot maxCos\right) - 2 \cdot \frac{1}{ux}\right) - 1\right)\right)\right)\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(maxCos \cdot \left(\left(2 + -1 \cdot maxCos\right) - 2 \cdot \frac{1}{ux}\right) - 1\right)\right)\right)\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(maxCos \cdot \left(\left(2 + -1 \cdot maxCos\right) - 2 \cdot \frac{1}{ux}\right) - 1\right)\right)\right)\right)\right) \]
      5. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(maxCos \cdot \left(\left(2 + -1 \cdot maxCos\right) - 2 \cdot \frac{1}{ux}\right) - 1\right)\right)\right)\right)\right) \]
      6. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{\_.f32}\left(\left(maxCos \cdot \left(\left(2 + -1 \cdot maxCos\right) - 2 \cdot \frac{1}{ux}\right)\right), 1\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(maxCos, \left(\left(2 + -1 \cdot maxCos\right) - 2 \cdot \frac{1}{ux}\right)\right), 1\right)\right)\right)\right)\right) \]
      8. associate--l+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(maxCos, \left(2 + \left(-1 \cdot maxCos - 2 \cdot \frac{1}{ux}\right)\right)\right), 1\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(2, \left(-1 \cdot maxCos - 2 \cdot \frac{1}{ux}\right)\right)\right), 1\right)\right)\right)\right)\right) \]
      10. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot maxCos\right), \left(2 \cdot \frac{1}{ux}\right)\right)\right)\right), 1\right)\right)\right)\right)\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(\mathsf{neg}\left(maxCos\right)\right), \left(2 \cdot \frac{1}{ux}\right)\right)\right)\right), 1\right)\right)\right)\right)\right) \]
      12. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{neg.f32}\left(maxCos\right), \left(2 \cdot \frac{1}{ux}\right)\right)\right)\right), 1\right)\right)\right)\right)\right) \]
      13. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{neg.f32}\left(maxCos\right), \left(\frac{2 \cdot 1}{ux}\right)\right)\right)\right), 1\right)\right)\right)\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{neg.f32}\left(maxCos\right), \left(\frac{2}{ux}\right)\right)\right)\right), 1\right)\right)\right)\right)\right) \]
      15. /-lowering-/.f3281.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{neg.f32}\left(maxCos\right), \mathsf{/.f32}\left(2, ux\right)\right)\right)\right), 1\right)\right)\right)\right)\right) \]
    14. Simplified81.5%

      \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\frac{2}{ux} + \left(maxCos \cdot \left(2 + \left(\left(-maxCos\right) - \frac{2}{ux}\right)\right) - 1\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} + \left(-1 + maxCos \cdot \left(2 - \left(maxCos + \frac{2}{ux}\right)\right)\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 87.3% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 + \left(-2 \cdot maxCos + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= maxCos 4.999999873689376e-5)
   (*
    (*
     uy
     (+ (* (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI))) (* 2.0 PI)))
    (sqrt (* ux (- 2.0 ux))))
   (*
    (* 2.0 (* uy PI))
    (sqrt
     (*
      ux
      (+
       2.0
       (+ (* -2.0 maxCos) (* ux (* (- 1.0 maxCos) (+ maxCos -1.0))))))))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (maxCos <= 4.999999873689376e-5f) {
		tmp = (uy * (((-1.3333333333333333f * (uy * uy)) * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))) + (2.0f * ((float) M_PI)))) * sqrtf((ux * (2.0f - ux)));
	} else {
		tmp = (2.0f * (uy * ((float) M_PI))) * sqrtf((ux * (2.0f + ((-2.0f * maxCos) + (ux * ((1.0f - maxCos) * (maxCos + -1.0f)))))));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (maxCos <= Float32(4.999999873689376e-5))
		tmp = Float32(Float32(uy * Float32(Float32(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))) + Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))));
	else
		tmp = Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(2.0) + Float32(Float32(Float32(-2.0) * maxCos) + Float32(ux * Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0)))))))));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if (maxCos <= single(4.999999873689376e-5))
		tmp = (uy * (((single(-1.3333333333333333) * (uy * uy)) * (single(pi) * (single(pi) * single(pi)))) + (single(2.0) * single(pi)))) * sqrt((ux * (single(2.0) - ux)));
	else
		tmp = (single(2.0) * (uy * single(pi))) * sqrt((ux * (single(2.0) + ((single(-2.0) * maxCos) + (ux * ((single(1.0) - maxCos) * (maxCos + single(-1.0))))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\
\;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 + \left(-2 \cdot maxCos + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if maxCos < 4.99999987e-5

    1. Initial program 59.2%

      \[\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. Add Preprocessing
    3. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(-2 \cdot maxCos\right)\right)\right)\right)\right) \]
    5. Simplified98.2%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)}} \]
    6. Taylor expanded in maxCos around 0

      \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)}} \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(\sqrt{ux \cdot \left(2 - ux\right)}\right)}\right) \]
      3. sin-lowering-sin.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux \cdot \left(2 - ux\right)}}\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux} \cdot \left(2 - ux\right)}\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
      6. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
      7. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(2 - ux\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 - ux\right)\right)\right)\right) \]
      9. --lowering--.f3297.6%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    8. Simplified97.6%

      \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}} \]
    9. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)}\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \color{blue}{\mathsf{\_.f32}\left(2, ux\right)}\right)\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\color{blue}{2}, ux\right)\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\frac{-4}{3} \cdot {uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\color{blue}{2}, ux\right)\right)\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left(uy \cdot uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{3}\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      8. cube-multN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      12. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      13. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
      14. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, \color{blue}{ux}\right)\right)\right)\right) \]
      15. PI-lowering-PI.f3288.1%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
    11. Simplified88.1%

      \[\leadsto \color{blue}{\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right)} \cdot \sqrt{ux \cdot \left(2 - ux\right)} \]

    if 4.99999987e-5 < maxCos

    1. Initial program 55.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in ux around -inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      6. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      10. div-subN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      11. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      13. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      15. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      19. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. Simplified97.8%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
    6. Taylor expanded in ux around inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      6. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      10. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      12. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      14. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      18. --lowering--.f3298.1%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    8. Simplified98.1%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
    9. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)}\right)\right) \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)}\right)\right)\right) \]
      3. PI-lowering-PI.f3281.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)}\right)\right)\right)\right) \]
    11. Simplified81.5%

      \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)} \]
    12. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(2 + \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)}\right)\right) \]
    13. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-2 \cdot maxCos + -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      3. fma-defineN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(\mathsf{fma}\left(-2, maxCos, -1 \cdot \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(\mathsf{fma}\left(-2, maxCos, \mathsf{neg}\left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      5. fmm-undefN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-2 \cdot maxCos - ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      6. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-2 \cdot maxCos\right), \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \left(ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      11. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      12. --lowering--.f3281.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    14. Simplified81.5%

      \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + \left(-2 \cdot maxCos - ux \cdot \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\ \;\;\;\;\left(uy \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 + \left(-2 \cdot maxCos + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 80.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \sqrt{\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}} \cdot \left(2 \cdot \left(ux \cdot \left(uy \cdot \pi\right)\right)\right) \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sqrt (+ (* (- 1.0 maxCos) (+ maxCos -1.0)) (/ (+ 2.0 (* -2.0 maxCos)) ux)))
  (* 2.0 (* ux (* uy PI)))))
float code(float ux, float uy, float maxCos) {
	return sqrtf((((1.0f - maxCos) * (maxCos + -1.0f)) + ((2.0f + (-2.0f * maxCos)) / ux))) * (2.0f * (ux * (uy * ((float) M_PI))));
}
function code(ux, uy, maxCos)
	return Float32(sqrt(Float32(Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))) + Float32(Float32(Float32(2.0) + Float32(Float32(-2.0) * maxCos)) / ux))) * Float32(Float32(2.0) * Float32(ux * Float32(uy * Float32(pi)))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sqrt((((single(1.0) - maxCos) * (maxCos + single(-1.0))) + ((single(2.0) + (single(-2.0) * maxCos)) / ux))) * (single(2.0) * (ux * (uy * single(pi))));
end
\begin{array}{l}

\\
\sqrt{\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}} \cdot \left(2 \cdot \left(ux \cdot \left(uy \cdot \pi\right)\right)\right)
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around -inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    6. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    9. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    11. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    14. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    15. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    18. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    19. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
  6. Taylor expanded in ux around inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    6. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    8. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    9. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    10. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    12. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    13. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    14. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    16. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    17. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    18. --lowering--.f3298.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
  8. Simplified98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
  9. Taylor expanded in uy around 0

    \[\leadsto \color{blue}{2 \cdot \left(\left(ux \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 - maxCos\right)}^{2}}\right)} \]
  10. Simplified80.6%

    \[\leadsto \color{blue}{\left(2 \cdot \left(ux \cdot \left(uy \cdot \pi\right)\right)\right) \cdot \sqrt{\frac{2 + -2 \cdot maxCos}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)}} \]
  11. Final simplification80.6%

    \[\leadsto \sqrt{\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{2 + -2 \cdot maxCos}{ux}} \cdot \left(2 \cdot \left(ux \cdot \left(uy \cdot \pi\right)\right)\right) \]
  12. Add Preprocessing

Alternative 17: 78.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-6}:\\ \;\;\;\;\left(2 \cdot \left(ux \cdot \left(uy \cdot \pi\right)\right)\right) \cdot \sqrt{\frac{2}{ux} + -1}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 + -2 \cdot maxCos\right)}\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= maxCos 4.999999873689376e-6)
   (* (* 2.0 (* ux (* uy PI))) (sqrt (+ (/ 2.0 ux) -1.0)))
   (* (* 2.0 (* uy PI)) (sqrt (* ux (+ 2.0 (* -2.0 maxCos)))))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (maxCos <= 4.999999873689376e-6f) {
		tmp = (2.0f * (ux * (uy * ((float) M_PI)))) * sqrtf(((2.0f / ux) + -1.0f));
	} else {
		tmp = (2.0f * (uy * ((float) M_PI))) * sqrtf((ux * (2.0f + (-2.0f * maxCos))));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (maxCos <= Float32(4.999999873689376e-6))
		tmp = Float32(Float32(Float32(2.0) * Float32(ux * Float32(uy * Float32(pi)))) * sqrt(Float32(Float32(Float32(2.0) / ux) + Float32(-1.0))));
	else
		tmp = Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(2.0) + Float32(Float32(-2.0) * maxCos)))));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if (maxCos <= single(4.999999873689376e-6))
		tmp = (single(2.0) * (ux * (uy * single(pi)))) * sqrt(((single(2.0) / ux) + single(-1.0)));
	else
		tmp = (single(2.0) * (uy * single(pi))) * sqrt((ux * (single(2.0) + (single(-2.0) * maxCos))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-6}:\\
\;\;\;\;\left(2 \cdot \left(ux \cdot \left(uy \cdot \pi\right)\right)\right) \cdot \sqrt{\frac{2}{ux} + -1}\\

\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 + -2 \cdot maxCos\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if maxCos < 4.99999987e-6

    1. Initial program 59.7%

      \[\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. Add Preprocessing
    3. Taylor expanded in ux around -inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      6. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      10. div-subN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      11. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
      13. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      15. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      19. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. Simplified98.3%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
    6. Taylor expanded in ux around inf

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      6. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      10. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      12. /-lowering-/.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      14. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
      18. --lowering--.f3298.3%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    8. Simplified98.3%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
    9. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)}\right)\right) \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)}\right)\right)\right) \]
      3. PI-lowering-PI.f3280.7%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)}\right)\right)\right)\right) \]
    11. Simplified80.7%

      \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)} \]
    12. Taylor expanded in maxCos around 0

      \[\leadsto \color{blue}{2 \cdot \left(\left(ux \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{2 \cdot \frac{1}{ux} - 1}\right)} \]
    13. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(2 \cdot \left(ux \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \frac{1}{ux} - 1}} \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\left(2 \cdot \left(ux \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \color{blue}{\left(\sqrt{2 \cdot \frac{1}{ux} - 1}\right)}\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(ux \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{2 \cdot \frac{1}{ux} - 1}}\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{2 \cdot \frac{1}{ux} - \color{blue}{1}}\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{2 \cdot \frac{1}{ux} - 1}\right)\right) \]
      6. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(\sqrt{2 \cdot \frac{1}{ux} - 1}\right)\right) \]
      7. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(2 \cdot \frac{1}{ux} - 1\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(2 \cdot \frac{1}{ux} + -1\right)\right)\right) \]
      10. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), -1\right)\right)\right) \]
      11. associate-*r/N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), -1\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(\left(\frac{2}{ux}\right), -1\right)\right)\right) \]
      13. /-lowering-/.f3280.6%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), -1\right)\right)\right) \]
    14. Simplified80.6%

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

    if 4.99999987e-6 < maxCos

    1. Initial program 53.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. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      2. sub-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      5. associate-+l+N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified53.0%

      \[\leadsto \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)}\right)\right) \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{\mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)}\right)\right)\right) \]
      3. PI-lowering-PI.f3248.7%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \color{blue}{\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)}\right)\right)\right)\right) \]
    7. Simplified48.7%

      \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)} \]
    8. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \color{blue}{\left(\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)}\right) \]
    9. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \left(\sqrt{ux \cdot \left(2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)}\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \left(\sqrt{ux \cdot \left(2 + -2 \cdot maxCos\right)}\right)\right) \]
      3. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(2 + -2 \cdot maxCos\right)\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + -2 \cdot maxCos\right)\right)\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f3267.8%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right)\right)\right)\right) \]
    10. Simplified67.8%

      \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \color{blue}{\sqrt{ux \cdot \left(2 + -2 \cdot maxCos\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 18: 76.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \left(2 \cdot \left(ux \cdot \left(uy \cdot \pi\right)\right)\right) \cdot \sqrt{\frac{2}{ux} + -1} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (* (* 2.0 (* ux (* uy PI))) (sqrt (+ (/ 2.0 ux) -1.0))))
float code(float ux, float uy, float maxCos) {
	return (2.0f * (ux * (uy * ((float) M_PI)))) * sqrtf(((2.0f / ux) + -1.0f));
}
function code(ux, uy, maxCos)
	return Float32(Float32(Float32(2.0) * Float32(ux * Float32(uy * Float32(pi)))) * sqrt(Float32(Float32(Float32(2.0) / ux) + Float32(-1.0))))
end
function tmp = code(ux, uy, maxCos)
	tmp = (single(2.0) * (ux * (uy * single(pi)))) * sqrt(((single(2.0) / ux) + single(-1.0)));
end
\begin{array}{l}

\\
\left(2 \cdot \left(ux \cdot \left(uy \cdot \pi\right)\right)\right) \cdot \sqrt{\frac{2}{ux} + -1}
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around -inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + -2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    6. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(2 \cdot \frac{1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2 \cdot 1}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - 2 \cdot \frac{maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    9. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\left(\frac{2}{ux} - \frac{2 \cdot maxCos}{ux}\right) - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    11. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(\frac{2 + -2 \cdot maxCos}{ux} - {\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\left(\frac{2 + -2 \cdot maxCos}{ux}\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    14. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\left(2 + -2 \cdot maxCos\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    15. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left({\left(1 + -1 \cdot maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    18. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \left(\left(1 + -1 \cdot maxCos\right) \cdot \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    19. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), ux\right), \mathsf{*.f32}\left(\left(1 + -1 \cdot maxCos\right), \left(1 + -1 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{2 + maxCos \cdot -2}{ux} - \left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)}} \]
  6. Taylor expanded in ux around inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left({ux}^{2} \cdot \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)}\right)\right) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left({ux}^{2}\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \left(-2 \cdot \frac{maxCos}{ux} + \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(-2 \cdot \frac{maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\left(\frac{-2 \cdot maxCos}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    6. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(-2 \cdot maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2} + 2 \cdot \frac{1}{ux}\right)\right)\right)\right)\right) \]
    8. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \left(2 \cdot \frac{1}{ux} + -1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right) \]
    9. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    10. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\left(\frac{2}{ux}\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    12. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(-1 \cdot {\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right) \]
    13. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \left(\mathsf{neg}\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    14. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left({\left(1 - maxCos\right)}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    16. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(1 - maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    17. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(1 - maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
    18. --lowering--.f3298.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
  8. Simplified98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)}} \]
  9. Taylor expanded in uy around 0

    \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)\right)\right) \]
  10. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)\right)}\right)\right) \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)\right)}\right)\right)\right) \]
    3. PI-lowering-PI.f3280.6%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(-2, maxCos\right), ux\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), \mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right)}\right)\right)\right)\right) \]
  11. Simplified80.6%

    \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{-2 \cdot maxCos}{ux} + \left(\frac{2}{ux} + \left(-\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right)\right)} \]
  12. Taylor expanded in maxCos around 0

    \[\leadsto \color{blue}{2 \cdot \left(\left(ux \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{2 \cdot \frac{1}{ux} - 1}\right)} \]
  13. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \left(2 \cdot \left(ux \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \frac{1}{ux} - 1}} \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\left(2 \cdot \left(ux \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \color{blue}{\left(\sqrt{2 \cdot \frac{1}{ux} - 1}\right)}\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(ux \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{2 \cdot \frac{1}{ux} - 1}}\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{2 \cdot \frac{1}{ux} - \color{blue}{1}}\right)\right) \]
    5. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{2 \cdot \frac{1}{ux} - 1}\right)\right) \]
    6. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(\sqrt{2 \cdot \frac{1}{ux} - 1}\right)\right) \]
    7. sqrt-lowering-sqrt.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(2 \cdot \frac{1}{ux} - 1\right)\right)\right) \]
    8. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(2 \cdot \frac{1}{ux} + -1\right)\right)\right) \]
    10. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(\left(2 \cdot \frac{1}{ux}\right), -1\right)\right)\right) \]
    11. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(\left(\frac{2 \cdot 1}{ux}\right), -1\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(\left(\frac{2}{ux}\right), -1\right)\right)\right) \]
    13. /-lowering-/.f3275.2%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(2, ux\right), -1\right)\right)\right) \]
  14. Simplified75.2%

    \[\leadsto \color{blue}{\left(2 \cdot \left(ux \cdot \left(uy \cdot \pi\right)\right)\right) \cdot \sqrt{\frac{2}{ux} + -1}} \]
  15. Add Preprocessing

Alternative 19: 76.5% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (* (* 2.0 (* uy PI)) (sqrt (* ux (- 2.0 ux)))))
float code(float ux, float uy, float maxCos) {
	return (2.0f * (uy * ((float) M_PI))) * sqrtf((ux * (2.0f - ux)));
}
function code(ux, uy, maxCos)
	return Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))))
end
function tmp = code(ux, uy, maxCos)
	tmp = (single(2.0) * (uy * single(pi))) * sqrt((ux * (single(2.0) - ux)));
end
\begin{array}{l}

\\
\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Add Preprocessing
  3. Taylor expanded in ux around 0

    \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)}\right)\right) \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)\right)\right)\right) \]
    2. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
    3. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(-2 \cdot maxCos\right)\right)\right)\right)\right) \]
  5. Simplified98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)}} \]
  6. Taylor expanded in maxCos around 0

    \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
  7. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\sqrt{ux \cdot \left(2 - ux\right)}} \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(\sqrt{ux \cdot \left(2 - ux\right)}\right)}\right) \]
    3. sin-lowering-sin.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux \cdot \left(2 - ux\right)}}\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{\color{blue}{ux} \cdot \left(2 - ux\right)}\right)\right) \]
    5. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
    6. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \left(\sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \]
    7. sqrt-lowering-sqrt.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(2 - ux\right)\right)\right)\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 - ux\right)\right)\right)\right) \]
    9. --lowering--.f3290.7%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
  8. Simplified90.7%

    \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}} \]
  9. Taylor expanded in uy around 0

    \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right)\right) \]
  10. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)}\right)\right) \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \color{blue}{\mathsf{\_.f32}\left(2, ux\right)}\right)\right)\right) \]
    3. PI-lowering-PI.f3275.1%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, \color{blue}{ux}\right)\right)\right)\right) \]
  11. Simplified75.1%

    \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} \cdot \sqrt{ux \cdot \left(2 - ux\right)} \]
  12. Add Preprocessing

Alternative 20: 7.1% accurate, 223.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (ux uy maxCos) :precision binary32 0.0)
float code(float ux, float uy, float maxCos) {
	return 0.0f;
}
real(4) function code(ux, uy, maxcos)
    real(4), intent (in) :: ux
    real(4), intent (in) :: uy
    real(4), intent (in) :: maxcos
    code = 0.0e0
end function
function code(ux, uy, maxCos)
	return Float32(0.0)
end
function tmp = code(ux, uy, maxCos)
	tmp = single(0.0);
end
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 58.6%

    \[\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. Step-by-step derivation
    1. distribute-rgt-inN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    2. sub-negN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. +-commutativeN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    5. associate-+l+N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified58.5%

    \[\leadsto \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in uy around 0

    \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right)\right) \]
  6. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)}\right)\right) \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{\mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)}\right)\right)\right) \]
    3. PI-lowering-PI.f3251.1%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \color{blue}{\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)}\right)\right)\right)\right) \]
  7. Simplified51.1%

    \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)} \]
  8. Taylor expanded in ux around 0

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{1}\right)\right)\right) \]
  9. Step-by-step derivation
    1. Simplified7.1%

      \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{1 - \color{blue}{1}} \]
    2. Step-by-step derivation
      1. pow1/2N/A

        \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(1 - 1\right)}^{\color{blue}{\frac{1}{2}}} \]
      2. metadata-evalN/A

        \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {0}^{\frac{1}{2}} \]
      3. metadata-evalN/A

        \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 0 \]
      4. mul0-rgt7.1%

        \[\leadsto 0 \]
    3. Applied egg-rr7.1%

      \[\leadsto \color{blue}{0} \]
    4. Add Preprocessing

    Reproduce

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