UniformSampleCone, y

Percentage Accurate: 58.0% → 98.3%
Time: 21.5s
Alternatives: 22
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 22 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: 58.0% 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.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := ux \cdot \left(maxCos + -1\right)\\
t_1 := \left(t\_0 \cdot t\_0\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\\
t_2 := 2 + maxCos \cdot -2\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\frac{ux \cdot \left(\left(\left(1 - maxCos\right) \cdot t\_0\right) \cdot t\_1 + {\left({t\_2}^{1.5}\right)}^{2}\right)}{t\_1 + t\_2 \cdot \left(t\_2 + \left(1 - maxCos\right) \cdot \left(\left(1 - maxCos\right) \cdot ux\right)\right)}}
\end{array}
\end{array}
Derivation
  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. 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. +-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(ux, \left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
    4. 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(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
    5. associate-+l+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(ux, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + \left(2 + -2 \cdot maxCos\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(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 + -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(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + \left(2 + maxCos \cdot -2\right)\right)}} \]
  6. Applied egg-rr98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\frac{\left(\left(\left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) \cdot \left(\left(\left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right)\right) + \left(2 + maxCos \cdot -2\right) \cdot \left(\left(2 + maxCos \cdot -2\right) \cdot \left(2 + maxCos \cdot -2\right)\right)\right) \cdot ux}{\left(\left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(1 - maxCos\right)\right) + \left(2 + maxCos \cdot -2\right) \cdot \left(\left(2 + maxCos \cdot -2\right) - \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)}}} \]
  7. Step-by-step derivation
    1. cube-unmultN/A

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right), \mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\left(2 + maxCos \cdot -2\right), \left(\frac{3}{2}\right)\right), 2\right)\right), ux\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\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(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right), \mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\mathsf{+.f32}\left(2, \left(maxCos \cdot -2\right)\right), \left(\frac{3}{2}\right)\right), 2\right)\right), ux\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\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(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right), \mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \left(\frac{3}{2}\right)\right), 2\right)\right), ux\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
    8. metadata-eval98.4%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right)\right), \mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \frac{3}{2}\right), 2\right)\right), ux\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{\_.f32}\left(1, maxCos\right)\right)\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \mathsf{\_.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(maxCos, -2\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr98.4%

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

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

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

\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) + ux \cdot \left(maxCos \cdot -2\right)}
\end{array}
Derivation
  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. 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. +-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(ux, \left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
    4. 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(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
    5. associate-+l+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(ux, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + \left(2 + -2 \cdot maxCos\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(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 + -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(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + \left(2 + maxCos \cdot -2\right)\right)}} \]
  6. Step-by-step derivation
    1. 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(\left(ux \cdot \left(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right) + maxCos \cdot -2\right)\right)\right)\right) \]
    2. distribute-rgt-inN/A

      \[\leadsto \mathsf{*.f32}\left(\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(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right) \cdot ux + \left(maxCos \cdot -2\right) \cdot ux\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(\left(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right) \cdot ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
    5. +-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(\left(2 + \left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot 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(\mathsf{+.f32}\left(2, \left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
    7. *-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(\mathsf{+.f32}\left(2, \left(\left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\left(1 - maxCos\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
    10. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(ux \cdot \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{*.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(ux \cdot \left(maxCos - 1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \left(maxCos - 1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
    13. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
    14. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \mathsf{*.f32}\left(\left(maxCos \cdot -2\right), ux\right)\right)\right)\right) \]
    17. *-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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), ux\right)\right)\right)\right) \]
  7. Applied egg-rr98.3%

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

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

Alternative 3: 98.3% accurate, 1.0× speedup?

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

\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right) + \left(2 + maxCos \cdot -2\right)\right)}
\end{array}
Derivation
  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. 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. +-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(ux, \left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
    4. 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(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
    5. associate-+l+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(ux, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + \left(2 + -2 \cdot maxCos\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(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 + -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(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + \left(2 + maxCos \cdot -2\right)\right)}} \]
  6. Final simplification98.2%

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

Alternative 4: 97.7% accurate, 1.0× speedup?

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

\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right) + maxCos \cdot \left(ux \cdot \left(-2 + 2 \cdot ux\right)\right)}
\end{array}
Derivation
  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. 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. +-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(ux, \left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
    4. 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(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
    5. associate-+l+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(ux, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + \left(2 + -2 \cdot maxCos\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(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 + -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(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + \left(2 + maxCos \cdot -2\right)\right)}} \]
  6. 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), \mathsf{sqrt.f32}\left(\color{blue}{\left(maxCos \cdot \left(ux \cdot \left(2 \cdot ux - 2\right)\right) + ux \cdot \left(2 + -1 \cdot ux\right)\right)}\right)\right) \]
  7. Step-by-step derivation
    1. +-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(\left(ux \cdot \left(2 + -1 \cdot ux\right) + maxCos \cdot \left(ux \cdot \left(2 \cdot ux - 2\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(\left(ux \cdot \left(2 + -1 \cdot ux\right)\right), \left(maxCos \cdot \left(ux \cdot \left(2 \cdot ux - 2\right)\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, \left(2 + -1 \cdot ux\right)\right), \left(maxCos \cdot \left(ux \cdot \left(2 \cdot ux - 2\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(\mathsf{*.f32}\left(ux, \left(2 + \left(\mathsf{neg}\left(ux\right)\right)\right)\right), \left(maxCos \cdot \left(ux \cdot \left(2 \cdot ux - 2\right)\right)\right)\right)\right)\right) \]
    5. 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, \left(2 - ux\right)\right), \left(maxCos \cdot \left(ux \cdot \left(2 \cdot ux - 2\right)\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, \mathsf{\_.f32}\left(2, ux\right)\right), \left(maxCos \cdot \left(ux \cdot \left(2 \cdot ux - 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(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right), \mathsf{*.f32}\left(maxCos, \left(ux \cdot \left(2 \cdot ux - 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(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \left(2 \cdot ux - 2\right)\right)\right)\right)\right)\right) \]
    9. 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, \mathsf{\_.f32}\left(2, ux\right)\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \left(2 \cdot ux + \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right)\right)\right)\right) \]
    10. 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, \mathsf{\_.f32}\left(2, ux\right)\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \left(2 \cdot ux + -2\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(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 \cdot ux\right), -2\right)\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f3297.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, \mathsf{\_.f32}\left(2, ux\right)\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, ux\right), -2\right)\right)\right)\right)\right)\right) \]
  8. Simplified97.3%

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

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

Alternative 5: 97.0% accurate, 1.0× speedup?

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

\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(maxCos \cdot -2\right) + ux \cdot \left(2 - ux\right)}
\end{array}
Derivation
  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. 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. +-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(ux, \left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
    4. 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(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
    5. associate-+l+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(ux, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + \left(2 + -2 \cdot maxCos\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(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 + -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(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + \left(2 + maxCos \cdot -2\right)\right)}} \]
  6. Step-by-step derivation
    1. 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(\left(ux \cdot \left(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right) + maxCos \cdot -2\right)\right)\right)\right) \]
    2. distribute-rgt-inN/A

      \[\leadsto \mathsf{*.f32}\left(\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(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right) \cdot ux + \left(maxCos \cdot -2\right) \cdot ux\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(\left(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right) \cdot ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
    5. +-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(\left(2 + \left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot 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(\mathsf{+.f32}\left(2, \left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
    7. *-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(\mathsf{+.f32}\left(2, \left(\left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\left(1 - maxCos\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
    10. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(ux \cdot \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{*.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(ux \cdot \left(maxCos - 1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \left(maxCos - 1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
    13. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
    14. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \mathsf{*.f32}\left(\left(maxCos \cdot -2\right), ux\right)\right)\right)\right) \]
    17. *-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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), ux\right)\right)\right)\right) \]
  7. Applied egg-rr98.3%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) \cdot ux + \left(maxCos \cdot -2\right) \cdot ux}} \]
  8. 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), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(\color{blue}{\left(ux \cdot \left(2 + -1 \cdot ux\right)\right)}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), ux\right)\right)\right)\right) \]
  9. 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, \left(2 + -1 \cdot ux\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), ux\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(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot ux\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\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, \mathsf{+.f32}\left(2, \left(\mathsf{neg}\left(ux\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), ux\right)\right)\right)\right) \]
    4. neg-lowering-neg.f3296.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(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{neg.f32}\left(ux\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), ux\right)\right)\right)\right) \]
  10. Simplified96.7%

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

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

Alternative 6: 96.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 5.000000058430487 \cdot 10^{-8}:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\

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


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

    1. Initial program 53.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 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), \mathsf{sqrt.f32}\left(\color{blue}{\left(1 - {\left(1 - ux\right)}^{2}\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(1, \left({\left(1 - ux\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(1, \left(\left(1 - ux\right) \cdot \left(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(1, \mathsf{*.f32}\left(\left(1 - ux\right), \left(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(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \left(1 - ux\right)\right)\right)\right)\right) \]
      5. --lowering--.f3253.6%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\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. Simplified53.6%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{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(ux \cdot \left(2 + -1 \cdot ux\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 + -1 \cdot ux\right)\right)\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), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(\mathsf{neg}\left(ux\right)\right)\right)\right)\right)\right) \]
      3. 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(ux, \left(2 - ux\right)\right)\right)\right) \]
      4. --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, ux\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 - ux\right)}} \]

    if 5.00000006e-8 < maxCos

    1. Initial program 52.8%

      \[\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 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      3. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      4. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      5. associate-*r*N/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      7. mul-1-negN/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      13. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      16. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f3294.1%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
    8. Simplified94.1%

      \[\leadsto \left(uy \cdot \left(\pi \cdot \left(2 + \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + \left(\left(-ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)}} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \mathsf{*.f32}\left(\left(\sqrt{ux \cdot \left(2 + \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)} \cdot uy\right), \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(2 + \left(\frac{-4}{3} \cdot \left(uy \cdot uy\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    10. Applied egg-rr94.5%

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

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

Alternative 7: 93.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.10000000149011612:\\ \;\;\;\;\left(uy \cdot {\left(ux \cdot \left(maxCos \cdot -2 + \left(2 + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)\right)}^{0.5}\right) \cdot \left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(uy \cdot \left(uy \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.10000000149011612)
   (*
    (*
     uy
     (pow
      (*
       ux
       (+ (* maxCos -2.0) (+ 2.0 (* ux (* (- 1.0 maxCos) (+ maxCos -1.0))))))
      0.5))
    (* PI (+ 2.0 (* -1.3333333333333333 (* uy (* uy (* 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.10000000149011612f) {
		tmp = (uy * powf((ux * ((maxCos * -2.0f) + (2.0f + (ux * ((1.0f - maxCos) * (maxCos + -1.0f)))))), 0.5f)) * (((float) M_PI) * (2.0f + (-1.3333333333333333f * (uy * (uy * (((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.10000000149011612))
		tmp = Float32(Float32(uy * (Float32(ux * Float32(Float32(maxCos * Float32(-2.0)) + Float32(Float32(2.0) + Float32(ux * Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))))))) ^ Float32(0.5))) * Float32(Float32(pi) * Float32(Float32(2.0) + Float32(Float32(-1.3333333333333333) * Float32(uy * Float32(uy * 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.10000000149011612))
		tmp = (uy * ((ux * ((maxCos * single(-2.0)) + (single(2.0) + (ux * ((single(1.0) - maxCos) * (maxCos + single(-1.0))))))) ^ single(0.5))) * (single(pi) * (single(2.0) + (single(-1.3333333333333333) * (uy * (uy * (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.10000000149011612:\\
\;\;\;\;\left(uy \cdot {\left(ux \cdot \left(maxCos \cdot -2 + \left(2 + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)\right)}^{0.5}\right) \cdot \left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(uy \cdot \left(uy \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.100000001

    1. Initial program 54.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 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      3. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      4. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      5. associate-*r*N/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      7. mul-1-negN/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      13. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      16. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f3297.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
    8. Simplified97.5%

      \[\leadsto \left(uy \cdot \left(\pi \cdot \left(2 + \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + \left(\left(-ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)}} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \mathsf{*.f32}\left(\left(\sqrt{ux \cdot \left(2 + \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)} \cdot uy\right), \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(2 + \left(\frac{-4}{3} \cdot \left(uy \cdot uy\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    10. Applied egg-rr97.6%

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

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

    1. Initial program 50.1%

      \[\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), \mathsf{sqrt.f32}\left(\color{blue}{\left(1 - {\left(1 - ux\right)}^{2}\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(1, \left({\left(1 - ux\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(1, \left(\left(1 - ux\right) \cdot \left(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(1, \mathsf{*.f32}\left(\left(1 - ux\right), \left(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(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \left(1 - ux\right)\right)\right)\right)\right) \]
      5. --lowering--.f3248.4%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\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. Simplified48.4%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{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-*.f3279.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(2, ux\right)\right)\right) \]
    8. Simplified79.5%

      \[\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 simplification95.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.10000000149011612:\\ \;\;\;\;\left(uy \cdot {\left(ux \cdot \left(maxCos \cdot -2 + \left(2 + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)\right)}^{0.5}\right) \cdot \left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(uy \cdot \left(uy \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 8: 89.2% accurate, 1.7× speedup?

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

\\
\left(uy \cdot {\left(ux \cdot \left(maxCos \cdot -2 + \left(2 + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)\right)}^{0.5}\right) \cdot \left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(uy \cdot \left(uy \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)
\end{array}
Derivation
  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. Add Preprocessing
  3. 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. associate-*r*N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    7. mul-1-negN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    13. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    14. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    16. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f3289.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  8. Simplified89.3%

    \[\leadsto \left(uy \cdot \left(\pi \cdot \left(2 + \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + \left(\left(-ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)}} \]
  9. Step-by-step derivation
    1. *-commutativeN/A

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

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

      \[\leadsto \mathsf{*.f32}\left(\left(\sqrt{ux \cdot \left(2 + \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)} \cdot uy\right), \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(2 + \left(\frac{-4}{3} \cdot \left(uy \cdot uy\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
  10. Applied egg-rr89.4%

    \[\leadsto \color{blue}{\left({\left(ux \cdot \left(\left(2 - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)\right)}^{0.5} \cdot uy\right) \cdot \left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(uy \cdot \left(uy \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)} \]
  11. Final simplification89.4%

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

Alternative 9: 89.2% accurate, 1.7× speedup?

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

\\
uy \cdot \left({\left(ux \cdot \left(maxCos \cdot -2 + \left(2 + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)\right)\right)}^{0.5} \cdot \left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(uy \cdot \left(uy \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\right)
\end{array}
Derivation
  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. Add Preprocessing
  3. 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. associate-*r*N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    7. mul-1-negN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    13. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    14. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    16. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f3289.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  8. Simplified89.3%

    \[\leadsto \left(uy \cdot \left(\pi \cdot \left(2 + \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + \left(\left(-ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)}} \]
  9. Step-by-step derivation
    1. associate-*l*N/A

      \[\leadsto uy \cdot \color{blue}{\left(\left(\mathsf{PI}\left(\right) \cdot \left(2 + \left(\frac{-4}{3} \cdot \left(uy \cdot uy\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 + \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)}\right)} \]
    2. *-commutativeN/A

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

      \[\leadsto \mathsf{*.f32}\left(\left(\left(\mathsf{PI}\left(\right) \cdot \left(2 + \left(\frac{-4}{3} \cdot \left(uy \cdot uy\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 + \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)}\right), \color{blue}{uy}\right) \]
  10. Applied egg-rr89.3%

    \[\leadsto \color{blue}{\left(\left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(uy \cdot \left(uy \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right) \cdot {\left(ux \cdot \left(\left(2 - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right) + maxCos \cdot -2\right)\right)}^{0.5}\right) \cdot uy} \]
  11. Final simplification89.3%

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

Alternative 10: 89.2% accurate, 1.7× speedup?

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

\\
\left(uy \cdot \left(\pi \cdot \left(2 + \pi \cdot \left(-1.3333333333333333 \cdot \left(\pi \cdot \left(uy \cdot uy\right)\right)\right)\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 + \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)}
\end{array}
Derivation
  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. Add Preprocessing
  3. 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. associate-*r*N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    7. mul-1-negN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    13. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    14. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    16. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f3289.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  8. Simplified89.3%

    \[\leadsto \left(uy \cdot \left(\pi \cdot \left(2 + \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + \left(\left(-ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)}} \]
  9. Step-by-step derivation
    1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

Alternative 11: 89.2% accurate, 1.7× speedup?

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

\\
\sqrt{ux \cdot \left(2 + \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)} \cdot \left(uy \cdot \left(\pi \cdot \left(2 + \left(\pi \cdot \pi\right) \cdot \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right)\right)\right)\right)
\end{array}
Derivation
  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. Add Preprocessing
  3. 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. associate-*r*N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    7. mul-1-negN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    13. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    14. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    16. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f3289.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  8. Simplified89.3%

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

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

Alternative 12: 89.2% accurate, 1.7× speedup?

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

\\
\left(uy \cdot \left(\pi \cdot \left(2 + \left(\pi \cdot \pi\right) \cdot \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right)\right)\right)\right) \cdot \sqrt{ux \cdot \left(\left(2 + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right) - 2 \cdot maxCos\right)}
\end{array}
Derivation
  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. Add Preprocessing
  3. 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. associate-*r*N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    7. mul-1-negN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    13. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    14. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    16. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f3289.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  8. Simplified89.3%

    \[\leadsto \left(uy \cdot \left(\pi \cdot \left(2 + \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + \left(\left(-ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2 \cdot maxCos\right)\right)}} \]
  9. Step-by-step derivation
    1. associate-+r-N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(2 + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right) - 2 \cdot maxCos\right)\right)\right)\right) \]
    2. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(2 + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right) \]
    3. distribute-lft-neg-outN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(2 + \left(\mathsf{neg}\left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right) \]
    4. unsub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(2 - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right) \]
    5. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\mathsf{\_.f32}\left(2, \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f32N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos + -1\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right) \]
    8. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right) \]
    9. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right) \]
    10. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \left(maxCos \cdot 2\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f3289.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \mathsf{*.f32}\left(maxCos, 2\right)\right)\right)\right)\right) \]
  10. Applied egg-rr89.3%

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

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

Alternative 13: 88.0% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 53.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 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      3. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      4. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      5. associate-*r*N/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      7. mul-1-negN/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      13. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      16. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f3288.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
    8. Simplified88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{neg.f32}\left(ux\right)\right)\right)\right), uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      19. PI-lowering-PI.f3288.6%

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

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

    if 4.99999999e-7 < maxCos

    1. Initial program 52.4%

      \[\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. +-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(ux, \left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)\right)\right)\right) \]
      4. 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(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + -2 \cdot maxCos\right)\right)\right)\right) \]
      5. associate-+l+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(ux, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + \left(2 + -2 \cdot maxCos\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(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 + -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(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + \left(2 + maxCos \cdot -2\right)\right)}} \]
    6. Step-by-step derivation
      1. 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(\left(ux \cdot \left(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right) + maxCos \cdot -2\right)\right)\right)\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f32}\left(\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(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right) \cdot ux + \left(maxCos \cdot -2\right) \cdot ux\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(\left(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right) \cdot ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right) + 2\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
      5. +-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(\left(2 + \left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot 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(\mathsf{+.f32}\left(2, \left(\left(1 - maxCos\right) \cdot \left(\left(maxCos + -1\right) \cdot ux\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
      7. *-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(\mathsf{+.f32}\left(2, \left(\left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\left(1 - maxCos\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
      10. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(ux \cdot \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{*.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \left(ux \cdot \left(maxCos - 1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \left(maxCos - 1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
      13. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\right)\right)\right)\right) \]
      14. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \left(\left(maxCos \cdot -2\right) \cdot ux\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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \mathsf{*.f32}\left(\left(maxCos \cdot -2\right), ux\right)\right)\right)\right) \]
      17. *-lowering-*.f3298.6%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, 2\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), ux\right)\right)\right)\right) \]
    7. Applied egg-rr98.6%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(2 + \left(1 - maxCos\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) \cdot ux + \left(maxCos \cdot -2\right) \cdot ux}} \]
    8. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), ux\right)\right)\right)\right) \]
    9. 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(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), 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(\mathsf{*.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \color{blue}{\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), ux\right)}\right)\right)\right) \]
      3. PI-lowering-PI.f3286.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(\mathsf{*.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, maxCos\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, -2\right), \color{blue}{ux}\right)\right)\right)\right) \]
    10. Simplified86.8%

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

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

Alternative 14: 88.7% accurate, 1.7× speedup?

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

\\
\left(uy \cdot \left(\pi \cdot \left(2 + \left(\pi \cdot \pi\right) \cdot \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right)\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 + \left(maxCos \cdot \left(-2 + 2 \cdot ux\right) - ux\right)\right)}
\end{array}
Derivation
  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. Add Preprocessing
  3. 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. associate-*r*N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    7. mul-1-negN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    13. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    14. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    16. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f3289.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  8. Simplified89.3%

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot ux + maxCos \cdot \left(2 \cdot ux - 2\right)\right)\right)\right)\right)\right) \]
    2. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{+.f32}\left(\left(-1 \cdot ux\right), \left(maxCos \cdot \left(2 \cdot ux - 2\right)\right)\right)\right)\right)\right)\right) \]
    3. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{+.f32}\left(\left(\mathsf{neg}\left(ux\right)\right), \left(maxCos \cdot \left(2 \cdot ux - 2\right)\right)\right)\right)\right)\right)\right) \]
    4. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{+.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(maxCos \cdot \left(2 \cdot ux - 2\right)\right)\right)\right)\right)\right)\right) \]
    5. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{+.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(maxCos, \left(2 \cdot ux - 2\right)\right)\right)\right)\right)\right)\right) \]
    6. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{+.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(maxCos, \left(2 \cdot ux + \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{+.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(maxCos, \left(2 \cdot ux + -2\right)\right)\right)\right)\right)\right)\right) \]
    8. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{+.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(\left(2 \cdot ux\right), -2\right)\right)\right)\right)\right)\right)\right) \]
    9. *-lowering-*.f3288.7%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{+.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, ux\right), -2\right)\right)\right)\right)\right)\right)\right) \]
  11. Simplified88.7%

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

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

Alternative 15: 88.0% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 53.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 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      3. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      4. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      5. associate-*r*N/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      7. mul-1-negN/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      13. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      16. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f3288.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
    8. Simplified88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{neg.f32}\left(ux\right)\right)\right)\right), uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      19. PI-lowering-PI.f3288.6%

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

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

    if 4.99999999e-7 < maxCos

    1. Initial program 52.4%

      \[\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 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      3. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      4. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      5. associate-*r*N/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      7. mul-1-negN/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      13. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      16. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f3293.8%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
    8. Simplified93.8%

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

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

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

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

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

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

Alternative 16: 88.0% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999987376214 \cdot 10^{-7}:\\ \;\;\;\;\left(uy \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right) \cdot \left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(\left(\pi \cdot \pi\right) \cdot \left(uy \cdot uy\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(maxCos \cdot -2 + \left(2 + 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.999999987376214e-7)
   (*
    (* uy (sqrt (* ux (- 2.0 ux))))
    (* PI (+ 2.0 (* -1.3333333333333333 (* (* PI PI) (* uy uy))))))
   (*
    (* uy (* 2.0 PI))
    (sqrt
     (*
      ux
      (+
       (* maxCos -2.0)
       (+ 2.0 (* ux (* (- 1.0 maxCos) (+ maxCos -1.0))))))))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (maxCos <= 4.999999987376214e-7f) {
		tmp = (uy * sqrtf((ux * (2.0f - ux)))) * (((float) M_PI) * (2.0f + (-1.3333333333333333f * ((((float) M_PI) * ((float) M_PI)) * (uy * uy)))));
	} else {
		tmp = (uy * (2.0f * ((float) M_PI))) * sqrtf((ux * ((maxCos * -2.0f) + (2.0f + (ux * ((1.0f - maxCos) * (maxCos + -1.0f)))))));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (maxCos <= Float32(4.999999987376214e-7))
		tmp = Float32(Float32(uy * sqrt(Float32(ux * Float32(Float32(2.0) - ux)))) * Float32(Float32(pi) * Float32(Float32(2.0) + Float32(Float32(-1.3333333333333333) * Float32(Float32(Float32(pi) * Float32(pi)) * Float32(uy * uy))))));
	else
		tmp = Float32(Float32(uy * Float32(Float32(2.0) * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(maxCos * Float32(-2.0)) + Float32(Float32(2.0) + 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.999999987376214e-7))
		tmp = (uy * sqrt((ux * (single(2.0) - ux)))) * (single(pi) * (single(2.0) + (single(-1.3333333333333333) * ((single(pi) * single(pi)) * (uy * uy)))));
	else
		tmp = (uy * (single(2.0) * single(pi))) * sqrt((ux * ((maxCos * single(-2.0)) + (single(2.0) + (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.999999987376214 \cdot 10^{-7}:\\
\;\;\;\;\left(uy \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right) \cdot \left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(\left(\pi \cdot \pi\right) \cdot \left(uy \cdot uy\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(maxCos \cdot -2 + \left(2 + 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.99999999e-7

    1. Initial program 53.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 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      3. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
      4. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      5. associate-*r*N/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      7. mul-1-negN/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      13. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      16. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f3288.5%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
    8. Simplified88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{neg.f32}\left(ux\right)\right)\right)\right), uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      19. PI-lowering-PI.f3288.6%

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

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

    if 4.99999999e-7 < maxCos

    1. Initial program 52.4%

      \[\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 uy around 0

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

        \[\leadsto \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right) \cdot \color{blue}{2} \]
      2. *-commutativeN/A

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

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

        \[\leadsto \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}} \cdot \left(uy \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)}\right) \]
      5. *-commutativeN/A

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\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), \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\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), \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f32}\left(\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), \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f32}\left(\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), \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\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), \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
      5. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \left(-2 \cdot maxCos\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
      17. *-lowering-*.f3286.6%

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

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

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

Alternative 17: 88.1% accurate, 1.8× speedup?

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

\\
\left(uy \cdot \left(\pi \cdot \left(2 + \left(\pi \cdot \pi\right) \cdot \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right)\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 - \left(ux + 2 \cdot maxCos\right)\right)}
\end{array}
Derivation
  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. Add Preprocessing
  3. 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. associate-*r*N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    7. mul-1-negN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    13. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    14. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    16. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f3289.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  8. Simplified89.3%

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\color{blue}{\left(-1 \cdot ux\right)}, \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  10. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(\mathsf{neg}\left(ux\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
    2. neg-lowering-neg.f3288.1%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  11. Simplified88.1%

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

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

Alternative 18: 84.3% accurate, 1.8× speedup?

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

\\
\left(uy \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right) \cdot \left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(\left(\pi \cdot \pi\right) \cdot \left(uy \cdot uy\right)\right)\right)\right)
\end{array}
Derivation
  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. Add Preprocessing
  3. 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. associate-*r*N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    7. mul-1-negN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    13. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    14. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    16. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f3289.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  8. Simplified89.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{neg.f32}\left(ux\right)\right)\right)\right), uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
    19. PI-lowering-PI.f3284.0%

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

    \[\leadsto \color{blue}{\left(\sqrt{ux \cdot \left(2 + \left(-ux\right)\right)} \cdot uy\right) \cdot \left(\pi \cdot \left(2 + -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right)} \]
  12. Final simplification84.0%

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

Alternative 19: 84.3% accurate, 1.8× speedup?

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

\\
\left(uy \cdot \left(\pi \cdot \left(2 + \left(\pi \cdot \pi\right) \cdot \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right)\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}
\end{array}
Derivation
  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. Add Preprocessing
  3. 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(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right), \mathsf{+.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, maxCos\right)\right)\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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) \]
  7. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\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. associate--l+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \left(2 + \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2 \cdot maxCos\right)\right)\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    5. associate-*r*N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\left(-1 \cdot ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    7. mul-1-negN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left({\left(maxCos - 1\right)}^{2}\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    13. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    14. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    16. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right)\right) \]
    17. *-lowering-*.f3289.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right)\right) \]
  8. Simplified89.3%

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \color{blue}{\left(2 + -1 \cdot ux\right)}\right)\right)\right) \]
  10. Step-by-step derivation
    1. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-1 \cdot ux\right)\right)\right)\right)\right) \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(\mathsf{neg}\left(ux\right)\right)\right)\right)\right)\right) \]
    3. neg-lowering-neg.f3284.0%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(2, \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{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{neg.f32}\left(ux\right)\right)\right)\right)\right) \]
  11. Simplified84.0%

    \[\leadsto \left(uy \cdot \left(\pi \cdot \left(2 + \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(2 + \left(-ux\right)\right)}} \]
  12. Final simplification84.0%

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

Alternative 20: 75.6% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ux < 1.53e-4

    1. Initial program 36.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 uy around 0

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

        \[\leadsto \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right) \cdot \color{blue}{2} \]
      2. *-commutativeN/A

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

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

        \[\leadsto \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}} \cdot \left(uy \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)}\right) \]
      5. *-commutativeN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \left(-2 \cdot maxCos\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
      5. *-lowering-*.f3278.4%

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

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

    if 1.53e-4 < ux

    1. Initial program 88.1%

      \[\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), \mathsf{sqrt.f32}\left(\color{blue}{\left(1 - {\left(1 - ux\right)}^{2}\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(1, \left({\left(1 - ux\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(1, \left(\left(1 - ux\right) \cdot \left(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(1, \mathsf{*.f32}\left(\left(1 - ux\right), \left(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(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \left(1 - ux\right)\right)\right)\right)\right) \]
      5. --lowering--.f3283.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. Simplified83.0%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 - \left(1 - ux\right) \cdot \left(1 - ux\right)}} \]
    6. 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, ux\right), \mathsf{\_.f32}\left(1, ux\right)\right)\right)\right)\right) \]
    7. 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, ux\right), \mathsf{\_.f32}\left(1, ux\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, ux\right), \mathsf{\_.f32}\left(1, ux\right)\right)}\right)\right)\right) \]
      3. PI-lowering-PI.f3270.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(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \color{blue}{\mathsf{\_.f32}\left(1, ux\right)}\right)\right)\right)\right) \]
    8. Simplified70.6%

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

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

Alternative 21: 65.7% accurate, 2.0× speedup?

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

\\
\left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 + maxCos \cdot -2\right)}
\end{array}
Derivation
  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. Add Preprocessing
  3. Taylor expanded in uy around 0

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

      \[\leadsto \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right) \cdot \color{blue}{2} \]
    2. *-commutativeN/A

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

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

      \[\leadsto \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}} \cdot \left(uy \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)}\right) \]
    5. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

Alternative 22: 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 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. Add Preprocessing
  3. Taylor expanded in uy around 0

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

      \[\leadsto \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right) \cdot \color{blue}{2} \]
    2. *-commutativeN/A

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

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

      \[\leadsto \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}} \cdot \left(uy \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)}\right) \]
    5. *-commutativeN/A

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

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

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

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

      \[\leadsto \sqrt{1 - \color{blue}{1}} \cdot \left(uy \cdot \left(2 \cdot \pi\right)\right) \]
    2. Step-by-step derivation
      1. pow1/2N/A

        \[\leadsto {\left(1 - 1\right)}^{\frac{1}{2}} \cdot \left(\color{blue}{uy} \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto {0}^{\frac{1}{2}} \cdot \left(uy \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto 0 \cdot \left(\color{blue}{uy} \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      4. mul0-lft7.2%

        \[\leadsto 0 \]
    3. Applied egg-rr7.2%

      \[\leadsto \color{blue}{0} \]
    4. Add Preprocessing

    Reproduce

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