Trowbridge-Reitz Sample, sample surface normal, cosTheta

Percentage Accurate: 99.4% → 99.4%
Time: 18.1s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\left(\left(\left(2.328306437 \cdot 10^{-10} \leq u0 \land u0 \leq 1\right) \land \left(2.328306437 \cdot 10^{-10} \leq u1 \land u1 \leq 0.5\right)\right) \land \left(0.0001 \leq alphax \land alphax \leq 1\right)\right) \land \left(0.0001 \leq alphay \land alphay \leq 1\right)\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)\\ t_1 := \sin t\_0\\ t_2 := \cos t\_0\\ \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{t\_2 \cdot t\_2}{alphax \cdot alphax} + \frac{t\_1 \cdot t\_1}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \end{array} \end{array} \]
(FPCore (u0 u1 alphax alphay)
 :precision binary32
 (let* ((t_0
         (atan
          (* (/ alphay alphax) (tan (+ (* (* 2.0 (PI)) u1) (* 0.5 (PI)))))))
        (t_1 (sin t_0))
        (t_2 (cos t_0)))
   (/
    1.0
    (sqrt
     (+
      1.0
      (/
       (*
        (/
         1.0
         (+
          (/ (* t_2 t_2) (* alphax alphax))
          (/ (* t_1 t_1) (* alphay alphay))))
        u0)
       (- 1.0 u0)))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{t\_2 \cdot t\_2}{alphax \cdot alphax} + \frac{t\_1 \cdot t\_1}{alphay \cdot alphay}} \cdot u0}{1 - u0}}}
\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 10 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: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)\\ t_1 := \sin t\_0\\ t_2 := \cos t\_0\\ \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{t\_2 \cdot t\_2}{alphax \cdot alphax} + \frac{t\_1 \cdot t\_1}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \end{array} \end{array} \]
(FPCore (u0 u1 alphax alphay)
 :precision binary32
 (let* ((t_0
         (atan
          (* (/ alphay alphax) (tan (+ (* (* 2.0 (PI)) u1) (* 0.5 (PI)))))))
        (t_1 (sin t_0))
        (t_2 (cos t_0)))
   (/
    1.0
    (sqrt
     (+
      1.0
      (/
       (*
        (/
         1.0
         (+
          (/ (* t_2 t_2) (* alphax alphax))
          (/ (* t_1 t_1) (* alphay alphay))))
        u0)
       (- 1.0 u0)))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{t\_2 \cdot t\_2}{alphax \cdot alphax} + \frac{t\_1 \cdot t\_1}{alphay \cdot alphay}} \cdot u0}{1 - u0}}}
\end{array}
\end{array}

Alternative 1: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)\\ t_1 := \cos t\_0\\ t_2 := \sin t\_0\\ \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{t\_2 \cdot t\_2}{alphay \cdot alphay} + \frac{t\_1 \cdot t\_1}{alphax \cdot alphax}} \cdot u0}{1 - u0}}} \end{array} \end{array} \]
(FPCore (u0 u1 alphax alphay)
 :precision binary32
 (let* ((t_0
         (atan
          (* (tan (+ (* 0.5 (PI)) (* (* (PI) 2.0) u1))) (/ alphay alphax))))
        (t_1 (cos t_0))
        (t_2 (sin t_0)))
   (/
    1.0
    (sqrt
     (-
      1.0
      (/
       (*
        (/
         -1.0
         (+
          (/ (* t_2 t_2) (* alphay alphay))
          (/ (* t_1 t_1) (* alphax alphax))))
        u0)
       (- 1.0 u0)))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
\frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{t\_2 \cdot t\_2}{alphay \cdot alphay} + \frac{t\_1 \cdot t\_1}{alphax \cdot alphax}} \cdot u0}{1 - u0}}}
\end{array}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
  2. Add Preprocessing
  3. Final simplification99.4%

    \[\leadsto \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{\sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right) \cdot \sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)}{alphay \cdot alphay} + \frac{\cos \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right) \cdot \cos \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)}{alphax \cdot alphax}} \cdot u0}{1 - u0}}} \]
  4. Add Preprocessing

Alternative 2: 97.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\\ t_1 := \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)\\ t_2 := \sin t\_1\\ t_3 := \cos t\_1\\ \mathbf{if}\;\frac{\frac{-1}{\frac{t\_2 \cdot t\_2}{alphay \cdot alphay} + \frac{t\_3 \cdot t\_3}{alphax \cdot alphax}} \cdot u0}{u0 - 1} \leq 2.5000000292152436 \cdot 10^{-8}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{{\sin \tan^{-1} \left(\frac{\sin t\_0 \cdot \frac{alphay}{alphax}}{\cos t\_0}\right)}^{2}}}{u0 - 1}}}\\ \end{array} \end{array} \]
(FPCore (u0 u1 alphax alphay)
 :precision binary32
 (let* ((t_0 (* (fma 2.0 u1 0.5) (PI)))
        (t_1
         (atan
          (* (tan (+ (* 0.5 (PI)) (* (* (PI) 2.0) u1))) (/ alphay alphax))))
        (t_2 (sin t_1))
        (t_3 (cos t_1)))
   (if (<=
        (/
         (*
          (/
           -1.0
           (+
            (/ (* t_2 t_2) (* alphay alphay))
            (/ (* t_3 t_3) (* alphax alphax))))
          u0)
         (- u0 1.0))
        2.5000000292152436e-8)
     1.0
     (/
      1.0
      (sqrt
       (-
        1.0
        (/
         (/
          (* u0 (* alphay alphay))
          (pow (sin (atan (/ (* (sin t_0) (/ alphay alphax)) (cos t_0)))) 2.0))
         (- u0 1.0))))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\\
t_1 := \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)\\
t_2 := \sin t\_1\\
t_3 := \cos t\_1\\
\mathbf{if}\;\frac{\frac{-1}{\frac{t\_2 \cdot t\_2}{alphay \cdot alphay} + \frac{t\_3 \cdot t\_3}{alphax \cdot alphax}} \cdot u0}{u0 - 1} \leq 2.5000000292152436 \cdot 10^{-8}:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{{\sin \tan^{-1} \left(\frac{\sin t\_0 \cdot \frac{alphay}{alphax}}{\cos t\_0}\right)}^{2}}}{u0 - 1}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 (*.f32 (/.f32 #s(literal 1 binary32) (+.f32 (/.f32 (*.f32 (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphax alphax)) (/.f32 (*.f32 (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphay alphay)))) u0) (-.f32 #s(literal 1 binary32) u0)) < 2.50000003e-8

    1. Initial program 100.0%

      \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
    2. Add Preprocessing
    3. Taylor expanded in u0 around 0

      \[\leadsto \color{blue}{1} \]
    4. Step-by-step derivation
      1. Applied rewrites100.0%

        \[\leadsto \color{blue}{1} \]

      if 2.50000003e-8 < (/.f32 (*.f32 (/.f32 #s(literal 1 binary32) (+.f32 (/.f32 (*.f32 (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphax alphax)) (/.f32 (*.f32 (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphay alphay)))) u0) (-.f32 #s(literal 1 binary32) u0))

      1. Initial program 98.6%

        \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
      2. Add Preprocessing
      3. Taylor expanded in alphax around inf

        \[\leadsto \frac{1}{\sqrt{1 + \frac{\color{blue}{\frac{{alphay}^{2} \cdot u0}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}}{1 - u0}}} \]
      4. Step-by-step derivation
        1. lower-/.f32N/A

          \[\leadsto \frac{1}{\sqrt{1 + \frac{\color{blue}{\frac{{alphay}^{2} \cdot u0}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}}{1 - u0}}} \]
        2. lower-*.f32N/A

          \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{\color{blue}{{alphay}^{2} \cdot u0}}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{1 - u0}}} \]
        3. unpow2N/A

          \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{\color{blue}{\left(alphay \cdot alphay\right)} \cdot u0}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{1 - u0}}} \]
        4. lower-*.f32N/A

          \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{\color{blue}{\left(alphay \cdot alphay\right)} \cdot u0}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{1 - u0}}} \]
        5. lower-pow.f32N/A

          \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{\left(alphay \cdot alphay\right) \cdot u0}{\color{blue}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}}{1 - u0}}} \]
      5. Applied rewrites92.5%

        \[\leadsto \frac{1}{\sqrt{1 + \frac{\color{blue}{\frac{\left(alphay \cdot alphay\right) \cdot u0}{{\sin \tan^{-1} \left(\frac{\frac{alphay}{alphax} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}\right)}^{2}}}}{1 - u0}}} \]
    5. Recombined 2 regimes into one program.
    6. Final simplification80.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\frac{-1}{\frac{\sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right) \cdot \sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)}{alphay \cdot alphay} + \frac{\cos \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right) \cdot \cos \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)}{alphax \cdot alphax}} \cdot u0}{u0 - 1} \leq 2.5000000292152436 \cdot 10^{-8}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{{\sin \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}}{u0 - 1}}}\\ \end{array} \]
    7. Add Preprocessing

    Alternative 3: 97.7% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\\ t_1 := \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)\\ t_2 := \sin t\_1\\ t_3 := \cos t\_1\\ \mathbf{if}\;\frac{\frac{-1}{\frac{t\_2 \cdot t\_2}{alphay \cdot alphay} + \frac{t\_3 \cdot t\_3}{alphax \cdot alphax}} \cdot u0}{u0 - 1} \leq 2.5000000292152436 \cdot 10^{-8}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{\left(u0 \cdot \left(alphay \cdot alphay\right)\right) \cdot 2}{1 - \cos \left(\tan^{-1} \left(\frac{\sin t\_0}{\cos t\_0} \cdot \frac{alphay}{alphax}\right) \cdot 2\right)}}{u0 - 1}}}\\ \end{array} \end{array} \]
    (FPCore (u0 u1 alphax alphay)
     :precision binary32
     (let* ((t_0 (* (fma 2.0 u1 0.5) (PI)))
            (t_1
             (atan
              (* (tan (+ (* 0.5 (PI)) (* (* (PI) 2.0) u1))) (/ alphay alphax))))
            (t_2 (sin t_1))
            (t_3 (cos t_1)))
       (if (<=
            (/
             (*
              (/
               -1.0
               (+
                (/ (* t_2 t_2) (* alphay alphay))
                (/ (* t_3 t_3) (* alphax alphax))))
              u0)
             (- u0 1.0))
            2.5000000292152436e-8)
         1.0
         (/
          1.0
          (sqrt
           (-
            1.0
            (/
             (/
              (* (* u0 (* alphay alphay)) 2.0)
              (-
               1.0
               (cos (* (atan (* (/ (sin t_0) (cos t_0)) (/ alphay alphax))) 2.0))))
             (- u0 1.0))))))))
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\\
    t_1 := \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)\\
    t_2 := \sin t\_1\\
    t_3 := \cos t\_1\\
    \mathbf{if}\;\frac{\frac{-1}{\frac{t\_2 \cdot t\_2}{alphay \cdot alphay} + \frac{t\_3 \cdot t\_3}{alphax \cdot alphax}} \cdot u0}{u0 - 1} \leq 2.5000000292152436 \cdot 10^{-8}:\\
    \;\;\;\;1\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{\left(u0 \cdot \left(alphay \cdot alphay\right)\right) \cdot 2}{1 - \cos \left(\tan^{-1} \left(\frac{\sin t\_0}{\cos t\_0} \cdot \frac{alphay}{alphax}\right) \cdot 2\right)}}{u0 - 1}}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f32 (*.f32 (/.f32 #s(literal 1 binary32) (+.f32 (/.f32 (*.f32 (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphax alphax)) (/.f32 (*.f32 (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphay alphay)))) u0) (-.f32 #s(literal 1 binary32) u0)) < 2.50000003e-8

      1. Initial program 100.0%

        \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
      2. Add Preprocessing
      3. Taylor expanded in u0 around 0

        \[\leadsto \color{blue}{1} \]
      4. Step-by-step derivation
        1. Applied rewrites100.0%

          \[\leadsto \color{blue}{1} \]

        if 2.50000003e-8 < (/.f32 (*.f32 (/.f32 #s(literal 1 binary32) (+.f32 (/.f32 (*.f32 (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphax alphax)) (/.f32 (*.f32 (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphay alphay)))) u0) (-.f32 #s(literal 1 binary32) u0))

        1. Initial program 98.6%

          \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
        2. Add Preprocessing
        3. Applied rewrites38.9%

          \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(\frac{1 - \cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), u1 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right)}{alphay}, \frac{0.5}{alphay}, {\left(\frac{\cos \tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), u1 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right) \cdot \frac{alphay}{alphax}\right)}{alphax}\right)}^{2}\right)}} \cdot u0}{1 - u0}}} \]
        4. Taylor expanded in alphax around inf

          \[\leadsto \frac{1}{\sqrt{1 + \frac{\color{blue}{2 \cdot \frac{{alphay}^{2} \cdot u0}{1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)}}}{1 - u0}}} \]
        5. Step-by-step derivation
          1. associate-*r/N/A

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\color{blue}{\frac{2 \cdot \left({alphay}^{2} \cdot u0\right)}{1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)}}}{1 - u0}}} \]
          2. lower-/.f32N/A

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\color{blue}{\frac{2 \cdot \left({alphay}^{2} \cdot u0\right)}{1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)}}}{1 - u0}}} \]
          3. lower-*.f32N/A

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{\color{blue}{2 \cdot \left({alphay}^{2} \cdot u0\right)}}{1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)}}{1 - u0}}} \]
          4. lower-*.f32N/A

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{2 \cdot \color{blue}{\left({alphay}^{2} \cdot u0\right)}}{1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)}}{1 - u0}}} \]
          5. unpow2N/A

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{2 \cdot \left(\color{blue}{\left(alphay \cdot alphay\right)} \cdot u0\right)}{1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)}}{1 - u0}}} \]
          6. lower-*.f32N/A

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{2 \cdot \left(\color{blue}{\left(alphay \cdot alphay\right)} \cdot u0\right)}{1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)}}{1 - u0}}} \]
          7. lower--.f32N/A

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{2 \cdot \left(\left(alphay \cdot alphay\right) \cdot u0\right)}{\color{blue}{1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)}}}{1 - u0}}} \]
          8. lower-cos.f32N/A

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{2 \cdot \left(\left(alphay \cdot alphay\right) \cdot u0\right)}{1 - \color{blue}{\cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)}}}{1 - u0}}} \]
        6. Applied rewrites92.5%

          \[\leadsto \frac{1}{\sqrt{1 + \frac{\color{blue}{\frac{2 \cdot \left(\left(alphay \cdot alphay\right) \cdot u0\right)}{1 - \cos \left(\tan^{-1} \left(\frac{alphay}{alphax} \cdot \frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2\right)}}}{1 - u0}}} \]
      5. Recombined 2 regimes into one program.
      6. Final simplification81.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\frac{-1}{\frac{\sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right) \cdot \sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)}{alphay \cdot alphay} + \frac{\cos \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right) \cdot \cos \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)}{alphax \cdot alphax}} \cdot u0}{u0 - 1} \leq 2.5000000292152436 \cdot 10^{-8}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{\left(u0 \cdot \left(alphay \cdot alphay\right)\right) \cdot 2}{1 - \cos \left(\tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot \frac{alphay}{alphax}\right) \cdot 2\right)}}{u0 - 1}}}\\ \end{array} \]
      7. Add Preprocessing

      Alternative 4: 96.5% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\\ t_1 := \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)\\ t_2 := \sin t\_1\\ t_3 := \cos t\_1\\ \mathbf{if}\;\frac{\frac{-1}{\frac{t\_2 \cdot t\_2}{alphay \cdot alphay} + \frac{t\_3 \cdot t\_3}{alphax \cdot alphax}} \cdot u0}{u0 - 1} \leq 3.999999975690116 \cdot 10^{-8}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{u0 - 1}}{\cos \left(\tan^{-1} \left(\frac{\sin t\_0}{\cos t\_0} \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}\\ \end{array} \end{array} \]
      (FPCore (u0 u1 alphax alphay)
       :precision binary32
       (let* ((t_0 (* (fma 2.0 u1 0.5) (PI)))
              (t_1
               (atan
                (* (tan (+ (* 0.5 (PI)) (* (* (PI) 2.0) u1))) (/ alphay alphax))))
              (t_2 (sin t_1))
              (t_3 (cos t_1)))
         (if (<=
              (/
               (*
                (/
                 -1.0
                 (+
                  (/ (* t_2 t_2) (* alphay alphay))
                  (/ (* t_3 t_3) (* alphax alphax))))
                u0)
               (- u0 1.0))
              3.999999975690116e-8)
           1.0
           (-
            1.0
            (/
             (/ (* u0 (* alphay alphay)) (- u0 1.0))
             (-
              (cos (* (atan (* (/ (sin t_0) (cos t_0)) (/ alphay alphax))) 2.0))
              1.0))))))
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\\
      t_1 := \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)\\
      t_2 := \sin t\_1\\
      t_3 := \cos t\_1\\
      \mathbf{if}\;\frac{\frac{-1}{\frac{t\_2 \cdot t\_2}{alphay \cdot alphay} + \frac{t\_3 \cdot t\_3}{alphax \cdot alphax}} \cdot u0}{u0 - 1} \leq 3.999999975690116 \cdot 10^{-8}:\\
      \;\;\;\;1\\
      
      \mathbf{else}:\\
      \;\;\;\;1 - \frac{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{u0 - 1}}{\cos \left(\tan^{-1} \left(\frac{\sin t\_0}{\cos t\_0} \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (/.f32 (*.f32 (/.f32 #s(literal 1 binary32) (+.f32 (/.f32 (*.f32 (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphax alphax)) (/.f32 (*.f32 (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphay alphay)))) u0) (-.f32 #s(literal 1 binary32) u0)) < 3.99999998e-8

        1. Initial program 100.0%

          \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
        2. Add Preprocessing
        3. Taylor expanded in u0 around 0

          \[\leadsto \color{blue}{1} \]
        4. Step-by-step derivation
          1. Applied rewrites100.0%

            \[\leadsto \color{blue}{1} \]

          if 3.99999998e-8 < (/.f32 (*.f32 (/.f32 #s(literal 1 binary32) (+.f32 (/.f32 (*.f32 (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (cos.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphax alphax)) (/.f32 (*.f32 (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32))))))) (sin.f32 (atan.f32 (*.f32 (/.f32 alphay alphax) (tan.f32 (+.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u1) (*.f32 #s(literal 1/2 binary32) (PI.f32)))))))) (*.f32 alphay alphay)))) u0) (-.f32 #s(literal 1 binary32) u0))

          1. Initial program 98.6%

            \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
          2. Add Preprocessing
          3. Applied rewrites37.5%

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(\frac{1 - \cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), u1 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right)}{alphay}, \frac{0.5}{alphay}, {\left(\frac{\cos \tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), u1 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right) \cdot \frac{alphay}{alphax}\right)}{alphax}\right)}^{2}\right)}} \cdot u0}{1 - u0}}} \]
          4. Taylor expanded in alphay around 0

            \[\leadsto \color{blue}{1 + -1 \cdot \frac{{alphay}^{2} \cdot u0}{\left(1 - u0\right) \cdot \left(1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)\right)}} \]
          5. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto 1 + \color{blue}{\left(\mathsf{neg}\left(\frac{{alphay}^{2} \cdot u0}{\left(1 - u0\right) \cdot \left(1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)\right)}\right)\right)} \]
            2. unsub-negN/A

              \[\leadsto \color{blue}{1 - \frac{{alphay}^{2} \cdot u0}{\left(1 - u0\right) \cdot \left(1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)\right)}} \]
            3. lower--.f32N/A

              \[\leadsto \color{blue}{1 - \frac{{alphay}^{2} \cdot u0}{\left(1 - u0\right) \cdot \left(1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)\right)}} \]
            4. associate-/r*N/A

              \[\leadsto 1 - \color{blue}{\frac{\frac{{alphay}^{2} \cdot u0}{1 - u0}}{1 - \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)}} \]
          6. Applied rewrites66.6%

            \[\leadsto \color{blue}{1 - \frac{\frac{\left(alphay \cdot alphay\right) \cdot u0}{1 - u0}}{1 - \cos \left(\tan^{-1} \left(\frac{alphay}{alphax} \cdot \frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2\right)}} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification80.8%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\frac{-1}{\frac{\sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right) \cdot \sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)}{alphay \cdot alphay} + \frac{\cos \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right) \cdot \cos \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)}{alphax \cdot alphax}} \cdot u0}{u0 - 1} \leq 3.999999975690116 \cdot 10^{-8}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{u0 - 1}}{\cos \left(\tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}\\ \end{array} \]
        7. Add Preprocessing

        Alternative 5: 98.7% accurate, 1.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)\\ \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{{\cos \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\left(u1 \cdot 2 + 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}{alphax \cdot alphax} + \frac{t\_0 \cdot t\_0}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \end{array} \end{array} \]
        (FPCore (u0 u1 alphax alphay)
         :precision binary32
         (let* ((t_0
                 (sin
                  (atan
                   (* (tan (+ (* 0.5 (PI)) (* (* (PI) 2.0) u1))) (/ alphay alphax))))))
           (/
            1.0
            (sqrt
             (-
              1.0
              (/
               (*
                (/
                 -1.0
                 (+
                  (/
                   (pow
                    (cos
                     (atan
                      (/
                       (* (sin (* (fma 2.0 u1 0.5) (PI))) (/ alphay alphax))
                       (cos (* (+ (* u1 2.0) 0.5) (PI))))))
                    2.0)
                   (* alphax alphax))
                  (/ (* t_0 t_0) (* alphay alphay))))
                u0)
               (- 1.0 u0)))))))
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)\\
        \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{{\cos \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\left(u1 \cdot 2 + 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}{alphax \cdot alphax} + \frac{t\_0 \cdot t\_0}{alphay \cdot alphay}} \cdot u0}{1 - u0}}}
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 99.4%

          \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
        2. Add Preprocessing
        3. Taylor expanded in u1 around 0

          \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{{\cos \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
        4. Step-by-step derivation
          1. lower-pow.f32N/A

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{{\cos \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
        5. Applied rewrites96.5%

          \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{{\cos \tan^{-1} \left(\frac{\frac{alphay}{alphax} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}\right)}^{2}}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
        6. Step-by-step derivation
          1. Applied rewrites98.6%

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{{\cos \tan^{-1} \left(\frac{\frac{alphay}{alphax} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \left(u1 \cdot 2 + 0.5\right)\right)}\right)}^{2}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
          2. Final simplification98.6%

            \[\leadsto \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{{\cos \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\left(u1 \cdot 2 + 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right) \cdot \sin \tan^{-1} \left(\tan \left(0.5 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right) \cdot \frac{alphay}{alphax}\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
          3. Add Preprocessing

          Alternative 6: 98.0% accurate, 1.5× speedup?

          \[\begin{array}{l} \\ \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{{\cos \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\left(u1 \cdot 2 + 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}{alphax \cdot alphax} - \frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}{alphay} \cdot \frac{0.5}{alphay}} \cdot u0}{1 - u0}}} \end{array} \]
          (FPCore (u0 u1 alphax alphay)
           :precision binary32
           (/
            1.0
            (sqrt
             (-
              1.0
              (/
               (*
                (/
                 -1.0
                 (-
                  (/
                   (pow
                    (cos
                     (atan
                      (/
                       (* (sin (* (fma 2.0 u1 0.5) (PI))) (/ alphay alphax))
                       (cos (* (+ (* u1 2.0) 0.5) (PI))))))
                    2.0)
                   (* alphax alphax))
                  (*
                   (/
                    (-
                     (cos
                      (*
                       (atan (* (tan (* (fma u1 2.0 0.5) (PI))) (/ alphay alphax)))
                       2.0))
                     1.0)
                    alphay)
                   (/ 0.5 alphay))))
                u0)
               (- 1.0 u0))))))
          \begin{array}{l}
          
          \\
          \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{{\cos \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\left(u1 \cdot 2 + 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}{alphax \cdot alphax} - \frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}{alphay} \cdot \frac{0.5}{alphay}} \cdot u0}{1 - u0}}}
          \end{array}
          
          Derivation
          1. Initial program 99.4%

            \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
          2. Add Preprocessing
          3. Taylor expanded in u1 around 0

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{{\cos \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
          4. Step-by-step derivation
            1. lower-pow.f32N/A

              \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{{\cos \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
          5. Applied rewrites96.5%

            \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{{\cos \tan^{-1} \left(\frac{\frac{alphay}{alphax} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}\right)}^{2}}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
          6. Step-by-step derivation
            1. Applied rewrites98.6%

              \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{{\cos \tan^{-1} \left(\frac{\frac{alphay}{alphax} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \left(u1 \cdot 2 + 0.5\right)\right)}\right)}^{2}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
            2. Applied rewrites63.0%

              \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{{\cos \tan^{-1} \left(\frac{\frac{alphay}{alphax} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \left(u1 \cdot 2 + 0.5\right)\right)}\right)}^{2}}{alphax \cdot alphax} + \color{blue}{\frac{1 - \cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right)}{alphay} \cdot \frac{0.5}{alphay}}} \cdot u0}{1 - u0}}} \]
            3. Final simplification63.0%

              \[\leadsto \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{{\cos \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\left(u1 \cdot 2 + 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}{alphax \cdot alphax} - \frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}{alphay} \cdot \frac{0.5}{alphay}} \cdot u0}{1 - u0}}} \]
            4. Add Preprocessing

            Alternative 7: 98.0% accurate, 1.5× speedup?

            \[\begin{array}{l} \\ \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{{\cos \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\left(u1 \cdot 2 + 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}{alphax \cdot alphax} - \frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}{\left(alphay \cdot alphay\right) \cdot 2}} \cdot u0}{1 - u0}}} \end{array} \]
            (FPCore (u0 u1 alphax alphay)
             :precision binary32
             (/
              1.0
              (sqrt
               (-
                1.0
                (/
                 (*
                  (/
                   -1.0
                   (-
                    (/
                     (pow
                      (cos
                       (atan
                        (/
                         (* (sin (* (fma 2.0 u1 0.5) (PI))) (/ alphay alphax))
                         (cos (* (+ (* u1 2.0) 0.5) (PI))))))
                      2.0)
                     (* alphax alphax))
                    (/
                     (-
                      (cos
                       (*
                        (atan (* (tan (* (fma u1 2.0 0.5) (PI))) (/ alphay alphax)))
                        2.0))
                      1.0)
                     (* (* alphay alphay) 2.0))))
                  u0)
                 (- 1.0 u0))))))
            \begin{array}{l}
            
            \\
            \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{{\cos \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\left(u1 \cdot 2 + 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}{alphax \cdot alphax} - \frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}{\left(alphay \cdot alphay\right) \cdot 2}} \cdot u0}{1 - u0}}}
            \end{array}
            
            Derivation
            1. Initial program 99.4%

              \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
            2. Add Preprocessing
            3. Taylor expanded in u1 around 0

              \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{{\cos \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
            4. Step-by-step derivation
              1. lower-pow.f32N/A

                \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{{\cos \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
            5. Applied rewrites96.5%

              \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{{\cos \tan^{-1} \left(\frac{\frac{alphay}{alphax} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}\right)}^{2}}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
            6. Step-by-step derivation
              1. Applied rewrites98.6%

                \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{{\cos \tan^{-1} \left(\frac{\frac{alphay}{alphax} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \left(u1 \cdot 2 + 0.5\right)\right)}\right)}^{2}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
              2. Applied rewrites63.3%

                \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{{\cos \tan^{-1} \left(\frac{\frac{alphay}{alphax} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \left(u1 \cdot 2 + 0.5\right)\right)}\right)}^{2}}{alphax \cdot alphax} + \color{blue}{\frac{1 - \cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right)}{\left(alphay \cdot alphay\right) \cdot 2}}} \cdot u0}{1 - u0}}} \]
              3. Final simplification62.6%

                \[\leadsto \frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{{\cos \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\left(u1 \cdot 2 + 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}{alphax \cdot alphax} - \frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}{\left(alphay \cdot alphay\right) \cdot 2}} \cdot u0}{1 - u0}}} \]
              4. Add Preprocessing

              Alternative 8: 52.6% accurate, 1.7× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right)\\ \frac{1}{\sqrt{1 - \frac{\frac{-1}{\mathsf{fma}\left(\frac{\cos \left(t\_0 \cdot 2\right) + 1}{alphax}, \frac{0.5}{alphax}, {\left(\frac{alphay}{\sin t\_0}\right)}^{-2}\right)} \cdot u0}{1 - u0}}} \end{array} \end{array} \]
              (FPCore (u0 u1 alphax alphay)
               :precision binary32
               (let* ((t_0 (atan (* (tan (* (fma u1 2.0 0.5) (PI))) (/ alphay alphax)))))
                 (/
                  1.0
                  (sqrt
                   (-
                    1.0
                    (/
                     (*
                      (/
                       -1.0
                       (fma
                        (/ (+ (cos (* t_0 2.0)) 1.0) alphax)
                        (/ 0.5 alphax)
                        (pow (/ alphay (sin t_0)) -2.0)))
                      u0)
                     (- 1.0 u0)))))))
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right)\\
              \frac{1}{\sqrt{1 - \frac{\frac{-1}{\mathsf{fma}\left(\frac{\cos \left(t\_0 \cdot 2\right) + 1}{alphax}, \frac{0.5}{alphax}, {\left(\frac{alphay}{\sin t\_0}\right)}^{-2}\right)} \cdot u0}{1 - u0}}}
              \end{array}
              \end{array}
              
              Derivation
              1. Initial program 99.4%

                \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-+.f32N/A

                  \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\color{blue}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}}} \cdot u0}{1 - u0}}} \]
              4. Applied rewrites52.6%

                \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(1, {\left(\frac{\cos \tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), u1 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right) \cdot \frac{alphay}{alphax}\right)}{alphax}\right)}^{2}, {\left(\frac{\sin \tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), u1 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right) \cdot \frac{alphay}{alphax}\right)}{alphay}\right)}^{2}\right)}} \cdot u0}{1 - u0}}} \]
              5. Applied rewrites54.0%

                \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(\frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) + 1}{alphax}, \frac{0.5}{alphax}, {\left(\frac{alphay}{\sin \tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right)}\right)}^{-2}\right)}} \cdot u0}{1 - u0}}} \]
              6. Final simplification53.9%

                \[\leadsto \frac{1}{\sqrt{1 - \frac{\frac{-1}{\mathsf{fma}\left(\frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) + 1}{alphax}, \frac{0.5}{alphax}, {\left(\frac{alphay}{\sin \tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right)}\right)}^{-2}\right)} \cdot u0}{1 - u0}}} \]
              7. Add Preprocessing

              Alternative 9: 97.1% accurate, 1.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\\ \mathbf{if}\;alphay \leq 0.02500000037252903:\\ \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{\mathsf{fma}\left(\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right), 0.5, 0.5\right)}{alphax \cdot alphax} - \frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}{\left(alphay \cdot alphay\right) \cdot 2}} \cdot u0}{1 - u0}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{{\sin \tan^{-1} \left(\frac{\sin t\_0 \cdot \frac{alphay}{alphax}}{\cos t\_0}\right)}^{2}}}{u0 - 1}}}\\ \end{array} \end{array} \]
              (FPCore (u0 u1 alphax alphay)
               :precision binary32
               (let* ((t_0 (* (fma 2.0 u1 0.5) (PI))))
                 (if (<= alphay 0.02500000037252903)
                   (/
                    1.0
                    (sqrt
                     (-
                      1.0
                      (/
                       (*
                        (/
                         -1.0
                         (-
                          (/
                           (fma
                            (cos
                             (*
                              (atan
                               (*
                                (tan (fma 0.5 (PI) (* (* (PI) 2.0) u1)))
                                (/ alphay alphax)))
                              2.0))
                            0.5
                            0.5)
                           (* alphax alphax))
                          (/
                           (-
                            (cos
                             (*
                              (atan (* (tan (* (fma u1 2.0 0.5) (PI))) (/ alphay alphax)))
                              2.0))
                            1.0)
                           (* (* alphay alphay) 2.0))))
                        u0)
                       (- 1.0 u0)))))
                   (/
                    1.0
                    (sqrt
                     (-
                      1.0
                      (/
                       (/
                        (* u0 (* alphay alphay))
                        (pow (sin (atan (/ (* (sin t_0) (/ alphay alphax)) (cos t_0)))) 2.0))
                       (- u0 1.0))))))))
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\\
              \mathbf{if}\;alphay \leq 0.02500000037252903:\\
              \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{\mathsf{fma}\left(\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right), 0.5, 0.5\right)}{alphax \cdot alphax} - \frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}{\left(alphay \cdot alphay\right) \cdot 2}} \cdot u0}{1 - u0}}}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{{\sin \tan^{-1} \left(\frac{\sin t\_0 \cdot \frac{alphay}{alphax}}{\cos t\_0}\right)}^{2}}}{u0 - 1}}}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if alphay < 0.0250000004

                1. Initial program 99.6%

                  \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-*.f32N/A

                    \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
                  2. lift-cos.f32N/A

                    \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
                  3. lift-cos.f32N/A

                    \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
                  4. sqr-cos-aN/A

                    \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
                  5. +-commutativeN/A

                    \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right) + \frac{1}{2}}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
                4. Applied rewrites96.4%

                  \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\color{blue}{\mathsf{fma}\left(\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), u1 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right), 0.5, 0.5\right)}}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
                5. Applied rewrites93.4%

                  \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\mathsf{fma}\left(\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), u1 \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right), 0.5, 0.5\right)}{alphax \cdot alphax} + \color{blue}{\frac{1 - \cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right)}{\left(alphay \cdot alphay\right) \cdot 2}}} \cdot u0}{1 - u0}}} \]

                if 0.0250000004 < alphay

                1. Initial program 99.0%

                  \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
                2. Add Preprocessing
                3. Taylor expanded in alphax around inf

                  \[\leadsto \frac{1}{\sqrt{1 + \frac{\color{blue}{\frac{{alphay}^{2} \cdot u0}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}}{1 - u0}}} \]
                4. Step-by-step derivation
                  1. lower-/.f32N/A

                    \[\leadsto \frac{1}{\sqrt{1 + \frac{\color{blue}{\frac{{alphay}^{2} \cdot u0}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}}{1 - u0}}} \]
                  2. lower-*.f32N/A

                    \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{\color{blue}{{alphay}^{2} \cdot u0}}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{1 - u0}}} \]
                  3. unpow2N/A

                    \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{\color{blue}{\left(alphay \cdot alphay\right)} \cdot u0}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{1 - u0}}} \]
                  4. lower-*.f32N/A

                    \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{\color{blue}{\left(alphay \cdot alphay\right)} \cdot u0}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}{1 - u0}}} \]
                  5. lower-pow.f32N/A

                    \[\leadsto \frac{1}{\sqrt{1 + \frac{\frac{\left(alphay \cdot alphay\right) \cdot u0}{\color{blue}{{\sin \tan^{-1} \left(\frac{alphay \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u1 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}}}}{1 - u0}}} \]
                5. Applied rewrites95.8%

                  \[\leadsto \frac{1}{\sqrt{1 + \frac{\color{blue}{\frac{\left(alphay \cdot alphay\right) \cdot u0}{{\sin \tan^{-1} \left(\frac{\frac{alphay}{alphax} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(2, u1, 0.5\right)\right)}\right)}^{2}}}}{1 - u0}}} \]
              3. Recombined 2 regimes into one program.
              4. Final simplification93.4%

                \[\leadsto \begin{array}{l} \mathbf{if}\;alphay \leq 0.02500000037252903:\\ \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{-1}{\frac{\mathsf{fma}\left(\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot u1\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right), 0.5, 0.5\right)}{alphax \cdot alphax} - \frac{\cos \left(\tan^{-1} \left(\tan \left(\mathsf{fma}\left(u1, 2, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}\right) \cdot 2\right) - 1}{\left(alphay \cdot alphay\right) \cdot 2}} \cdot u0}{1 - u0}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 - \frac{\frac{u0 \cdot \left(alphay \cdot alphay\right)}{{\sin \tan^{-1} \left(\frac{\sin \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{alphay}{alphax}}{\cos \left(\mathsf{fma}\left(2, u1, 0.5\right) \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}}}{u0 - 1}}}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 10: 91.7% accurate, 1436.0× speedup?

              \[\begin{array}{l} \\ 1 \end{array} \]
              (FPCore (u0 u1 alphax alphay) :precision binary32 1.0)
              float code(float u0, float u1, float alphax, float alphay) {
              	return 1.0f;
              }
              
              real(4) function code(u0, u1, alphax, alphay)
                  real(4), intent (in) :: u0
                  real(4), intent (in) :: u1
                  real(4), intent (in) :: alphax
                  real(4), intent (in) :: alphay
                  code = 1.0e0
              end function
              
              function code(u0, u1, alphax, alphay)
              	return Float32(1.0)
              end
              
              function tmp = code(u0, u1, alphax, alphay)
              	tmp = single(1.0);
              end
              
              \begin{array}{l}
              
              \\
              1
              \end{array}
              
              Derivation
              1. Initial program 99.4%

                \[\frac{1}{\sqrt{1 + \frac{\frac{1}{\frac{\cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphax \cdot alphax} + \frac{\sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \tan^{-1} \left(\frac{alphay}{alphax} \cdot \tan \left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot u1 + 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}{alphay \cdot alphay}} \cdot u0}{1 - u0}}} \]
              2. Add Preprocessing
              3. Taylor expanded in u0 around 0

                \[\leadsto \color{blue}{1} \]
              4. Step-by-step derivation
                1. Applied rewrites89.9%

                  \[\leadsto \color{blue}{1} \]
                2. Add Preprocessing

                Reproduce

                ?
                herbie shell --seed 2024304 
                (FPCore (u0 u1 alphax alphay)
                  :name "Trowbridge-Reitz Sample, sample surface normal, cosTheta"
                  :precision binary32
                  :pre (and (and (and (and (<= 2.328306437e-10 u0) (<= u0 1.0)) (and (<= 2.328306437e-10 u1) (<= u1 0.5))) (and (<= 0.0001 alphax) (<= alphax 1.0))) (and (<= 0.0001 alphay) (<= alphay 1.0)))
                  (/ 1.0 (sqrt (+ 1.0 (/ (* (/ 1.0 (+ (/ (* (cos (atan (* (/ alphay alphax) (tan (+ (* (* 2.0 (PI)) u1) (* 0.5 (PI))))))) (cos (atan (* (/ alphay alphax) (tan (+ (* (* 2.0 (PI)) u1) (* 0.5 (PI)))))))) (* alphax alphax)) (/ (* (sin (atan (* (/ alphay alphax) (tan (+ (* (* 2.0 (PI)) u1) (* 0.5 (PI))))))) (sin (atan (* (/ alphay alphax) (tan (+ (* (* 2.0 (PI)) u1) (* 0.5 (PI)))))))) (* alphay alphay)))) u0) (- 1.0 u0))))))