UniformSampleCone, x

Percentage Accurate: 57.4% → 99.0%
Time: 15.3s
Alternatives: 22
Speedup: 2.1×

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\\ \cos \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))))
   (* (cos (* (* 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 cosf(((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(cos(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 = cos(((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\\
\cos \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: 57.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ \cos \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))))
   (* (cos (* (* 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 cosf(((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(cos(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 = cos(((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\\
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
\end{array}

Alternative 1: 99.0% accurate, 1.0× speedup?

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

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

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified61.1%

    \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

    \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
  7. Step-by-step derivation
    1. distribute-lft-out--N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
    2. distribute-lft-out--N/A

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
  8. Applied egg-rr99.0%

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

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

Alternative 2: 99.0% accurate, 1.0× speedup?

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

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

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified61.1%

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \left(\mathsf{neg}\left(maxCos \cdot 2\right)\right)\right)\right)\right)\right) \]
    17. distribute-rgt-neg-inN/A

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

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

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

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

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

Alternative 3: 97.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := ux \cdot \left(1 - maxCos\right)\\
\mathbf{if}\;uy \leq 0.014000000432133675:\\
\;\;\;\;\sqrt{ux \cdot \left(\left(\left(maxCos + -1\right) \cdot t\_0 + \left(1 - maxCos\right)\right) + \left(1 - maxCos\right)\right)} \cdot \left(\left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right) + 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.0140000004

    1. Initial program 59.8%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified59.8%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
    7. Step-by-step derivation
      1. distribute-lft-out--N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
      2. distribute-lft-out--N/A

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0140000004 < uy

    1. Initial program 66.2%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified66.2%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.3% accurate, 1.0× speedup?

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

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

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified61.1%

    \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

    \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
  7. Step-by-step derivation
    1. distribute-lft-out--N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
    2. distribute-lft-out--N/A

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
  8. Applied egg-rr99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 98.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos \left(uy \cdot \left(2 \cdot \pi\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
 (*
  (cos (* uy (* 2.0 PI)))
  (sqrt (* ux (+ 2.0 (- (* maxCos (+ -2.0 (* 2.0 ux))) ux))))))
float code(float ux, float uy, float maxCos) {
	return cosf((uy * (2.0f * ((float) M_PI)))) * sqrtf((ux * (2.0f + ((maxCos * (-2.0f + (2.0f * ux))) - ux))));
}
function code(ux, uy, maxCos)
	return Float32(cos(Float32(uy * Float32(Float32(2.0) * Float32(pi)))) * 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 = cos((uy * (single(2.0) * single(pi)))) * sqrt((ux * (single(2.0) + ((maxCos * (single(-2.0) + (single(2.0) * ux))) - ux))));
end
\begin{array}{l}

\\
\cos \left(uy \cdot \left(2 \cdot \pi\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 61.0%

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified61.1%

    \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

    \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
  7. Step-by-step derivation
    1. distribute-lft-out--N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
    2. distribute-lft-out--N/A

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
  8. Applied egg-rr99.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(\left(ux \cdot 2\right), -2\right)\right), ux\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f3298.0%

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

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

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

Alternative 6: 97.6% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.0140000004

    1. Initial program 59.8%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified59.8%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
    7. Step-by-step derivation
      1. distribute-lft-out--N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
      2. distribute-lft-out--N/A

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0140000004 < uy

    1. Initial program 66.2%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified66.2%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3293.7%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified93.7%

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux - \left(-ux\right)\right) - ux \cdot ux}} \]
    10. Step-by-step derivation
      1. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(ux - \left(\mathsf{neg}\left(ux\right)\right)\right) - ux \cdot ux\right)\right)\right) \]
      2. associate--l-N/A

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{*.f32}\left(ux, \left(-1 + ux\right)\right)\right)\right)\right) \]
      7. +-lowering-+.f3293.9%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(-1, ux\right)\right)\right)\right)\right) \]
    11. Applied egg-rr93.9%

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

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

Alternative 7: 97.6% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.0140000004

    1. Initial program 59.8%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified59.8%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
    7. Step-by-step derivation
      1. distribute-lft-out--N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
      2. distribute-lft-out--N/A

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0140000004 < uy

    1. Initial program 66.2%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified66.2%

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \left(\mathsf{neg}\left(maxCos \cdot 2\right)\right)\right)\right)\right)\right) \]
      17. distribute-rgt-neg-inN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right), \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      8. PI-lowering-PI.f3293.9%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(2, ux\right)\right)\right), \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right) \]
    10. Simplified93.9%

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

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

Alternative 8: 94.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := ux \cdot \left(1 - maxCos\right)\\
\mathbf{if}\;uy \leq 0.032999999821186066:\\
\;\;\;\;\left(\left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right) + 1\right) \cdot \sqrt{\left(t\_0 + ux \cdot \left(\left(maxCos + -1\right) \cdot t\_0\right)\right) + t\_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.0329999998

    1. Initial program 60.6%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified60.7%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0329999998 < uy

    1. Initial program 63.4%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified63.4%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3291.6%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified91.6%

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, 2\right)\right)\right) \]
    12. Simplified68.7%

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

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

Alternative 9: 88.6% accurate, 1.7× speedup?

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

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

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified61.1%

    \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 88.6% accurate, 1.7× speedup?

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

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

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified61.1%

    \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

    \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
  7. Step-by-step derivation
    1. distribute-lft-out--N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
    2. distribute-lft-out--N/A

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
  8. Applied egg-rr99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 88.6% accurate, 1.7× speedup?

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

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

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Step-by-step derivation
    1. distribute-rgt-inN/A

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

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified61.1%

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{\_.f32}\left(2, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right), \left(\mathsf{neg}\left(maxCos \cdot 2\right)\right)\right)\right)\right)\right) \]
    17. distribute-rgt-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 87.1% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 62.8%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified62.8%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3298.8%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified98.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f3288.9%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    12. Simplified88.9%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, \color{blue}{ux}\right)\right)\right)\right) \]
    14. Applied egg-rr88.9%

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

    if 4.00000005e-7 < maxCos

    1. Initial program 53.0%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified53.4%

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

      \[\leadsto \color{blue}{\sqrt{1 - {\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}}} \]
    6. Step-by-step derivation
      1. sqrt-lowering-sqrt.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f3247.0%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right) \]
    7. Simplified47.0%

      \[\leadsto \color{blue}{\sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    8. Taylor expanded in ux around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
      22. +-lowering-+.f3283.8%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right) \]
    10. Simplified83.8%

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

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

Alternative 13: 87.1% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 62.8%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified62.8%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3298.8%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified98.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f3288.9%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    12. Simplified88.9%

      \[\leadsto \color{blue}{\left(1 + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)} \cdot \sqrt{\left(ux - \left(-ux\right)\right) - ux \cdot ux} \]
    13. Step-by-step derivation
      1. --lowering--.f32N/A

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{+.f32}\left(ux, ux\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      5. *-lowering-*.f3288.9%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{+.f32}\left(ux, ux\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    14. Applied egg-rr88.9%

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

    if 4.00000005e-7 < maxCos

    1. Initial program 53.0%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified53.4%

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

      \[\leadsto \color{blue}{\sqrt{1 - {\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}}} \]
    6. Step-by-step derivation
      1. sqrt-lowering-sqrt.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f3247.0%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right) \]
    7. Simplified47.0%

      \[\leadsto \color{blue}{\sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    8. Taylor expanded in ux around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
      22. +-lowering-+.f3283.8%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right) \]
    10. Simplified83.8%

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

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

Alternative 14: 87.1% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 62.8%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified62.8%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3298.8%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified98.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f3288.9%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    12. Simplified88.9%

      \[\leadsto \color{blue}{\left(1 + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)} \cdot \sqrt{\left(ux - \left(-ux\right)\right) - ux \cdot ux} \]
    13. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(ux, \mathsf{\_.f32}\left(ux, \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right)\right) \]
    14. Applied egg-rr88.8%

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

    if 4.00000005e-7 < maxCos

    1. Initial program 53.0%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified53.4%

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

      \[\leadsto \color{blue}{\sqrt{1 - {\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}}} \]
    6. Step-by-step derivation
      1. sqrt-lowering-sqrt.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f3247.0%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right) \]
    7. Simplified47.0%

      \[\leadsto \color{blue}{\sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    8. Taylor expanded in ux around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
      22. +-lowering-+.f3283.8%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right) \]
    10. Simplified83.8%

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

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

Alternative 15: 87.1% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 62.8%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified62.8%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3298.8%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified98.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f3288.9%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    12. Simplified88.9%

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

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

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

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

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

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

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

    if 4.00000005e-7 < maxCos

    1. Initial program 53.0%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified53.4%

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

      \[\leadsto \color{blue}{\sqrt{1 - {\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}}} \]
    6. Step-by-step derivation
      1. sqrt-lowering-sqrt.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f3247.0%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right) \]
    7. Simplified47.0%

      \[\leadsto \color{blue}{\sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    8. Taylor expanded in ux around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
      22. +-lowering-+.f3283.8%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, ux\right), \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(2, \mathsf{*.f32}\left(-2, maxCos\right)\right), ux\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right) \]
    10. Simplified83.8%

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

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

Alternative 16: 87.1% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 62.8%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified62.8%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3298.8%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified98.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f3288.9%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    12. Simplified88.9%

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

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

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

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

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

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

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

    if 4.00000005e-7 < maxCos

    1. Initial program 53.0%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified53.4%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
    7. Step-by-step derivation
      1. distribute-lft-out--N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
      2. distribute-lft-out--N/A

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.2%

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

      \[\leadsto \color{blue}{\sqrt{ux \cdot \left(\left(2 + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right) - 2 \cdot maxCos\right)}} \]
    10. Step-by-step derivation
      1. sqrt-lowering-sqrt.f32N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(1, maxCos\right)\right), \mathsf{+.f32}\left(maxCos, -1\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f3283.7%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(1, maxCos\right)\right), \mathsf{+.f32}\left(maxCos, -1\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right) \]
    11. Simplified83.7%

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

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

Alternative 17: 83.4% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.00340000005

    1. Initial program 60.0%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified60.1%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
    7. Step-by-step derivation
      1. distribute-lft-out--N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot \left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
      2. distribute-lft-out--N/A

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(\left(\left(1 + \left(\mathsf{neg}\left(maxCos\right)\right)\right) - \left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(maxCos + -1\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.4%

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

      \[\leadsto \color{blue}{\sqrt{ux \cdot \left(\left(2 + ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right) - 2 \cdot maxCos\right)}} \]
    10. Step-by-step derivation
      1. sqrt-lowering-sqrt.f32N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(1, maxCos\right)\right), \mathsf{+.f32}\left(maxCos, -1\right)\right), \left(2 \cdot maxCos\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f3295.1%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(2, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{\_.f32}\left(1, maxCos\right)\right), \mathsf{+.f32}\left(maxCos, -1\right)\right), \mathsf{*.f32}\left(2, maxCos\right)\right)\right)\right)\right) \]
    11. Simplified95.1%

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

    if 0.00340000005 < uy

    1. Initial program 63.7%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified63.7%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right) + 1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      6. distribute-lft1-inN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(\left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right) + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      7. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
      8. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
    6. Applied egg-rr97.8%

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
    7. Taylor expanded in maxCos around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux - \left(-1 \cdot ux + {ux}^{2}\right)\right)}\right)\right) \]
    8. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(ux - -1 \cdot ux\right) - {ux}^{2}\right)\right)\right) \]
      2. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(ux - -1 \cdot ux\right), \left({ux}^{2}\right)\right)\right)\right) \]
      3. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(-1 \cdot ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3291.8%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified91.8%

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux - \left(-ux\right)\right) - ux \cdot ux}} \]
    10. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    11. Step-by-step derivation
      1. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \left(-2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)}\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \left(\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \color{blue}{\mathsf{*.f32}\left(ux, ux\right)}\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\left(-2 \cdot {uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \color{blue}{\mathsf{*.f32}\left(ux, ux\right)}\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(\color{blue}{ux}, ux\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \left(uy \cdot uy\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      6. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, \color{blue}{ux}\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, \color{blue}{ux}\right)\right)\right)\right) \]
      9. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f3259.3%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    12. Simplified59.3%

      \[\leadsto \color{blue}{\left(1 + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)} \cdot \sqrt{\left(ux - \left(-ux\right)\right) - ux \cdot ux} \]
    13. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(2 \cdot ux\right)}\right)\right) \]
    14. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot 2\right)\right)\right) \]
      2. *-lowering-*.f3251.4%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, 2\right)\right)\right) \]
    15. Simplified51.4%

      \[\leadsto \left(1 + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot 2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \leq 0.0034000000450760126:\\ \;\;\;\;\sqrt{ux \cdot \left(2 + \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right) - 2 \cdot maxCos\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right) + 1\right) \cdot \sqrt{2 \cdot ux}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 83.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 0.0034000000450760126:\\ \;\;\;\;\sqrt{\left(ux \cdot maxCos\right) \cdot \left(\left(-2\right) - ux \cdot -2\right) - ux \cdot \left(ux + -2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right) + 1\right) \cdot \sqrt{2 \cdot ux}\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= uy 0.0034000000450760126)
   (sqrt (- (* (* ux maxCos) (- (- 2.0) (* ux -2.0))) (* ux (+ ux -2.0))))
   (* (+ (* (* -2.0 (* uy uy)) (* PI PI)) 1.0) (sqrt (* 2.0 ux)))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (uy <= 0.0034000000450760126f) {
		tmp = sqrtf((((ux * maxCos) * (-2.0f - (ux * -2.0f))) - (ux * (ux + -2.0f))));
	} else {
		tmp = (((-2.0f * (uy * uy)) * (((float) M_PI) * ((float) M_PI))) + 1.0f) * sqrtf((2.0f * ux));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (uy <= Float32(0.0034000000450760126))
		tmp = sqrt(Float32(Float32(Float32(ux * maxCos) * Float32(Float32(-Float32(2.0)) - Float32(ux * Float32(-2.0)))) - Float32(ux * Float32(ux + Float32(-2.0)))));
	else
		tmp = Float32(Float32(Float32(Float32(Float32(-2.0) * Float32(uy * uy)) * Float32(Float32(pi) * Float32(pi))) + Float32(1.0)) * sqrt(Float32(Float32(2.0) * ux)));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if (uy <= single(0.0034000000450760126))
		tmp = sqrt((((ux * maxCos) * (-single(2.0) - (ux * single(-2.0)))) - (ux * (ux + single(-2.0)))));
	else
		tmp = (((single(-2.0) * (uy * uy)) * (single(pi) * single(pi))) + single(1.0)) * sqrt((single(2.0) * ux));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;uy \leq 0.0034000000450760126:\\
\;\;\;\;\sqrt{\left(ux \cdot maxCos\right) \cdot \left(\left(-2\right) - ux \cdot -2\right) - ux \cdot \left(ux + -2\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(\left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right) + 1\right) \cdot \sqrt{2 \cdot ux}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.00340000005

    1. Initial program 60.0%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      2. sub-negN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      5. associate-+l+N/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified60.1%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in uy around 0

      \[\leadsto \color{blue}{\sqrt{1 - {\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}}} \]
    6. Step-by-step derivation
      1. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\left(1 - {\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}\right)\right) \]
      2. --lowering--.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \left({\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}\right)\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \left(\left(1 + ux \cdot \left(maxCos - 1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\left(1 + ux \cdot \left(maxCos - 1\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \left(ux \cdot \left(maxCos - 1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos - 1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
      7. sub-negN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
      10. +-lowering-+.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \left(ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos - 1\right)\right)\right)\right)\right)\right) \]
      12. sub-negN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      14. +-lowering-+.f3259.3%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right) \]
    7. Simplified59.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)}} \]
    8. Taylor expanded in ux around 0

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{\left(1 + ux \cdot \left(\left(2 \cdot maxCos + ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2\right)\right)}\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \left(ux \cdot \left(\left(2 \cdot maxCos + ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2\right)\right)\right)\right)\right) \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(\left(2 \cdot maxCos + ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2\right)\right)\right)\right)\right) \]
      3. associate--l+N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(2 \cdot maxCos + \left(ux \cdot {\left(maxCos - 1\right)}^{2} - 2\right)\right)\right)\right)\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 \cdot maxCos\right), \left(ux \cdot {\left(maxCos - 1\right)}^{2} - 2\right)\right)\right)\right)\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \left(ux \cdot {\left(maxCos - 1\right)}^{2} - 2\right)\right)\right)\right)\right)\right) \]
      6. --lowering--.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\left(ux \cdot {\left(maxCos - 1\right)}^{2}\right), 2\right)\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \left({\left(maxCos - 1\right)}^{2}\right)\right), 2\right)\right)\right)\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
      10. sub-negN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
      12. +-lowering-+.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\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), 2\right)\right)\right)\right)\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
      15. +-lowering-+.f3261.9%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    10. Simplified61.9%

      \[\leadsto \sqrt{1 - \color{blue}{\left(1 + ux \cdot \left(2 \cdot maxCos + \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2\right)\right)\right)}} \]
    11. Taylor expanded in maxCos around 0

      \[\leadsto \mathsf{sqrt.f32}\left(\color{blue}{\left(-1 \cdot \left(maxCos \cdot \left(ux \cdot \left(2 + -2 \cdot ux\right)\right)\right) - ux \cdot \left(ux - 2\right)\right)}\right) \]
    12. Step-by-step derivation
      1. --lowering--.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(-1 \cdot \left(maxCos \cdot \left(ux \cdot \left(2 + -2 \cdot ux\right)\right)\right)\right), \left(ux \cdot \left(ux - 2\right)\right)\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(\mathsf{neg}\left(maxCos \cdot \left(ux \cdot \left(2 + -2 \cdot ux\right)\right)\right)\right), \left(ux \cdot \left(ux - 2\right)\right)\right)\right) \]
      3. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\left(maxCos \cdot \left(ux \cdot \left(2 + -2 \cdot ux\right)\right)\right)\right), \left(ux \cdot \left(ux - 2\right)\right)\right)\right) \]
      4. associate-*r*N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\left(\left(maxCos \cdot ux\right) \cdot \left(2 + -2 \cdot ux\right)\right)\right), \left(ux \cdot \left(ux - 2\right)\right)\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(maxCos \cdot ux\right), \left(2 + -2 \cdot ux\right)\right)\right), \left(ux \cdot \left(ux - 2\right)\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\mathsf{*.f32}\left(\left(ux \cdot maxCos\right), \left(2 + -2 \cdot ux\right)\right)\right), \left(ux \cdot \left(ux - 2\right)\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, maxCos\right), \left(2 + -2 \cdot ux\right)\right)\right), \left(ux \cdot \left(ux - 2\right)\right)\right)\right) \]
      8. +-lowering-+.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, maxCos\right), \mathsf{+.f32}\left(2, \left(-2 \cdot ux\right)\right)\right)\right), \left(ux \cdot \left(ux - 2\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, maxCos\right), \mathsf{+.f32}\left(2, \left(ux \cdot -2\right)\right)\right)\right), \left(ux \cdot \left(ux - 2\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, maxCos\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(ux, -2\right)\right)\right)\right), \left(ux \cdot \left(ux - 2\right)\right)\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, maxCos\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(ux, -2\right)\right)\right)\right), \mathsf{*.f32}\left(ux, \left(ux - 2\right)\right)\right)\right) \]
      12. sub-negN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, maxCos\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(ux, -2\right)\right)\right)\right), \mathsf{*.f32}\left(ux, \left(ux + \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, maxCos\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(ux, -2\right)\right)\right)\right), \mathsf{*.f32}\left(ux, \left(ux + -2\right)\right)\right)\right) \]
      14. +-lowering-+.f3294.5%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{neg.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, maxCos\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(ux, -2\right)\right)\right)\right), \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(ux, -2\right)\right)\right)\right) \]
    13. Simplified94.5%

      \[\leadsto \sqrt{\color{blue}{\left(-\left(ux \cdot maxCos\right) \cdot \left(2 + ux \cdot -2\right)\right) - ux \cdot \left(ux + -2\right)}} \]

    if 0.00340000005 < uy

    1. Initial program 63.7%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      2. sub-negN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      5. associate-+l+N/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified63.7%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(1 - \left(1 \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right) + \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      2. *-lft-identityN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(1 - \left(\left(1 + ux \cdot \left(maxCos + -1\right)\right) + \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      3. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right) + 1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      6. distribute-lft1-inN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(\left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right) + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      7. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
      8. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
    6. Applied egg-rr97.8%

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
    7. Taylor expanded in maxCos around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux - \left(-1 \cdot ux + {ux}^{2}\right)\right)}\right)\right) \]
    8. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(ux - -1 \cdot ux\right) - {ux}^{2}\right)\right)\right) \]
      2. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(ux - -1 \cdot ux\right), \left({ux}^{2}\right)\right)\right)\right) \]
      3. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(-1 \cdot ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3291.8%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified91.8%

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux - \left(-ux\right)\right) - ux \cdot ux}} \]
    10. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    11. Step-by-step derivation
      1. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \left(-2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)}\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \left(\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \color{blue}{\mathsf{*.f32}\left(ux, ux\right)}\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\left(-2 \cdot {uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \color{blue}{\mathsf{*.f32}\left(ux, ux\right)}\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(\color{blue}{ux}, ux\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \left(uy \cdot uy\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      6. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, \color{blue}{ux}\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, \color{blue}{ux}\right)\right)\right)\right) \]
      9. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f3259.3%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    12. Simplified59.3%

      \[\leadsto \color{blue}{\left(1 + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)} \cdot \sqrt{\left(ux - \left(-ux\right)\right) - ux \cdot ux} \]
    13. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(2 \cdot ux\right)}\right)\right) \]
    14. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot 2\right)\right)\right) \]
      2. *-lowering-*.f3251.4%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, 2\right)\right)\right) \]
    15. Simplified51.4%

      \[\leadsto \left(1 + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot 2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \leq 0.0034000000450760126:\\ \;\;\;\;\sqrt{\left(ux \cdot maxCos\right) \cdot \left(\left(-2\right) - ux \cdot -2\right) - ux \cdot \left(ux + -2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right) + 1\right) \cdot \sqrt{2 \cdot ux}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 79.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 0.0034000000450760126:\\ \;\;\;\;\sqrt{2 \cdot ux - ux \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right) + 1\right) \cdot \sqrt{2 \cdot ux}\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= uy 0.0034000000450760126)
   (sqrt (- (* 2.0 ux) (* ux ux)))
   (* (+ (* (* -2.0 (* uy uy)) (* PI PI)) 1.0) (sqrt (* 2.0 ux)))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (uy <= 0.0034000000450760126f) {
		tmp = sqrtf(((2.0f * ux) - (ux * ux)));
	} else {
		tmp = (((-2.0f * (uy * uy)) * (((float) M_PI) * ((float) M_PI))) + 1.0f) * sqrtf((2.0f * ux));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (uy <= Float32(0.0034000000450760126))
		tmp = sqrt(Float32(Float32(Float32(2.0) * ux) - Float32(ux * ux)));
	else
		tmp = Float32(Float32(Float32(Float32(Float32(-2.0) * Float32(uy * uy)) * Float32(Float32(pi) * Float32(pi))) + Float32(1.0)) * sqrt(Float32(Float32(2.0) * ux)));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if (uy <= single(0.0034000000450760126))
		tmp = sqrt(((single(2.0) * ux) - (ux * ux)));
	else
		tmp = (((single(-2.0) * (uy * uy)) * (single(pi) * single(pi))) + single(1.0)) * sqrt((single(2.0) * ux));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;uy \leq 0.0034000000450760126:\\
\;\;\;\;\sqrt{2 \cdot ux - ux \cdot ux}\\

\mathbf{else}:\\
\;\;\;\;\left(\left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right) + 1\right) \cdot \sqrt{2 \cdot ux}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.00340000005

    1. Initial program 60.0%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      2. sub-negN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      5. associate-+l+N/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified60.1%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(1 - \left(1 \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right) + \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      2. *-lft-identityN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(1 - \left(\left(1 + ux \cdot \left(maxCos + -1\right)\right) + \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      3. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right) + 1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      6. distribute-lft1-inN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(\left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right) + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      7. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
      8. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
    6. Applied egg-rr99.4%

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
    7. Taylor expanded in maxCos around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux - \left(-1 \cdot ux + {ux}^{2}\right)\right)}\right)\right) \]
    8. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(ux - -1 \cdot ux\right) - {ux}^{2}\right)\right)\right) \]
      2. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(ux - -1 \cdot ux\right), \left({ux}^{2}\right)\right)\right)\right) \]
      3. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(-1 \cdot ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3292.7%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified92.7%

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux - \left(-ux\right)\right) - ux \cdot ux}} \]
    10. Taylor expanded in uy around 0

      \[\leadsto \color{blue}{\sqrt{2 \cdot ux - {ux}^{2}}} \]
    11. Step-by-step derivation
      1. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\left(2 \cdot ux - {ux}^{2}\right)\right) \]
      2. --lowering--.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(2 \cdot ux\right), \left({ux}^{2}\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(ux \cdot 2\right), \left({ux}^{2}\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, 2\right), \left({ux}^{2}\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, 2\right), \left(ux \cdot ux\right)\right)\right) \]
      6. *-lowering-*.f3289.2%

        \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, 2\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right) \]
    12. Simplified89.2%

      \[\leadsto \color{blue}{\sqrt{ux \cdot 2 - ux \cdot ux}} \]

    if 0.00340000005 < uy

    1. Initial program 63.7%

      \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      2. sub-negN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      4. distribute-lft1-inN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
      5. associate-+l+N/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. Simplified63.7%

      \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(1 - \left(1 \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right) + \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      2. *-lft-identityN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(1 - \left(\left(1 + ux \cdot \left(maxCos + -1\right)\right) + \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
      3. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right) + 1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      6. distribute-lft1-inN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(\left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right) + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
      7. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
      8. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
    6. Applied egg-rr97.8%

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
    7. Taylor expanded in maxCos around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux - \left(-1 \cdot ux + {ux}^{2}\right)\right)}\right)\right) \]
    8. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(ux - -1 \cdot ux\right) - {ux}^{2}\right)\right)\right) \]
      2. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(ux - -1 \cdot ux\right), \left({ux}^{2}\right)\right)\right)\right) \]
      3. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(-1 \cdot ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      5. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
      7. *-lowering-*.f3291.8%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    9. Simplified91.8%

      \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux - \left(-ux\right)\right) - ux \cdot ux}} \]
    10. Taylor expanded in uy around 0

      \[\leadsto \mathsf{*.f32}\left(\color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    11. Step-by-step derivation
      1. +-lowering-+.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \left(-2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)}\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \left(\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \color{blue}{\mathsf{*.f32}\left(ux, ux\right)}\right)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\left(-2 \cdot {uy}^{2}\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \color{blue}{\mathsf{*.f32}\left(ux, ux\right)}\right)\right)\right) \]
      4. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(\color{blue}{ux}, ux\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \left(uy \cdot uy\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      6. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, \color{blue}{ux}\right)\right)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, \color{blue}{ux}\right)\right)\right)\right) \]
      9. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
      10. PI-lowering-PI.f3259.3%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
    12. Simplified59.3%

      \[\leadsto \color{blue}{\left(1 + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right)} \cdot \sqrt{\left(ux - \left(-ux\right)\right) - ux \cdot ux} \]
    13. Taylor expanded in ux around 0

      \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(2 \cdot ux\right)}\right)\right) \]
    14. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(ux \cdot 2\right)\right)\right) \]
      2. *-lowering-*.f3251.4%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(ux, 2\right)\right)\right) \]
    15. Simplified51.4%

      \[\leadsto \left(1 + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot 2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \leq 0.0034000000450760126:\\ \;\;\;\;\sqrt{2 \cdot ux - ux \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \pi\right) + 1\right) \cdot \sqrt{2 \cdot ux}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 75.9% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \sqrt{2 \cdot ux - ux \cdot ux} \end{array} \]
(FPCore (ux uy maxCos) :precision binary32 (sqrt (- (* 2.0 ux) (* ux ux))))
float code(float ux, float uy, float maxCos) {
	return sqrtf(((2.0f * ux) - (ux * ux)));
}
real(4) function code(ux, uy, maxcos)
    real(4), intent (in) :: ux
    real(4), intent (in) :: uy
    real(4), intent (in) :: maxcos
    code = sqrt(((2.0e0 * ux) - (ux * ux)))
end function
function code(ux, uy, maxCos)
	return sqrt(Float32(Float32(Float32(2.0) * ux) - Float32(ux * ux)))
end
function tmp = code(ux, uy, maxCos)
	tmp = sqrt(((single(2.0) * ux) - (ux * ux)));
end
\begin{array}{l}

\\
\sqrt{2 \cdot ux - ux \cdot ux}
\end{array}
Derivation
  1. Initial program 61.0%

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Step-by-step derivation
    1. distribute-rgt-inN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    2. sub-negN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    5. associate-+l+N/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified61.1%

    \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-rgt-inN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(1 - \left(1 \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right) + \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
    2. *-lft-identityN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(1 - \left(\left(1 + ux \cdot \left(maxCos + -1\right)\right) + \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
    3. associate--r+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right) + 1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
    6. distribute-lft1-inN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(\left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right) + ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
    7. associate--r+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right) - ux \cdot \left(maxCos + -1\right)\right)\right)\right) \]
    8. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(\left(1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right)\right) - \left(ux \cdot \left(maxCos + -1\right)\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right), \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right)\right) \]
  6. Applied egg-rr99.0%

    \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot \left(1 + \left(-maxCos\right)\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot \left(maxCos + -1\right)\right)\right)\right) - ux \cdot \left(maxCos + -1\right)}} \]
  7. Taylor expanded in maxCos around 0

    \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\color{blue}{\left(ux - \left(-1 \cdot ux + {ux}^{2}\right)\right)}\right)\right) \]
  8. Step-by-step derivation
    1. associate--r+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\left(\left(ux - -1 \cdot ux\right) - {ux}^{2}\right)\right)\right) \]
    2. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(ux - -1 \cdot ux\right), \left({ux}^{2}\right)\right)\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(-1 \cdot ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
    4. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \left(\mathsf{neg}\left(ux\right)\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
    5. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left({ux}^{2}\right)\right)\right)\right) \]
    6. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \left(ux \cdot ux\right)\right)\right)\right) \]
    7. *-lowering-*.f3292.4%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{\_.f32}\left(ux, \mathsf{neg.f32}\left(ux\right)\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right)\right) \]
  9. Simplified92.4%

    \[\leadsto \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(ux - \left(-ux\right)\right) - ux \cdot ux}} \]
  10. Taylor expanded in uy around 0

    \[\leadsto \color{blue}{\sqrt{2 \cdot ux - {ux}^{2}}} \]
  11. Step-by-step derivation
    1. sqrt-lowering-sqrt.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\left(2 \cdot ux - {ux}^{2}\right)\right) \]
    2. --lowering--.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(2 \cdot ux\right), \left({ux}^{2}\right)\right)\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\left(ux \cdot 2\right), \left({ux}^{2}\right)\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, 2\right), \left({ux}^{2}\right)\right)\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, 2\right), \left(ux \cdot ux\right)\right)\right) \]
    6. *-lowering-*.f3275.5%

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, 2\right), \mathsf{*.f32}\left(ux, ux\right)\right)\right) \]
  12. Simplified75.5%

    \[\leadsto \color{blue}{\sqrt{ux \cdot 2 - ux \cdot ux}} \]
  13. Final simplification75.5%

    \[\leadsto \sqrt{2 \cdot ux - ux \cdot ux} \]
  14. Add Preprocessing

Alternative 21: 75.9% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \sqrt{ux \cdot \left(\left(-ux\right) - -2\right)} \end{array} \]
(FPCore (ux uy maxCos) :precision binary32 (sqrt (* ux (- (- ux) -2.0))))
float code(float ux, float uy, float maxCos) {
	return sqrtf((ux * (-ux - -2.0f)));
}
real(4) function code(ux, uy, maxcos)
    real(4), intent (in) :: ux
    real(4), intent (in) :: uy
    real(4), intent (in) :: maxcos
    code = sqrt((ux * (-ux - (-2.0e0))))
end function
function code(ux, uy, maxCos)
	return sqrt(Float32(ux * Float32(Float32(-ux) - Float32(-2.0))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sqrt((ux * (-ux - single(-2.0))));
end
\begin{array}{l}

\\
\sqrt{ux \cdot \left(\left(-ux\right) - -2\right)}
\end{array}
Derivation
  1. Initial program 61.0%

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Step-by-step derivation
    1. distribute-rgt-inN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    2. sub-negN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    5. associate-+l+N/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified61.1%

    \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in uy around 0

    \[\leadsto \color{blue}{\sqrt{1 - {\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}}} \]
  6. Step-by-step derivation
    1. sqrt-lowering-sqrt.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\left(1 - {\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}\right)\right) \]
    2. --lowering--.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \left({\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}\right)\right)\right) \]
    3. unpow2N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \left(\left(1 + ux \cdot \left(maxCos - 1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\left(1 + ux \cdot \left(maxCos - 1\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \left(ux \cdot \left(maxCos - 1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos - 1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    7. sub-negN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    9. +-lowering-+.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    10. +-lowering-+.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \left(ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos - 1\right)\right)\right)\right)\right)\right) \]
    12. sub-negN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right)\right)\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
    14. +-lowering-+.f3252.3%

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right) \]
  7. Simplified52.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)}} \]
  8. Taylor expanded in ux around 0

    \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{\left(1 + ux \cdot \left(\left(2 \cdot maxCos + ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2\right)\right)}\right)\right) \]
  9. Step-by-step derivation
    1. +-lowering-+.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \left(ux \cdot \left(\left(2 \cdot maxCos + ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2\right)\right)\right)\right)\right) \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(\left(2 \cdot maxCos + ux \cdot {\left(maxCos - 1\right)}^{2}\right) - 2\right)\right)\right)\right)\right) \]
    3. associate--l+N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(2 \cdot maxCos + \left(ux \cdot {\left(maxCos - 1\right)}^{2} - 2\right)\right)\right)\right)\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\left(2 \cdot maxCos\right), \left(ux \cdot {\left(maxCos - 1\right)}^{2} - 2\right)\right)\right)\right)\right)\right) \]
    5. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \left(ux \cdot {\left(maxCos - 1\right)}^{2} - 2\right)\right)\right)\right)\right)\right) \]
    6. --lowering--.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\left(ux \cdot {\left(maxCos - 1\right)}^{2}\right), 2\right)\right)\right)\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \left({\left(maxCos - 1\right)}^{2}\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    8. unpow2N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \left(\left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(maxCos - 1\right), \left(maxCos - 1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    10. sub-negN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right), \left(maxCos - 1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\left(maxCos + -1\right), \left(maxCos - 1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    12. +-lowering-+.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos - 1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    13. sub-negN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\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), 2\right)\right)\right)\right)\right)\right) \]
    14. metadata-evalN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \left(maxCos + -1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    15. +-lowering-+.f3254.5%

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, maxCos\right), \mathsf{\_.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{+.f32}\left(maxCos, -1\right), \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), 2\right)\right)\right)\right)\right)\right) \]
  10. Simplified54.5%

    \[\leadsto \sqrt{1 - \color{blue}{\left(1 + ux \cdot \left(2 \cdot maxCos + \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right) - 2\right)\right)\right)}} \]
  11. Taylor expanded in maxCos around 0

    \[\leadsto \mathsf{sqrt.f32}\left(\color{blue}{\left(-1 \cdot \left(ux \cdot \left(ux - 2\right)\right)\right)}\right) \]
  12. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\left(\left(-1 \cdot ux\right) \cdot \left(ux - 2\right)\right)\right) \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(ux - 2\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\left(\mathsf{neg}\left(ux\right)\right), \left(ux - 2\right)\right)\right) \]
    4. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(ux - 2\right)\right)\right) \]
    5. sub-negN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(ux + \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \left(ux + -2\right)\right)\right) \]
    7. +-lowering-+.f3275.4%

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(ux\right), \mathsf{+.f32}\left(ux, -2\right)\right)\right) \]
  13. Simplified75.4%

    \[\leadsto \sqrt{\color{blue}{\left(-ux\right) \cdot \left(ux + -2\right)}} \]
  14. Final simplification75.4%

    \[\leadsto \sqrt{ux \cdot \left(\left(-ux\right) - -2\right)} \]
  15. Add Preprocessing

Alternative 22: 6.6% 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 61.0%

    \[\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Step-by-step derivation
    1. distribute-rgt-inN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    2. sub-negN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 + \left(\mathsf{neg}\left(ux\right)\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    3. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) + 1\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    4. distribute-lft1-inN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
    5. associate-+l+N/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)} \]
    7. +-commutativeN/A

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + \left(\mathsf{neg}\left(ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} \]
  3. Simplified61.1%

    \[\leadsto \color{blue}{\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(1 + ux \cdot \left(maxCos + -1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos + -1\right)\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in uy around 0

    \[\leadsto \color{blue}{\sqrt{1 - {\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}}} \]
  6. Step-by-step derivation
    1. sqrt-lowering-sqrt.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\left(1 - {\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}\right)\right) \]
    2. --lowering--.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \left({\left(1 + ux \cdot \left(maxCos - 1\right)\right)}^{2}\right)\right)\right) \]
    3. unpow2N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \left(\left(1 + ux \cdot \left(maxCos - 1\right)\right) \cdot \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\left(1 + ux \cdot \left(maxCos - 1\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \left(ux \cdot \left(maxCos - 1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos - 1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    7. sub-negN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    9. +-lowering-+.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \left(1 + ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right) \]
    10. +-lowering-+.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \left(ux \cdot \left(maxCos - 1\right)\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos - 1\right)\right)\right)\right)\right)\right) \]
    12. sub-negN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right)\right)\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \left(maxCos + -1\right)\right)\right)\right)\right)\right) \]
    14. +-lowering-+.f3252.3%

      \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(ux, \mathsf{+.f32}\left(maxCos, -1\right)\right)\right)\right)\right)\right) \]
  7. Simplified52.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)}} \]
  8. Taylor expanded in ux around 0

    \[\leadsto \mathsf{sqrt.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{1}\right)\right) \]
  9. Step-by-step derivation
    1. Simplified6.6%

      \[\leadsto \sqrt{1 - \color{blue}{1}} \]
    2. Step-by-step derivation
      1. pow1/2N/A

        \[\leadsto {\left(1 - 1\right)}^{\color{blue}{\frac{1}{2}}} \]
      2. metadata-evalN/A

        \[\leadsto {0}^{\frac{1}{2}} \]
      3. metadata-eval6.6%

        \[\leadsto 0 \]
    3. Applied egg-rr6.6%

      \[\leadsto \color{blue}{0} \]
    4. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2024138 
    (FPCore (ux uy maxCos)
      :name "UniformSampleCone, x"
      :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)))
      (* (cos (* (* uy 2.0) PI)) (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))