Trowbridge-Reitz Sample, near normal, slope_y

Percentage Accurate: 98.3% → 98.3%
Time: 10.7s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\left(\left(cosTheta\_i > 0.9999 \land cosTheta\_i \leq 1\right) \land \left(2.328306437 \cdot 10^{-10} \leq u1 \land u1 \leq 1\right)\right) \land \left(2.328306437 \cdot 10^{-10} \leq u2 \land u2 \leq 1\right)\]
\[\begin{array}{l} \\ \sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \end{array} \]
(FPCore (cosTheta_i u1 u2)
 :precision binary32
 (* (sqrt (/ u1 (- 1.0 u1))) (sin (* 6.28318530718 u2))))
float code(float cosTheta_i, float u1, float u2) {
	return sqrtf((u1 / (1.0f - u1))) * sinf((6.28318530718f * u2));
}
real(4) function code(costheta_i, u1, u2)
    real(4), intent (in) :: costheta_i
    real(4), intent (in) :: u1
    real(4), intent (in) :: u2
    code = sqrt((u1 / (1.0e0 - u1))) * sin((6.28318530718e0 * u2))
end function
function code(cosTheta_i, u1, u2)
	return Float32(sqrt(Float32(u1 / Float32(Float32(1.0) - u1))) * sin(Float32(Float32(6.28318530718) * u2)))
end
function tmp = code(cosTheta_i, u1, u2)
	tmp = sqrt((u1 / (single(1.0) - u1))) * sin((single(6.28318530718) * u2));
end
\begin{array}{l}

\\
\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right)
\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 9 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: 98.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \end{array} \]
(FPCore (cosTheta_i u1 u2)
 :precision binary32
 (* (sqrt (/ u1 (- 1.0 u1))) (sin (* 6.28318530718 u2))))
float code(float cosTheta_i, float u1, float u2) {
	return sqrtf((u1 / (1.0f - u1))) * sinf((6.28318530718f * u2));
}
real(4) function code(costheta_i, u1, u2)
    real(4), intent (in) :: costheta_i
    real(4), intent (in) :: u1
    real(4), intent (in) :: u2
    code = sqrt((u1 / (1.0e0 - u1))) * sin((6.28318530718e0 * u2))
end function
function code(cosTheta_i, u1, u2)
	return Float32(sqrt(Float32(u1 / Float32(Float32(1.0) - u1))) * sin(Float32(Float32(6.28318530718) * u2)))
end
function tmp = code(cosTheta_i, u1, u2)
	tmp = sqrt((u1 / (single(1.0) - u1))) * sin((single(6.28318530718) * u2));
end
\begin{array}{l}

\\
\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right)
\end{array}

Alternative 1: 98.3% accurate, 0.9× speedup?

\[\begin{array}{l} cosTheta_i_m = \left|cosTheta\_i\right| \\ u2\_m = \left|u2\right| \\ u2\_s = \mathsf{copysign}\left(1, u2\right) \\ u2\_s \cdot \left(\sqrt{\frac{u1 \cdot \mathsf{fma}\left(u1, u1, 1\right)}{\mathsf{fma}\left(u1, u1, 1\right) \cdot \left(1 - u1\right)}} \cdot \sin \left(6.28318530718 \cdot u2\_m\right)\right) \end{array} \]
cosTheta_i_m = (fabs.f32 cosTheta_i)
u2\_m = (fabs.f32 u2)
u2\_s = (copysign.f32 #s(literal 1 binary32) u2)
(FPCore (u2_s cosTheta_i_m u1 u2_m)
 :precision binary32
 (*
  u2_s
  (*
   (sqrt (/ (* u1 (fma u1 u1 1.0)) (* (fma u1 u1 1.0) (- 1.0 u1))))
   (sin (* 6.28318530718 u2_m)))))
cosTheta_i_m = fabs(cosTheta_i);
u2\_m = fabs(u2);
u2\_s = copysign(1.0, u2);
float code(float u2_s, float cosTheta_i_m, float u1, float u2_m) {
	return u2_s * (sqrtf(((u1 * fmaf(u1, u1, 1.0f)) / (fmaf(u1, u1, 1.0f) * (1.0f - u1)))) * sinf((6.28318530718f * u2_m)));
}
cosTheta_i_m = abs(cosTheta_i)
u2\_m = abs(u2)
u2\_s = copysign(1.0, u2)
function code(u2_s, cosTheta_i_m, u1, u2_m)
	return Float32(u2_s * Float32(sqrt(Float32(Float32(u1 * fma(u1, u1, Float32(1.0))) / Float32(fma(u1, u1, Float32(1.0)) * Float32(Float32(1.0) - u1)))) * sin(Float32(Float32(6.28318530718) * u2_m))))
end
\begin{array}{l}
cosTheta_i_m = \left|cosTheta\_i\right|
\\
u2\_m = \left|u2\right|
\\
u2\_s = \mathsf{copysign}\left(1, u2\right)

\\
u2\_s \cdot \left(\sqrt{\frac{u1 \cdot \mathsf{fma}\left(u1, u1, 1\right)}{\mathsf{fma}\left(u1, u1, 1\right) \cdot \left(1 - u1\right)}} \cdot \sin \left(6.28318530718 \cdot u2\_m\right)\right)
\end{array}
Derivation
  1. Initial program 98.5%

    \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
  2. Add Preprocessing
  3. Applied rewrites98.0%

    \[\leadsto \sqrt{\color{blue}{\frac{u1 \cdot \mathsf{fma}\left(u1, u1, 1\right)}{\mathsf{fma}\left(u1, u1, 1\right) \cdot \left(1 - u1\right)}}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
  4. Add Preprocessing

Alternative 2: 96.5% accurate, 1.0× speedup?

\[\begin{array}{l} cosTheta_i_m = \left|cosTheta\_i\right| \\ u2\_m = \left|u2\right| \\ u2\_s = \mathsf{copysign}\left(1, u2\right) \\ u2\_s \cdot \begin{array}{l} \mathbf{if}\;u2\_m \leq 0.041999999433755875:\\ \;\;\;\;\sqrt{u1 \cdot \frac{-1}{-1 + u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2\_m \cdot u2\_m, -76.70585975309672, 81.6052492761019\right) \cdot u2\_m\right) \cdot u2\_m - 41.341702240407926\right) \cdot u2\_m\right) \cdot u2\_m + 6.28318530718\right) \cdot u2\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(1 + u1\right) \cdot u1} \cdot \sin \left(6.28318530718 \cdot u2\_m\right)\\ \end{array} \end{array} \]
cosTheta_i_m = (fabs.f32 cosTheta_i)
u2\_m = (fabs.f32 u2)
u2\_s = (copysign.f32 #s(literal 1 binary32) u2)
(FPCore (u2_s cosTheta_i_m u1 u2_m)
 :precision binary32
 (*
  u2_s
  (if (<= u2_m 0.041999999433755875)
    (*
     (sqrt (* u1 (/ -1.0 (+ -1.0 u1))))
     (*
      (+
       (*
        (*
         (-
          (*
           (* (fma (* u2_m u2_m) -76.70585975309672 81.6052492761019) u2_m)
           u2_m)
          41.341702240407926)
         u2_m)
        u2_m)
       6.28318530718)
      u2_m))
    (* (sqrt (* (+ 1.0 u1) u1)) (sin (* 6.28318530718 u2_m))))))
cosTheta_i_m = fabs(cosTheta_i);
u2\_m = fabs(u2);
u2\_s = copysign(1.0, u2);
float code(float u2_s, float cosTheta_i_m, float u1, float u2_m) {
	float tmp;
	if (u2_m <= 0.041999999433755875f) {
		tmp = sqrtf((u1 * (-1.0f / (-1.0f + u1)))) * (((((((fmaf((u2_m * u2_m), -76.70585975309672f, 81.6052492761019f) * u2_m) * u2_m) - 41.341702240407926f) * u2_m) * u2_m) + 6.28318530718f) * u2_m);
	} else {
		tmp = sqrtf(((1.0f + u1) * u1)) * sinf((6.28318530718f * u2_m));
	}
	return u2_s * tmp;
}
cosTheta_i_m = abs(cosTheta_i)
u2\_m = abs(u2)
u2\_s = copysign(1.0, u2)
function code(u2_s, cosTheta_i_m, u1, u2_m)
	tmp = Float32(0.0)
	if (u2_m <= Float32(0.041999999433755875))
		tmp = Float32(sqrt(Float32(u1 * Float32(Float32(-1.0) / Float32(Float32(-1.0) + u1)))) * Float32(Float32(Float32(Float32(Float32(Float32(Float32(fma(Float32(u2_m * u2_m), Float32(-76.70585975309672), Float32(81.6052492761019)) * u2_m) * u2_m) - Float32(41.341702240407926)) * u2_m) * u2_m) + Float32(6.28318530718)) * u2_m));
	else
		tmp = Float32(sqrt(Float32(Float32(Float32(1.0) + u1) * u1)) * sin(Float32(Float32(6.28318530718) * u2_m)));
	end
	return Float32(u2_s * tmp)
end
\begin{array}{l}
cosTheta_i_m = \left|cosTheta\_i\right|
\\
u2\_m = \left|u2\right|
\\
u2\_s = \mathsf{copysign}\left(1, u2\right)

\\
u2\_s \cdot \begin{array}{l}
\mathbf{if}\;u2\_m \leq 0.041999999433755875:\\
\;\;\;\;\sqrt{u1 \cdot \frac{-1}{-1 + u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2\_m \cdot u2\_m, -76.70585975309672, 81.6052492761019\right) \cdot u2\_m\right) \cdot u2\_m - 41.341702240407926\right) \cdot u2\_m\right) \cdot u2\_m + 6.28318530718\right) \cdot u2\_m\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\left(1 + u1\right) \cdot u1} \cdot \sin \left(6.28318530718 \cdot u2\_m\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if u2 < 0.0419999994

    1. Initial program 98.6%

      \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
    2. Add Preprocessing
    3. Applied rewrites98.4%

      \[\leadsto \sqrt{\color{blue}{\left(-u1\right) \cdot \frac{-1}{1 - u1}}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
    4. Taylor expanded in u2 around 0

      \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(u2 \cdot \left(\frac{314159265359}{50000000000} + {u2}^{2} \cdot \left({u2}^{2} \cdot \left(\frac{3060196847853821555298148281676017575122444629042460390799}{37500000000000000000000000000000000000000000000000000000} + \frac{-302029322777818351566783844332719832329455959975176141755859165754785028165295919}{3937500000000000000000000000000000000000000000000000000000000000000000000000000} \cdot {u2}^{2}\right) - \frac{31006276680305942139213528068663279}{750000000000000000000000000000000}\right)\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(\left(\frac{314159265359}{50000000000} + {u2}^{2} \cdot \left({u2}^{2} \cdot \left(\frac{3060196847853821555298148281676017575122444629042460390799}{37500000000000000000000000000000000000000000000000000000} + \frac{-302029322777818351566783844332719832329455959975176141755859165754785028165295919}{3937500000000000000000000000000000000000000000000000000000000000000000000000000} \cdot {u2}^{2}\right) - \frac{31006276680305942139213528068663279}{750000000000000000000000000000000}\right)\right) \cdot u2\right)} \]
      2. lower-*.f32N/A

        \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(\left(\frac{314159265359}{50000000000} + {u2}^{2} \cdot \left({u2}^{2} \cdot \left(\frac{3060196847853821555298148281676017575122444629042460390799}{37500000000000000000000000000000000000000000000000000000} + \frac{-302029322777818351566783844332719832329455959975176141755859165754785028165295919}{3937500000000000000000000000000000000000000000000000000000000000000000000000000} \cdot {u2}^{2}\right) - \frac{31006276680305942139213528068663279}{750000000000000000000000000000000}\right)\right) \cdot u2\right)} \]
    6. Applied rewrites90.0%

      \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(\mathsf{fma}\left(\left(\mathsf{fma}\left(-76.70585975309672, u2 \cdot u2, 81.6052492761019\right) \cdot u2\right) \cdot u2 - 41.341702240407926, u2 \cdot u2, 6.28318530718\right) \cdot u2\right)} \]
    7. Step-by-step derivation
      1. Applied rewrites98.4%

        \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2 \cdot u2, -76.70585975309672, 81.6052492761019\right) \cdot u2\right) \cdot u2 - 41.341702240407926\right) \cdot u2\right) \cdot u2 + 6.28318530718\right) \cdot u2\right) \]

      if 0.0419999994 < u2

      1. Initial program 97.8%

        \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f32N/A

          \[\leadsto \sqrt{\color{blue}{\frac{u1}{1 - u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        2. lift--.f32N/A

          \[\leadsto \sqrt{\frac{u1}{\color{blue}{1 - u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        3. flip--N/A

          \[\leadsto \sqrt{\frac{u1}{\color{blue}{\frac{1 \cdot 1 - u1 \cdot u1}{1 + u1}}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        4. frac-2negN/A

          \[\leadsto \sqrt{\frac{u1}{\color{blue}{\frac{\mathsf{neg}\left(\left(1 \cdot 1 - u1 \cdot u1\right)\right)}{\mathsf{neg}\left(\left(1 + u1\right)\right)}}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        5. associate-/r/N/A

          \[\leadsto \sqrt{\color{blue}{\frac{u1}{\mathsf{neg}\left(\left(1 \cdot 1 - u1 \cdot u1\right)\right)} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        6. lower-*.f32N/A

          \[\leadsto \sqrt{\color{blue}{\frac{u1}{\mathsf{neg}\left(\left(1 \cdot 1 - u1 \cdot u1\right)\right)} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        7. lower-/.f32N/A

          \[\leadsto \sqrt{\color{blue}{\frac{u1}{\mathsf{neg}\left(\left(1 \cdot 1 - u1 \cdot u1\right)\right)}} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        8. metadata-evalN/A

          \[\leadsto \sqrt{\frac{u1}{\mathsf{neg}\left(\left(\color{blue}{1} - u1 \cdot u1\right)\right)} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        9. fp-cancel-sub-sign-invN/A

          \[\leadsto \sqrt{\frac{u1}{\mathsf{neg}\left(\color{blue}{\left(1 + \left(\mathsf{neg}\left(u1\right)\right) \cdot u1\right)}\right)} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        10. distribute-neg-inN/A

          \[\leadsto \sqrt{\frac{u1}{\color{blue}{\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(u1\right)\right) \cdot u1\right)\right)}} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        11. distribute-rgt-neg-outN/A

          \[\leadsto \sqrt{\frac{u1}{\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{\left(\mathsf{neg}\left(u1\right)\right) \cdot \left(\mathsf{neg}\left(u1\right)\right)}} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        12. sqr-neg-revN/A

          \[\leadsto \sqrt{\frac{u1}{\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{u1 \cdot u1}} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        13. lower-+.f32N/A

          \[\leadsto \sqrt{\frac{u1}{\color{blue}{\left(\mathsf{neg}\left(1\right)\right) + u1 \cdot u1}} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        14. metadata-evalN/A

          \[\leadsto \sqrt{\frac{u1}{\color{blue}{-1} + u1 \cdot u1} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        15. lower-*.f32N/A

          \[\leadsto \sqrt{\frac{u1}{-1 + \color{blue}{u1 \cdot u1}} \cdot \left(\mathsf{neg}\left(\left(1 + u1\right)\right)\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        16. distribute-neg-inN/A

          \[\leadsto \sqrt{\frac{u1}{-1 + u1 \cdot u1} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(u1\right)\right)\right)}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        17. *-rgt-identityN/A

          \[\leadsto \sqrt{\frac{u1}{-1 + u1 \cdot u1} \cdot \left(\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(\color{blue}{u1 \cdot 1}\right)\right)\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        18. distribute-lft-neg-inN/A

          \[\leadsto \sqrt{\frac{u1}{-1 + u1 \cdot u1} \cdot \left(\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{\left(\mathsf{neg}\left(u1\right)\right) \cdot 1}\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        19. fp-cancel-sub-signN/A

          \[\leadsto \sqrt{\frac{u1}{-1 + u1 \cdot u1} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(1\right)\right) - u1 \cdot 1\right)}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        20. *-rgt-identityN/A

          \[\leadsto \sqrt{\frac{u1}{-1 + u1 \cdot u1} \cdot \left(\left(\mathsf{neg}\left(1\right)\right) - \color{blue}{u1}\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        21. lower--.f32N/A

          \[\leadsto \sqrt{\frac{u1}{-1 + u1 \cdot u1} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(1\right)\right) - u1\right)}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        22. metadata-eval97.7

          \[\leadsto \sqrt{\frac{u1}{-1 + u1 \cdot u1} \cdot \left(\color{blue}{-1} - u1\right)} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
      4. Applied rewrites97.7%

        \[\leadsto \sqrt{\color{blue}{\frac{u1}{-1 + u1 \cdot u1} \cdot \left(-1 - u1\right)}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
      5. Step-by-step derivation
        1. lift-*.f32N/A

          \[\leadsto \sqrt{\color{blue}{\frac{u1}{-1 + u1 \cdot u1} \cdot \left(-1 - u1\right)}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        2. lift-/.f32N/A

          \[\leadsto \sqrt{\color{blue}{\frac{u1}{-1 + u1 \cdot u1}} \cdot \left(-1 - u1\right)} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        3. associate-/r/N/A

          \[\leadsto \sqrt{\color{blue}{\frac{u1}{\frac{-1 + u1 \cdot u1}{-1 - u1}}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        4. lift--.f32N/A

          \[\leadsto \sqrt{\frac{u1}{\frac{-1 + u1 \cdot u1}{\color{blue}{-1 - u1}}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        5. *-lft-identityN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{-1 + u1 \cdot u1}{-1 - \color{blue}{1 \cdot u1}}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        6. fp-cancel-sub-sign-invN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{-1 + u1 \cdot u1}{\color{blue}{-1 + \left(\mathsf{neg}\left(1\right)\right) \cdot u1}}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        7. metadata-evalN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{-1 + u1 \cdot u1}{\color{blue}{\left(\mathsf{neg}\left(1\right)\right)} + \left(\mathsf{neg}\left(1\right)\right) \cdot u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        8. metadata-evalN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{-1 + u1 \cdot u1}{\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{-1} \cdot u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        9. mul-1-negN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{-1 + u1 \cdot u1}{\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{\left(\mathsf{neg}\left(u1\right)\right)}}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        10. distribute-neg-inN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{-1 + u1 \cdot u1}{\color{blue}{\mathsf{neg}\left(\left(1 + u1\right)\right)}}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        11. distribute-frac-neg2N/A

          \[\leadsto \sqrt{\frac{u1}{\color{blue}{\mathsf{neg}\left(\frac{-1 + u1 \cdot u1}{1 + u1}\right)}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        12. distribute-frac-negN/A

          \[\leadsto \sqrt{\frac{u1}{\color{blue}{\frac{\mathsf{neg}\left(\left(-1 + u1 \cdot u1\right)\right)}{1 + u1}}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        13. lift-+.f32N/A

          \[\leadsto \sqrt{\frac{u1}{\frac{\mathsf{neg}\left(\color{blue}{\left(-1 + u1 \cdot u1\right)}\right)}{1 + u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        14. distribute-neg-inN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{\color{blue}{\left(\mathsf{neg}\left(-1\right)\right) + \left(\mathsf{neg}\left(u1 \cdot u1\right)\right)}}{1 + u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        15. metadata-evalN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{\color{blue}{1} + \left(\mathsf{neg}\left(u1 \cdot u1\right)\right)}{1 + u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        16. lift-*.f32N/A

          \[\leadsto \sqrt{\frac{u1}{\frac{1 + \left(\mathsf{neg}\left(\color{blue}{u1 \cdot u1}\right)\right)}{1 + u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        17. distribute-lft-neg-outN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{1 + \color{blue}{\left(\mathsf{neg}\left(u1\right)\right) \cdot u1}}{1 + u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        18. fp-cancel-sub-sign-invN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{\color{blue}{1 - u1 \cdot u1}}{1 + u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        19. metadata-evalN/A

          \[\leadsto \sqrt{\frac{u1}{\frac{\color{blue}{1 \cdot 1} - u1 \cdot u1}{1 + u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        20. flip--N/A

          \[\leadsto \sqrt{\frac{u1}{\color{blue}{1 - u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        21. *-lft-identityN/A

          \[\leadsto \sqrt{\frac{\color{blue}{1 \cdot u1}}{1 - u1}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        22. lift--.f32N/A

          \[\leadsto \sqrt{\frac{1 \cdot u1}{\color{blue}{1 - u1}}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
      6. Applied rewrites97.6%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{1 - u1} \cdot u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
      7. Taylor expanded in u1 around 0

        \[\leadsto \sqrt{\color{blue}{\left(1 + u1\right)} \cdot u1} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
      8. Step-by-step derivation
        1. lower-+.f3287.8

          \[\leadsto \sqrt{\color{blue}{\left(1 + u1\right)} \cdot u1} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
      9. Applied rewrites87.8%

        \[\leadsto \sqrt{\color{blue}{\left(1 + u1\right)} \cdot u1} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
    8. Recombined 2 regimes into one program.
    9. Final simplification96.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;u2 \leq 0.041999999433755875:\\ \;\;\;\;\sqrt{u1 \cdot \frac{-1}{-1 + u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2 \cdot u2, -76.70585975309672, 81.6052492761019\right) \cdot u2\right) \cdot u2 - 41.341702240407926\right) \cdot u2\right) \cdot u2 + 6.28318530718\right) \cdot u2\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(1 + u1\right) \cdot u1} \cdot \sin \left(6.28318530718 \cdot u2\right)\\ \end{array} \]
    10. Add Preprocessing

    Alternative 3: 98.3% accurate, 1.0× speedup?

    \[\begin{array}{l} cosTheta_i_m = \left|cosTheta\_i\right| \\ u2\_m = \left|u2\right| \\ u2\_s = \mathsf{copysign}\left(1, u2\right) \\ u2\_s \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\_m\right)\right) \end{array} \]
    cosTheta_i_m = (fabs.f32 cosTheta_i)
    u2\_m = (fabs.f32 u2)
    u2\_s = (copysign.f32 #s(literal 1 binary32) u2)
    (FPCore (u2_s cosTheta_i_m u1 u2_m)
     :precision binary32
     (* u2_s (* (sqrt (/ u1 (- 1.0 u1))) (sin (* 6.28318530718 u2_m)))))
    cosTheta_i_m = fabs(cosTheta_i);
    u2\_m = fabs(u2);
    u2\_s = copysign(1.0, u2);
    float code(float u2_s, float cosTheta_i_m, float u1, float u2_m) {
    	return u2_s * (sqrtf((u1 / (1.0f - u1))) * sinf((6.28318530718f * u2_m)));
    }
    
    cosTheta_i_m = abs(costheta_i)
    u2\_m = abs(u2)
    u2\_s = copysign(1.0d0, u2)
    real(4) function code(u2_s, costheta_i_m, u1, u2_m)
        real(4), intent (in) :: u2_s
        real(4), intent (in) :: costheta_i_m
        real(4), intent (in) :: u1
        real(4), intent (in) :: u2_m
        code = u2_s * (sqrt((u1 / (1.0e0 - u1))) * sin((6.28318530718e0 * u2_m)))
    end function
    
    cosTheta_i_m = abs(cosTheta_i)
    u2\_m = abs(u2)
    u2\_s = copysign(1.0, u2)
    function code(u2_s, cosTheta_i_m, u1, u2_m)
    	return Float32(u2_s * Float32(sqrt(Float32(u1 / Float32(Float32(1.0) - u1))) * sin(Float32(Float32(6.28318530718) * u2_m))))
    end
    
    cosTheta_i_m = abs(cosTheta_i);
    u2\_m = abs(u2);
    u2\_s = sign(u2) * abs(1.0);
    function tmp = code(u2_s, cosTheta_i_m, u1, u2_m)
    	tmp = u2_s * (sqrt((u1 / (single(1.0) - u1))) * sin((single(6.28318530718) * u2_m)));
    end
    
    \begin{array}{l}
    cosTheta_i_m = \left|cosTheta\_i\right|
    \\
    u2\_m = \left|u2\right|
    \\
    u2\_s = \mathsf{copysign}\left(1, u2\right)
    
    \\
    u2\_s \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\_m\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 98.5%

      \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
    2. Add Preprocessing
    3. Add Preprocessing

    Alternative 4: 94.8% accurate, 1.1× speedup?

    \[\begin{array}{l} cosTheta_i_m = \left|cosTheta\_i\right| \\ u2\_m = \left|u2\right| \\ u2\_s = \mathsf{copysign}\left(1, u2\right) \\ u2\_s \cdot \begin{array}{l} \mathbf{if}\;u2\_m \leq 0.041999999433755875:\\ \;\;\;\;\sqrt{u1 \cdot \frac{-1}{-1 + u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2\_m \cdot u2\_m, -76.70585975309672, 81.6052492761019\right) \cdot u2\_m\right) \cdot u2\_m - 41.341702240407926\right) \cdot u2\_m\right) \cdot u2\_m + 6.28318530718\right) \cdot u2\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1} \cdot \sin \left(6.28318530718 \cdot u2\_m\right)\\ \end{array} \end{array} \]
    cosTheta_i_m = (fabs.f32 cosTheta_i)
    u2\_m = (fabs.f32 u2)
    u2\_s = (copysign.f32 #s(literal 1 binary32) u2)
    (FPCore (u2_s cosTheta_i_m u1 u2_m)
     :precision binary32
     (*
      u2_s
      (if (<= u2_m 0.041999999433755875)
        (*
         (sqrt (* u1 (/ -1.0 (+ -1.0 u1))))
         (*
          (+
           (*
            (*
             (-
              (*
               (* (fma (* u2_m u2_m) -76.70585975309672 81.6052492761019) u2_m)
               u2_m)
              41.341702240407926)
             u2_m)
            u2_m)
           6.28318530718)
          u2_m))
        (* (sqrt u1) (sin (* 6.28318530718 u2_m))))))
    cosTheta_i_m = fabs(cosTheta_i);
    u2\_m = fabs(u2);
    u2\_s = copysign(1.0, u2);
    float code(float u2_s, float cosTheta_i_m, float u1, float u2_m) {
    	float tmp;
    	if (u2_m <= 0.041999999433755875f) {
    		tmp = sqrtf((u1 * (-1.0f / (-1.0f + u1)))) * (((((((fmaf((u2_m * u2_m), -76.70585975309672f, 81.6052492761019f) * u2_m) * u2_m) - 41.341702240407926f) * u2_m) * u2_m) + 6.28318530718f) * u2_m);
    	} else {
    		tmp = sqrtf(u1) * sinf((6.28318530718f * u2_m));
    	}
    	return u2_s * tmp;
    }
    
    cosTheta_i_m = abs(cosTheta_i)
    u2\_m = abs(u2)
    u2\_s = copysign(1.0, u2)
    function code(u2_s, cosTheta_i_m, u1, u2_m)
    	tmp = Float32(0.0)
    	if (u2_m <= Float32(0.041999999433755875))
    		tmp = Float32(sqrt(Float32(u1 * Float32(Float32(-1.0) / Float32(Float32(-1.0) + u1)))) * Float32(Float32(Float32(Float32(Float32(Float32(Float32(fma(Float32(u2_m * u2_m), Float32(-76.70585975309672), Float32(81.6052492761019)) * u2_m) * u2_m) - Float32(41.341702240407926)) * u2_m) * u2_m) + Float32(6.28318530718)) * u2_m));
    	else
    		tmp = Float32(sqrt(u1) * sin(Float32(Float32(6.28318530718) * u2_m)));
    	end
    	return Float32(u2_s * tmp)
    end
    
    \begin{array}{l}
    cosTheta_i_m = \left|cosTheta\_i\right|
    \\
    u2\_m = \left|u2\right|
    \\
    u2\_s = \mathsf{copysign}\left(1, u2\right)
    
    \\
    u2\_s \cdot \begin{array}{l}
    \mathbf{if}\;u2\_m \leq 0.041999999433755875:\\
    \;\;\;\;\sqrt{u1 \cdot \frac{-1}{-1 + u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2\_m \cdot u2\_m, -76.70585975309672, 81.6052492761019\right) \cdot u2\_m\right) \cdot u2\_m - 41.341702240407926\right) \cdot u2\_m\right) \cdot u2\_m + 6.28318530718\right) \cdot u2\_m\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\sqrt{u1} \cdot \sin \left(6.28318530718 \cdot u2\_m\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if u2 < 0.0419999994

      1. Initial program 98.6%

        \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
      2. Add Preprocessing
      3. Applied rewrites98.4%

        \[\leadsto \sqrt{\color{blue}{\left(-u1\right) \cdot \frac{-1}{1 - u1}}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
      4. Taylor expanded in u2 around 0

        \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(u2 \cdot \left(\frac{314159265359}{50000000000} + {u2}^{2} \cdot \left({u2}^{2} \cdot \left(\frac{3060196847853821555298148281676017575122444629042460390799}{37500000000000000000000000000000000000000000000000000000} + \frac{-302029322777818351566783844332719832329455959975176141755859165754785028165295919}{3937500000000000000000000000000000000000000000000000000000000000000000000000000} \cdot {u2}^{2}\right) - \frac{31006276680305942139213528068663279}{750000000000000000000000000000000}\right)\right)\right)} \]
      5. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(\left(\frac{314159265359}{50000000000} + {u2}^{2} \cdot \left({u2}^{2} \cdot \left(\frac{3060196847853821555298148281676017575122444629042460390799}{37500000000000000000000000000000000000000000000000000000} + \frac{-302029322777818351566783844332719832329455959975176141755859165754785028165295919}{3937500000000000000000000000000000000000000000000000000000000000000000000000000} \cdot {u2}^{2}\right) - \frac{31006276680305942139213528068663279}{750000000000000000000000000000000}\right)\right) \cdot u2\right)} \]
        2. lower-*.f32N/A

          \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(\left(\frac{314159265359}{50000000000} + {u2}^{2} \cdot \left({u2}^{2} \cdot \left(\frac{3060196847853821555298148281676017575122444629042460390799}{37500000000000000000000000000000000000000000000000000000} + \frac{-302029322777818351566783844332719832329455959975176141755859165754785028165295919}{3937500000000000000000000000000000000000000000000000000000000000000000000000000} \cdot {u2}^{2}\right) - \frac{31006276680305942139213528068663279}{750000000000000000000000000000000}\right)\right) \cdot u2\right)} \]
      6. Applied rewrites90.0%

        \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(\mathsf{fma}\left(\left(\mathsf{fma}\left(-76.70585975309672, u2 \cdot u2, 81.6052492761019\right) \cdot u2\right) \cdot u2 - 41.341702240407926, u2 \cdot u2, 6.28318530718\right) \cdot u2\right)} \]
      7. Step-by-step derivation
        1. Applied rewrites98.4%

          \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2 \cdot u2, -76.70585975309672, 81.6052492761019\right) \cdot u2\right) \cdot u2 - 41.341702240407926\right) \cdot u2\right) \cdot u2 + 6.28318530718\right) \cdot u2\right) \]

        if 0.0419999994 < u2

        1. Initial program 97.8%

          \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
        2. Add Preprocessing
        3. Taylor expanded in u1 around 0

          \[\leadsto \color{blue}{\sqrt{u1}} \cdot \sin \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
        4. Step-by-step derivation
          1. lower-sqrt.f3273.5

            \[\leadsto \color{blue}{\sqrt{u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
        5. Applied rewrites73.5%

          \[\leadsto \color{blue}{\sqrt{u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
      8. Recombined 2 regimes into one program.
      9. Final simplification94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;u2 \leq 0.041999999433755875:\\ \;\;\;\;\sqrt{u1 \cdot \frac{-1}{-1 + u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2 \cdot u2, -76.70585975309672, 81.6052492761019\right) \cdot u2\right) \cdot u2 - 41.341702240407926\right) \cdot u2\right) \cdot u2 + 6.28318530718\right) \cdot u2\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1} \cdot \sin \left(6.28318530718 \cdot u2\right)\\ \end{array} \]
      10. Add Preprocessing

      Alternative 5: 91.8% accurate, 1.8× speedup?

      \[\begin{array}{l} cosTheta_i_m = \left|cosTheta\_i\right| \\ u2\_m = \left|u2\right| \\ u2\_s = \mathsf{copysign}\left(1, u2\right) \\ u2\_s \cdot \left(\sqrt{u1 \cdot \frac{-1}{-1 + u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2\_m \cdot u2\_m, -76.70585975309672, 81.6052492761019\right) \cdot u2\_m\right) \cdot u2\_m - 41.341702240407926\right) \cdot u2\_m\right) \cdot u2\_m + 6.28318530718\right) \cdot u2\_m\right)\right) \end{array} \]
      cosTheta_i_m = (fabs.f32 cosTheta_i)
      u2\_m = (fabs.f32 u2)
      u2\_s = (copysign.f32 #s(literal 1 binary32) u2)
      (FPCore (u2_s cosTheta_i_m u1 u2_m)
       :precision binary32
       (*
        u2_s
        (*
         (sqrt (* u1 (/ -1.0 (+ -1.0 u1))))
         (*
          (+
           (*
            (*
             (-
              (*
               (* (fma (* u2_m u2_m) -76.70585975309672 81.6052492761019) u2_m)
               u2_m)
              41.341702240407926)
             u2_m)
            u2_m)
           6.28318530718)
          u2_m))))
      cosTheta_i_m = fabs(cosTheta_i);
      u2\_m = fabs(u2);
      u2\_s = copysign(1.0, u2);
      float code(float u2_s, float cosTheta_i_m, float u1, float u2_m) {
      	return u2_s * (sqrtf((u1 * (-1.0f / (-1.0f + u1)))) * (((((((fmaf((u2_m * u2_m), -76.70585975309672f, 81.6052492761019f) * u2_m) * u2_m) - 41.341702240407926f) * u2_m) * u2_m) + 6.28318530718f) * u2_m));
      }
      
      cosTheta_i_m = abs(cosTheta_i)
      u2\_m = abs(u2)
      u2\_s = copysign(1.0, u2)
      function code(u2_s, cosTheta_i_m, u1, u2_m)
      	return Float32(u2_s * Float32(sqrt(Float32(u1 * Float32(Float32(-1.0) / Float32(Float32(-1.0) + u1)))) * Float32(Float32(Float32(Float32(Float32(Float32(Float32(fma(Float32(u2_m * u2_m), Float32(-76.70585975309672), Float32(81.6052492761019)) * u2_m) * u2_m) - Float32(41.341702240407926)) * u2_m) * u2_m) + Float32(6.28318530718)) * u2_m)))
      end
      
      \begin{array}{l}
      cosTheta_i_m = \left|cosTheta\_i\right|
      \\
      u2\_m = \left|u2\right|
      \\
      u2\_s = \mathsf{copysign}\left(1, u2\right)
      
      \\
      u2\_s \cdot \left(\sqrt{u1 \cdot \frac{-1}{-1 + u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2\_m \cdot u2\_m, -76.70585975309672, 81.6052492761019\right) \cdot u2\_m\right) \cdot u2\_m - 41.341702240407926\right) \cdot u2\_m\right) \cdot u2\_m + 6.28318530718\right) \cdot u2\_m\right)\right)
      \end{array}
      
      Derivation
      1. Initial program 98.5%

        \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
      2. Add Preprocessing
      3. Applied rewrites98.2%

        \[\leadsto \sqrt{\color{blue}{\left(-u1\right) \cdot \frac{-1}{1 - u1}}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
      4. Taylor expanded in u2 around 0

        \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(u2 \cdot \left(\frac{314159265359}{50000000000} + {u2}^{2} \cdot \left({u2}^{2} \cdot \left(\frac{3060196847853821555298148281676017575122444629042460390799}{37500000000000000000000000000000000000000000000000000000} + \frac{-302029322777818351566783844332719832329455959975176141755859165754785028165295919}{3937500000000000000000000000000000000000000000000000000000000000000000000000000} \cdot {u2}^{2}\right) - \frac{31006276680305942139213528068663279}{750000000000000000000000000000000}\right)\right)\right)} \]
      5. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(\left(\frac{314159265359}{50000000000} + {u2}^{2} \cdot \left({u2}^{2} \cdot \left(\frac{3060196847853821555298148281676017575122444629042460390799}{37500000000000000000000000000000000000000000000000000000} + \frac{-302029322777818351566783844332719832329455959975176141755859165754785028165295919}{3937500000000000000000000000000000000000000000000000000000000000000000000000000} \cdot {u2}^{2}\right) - \frac{31006276680305942139213528068663279}{750000000000000000000000000000000}\right)\right) \cdot u2\right)} \]
        2. lower-*.f32N/A

          \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(\left(\frac{314159265359}{50000000000} + {u2}^{2} \cdot \left({u2}^{2} \cdot \left(\frac{3060196847853821555298148281676017575122444629042460390799}{37500000000000000000000000000000000000000000000000000000} + \frac{-302029322777818351566783844332719832329455959975176141755859165754785028165295919}{3937500000000000000000000000000000000000000000000000000000000000000000000000000} \cdot {u2}^{2}\right) - \frac{31006276680305942139213528068663279}{750000000000000000000000000000000}\right)\right) \cdot u2\right)} \]
      6. Applied rewrites78.7%

        \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \color{blue}{\left(\mathsf{fma}\left(\left(\mathsf{fma}\left(-76.70585975309672, u2 \cdot u2, 81.6052492761019\right) \cdot u2\right) \cdot u2 - 41.341702240407926, u2 \cdot u2, 6.28318530718\right) \cdot u2\right)} \]
      7. Step-by-step derivation
        1. Applied rewrites89.1%

          \[\leadsto \sqrt{\left(-u1\right) \cdot \frac{-1}{1 - u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2 \cdot u2, -76.70585975309672, 81.6052492761019\right) \cdot u2\right) \cdot u2 - 41.341702240407926\right) \cdot u2\right) \cdot u2 + 6.28318530718\right) \cdot u2\right) \]
        2. Final simplification89.1%

          \[\leadsto \sqrt{u1 \cdot \frac{-1}{-1 + u1}} \cdot \left(\left(\left(\left(\left(\mathsf{fma}\left(u2 \cdot u2, -76.70585975309672, 81.6052492761019\right) \cdot u2\right) \cdot u2 - 41.341702240407926\right) \cdot u2\right) \cdot u2 + 6.28318530718\right) \cdot u2\right) \]
        3. Add Preprocessing

        Alternative 6: 89.4% accurate, 1.8× speedup?

        \[\begin{array}{l} cosTheta_i_m = \left|cosTheta\_i\right| \\ u2\_m = \left|u2\right| \\ u2\_s = \mathsf{copysign}\left(1, u2\right) \\ \begin{array}{l} t_0 := \sqrt{\frac{u1}{1 - u1}}\\ u2\_s \cdot \left(\left(t\_0 \cdot \left(-41.341702240407926 \cdot \left(u2\_m \cdot u2\_m\right)\right) - -6.28318530718 \cdot t\_0\right) \cdot u2\_m\right) \end{array} \end{array} \]
        cosTheta_i_m = (fabs.f32 cosTheta_i)
        u2\_m = (fabs.f32 u2)
        u2\_s = (copysign.f32 #s(literal 1 binary32) u2)
        (FPCore (u2_s cosTheta_i_m u1 u2_m)
         :precision binary32
         (let* ((t_0 (sqrt (/ u1 (- 1.0 u1)))))
           (*
            u2_s
            (*
             (- (* t_0 (* -41.341702240407926 (* u2_m u2_m))) (* -6.28318530718 t_0))
             u2_m))))
        cosTheta_i_m = fabs(cosTheta_i);
        u2\_m = fabs(u2);
        u2\_s = copysign(1.0, u2);
        float code(float u2_s, float cosTheta_i_m, float u1, float u2_m) {
        	float t_0 = sqrtf((u1 / (1.0f - u1)));
        	return u2_s * (((t_0 * (-41.341702240407926f * (u2_m * u2_m))) - (-6.28318530718f * t_0)) * u2_m);
        }
        
        cosTheta_i_m = abs(costheta_i)
        u2\_m = abs(u2)
        u2\_s = copysign(1.0d0, u2)
        real(4) function code(u2_s, costheta_i_m, u1, u2_m)
            real(4), intent (in) :: u2_s
            real(4), intent (in) :: costheta_i_m
            real(4), intent (in) :: u1
            real(4), intent (in) :: u2_m
            real(4) :: t_0
            t_0 = sqrt((u1 / (1.0e0 - u1)))
            code = u2_s * (((t_0 * ((-41.341702240407926e0) * (u2_m * u2_m))) - ((-6.28318530718e0) * t_0)) * u2_m)
        end function
        
        cosTheta_i_m = abs(cosTheta_i)
        u2\_m = abs(u2)
        u2\_s = copysign(1.0, u2)
        function code(u2_s, cosTheta_i_m, u1, u2_m)
        	t_0 = sqrt(Float32(u1 / Float32(Float32(1.0) - u1)))
        	return Float32(u2_s * Float32(Float32(Float32(t_0 * Float32(Float32(-41.341702240407926) * Float32(u2_m * u2_m))) - Float32(Float32(-6.28318530718) * t_0)) * u2_m))
        end
        
        cosTheta_i_m = abs(cosTheta_i);
        u2\_m = abs(u2);
        u2\_s = sign(u2) * abs(1.0);
        function tmp = code(u2_s, cosTheta_i_m, u1, u2_m)
        	t_0 = sqrt((u1 / (single(1.0) - u1)));
        	tmp = u2_s * (((t_0 * (single(-41.341702240407926) * (u2_m * u2_m))) - (single(-6.28318530718) * t_0)) * u2_m);
        end
        
        \begin{array}{l}
        cosTheta_i_m = \left|cosTheta\_i\right|
        \\
        u2\_m = \left|u2\right|
        \\
        u2\_s = \mathsf{copysign}\left(1, u2\right)
        
        \\
        \begin{array}{l}
        t_0 := \sqrt{\frac{u1}{1 - u1}}\\
        u2\_s \cdot \left(\left(t\_0 \cdot \left(-41.341702240407926 \cdot \left(u2\_m \cdot u2\_m\right)\right) - -6.28318530718 \cdot t\_0\right) \cdot u2\_m\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 98.5%

          \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
        2. Add Preprocessing
        3. Taylor expanded in u2 around 0

          \[\leadsto \color{blue}{\frac{314159265359}{50000000000} \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot u2\right)} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{\left(\sqrt{\frac{u1}{1 - u1}} \cdot u2\right) \cdot \frac{314159265359}{50000000000}} \]
          2. associate-*l*N/A

            \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(u2 \cdot \frac{314159265359}{50000000000}\right)} \]
          3. *-commutativeN/A

            \[\leadsto \sqrt{\frac{u1}{1 - u1}} \cdot \color{blue}{\left(\frac{314159265359}{50000000000} \cdot u2\right)} \]
          4. lower-*.f32N/A

            \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right)} \]
          5. lower-sqrt.f32N/A

            \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
          6. lower-/.f32N/A

            \[\leadsto \sqrt{\color{blue}{\frac{u1}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
          7. lower--.f32N/A

            \[\leadsto \sqrt{\frac{u1}{\color{blue}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
          8. lower-*.f3278.8

            \[\leadsto \sqrt{\frac{u1}{1 - u1}} \cdot \color{blue}{\left(6.28318530718 \cdot u2\right)} \]
        5. Applied rewrites78.8%

          \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(6.28318530718 \cdot u2\right)} \]
        6. Taylor expanded in u2 around 0

          \[\leadsto \color{blue}{u2 \cdot \left(\frac{-31006276680305942139213528068663279}{750000000000000000000000000000000} \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot {u2}^{2}\right) + \frac{314159265359}{50000000000} \cdot \sqrt{\frac{u1}{1 - u1}}\right)} \]
        7. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{\left(\frac{-31006276680305942139213528068663279}{750000000000000000000000000000000} \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot {u2}^{2}\right) + \frac{314159265359}{50000000000} \cdot \sqrt{\frac{u1}{1 - u1}}\right) \cdot u2} \]
          2. lower-*.f32N/A

            \[\leadsto \color{blue}{\left(\frac{-31006276680305942139213528068663279}{750000000000000000000000000000000} \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot {u2}^{2}\right) + \frac{314159265359}{50000000000} \cdot \sqrt{\frac{u1}{1 - u1}}\right) \cdot u2} \]
        8. Applied rewrites78.6%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(u2 \cdot u2\right) \cdot -41.341702240407926, \sqrt{\frac{u1}{1 - u1}}, 6.28318530718 \cdot \sqrt{\frac{u1}{1 - u1}}\right) \cdot u2} \]
        9. Step-by-step derivation
          1. Applied rewrites87.0%

            \[\leadsto \left(\sqrt{\frac{u1}{1 - u1}} \cdot \left(-41.341702240407926 \cdot \left(u2 \cdot u2\right)\right) - -6.28318530718 \cdot \sqrt{\frac{u1}{1 - u1}}\right) \cdot u2 \]
          2. Add Preprocessing

          Alternative 7: 81.6% accurate, 3.9× speedup?

          \[\begin{array}{l} cosTheta_i_m = \left|cosTheta\_i\right| \\ u2\_m = \left|u2\right| \\ u2\_s = \mathsf{copysign}\left(1, u2\right) \\ u2\_s \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot \left(6.28318530718 \cdot u2\_m\right)\right) \end{array} \]
          cosTheta_i_m = (fabs.f32 cosTheta_i)
          u2\_m = (fabs.f32 u2)
          u2\_s = (copysign.f32 #s(literal 1 binary32) u2)
          (FPCore (u2_s cosTheta_i_m u1 u2_m)
           :precision binary32
           (* u2_s (* (sqrt (/ u1 (- 1.0 u1))) (* 6.28318530718 u2_m))))
          cosTheta_i_m = fabs(cosTheta_i);
          u2\_m = fabs(u2);
          u2\_s = copysign(1.0, u2);
          float code(float u2_s, float cosTheta_i_m, float u1, float u2_m) {
          	return u2_s * (sqrtf((u1 / (1.0f - u1))) * (6.28318530718f * u2_m));
          }
          
          cosTheta_i_m = abs(costheta_i)
          u2\_m = abs(u2)
          u2\_s = copysign(1.0d0, u2)
          real(4) function code(u2_s, costheta_i_m, u1, u2_m)
              real(4), intent (in) :: u2_s
              real(4), intent (in) :: costheta_i_m
              real(4), intent (in) :: u1
              real(4), intent (in) :: u2_m
              code = u2_s * (sqrt((u1 / (1.0e0 - u1))) * (6.28318530718e0 * u2_m))
          end function
          
          cosTheta_i_m = abs(cosTheta_i)
          u2\_m = abs(u2)
          u2\_s = copysign(1.0, u2)
          function code(u2_s, cosTheta_i_m, u1, u2_m)
          	return Float32(u2_s * Float32(sqrt(Float32(u1 / Float32(Float32(1.0) - u1))) * Float32(Float32(6.28318530718) * u2_m)))
          end
          
          cosTheta_i_m = abs(cosTheta_i);
          u2\_m = abs(u2);
          u2\_s = sign(u2) * abs(1.0);
          function tmp = code(u2_s, cosTheta_i_m, u1, u2_m)
          	tmp = u2_s * (sqrt((u1 / (single(1.0) - u1))) * (single(6.28318530718) * u2_m));
          end
          
          \begin{array}{l}
          cosTheta_i_m = \left|cosTheta\_i\right|
          \\
          u2\_m = \left|u2\right|
          \\
          u2\_s = \mathsf{copysign}\left(1, u2\right)
          
          \\
          u2\_s \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot \left(6.28318530718 \cdot u2\_m\right)\right)
          \end{array}
          
          Derivation
          1. Initial program 98.5%

            \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
          2. Add Preprocessing
          3. Taylor expanded in u2 around 0

            \[\leadsto \color{blue}{\frac{314159265359}{50000000000} \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot u2\right)} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\left(\sqrt{\frac{u1}{1 - u1}} \cdot u2\right) \cdot \frac{314159265359}{50000000000}} \]
            2. associate-*l*N/A

              \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(u2 \cdot \frac{314159265359}{50000000000}\right)} \]
            3. *-commutativeN/A

              \[\leadsto \sqrt{\frac{u1}{1 - u1}} \cdot \color{blue}{\left(\frac{314159265359}{50000000000} \cdot u2\right)} \]
            4. lower-*.f32N/A

              \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right)} \]
            5. lower-sqrt.f32N/A

              \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
            6. lower-/.f32N/A

              \[\leadsto \sqrt{\color{blue}{\frac{u1}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
            7. lower--.f32N/A

              \[\leadsto \sqrt{\frac{u1}{\color{blue}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
            8. lower-*.f3278.8

              \[\leadsto \sqrt{\frac{u1}{1 - u1}} \cdot \color{blue}{\left(6.28318530718 \cdot u2\right)} \]
          5. Applied rewrites78.8%

            \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(6.28318530718 \cdot u2\right)} \]
          6. Add Preprocessing

          Alternative 8: 65.1% accurate, 6.4× speedup?

          \[\begin{array}{l} cosTheta_i_m = \left|cosTheta\_i\right| \\ u2\_m = \left|u2\right| \\ u2\_s = \mathsf{copysign}\left(1, u2\right) \\ u2\_s \cdot \left(\left(\sqrt{u1} \cdot u2\_m\right) \cdot 6.28318530718\right) \end{array} \]
          cosTheta_i_m = (fabs.f32 cosTheta_i)
          u2\_m = (fabs.f32 u2)
          u2\_s = (copysign.f32 #s(literal 1 binary32) u2)
          (FPCore (u2_s cosTheta_i_m u1 u2_m)
           :precision binary32
           (* u2_s (* (* (sqrt u1) u2_m) 6.28318530718)))
          cosTheta_i_m = fabs(cosTheta_i);
          u2\_m = fabs(u2);
          u2\_s = copysign(1.0, u2);
          float code(float u2_s, float cosTheta_i_m, float u1, float u2_m) {
          	return u2_s * ((sqrtf(u1) * u2_m) * 6.28318530718f);
          }
          
          cosTheta_i_m = abs(costheta_i)
          u2\_m = abs(u2)
          u2\_s = copysign(1.0d0, u2)
          real(4) function code(u2_s, costheta_i_m, u1, u2_m)
              real(4), intent (in) :: u2_s
              real(4), intent (in) :: costheta_i_m
              real(4), intent (in) :: u1
              real(4), intent (in) :: u2_m
              code = u2_s * ((sqrt(u1) * u2_m) * 6.28318530718e0)
          end function
          
          cosTheta_i_m = abs(cosTheta_i)
          u2\_m = abs(u2)
          u2\_s = copysign(1.0, u2)
          function code(u2_s, cosTheta_i_m, u1, u2_m)
          	return Float32(u2_s * Float32(Float32(sqrt(u1) * u2_m) * Float32(6.28318530718)))
          end
          
          cosTheta_i_m = abs(cosTheta_i);
          u2\_m = abs(u2);
          u2\_s = sign(u2) * abs(1.0);
          function tmp = code(u2_s, cosTheta_i_m, u1, u2_m)
          	tmp = u2_s * ((sqrt(u1) * u2_m) * single(6.28318530718));
          end
          
          \begin{array}{l}
          cosTheta_i_m = \left|cosTheta\_i\right|
          \\
          u2\_m = \left|u2\right|
          \\
          u2\_s = \mathsf{copysign}\left(1, u2\right)
          
          \\
          u2\_s \cdot \left(\left(\sqrt{u1} \cdot u2\_m\right) \cdot 6.28318530718\right)
          \end{array}
          
          Derivation
          1. Initial program 98.5%

            \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
          2. Add Preprocessing
          3. Taylor expanded in u2 around 0

            \[\leadsto \color{blue}{\frac{314159265359}{50000000000} \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot u2\right)} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\left(\sqrt{\frac{u1}{1 - u1}} \cdot u2\right) \cdot \frac{314159265359}{50000000000}} \]
            2. associate-*l*N/A

              \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(u2 \cdot \frac{314159265359}{50000000000}\right)} \]
            3. *-commutativeN/A

              \[\leadsto \sqrt{\frac{u1}{1 - u1}} \cdot \color{blue}{\left(\frac{314159265359}{50000000000} \cdot u2\right)} \]
            4. lower-*.f32N/A

              \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right)} \]
            5. lower-sqrt.f32N/A

              \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
            6. lower-/.f32N/A

              \[\leadsto \sqrt{\color{blue}{\frac{u1}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
            7. lower--.f32N/A

              \[\leadsto \sqrt{\frac{u1}{\color{blue}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
            8. lower-*.f3278.8

              \[\leadsto \sqrt{\frac{u1}{1 - u1}} \cdot \color{blue}{\left(6.28318530718 \cdot u2\right)} \]
          5. Applied rewrites78.8%

            \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(6.28318530718 \cdot u2\right)} \]
          6. Taylor expanded in u1 around 0

            \[\leadsto \frac{314159265359}{50000000000} \cdot \color{blue}{\left(\sqrt{u1} \cdot u2\right)} \]
          7. Step-by-step derivation
            1. Applied rewrites61.4%

              \[\leadsto \left(\sqrt{u1} \cdot u2\right) \cdot \color{blue}{6.28318530718} \]
            2. Add Preprocessing

            Alternative 9: 65.1% accurate, 6.4× speedup?

            \[\begin{array}{l} cosTheta_i_m = \left|cosTheta\_i\right| \\ u2\_m = \left|u2\right| \\ u2\_s = \mathsf{copysign}\left(1, u2\right) \\ u2\_s \cdot \left(\left(\sqrt{u1} \cdot 6.28318530718\right) \cdot u2\_m\right) \end{array} \]
            cosTheta_i_m = (fabs.f32 cosTheta_i)
            u2\_m = (fabs.f32 u2)
            u2\_s = (copysign.f32 #s(literal 1 binary32) u2)
            (FPCore (u2_s cosTheta_i_m u1 u2_m)
             :precision binary32
             (* u2_s (* (* (sqrt u1) 6.28318530718) u2_m)))
            cosTheta_i_m = fabs(cosTheta_i);
            u2\_m = fabs(u2);
            u2\_s = copysign(1.0, u2);
            float code(float u2_s, float cosTheta_i_m, float u1, float u2_m) {
            	return u2_s * ((sqrtf(u1) * 6.28318530718f) * u2_m);
            }
            
            cosTheta_i_m = abs(costheta_i)
            u2\_m = abs(u2)
            u2\_s = copysign(1.0d0, u2)
            real(4) function code(u2_s, costheta_i_m, u1, u2_m)
                real(4), intent (in) :: u2_s
                real(4), intent (in) :: costheta_i_m
                real(4), intent (in) :: u1
                real(4), intent (in) :: u2_m
                code = u2_s * ((sqrt(u1) * 6.28318530718e0) * u2_m)
            end function
            
            cosTheta_i_m = abs(cosTheta_i)
            u2\_m = abs(u2)
            u2\_s = copysign(1.0, u2)
            function code(u2_s, cosTheta_i_m, u1, u2_m)
            	return Float32(u2_s * Float32(Float32(sqrt(u1) * Float32(6.28318530718)) * u2_m))
            end
            
            cosTheta_i_m = abs(cosTheta_i);
            u2\_m = abs(u2);
            u2\_s = sign(u2) * abs(1.0);
            function tmp = code(u2_s, cosTheta_i_m, u1, u2_m)
            	tmp = u2_s * ((sqrt(u1) * single(6.28318530718)) * u2_m);
            end
            
            \begin{array}{l}
            cosTheta_i_m = \left|cosTheta\_i\right|
            \\
            u2\_m = \left|u2\right|
            \\
            u2\_s = \mathsf{copysign}\left(1, u2\right)
            
            \\
            u2\_s \cdot \left(\left(\sqrt{u1} \cdot 6.28318530718\right) \cdot u2\_m\right)
            \end{array}
            
            Derivation
            1. Initial program 98.5%

              \[\sqrt{\frac{u1}{1 - u1}} \cdot \sin \left(6.28318530718 \cdot u2\right) \]
            2. Add Preprocessing
            3. Taylor expanded in u2 around 0

              \[\leadsto \color{blue}{\frac{314159265359}{50000000000} \cdot \left(\sqrt{\frac{u1}{1 - u1}} \cdot u2\right)} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \color{blue}{\left(\sqrt{\frac{u1}{1 - u1}} \cdot u2\right) \cdot \frac{314159265359}{50000000000}} \]
              2. associate-*l*N/A

                \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(u2 \cdot \frac{314159265359}{50000000000}\right)} \]
              3. *-commutativeN/A

                \[\leadsto \sqrt{\frac{u1}{1 - u1}} \cdot \color{blue}{\left(\frac{314159265359}{50000000000} \cdot u2\right)} \]
              4. lower-*.f32N/A

                \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right)} \]
              5. lower-sqrt.f32N/A

                \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
              6. lower-/.f32N/A

                \[\leadsto \sqrt{\color{blue}{\frac{u1}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
              7. lower--.f32N/A

                \[\leadsto \sqrt{\frac{u1}{\color{blue}{1 - u1}}} \cdot \left(\frac{314159265359}{50000000000} \cdot u2\right) \]
              8. lower-*.f3278.8

                \[\leadsto \sqrt{\frac{u1}{1 - u1}} \cdot \color{blue}{\left(6.28318530718 \cdot u2\right)} \]
            5. Applied rewrites78.8%

              \[\leadsto \color{blue}{\sqrt{\frac{u1}{1 - u1}} \cdot \left(6.28318530718 \cdot u2\right)} \]
            6. Taylor expanded in u1 around 0

              \[\leadsto \frac{314159265359}{50000000000} \cdot \color{blue}{\left(\sqrt{u1} \cdot u2\right)} \]
            7. Step-by-step derivation
              1. Applied rewrites61.4%

                \[\leadsto \left(\sqrt{u1} \cdot u2\right) \cdot \color{blue}{6.28318530718} \]
              2. Step-by-step derivation
                1. Applied rewrites61.4%

                  \[\leadsto \left(\sqrt{u1} \cdot 6.28318530718\right) \cdot u2 \]
                2. Add Preprocessing

                Reproduce

                ?
                herbie shell --seed 2024337 
                (FPCore (cosTheta_i u1 u2)
                  :name "Trowbridge-Reitz Sample, near normal, slope_y"
                  :precision binary32
                  :pre (and (and (and (> cosTheta_i 0.9999) (<= cosTheta_i 1.0)) (and (<= 2.328306437e-10 u1) (<= u1 1.0))) (and (<= 2.328306437e-10 u2) (<= u2 1.0)))
                  (* (sqrt (/ u1 (- 1.0 u1))) (sin (* 6.28318530718 u2))))