Beckmann Sample, near normal, slope_y

Percentage Accurate: 57.4% → 98.5%
Time: 9.9s
Alternatives: 24
Speedup: 6.2×

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)\]
\[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
(FPCore (cosTheta_i u1 u2)
  :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 (- (log (- 1.0 u1)))) (sin (* (* 2.0 PI) u2))))
float code(float cosTheta_i, float u1, float u2) {
	return sqrtf(-logf((1.0f - u1))) * sinf(((2.0f * ((float) M_PI)) * u2));
}
function code(cosTheta_i, u1, u2)
	return Float32(sqrt(Float32(-log(Float32(Float32(1.0) - u1)))) * sin(Float32(Float32(Float32(2.0) * Float32(pi)) * u2)))
end
function tmp = code(cosTheta_i, u1, u2)
	tmp = sqrt(-log((single(1.0) - u1))) * sin(((single(2.0) * single(pi)) * u2));
end
\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right)

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 24 alternatives:

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

Initial Program: 57.4% accurate, 1.0× speedup?

\[\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)\]
\[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
(FPCore (cosTheta_i u1 u2)
  :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 (- (log (- 1.0 u1)))) (sin (* (* 2.0 PI) u2))))
float code(float cosTheta_i, float u1, float u2) {
	return sqrtf(-logf((1.0f - u1))) * sinf(((2.0f * ((float) M_PI)) * u2));
}
function code(cosTheta_i, u1, u2)
	return Float32(sqrt(Float32(-log(Float32(Float32(1.0) - u1)))) * sin(Float32(Float32(Float32(2.0) * Float32(pi)) * u2)))
end
function tmp = code(cosTheta_i, u1, u2)
	tmp = sqrt(-log((single(1.0) - u1))) * sin(((single(2.0) * single(pi)) * u2));
end
\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right)

Alternative 1: 98.5% accurate, 0.8× speedup?

\[\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)\]
\[\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \sin \left(\mathsf{fma}\left(3 \cdot \left(0.5 \cdot \pi\right), u2, \left(u2 \cdot \pi\right) \cdot 0.5\right)\right) \]
(FPCore (cosTheta_i u1 u2)
  :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 (- (log1p (- u1))))
 (sin (fma (* 3.0 (* 0.5 PI)) u2 (* (* u2 PI) 0.5)))))
float code(float cosTheta_i, float u1, float u2) {
	return sqrtf(-log1pf(-u1)) * sinf(fmaf((3.0f * (0.5f * ((float) M_PI))), u2, ((u2 * ((float) M_PI)) * 0.5f)));
}
function code(cosTheta_i, u1, u2)
	return Float32(sqrt(Float32(-log1p(Float32(-u1)))) * sin(fma(Float32(Float32(3.0) * Float32(Float32(0.5) * Float32(pi))), u2, Float32(Float32(u2 * Float32(pi)) * Float32(0.5)))))
end
\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \sin \left(\mathsf{fma}\left(3 \cdot \left(0.5 \cdot \pi\right), u2, \left(u2 \cdot \pi\right) \cdot 0.5\right)\right)
Derivation
  1. Initial program 57.4%

    \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
  2. Step-by-step derivation
    1. Applied rewrites98.4%

      \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
    2. Step-by-step derivation
      1. Applied rewrites98.5%

        \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \sin \left(\mathsf{fma}\left(3 \cdot \left(0.5 \cdot \pi\right), u2, \left(u2 \cdot \pi\right) \cdot 0.5\right)\right) \]
      2. Add Preprocessing

      Alternative 2: 98.4% accurate, 1.0× speedup?

      \[\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)\]
      \[\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
      (FPCore (cosTheta_i u1 u2)
        :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 (- (log1p (- u1)))) (sin (* 6.2831854820251465 u2))))
      float code(float cosTheta_i, float u1, float u2) {
      	return sqrtf(-log1pf(-u1)) * sinf((6.2831854820251465f * u2));
      }
      
      function code(cosTheta_i, u1, u2)
      	return Float32(sqrt(Float32(-log1p(Float32(-u1)))) * sin(Float32(Float32(6.2831854820251465) * u2)))
      end
      
      \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right)
      
      Derivation
      1. Initial program 57.4%

        \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
      2. Step-by-step derivation
        1. Applied rewrites98.4%

          \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
        2. Evaluated real constant98.4%

          \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
        3. Add Preprocessing

        Alternative 3: 96.2% accurate, 0.9× speedup?

        \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.05999999865889549:\\ \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(u1 \cdot u1, 0.25, u1\right)}{\sqrt{u1}} \cdot \sin \left(6.2831854820251465 \cdot u2\right)\\ \end{array} \]
        (FPCore (cosTheta_i u1 u2)
          :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)))
          (if (<= (* (* 2.0 PI) u2) 0.05999999865889549)
          (*
           (sqrt (- (log1p (- u1))))
           (fma
            6.2831854820251465
            u2
            (* u2 (* -41.341705691712875 (* u2 u2)))))
          (*
           (/ (fma (* u1 u1) 0.25 u1) (sqrt u1))
           (sin (* 6.2831854820251465 u2)))))
        float code(float cosTheta_i, float u1, float u2) {
        	float tmp;
        	if (((2.0f * ((float) M_PI)) * u2) <= 0.05999999865889549f) {
        		tmp = sqrtf(-log1pf(-u1)) * fmaf(6.2831854820251465f, u2, (u2 * (-41.341705691712875f * (u2 * u2))));
        	} else {
        		tmp = (fmaf((u1 * u1), 0.25f, u1) / sqrtf(u1)) * sinf((6.2831854820251465f * u2));
        	}
        	return tmp;
        }
        
        function code(cosTheta_i, u1, u2)
        	tmp = Float32(0.0)
        	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.05999999865889549))
        		tmp = Float32(sqrt(Float32(-log1p(Float32(-u1)))) * fma(Float32(6.2831854820251465), u2, Float32(u2 * Float32(Float32(-41.341705691712875) * Float32(u2 * u2)))));
        	else
        		tmp = Float32(Float32(fma(Float32(u1 * u1), Float32(0.25), u1) / sqrt(u1)) * sin(Float32(Float32(6.2831854820251465) * u2)));
        	end
        	return tmp
        end
        
        \begin{array}{l}
        \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.05999999865889549:\\
        \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(u1 \cdot u1, 0.25, u1\right)}{\sqrt{u1}} \cdot \sin \left(6.2831854820251465 \cdot u2\right)\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.0599999987

          1. Initial program 57.4%

            \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
          2. Evaluated real constant57.4%

            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
          3. Taylor expanded in u2 around 0

            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
          4. Step-by-step derivation
            1. Applied rewrites53.3%

              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
            2. Step-by-step derivation
              1. Applied rewrites53.3%

                \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]
              2. Step-by-step derivation
                1. Applied rewrites88.9%

                  \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]

                if 0.0599999987 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                1. Initial program 57.4%

                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                2. Taylor expanded in u1 around 0

                  \[\leadsto \left(\sqrt{u1} + \frac{1}{4} \cdot \frac{{u1}^{2}}{\sqrt{u1}}\right) \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                3. Step-by-step derivation
                  1. Applied rewrites88.2%

                    \[\leadsto \left(\sqrt{u1} + 0.25 \cdot \frac{{u1}^{2}}{\sqrt{u1}}\right) \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                  2. Step-by-step derivation
                    1. Applied rewrites88.0%

                      \[\leadsto \frac{u1 + \left(u1 \cdot u1\right) \cdot 0.25}{\sqrt{u1}} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                    2. Evaluated real constant88.0%

                      \[\leadsto \frac{u1 + \left(u1 \cdot u1\right) \cdot 0.25}{\sqrt{u1}} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                    3. Step-by-step derivation
                      1. Applied rewrites88.0%

                        \[\leadsto \frac{\mathsf{fma}\left(u1 \cdot u1, 0.25, u1\right)}{\sqrt{u1}} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                    4. Recombined 2 regimes into one program.
                    5. Add Preprocessing

                    Alternative 4: 96.1% accurate, 0.9× speedup?

                    \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.05999999865889549:\\ \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt{u1} \cdot u1, 0.25, \sqrt{u1}\right) \cdot \sin \left(u2 \cdot 6.2831854820251465\right)\\ \end{array} \]
                    (FPCore (cosTheta_i u1 u2)
                      :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)))
                      (if (<= (* (* 2.0 PI) u2) 0.05999999865889549)
                      (*
                       (sqrt (- (log1p (- u1))))
                       (fma
                        6.2831854820251465
                        u2
                        (* u2 (* -41.341705691712875 (* u2 u2)))))
                      (*
                       (fma (* (sqrt u1) u1) 0.25 (sqrt u1))
                       (sin (* u2 6.2831854820251465)))))
                    float code(float cosTheta_i, float u1, float u2) {
                    	float tmp;
                    	if (((2.0f * ((float) M_PI)) * u2) <= 0.05999999865889549f) {
                    		tmp = sqrtf(-log1pf(-u1)) * fmaf(6.2831854820251465f, u2, (u2 * (-41.341705691712875f * (u2 * u2))));
                    	} else {
                    		tmp = fmaf((sqrtf(u1) * u1), 0.25f, sqrtf(u1)) * sinf((u2 * 6.2831854820251465f));
                    	}
                    	return tmp;
                    }
                    
                    function code(cosTheta_i, u1, u2)
                    	tmp = Float32(0.0)
                    	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.05999999865889549))
                    		tmp = Float32(sqrt(Float32(-log1p(Float32(-u1)))) * fma(Float32(6.2831854820251465), u2, Float32(u2 * Float32(Float32(-41.341705691712875) * Float32(u2 * u2)))));
                    	else
                    		tmp = Float32(fma(Float32(sqrt(u1) * u1), Float32(0.25), sqrt(u1)) * sin(Float32(u2 * Float32(6.2831854820251465))));
                    	end
                    	return tmp
                    end
                    
                    \begin{array}{l}
                    \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.05999999865889549:\\
                    \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\mathsf{fma}\left(\sqrt{u1} \cdot u1, 0.25, \sqrt{u1}\right) \cdot \sin \left(u2 \cdot 6.2831854820251465\right)\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.0599999987

                      1. Initial program 57.4%

                        \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                      2. Evaluated real constant57.4%

                        \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                      3. Taylor expanded in u2 around 0

                        \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                      4. Step-by-step derivation
                        1. Applied rewrites53.3%

                          \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                        2. Step-by-step derivation
                          1. Applied rewrites53.3%

                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]
                          2. Step-by-step derivation
                            1. Applied rewrites88.9%

                              \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]

                            if 0.0599999987 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                            1. Initial program 57.4%

                              \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                            2. Taylor expanded in u1 around 0

                              \[\leadsto \left(\sqrt{u1} + \frac{1}{4} \cdot \frac{{u1}^{2}}{\sqrt{u1}}\right) \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                            3. Step-by-step derivation
                              1. Applied rewrites88.2%

                                \[\leadsto \left(\sqrt{u1} + 0.25 \cdot \frac{{u1}^{2}}{\sqrt{u1}}\right) \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                              2. Step-by-step derivation
                                1. Applied rewrites88.2%

                                  \[\leadsto \mathsf{fma}\left(\sqrt{u1} \cdot u1, 0.25, \sqrt{u1}\right) \cdot \sin \left(u2 \cdot \left(\pi + \pi\right)\right) \]
                                2. Evaluated real constant88.2%

                                  \[\leadsto \mathsf{fma}\left(\sqrt{u1} \cdot u1, 0.25, \sqrt{u1}\right) \cdot \sin \left(u2 \cdot 6.2831854820251465\right) \]
                              3. Recombined 2 regimes into one program.
                              4. Add Preprocessing

                              Alternative 5: 96.1% accurate, 0.9× speedup?

                              \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.05999999865889549:\\ \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right)\\ \end{array} \]
                              (FPCore (cosTheta_i u1 u2)
                                :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)))
                                (if (<= (* (* 2.0 PI) u2) 0.05999999865889549)
                                (*
                                 (sqrt (- (log1p (- u1))))
                                 (fma
                                  6.2831854820251465
                                  u2
                                  (* u2 (* -41.341705691712875 (* u2 u2)))))
                                (* (sqrt (fma (* 0.5 u1) u1 u1)) (sin (* 6.2831854820251465 u2)))))
                              float code(float cosTheta_i, float u1, float u2) {
                              	float tmp;
                              	if (((2.0f * ((float) M_PI)) * u2) <= 0.05999999865889549f) {
                              		tmp = sqrtf(-log1pf(-u1)) * fmaf(6.2831854820251465f, u2, (u2 * (-41.341705691712875f * (u2 * u2))));
                              	} else {
                              		tmp = sqrtf(fmaf((0.5f * u1), u1, u1)) * sinf((6.2831854820251465f * u2));
                              	}
                              	return tmp;
                              }
                              
                              function code(cosTheta_i, u1, u2)
                              	tmp = Float32(0.0)
                              	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.05999999865889549))
                              		tmp = Float32(sqrt(Float32(-log1p(Float32(-u1)))) * fma(Float32(6.2831854820251465), u2, Float32(u2 * Float32(Float32(-41.341705691712875) * Float32(u2 * u2)))));
                              	else
                              		tmp = Float32(sqrt(fma(Float32(Float32(0.5) * u1), u1, u1)) * sin(Float32(Float32(6.2831854820251465) * u2)));
                              	end
                              	return tmp
                              end
                              
                              \begin{array}{l}
                              \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.05999999865889549:\\
                              \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right)\\
                              
                              
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.0599999987

                                1. Initial program 57.4%

                                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                2. Evaluated real constant57.4%

                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                3. Taylor expanded in u2 around 0

                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                4. Step-by-step derivation
                                  1. Applied rewrites53.3%

                                    \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                  2. Step-by-step derivation
                                    1. Applied rewrites53.3%

                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites88.9%

                                        \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]

                                      if 0.0599999987 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                                      1. Initial program 57.4%

                                        \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                      2. Taylor expanded in u1 around 0

                                        \[\leadsto \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites87.9%

                                          \[\leadsto \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                        2. Step-by-step derivation
                                          1. Applied rewrites87.9%

                                            \[\leadsto \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                          2. Evaluated real constant87.9%

                                            \[\leadsto \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                        3. Recombined 2 regimes into one program.
                                        4. Add Preprocessing

                                        Alternative 6: 96.1% accurate, 0.9× speedup?

                                        \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.05999999865889549:\\ \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(0.5, u1, 1\right) \cdot u1} \cdot \sin \left(6.2831854820251465 \cdot u2\right)\\ \end{array} \]
                                        (FPCore (cosTheta_i u1 u2)
                                          :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)))
                                          (if (<= (* (* 2.0 PI) u2) 0.05999999865889549)
                                          (*
                                           (sqrt (- (log1p (- u1))))
                                           (fma
                                            6.2831854820251465
                                            u2
                                            (* u2 (* -41.341705691712875 (* u2 u2)))))
                                          (* (sqrt (* (fma 0.5 u1 1.0) u1)) (sin (* 6.2831854820251465 u2)))))
                                        float code(float cosTheta_i, float u1, float u2) {
                                        	float tmp;
                                        	if (((2.0f * ((float) M_PI)) * u2) <= 0.05999999865889549f) {
                                        		tmp = sqrtf(-log1pf(-u1)) * fmaf(6.2831854820251465f, u2, (u2 * (-41.341705691712875f * (u2 * u2))));
                                        	} else {
                                        		tmp = sqrtf((fmaf(0.5f, u1, 1.0f) * u1)) * sinf((6.2831854820251465f * u2));
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(cosTheta_i, u1, u2)
                                        	tmp = Float32(0.0)
                                        	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.05999999865889549))
                                        		tmp = Float32(sqrt(Float32(-log1p(Float32(-u1)))) * fma(Float32(6.2831854820251465), u2, Float32(u2 * Float32(Float32(-41.341705691712875) * Float32(u2 * u2)))));
                                        	else
                                        		tmp = Float32(sqrt(Float32(fma(Float32(0.5), u1, Float32(1.0)) * u1)) * sin(Float32(Float32(6.2831854820251465) * u2)));
                                        	end
                                        	return tmp
                                        end
                                        
                                        \begin{array}{l}
                                        \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.05999999865889549:\\
                                        \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\sqrt{\mathsf{fma}\left(0.5, u1, 1\right) \cdot u1} \cdot \sin \left(6.2831854820251465 \cdot u2\right)\\
                                        
                                        
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.0599999987

                                          1. Initial program 57.4%

                                            \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                          2. Evaluated real constant57.4%

                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                          3. Taylor expanded in u2 around 0

                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                          4. Step-by-step derivation
                                            1. Applied rewrites53.3%

                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites53.3%

                                                \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites88.9%

                                                  \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]

                                                if 0.0599999987 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                                                1. Initial program 57.4%

                                                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                2. Taylor expanded in u1 around 0

                                                  \[\leadsto \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites87.9%

                                                    \[\leadsto \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                  2. Evaluated real constant87.9%

                                                    \[\leadsto \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites87.9%

                                                      \[\leadsto \sqrt{\mathsf{fma}\left(0.5, u1, 1\right) \cdot u1} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                  4. Recombined 2 regimes into one program.
                                                  5. Add Preprocessing

                                                  Alternative 7: 94.2% accurate, 1.0× speedup?

                                                  \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.12999999523162842:\\ \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{u1}{\sqrt{u1}} \cdot \sin \left(6.2831854820251465 \cdot u2\right)\\ \end{array} \]
                                                  (FPCore (cosTheta_i u1 u2)
                                                    :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)))
                                                    (if (<= (* (* 2.0 PI) u2) 0.12999999523162842)
                                                    (*
                                                     (sqrt (- (log1p (- u1))))
                                                     (fma
                                                      6.2831854820251465
                                                      u2
                                                      (* u2 (* -41.341705691712875 (* u2 u2)))))
                                                    (* (/ u1 (sqrt u1)) (sin (* 6.2831854820251465 u2)))))
                                                  float code(float cosTheta_i, float u1, float u2) {
                                                  	float tmp;
                                                  	if (((2.0f * ((float) M_PI)) * u2) <= 0.12999999523162842f) {
                                                  		tmp = sqrtf(-log1pf(-u1)) * fmaf(6.2831854820251465f, u2, (u2 * (-41.341705691712875f * (u2 * u2))));
                                                  	} else {
                                                  		tmp = (u1 / sqrtf(u1)) * sinf((6.2831854820251465f * u2));
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  function code(cosTheta_i, u1, u2)
                                                  	tmp = Float32(0.0)
                                                  	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.12999999523162842))
                                                  		tmp = Float32(sqrt(Float32(-log1p(Float32(-u1)))) * fma(Float32(6.2831854820251465), u2, Float32(u2 * Float32(Float32(-41.341705691712875) * Float32(u2 * u2)))));
                                                  	else
                                                  		tmp = Float32(Float32(u1 / sqrt(u1)) * sin(Float32(Float32(6.2831854820251465) * u2)));
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  \begin{array}{l}
                                                  \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.12999999523162842:\\
                                                  \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;\frac{u1}{\sqrt{u1}} \cdot \sin \left(6.2831854820251465 \cdot u2\right)\\
                                                  
                                                  
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 2 regimes
                                                  2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.129999995

                                                    1. Initial program 57.4%

                                                      \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                    2. Evaluated real constant57.4%

                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                    3. Taylor expanded in u2 around 0

                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                    4. Step-by-step derivation
                                                      1. Applied rewrites53.3%

                                                        \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                      2. Step-by-step derivation
                                                        1. Applied rewrites53.3%

                                                          \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]
                                                        2. Step-by-step derivation
                                                          1. Applied rewrites88.9%

                                                            \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]

                                                          if 0.129999995 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                                                          1. Initial program 57.4%

                                                            \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                          2. Taylor expanded in u1 around 0

                                                            \[\leadsto \sqrt{u1} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites76.6%

                                                              \[\leadsto \sqrt{u1} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                            2. Step-by-step derivation
                                                              1. lift-sqrt.f32N/A

                                                                \[\leadsto \frac{u1}{\sqrt{u1}} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                              2. pow1/2N/A

                                                                \[\leadsto \frac{u1}{{u1}^{\frac{1}{2}}} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                              3. metadata-evalN/A

                                                                \[\leadsto \frac{u1}{{u1}^{\left(1 - \frac{1}{2}\right)}} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                              4. pow-divN/A

                                                                \[\leadsto \frac{u1}{\frac{{u1}^{1}}{{u1}^{\frac{1}{2}}}} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                              5. pow1N/A

                                                                \[\leadsto \frac{u1}{\frac{u1}{{u1}^{\frac{1}{2}}}} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                              6. pow1/2N/A

                                                                \[\leadsto \frac{u1}{\frac{u1}{\sqrt{u1}}} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                              7. lift-sqrt.f32N/A

                                                                \[\leadsto \frac{u1}{\frac{u1}{\sqrt{u1}}} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                              8. lower-/.f3276.6%

                                                                \[\leadsto \frac{u1}{\frac{u1}{\sqrt{u1}}} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                            3. Applied rewrites76.5%

                                                              \[\leadsto \frac{u1}{\sqrt{u1}} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                            4. Evaluated real constant76.5%

                                                              \[\leadsto \frac{u1}{\sqrt{u1}} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                          4. Recombined 2 regimes into one program.
                                                          5. Add Preprocessing

                                                          Alternative 8: 94.2% accurate, 1.0× speedup?

                                                          \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.12999999523162842:\\ \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1} \cdot \sin \left(\mathsf{fma}\left(u2, -6.2831854820251465, \pi\right)\right)\\ \end{array} \]
                                                          (FPCore (cosTheta_i u1 u2)
                                                            :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)))
                                                            (if (<= (* (* 2.0 PI) u2) 0.12999999523162842)
                                                            (*
                                                             (sqrt (- (log1p (- u1))))
                                                             (fma
                                                              6.2831854820251465
                                                              u2
                                                              (* u2 (* -41.341705691712875 (* u2 u2)))))
                                                            (* (sqrt u1) (sin (fma u2 -6.2831854820251465 PI)))))
                                                          float code(float cosTheta_i, float u1, float u2) {
                                                          	float tmp;
                                                          	if (((2.0f * ((float) M_PI)) * u2) <= 0.12999999523162842f) {
                                                          		tmp = sqrtf(-log1pf(-u1)) * fmaf(6.2831854820251465f, u2, (u2 * (-41.341705691712875f * (u2 * u2))));
                                                          	} else {
                                                          		tmp = sqrtf(u1) * sinf(fmaf(u2, -6.2831854820251465f, ((float) M_PI)));
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          function code(cosTheta_i, u1, u2)
                                                          	tmp = Float32(0.0)
                                                          	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.12999999523162842))
                                                          		tmp = Float32(sqrt(Float32(-log1p(Float32(-u1)))) * fma(Float32(6.2831854820251465), u2, Float32(u2 * Float32(Float32(-41.341705691712875) * Float32(u2 * u2)))));
                                                          	else
                                                          		tmp = Float32(sqrt(u1) * sin(fma(u2, Float32(-6.2831854820251465), Float32(pi))));
                                                          	end
                                                          	return tmp
                                                          end
                                                          
                                                          \begin{array}{l}
                                                          \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.12999999523162842:\\
                                                          \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;\sqrt{u1} \cdot \sin \left(\mathsf{fma}\left(u2, -6.2831854820251465, \pi\right)\right)\\
                                                          
                                                          
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 2 regimes
                                                          2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.129999995

                                                            1. Initial program 57.4%

                                                              \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                            2. Evaluated real constant57.4%

                                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                            3. Taylor expanded in u2 around 0

                                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                            4. Step-by-step derivation
                                                              1. Applied rewrites53.3%

                                                                \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                              2. Step-by-step derivation
                                                                1. Applied rewrites53.3%

                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]
                                                                2. Step-by-step derivation
                                                                  1. Applied rewrites88.9%

                                                                    \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]

                                                                  if 0.129999995 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                                                                  1. Initial program 57.4%

                                                                    \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                  2. Taylor expanded in u1 around 0

                                                                    \[\leadsto \sqrt{u1} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites76.6%

                                                                      \[\leadsto \sqrt{u1} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                    2. Step-by-step derivation
                                                                      1. Applied rewrites49.3%

                                                                        \[\leadsto \sqrt{u1} \cdot \sin \left(\left(-u2 \cdot \left(\pi + \pi\right)\right) + \pi\right) \]
                                                                      2. Evaluated real constant49.3%

                                                                        \[\leadsto \sqrt{u1} \cdot \sin \left(\left(-u2 \cdot 6.2831854820251465\right) + \pi\right) \]
                                                                      3. Step-by-step derivation
                                                                        1. Applied rewrites49.4%

                                                                          \[\leadsto \sqrt{u1} \cdot \sin \left(\mathsf{fma}\left(u2, -6.2831854820251465, \pi\right)\right) \]
                                                                      4. Recombined 2 regimes into one program.
                                                                      5. Add Preprocessing

                                                                      Alternative 9: 94.1% accurate, 1.1× speedup?

                                                                      \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.12999999523162842:\\ \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1} \cdot \sin \left(6.2831854820251465 \cdot u2\right)\\ \end{array} \]
                                                                      (FPCore (cosTheta_i u1 u2)
                                                                        :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)))
                                                                        (if (<= (* (* 2.0 PI) u2) 0.12999999523162842)
                                                                        (*
                                                                         (sqrt (- (log1p (- u1))))
                                                                         (fma
                                                                          6.2831854820251465
                                                                          u2
                                                                          (* u2 (* -41.341705691712875 (* u2 u2)))))
                                                                        (* (sqrt u1) (sin (* 6.2831854820251465 u2)))))
                                                                      float code(float cosTheta_i, float u1, float u2) {
                                                                      	float tmp;
                                                                      	if (((2.0f * ((float) M_PI)) * u2) <= 0.12999999523162842f) {
                                                                      		tmp = sqrtf(-log1pf(-u1)) * fmaf(6.2831854820251465f, u2, (u2 * (-41.341705691712875f * (u2 * u2))));
                                                                      	} else {
                                                                      		tmp = sqrtf(u1) * sinf((6.2831854820251465f * u2));
                                                                      	}
                                                                      	return tmp;
                                                                      }
                                                                      
                                                                      function code(cosTheta_i, u1, u2)
                                                                      	tmp = Float32(0.0)
                                                                      	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.12999999523162842))
                                                                      		tmp = Float32(sqrt(Float32(-log1p(Float32(-u1)))) * fma(Float32(6.2831854820251465), u2, Float32(u2 * Float32(Float32(-41.341705691712875) * Float32(u2 * u2)))));
                                                                      	else
                                                                      		tmp = Float32(sqrt(u1) * sin(Float32(Float32(6.2831854820251465) * u2)));
                                                                      	end
                                                                      	return tmp
                                                                      end
                                                                      
                                                                      \begin{array}{l}
                                                                      \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.12999999523162842:\\
                                                                      \;\;\;\;\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)\\
                                                                      
                                                                      \mathbf{else}:\\
                                                                      \;\;\;\;\sqrt{u1} \cdot \sin \left(6.2831854820251465 \cdot u2\right)\\
                                                                      
                                                                      
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Split input into 2 regimes
                                                                      2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.129999995

                                                                        1. Initial program 57.4%

                                                                          \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                        2. Evaluated real constant57.4%

                                                                          \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                        3. Taylor expanded in u2 around 0

                                                                          \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                        4. Step-by-step derivation
                                                                          1. Applied rewrites53.3%

                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                          2. Step-by-step derivation
                                                                            1. Applied rewrites53.3%

                                                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]
                                                                            2. Step-by-step derivation
                                                                              1. Applied rewrites88.9%

                                                                                \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]

                                                                              if 0.129999995 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                                                                              1. Initial program 57.4%

                                                                                \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                              2. Taylor expanded in u1 around 0

                                                                                \[\leadsto \sqrt{u1} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites76.6%

                                                                                  \[\leadsto \sqrt{u1} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                2. Evaluated real constant76.6%

                                                                                  \[\leadsto \sqrt{u1} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                              4. Recombined 2 regimes into one program.
                                                                              5. Add Preprocessing

                                                                              Alternative 10: 88.9% accurate, 1.7× speedup?

                                                                              \[\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)\]
                                                                              \[\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]
                                                                              (FPCore (cosTheta_i u1 u2)
                                                                                :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 (- (log1p (- u1))))
                                                                               (fma 6.2831854820251465 u2 (* u2 (* -41.341705691712875 (* u2 u2))))))
                                                                              float code(float cosTheta_i, float u1, float u2) {
                                                                              	return sqrtf(-log1pf(-u1)) * fmaf(6.2831854820251465f, u2, (u2 * (-41.341705691712875f * (u2 * u2))));
                                                                              }
                                                                              
                                                                              function code(cosTheta_i, u1, u2)
                                                                              	return Float32(sqrt(Float32(-log1p(Float32(-u1)))) * fma(Float32(6.2831854820251465), u2, Float32(u2 * Float32(Float32(-41.341705691712875) * Float32(u2 * u2)))))
                                                                              end
                                                                              
                                                                              \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right)
                                                                              
                                                                              Derivation
                                                                              1. Initial program 57.4%

                                                                                \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                              2. Evaluated real constant57.4%

                                                                                \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                              3. Taylor expanded in u2 around 0

                                                                                \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                              4. Step-by-step derivation
                                                                                1. Applied rewrites53.3%

                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                2. Step-by-step derivation
                                                                                  1. Applied rewrites53.3%

                                                                                    \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]
                                                                                  2. Step-by-step derivation
                                                                                    1. Applied rewrites88.9%

                                                                                      \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right)\right) \]
                                                                                    2. Add Preprocessing

                                                                                    Alternative 11: 88.9% accurate, 1.9× speedup?

                                                                                    \[\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)\]
                                                                                    \[\sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right) \]
                                                                                    (FPCore (cosTheta_i u1 u2)
                                                                                      :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 (- (log1p (- u1))))
                                                                                     (* (fma -41.341705691712875 (* u2 u2) 6.2831854820251465) u2)))
                                                                                    float code(float cosTheta_i, float u1, float u2) {
                                                                                    	return sqrtf(-log1pf(-u1)) * (fmaf(-41.341705691712875f, (u2 * u2), 6.2831854820251465f) * u2);
                                                                                    }
                                                                                    
                                                                                    function code(cosTheta_i, u1, u2)
                                                                                    	return Float32(sqrt(Float32(-log1p(Float32(-u1)))) * Float32(fma(Float32(-41.341705691712875), Float32(u2 * u2), Float32(6.2831854820251465)) * u2))
                                                                                    end
                                                                                    
                                                                                    \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right)
                                                                                    
                                                                                    Derivation
                                                                                    1. Initial program 57.4%

                                                                                      \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                    2. Evaluated real constant57.4%

                                                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                    3. Taylor expanded in u2 around 0

                                                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                    4. Step-by-step derivation
                                                                                      1. Applied rewrites53.3%

                                                                                        \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                      2. Step-by-step derivation
                                                                                        1. Applied rewrites53.3%

                                                                                          \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right) \]
                                                                                        2. Step-by-step derivation
                                                                                          1. Applied rewrites88.9%

                                                                                            \[\leadsto \sqrt{-\mathsf{log1p}\left(-u1\right)} \cdot \left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right) \]
                                                                                          2. Add Preprocessing

                                                                                          Alternative 12: 87.7% accurate, 1.6× speedup?

                                                                                          \[\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} \mathbf{if}\;1 - u1 \leq 0.9975000023841858:\\ \;\;\;\;\sqrt{-\log \left(1 - u1\right)} \cdot \left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right) \cdot u2\right)\\ \end{array} \]
                                                                                          (FPCore (cosTheta_i u1 u2)
                                                                                            :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)))
                                                                                            (if (<= (- 1.0 u1) 0.9975000023841858)
                                                                                            (*
                                                                                             (sqrt (- (log (- 1.0 u1))))
                                                                                             (* (fma -41.341705691712875 (* u2 u2) 6.2831854820251465) u2))
                                                                                            (*
                                                                                             (sqrt (* u1 (+ 1.0 (* 0.5 u1))))
                                                                                             (fma
                                                                                              6.2831854820251465
                                                                                              u2
                                                                                              (* (* -41.341705691712875 (* u2 u2)) u2)))))
                                                                                          float code(float cosTheta_i, float u1, float u2) {
                                                                                          	float tmp;
                                                                                          	if ((1.0f - u1) <= 0.9975000023841858f) {
                                                                                          		tmp = sqrtf(-logf((1.0f - u1))) * (fmaf(-41.341705691712875f, (u2 * u2), 6.2831854820251465f) * u2);
                                                                                          	} else {
                                                                                          		tmp = sqrtf((u1 * (1.0f + (0.5f * u1)))) * fmaf(6.2831854820251465f, u2, ((-41.341705691712875f * (u2 * u2)) * u2));
                                                                                          	}
                                                                                          	return tmp;
                                                                                          }
                                                                                          
                                                                                          function code(cosTheta_i, u1, u2)
                                                                                          	tmp = Float32(0.0)
                                                                                          	if (Float32(Float32(1.0) - u1) <= Float32(0.9975000023841858))
                                                                                          		tmp = Float32(sqrt(Float32(-log(Float32(Float32(1.0) - u1)))) * Float32(fma(Float32(-41.341705691712875), Float32(u2 * u2), Float32(6.2831854820251465)) * u2));
                                                                                          	else
                                                                                          		tmp = Float32(sqrt(Float32(u1 * Float32(Float32(1.0) + Float32(Float32(0.5) * u1)))) * fma(Float32(6.2831854820251465), u2, Float32(Float32(Float32(-41.341705691712875) * Float32(u2 * u2)) * u2)));
                                                                                          	end
                                                                                          	return tmp
                                                                                          end
                                                                                          
                                                                                          \begin{array}{l}
                                                                                          \mathbf{if}\;1 - u1 \leq 0.9975000023841858:\\
                                                                                          \;\;\;\;\sqrt{-\log \left(1 - u1\right)} \cdot \left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right)\\
                                                                                          
                                                                                          \mathbf{else}:\\
                                                                                          \;\;\;\;\sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right) \cdot u2\right)\\
                                                                                          
                                                                                          
                                                                                          \end{array}
                                                                                          
                                                                                          Derivation
                                                                                          1. Split input into 2 regimes
                                                                                          2. if (-.f32 #s(literal 1 binary32) u1) < 0.997500002

                                                                                            1. Initial program 57.4%

                                                                                              \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                            2. Evaluated real constant57.4%

                                                                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                            3. Taylor expanded in u2 around 0

                                                                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                            4. Step-by-step derivation
                                                                                              1. Applied rewrites53.3%

                                                                                                \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                              2. Step-by-step derivation
                                                                                                1. Applied rewrites53.3%

                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right) \]

                                                                                                if 0.997500002 < (-.f32 #s(literal 1 binary32) u1)

                                                                                                1. Initial program 57.4%

                                                                                                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                2. Evaluated real constant57.4%

                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                3. Taylor expanded in u2 around 0

                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                4. Step-by-step derivation
                                                                                                  1. Applied rewrites53.3%

                                                                                                    \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                  2. Taylor expanded in u1 around 0

                                                                                                    \[\leadsto \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                  3. Step-by-step derivation
                                                                                                    1. Applied rewrites80.1%

                                                                                                      \[\leadsto \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                    2. Step-by-step derivation
                                                                                                      1. Applied rewrites80.1%

                                                                                                        \[\leadsto \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)} \cdot \mathsf{fma}\left(6.2831854820251465, u2, \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right)\right) \cdot u2\right) \]
                                                                                                    3. Recombined 2 regimes into one program.
                                                                                                    4. Add Preprocessing

                                                                                                    Alternative 13: 87.7% accurate, 1.7× speedup?

                                                                                                    \[\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} t_0 := \mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\\ \mathbf{if}\;1 - u1 \leq 0.9975000023841858:\\ \;\;\;\;\sqrt{-\log \left(1 - u1\right)} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \sqrt{\mathsf{fma}\left(0.5, u1, 1\right) \cdot u1}\\ \end{array} \]
                                                                                                    (FPCore (cosTheta_i u1 u2)
                                                                                                      :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)))
                                                                                                      (let* ((t_0
                                                                                                            (*
                                                                                                             (fma -41.341705691712875 (* u2 u2) 6.2831854820251465)
                                                                                                             u2)))
                                                                                                      (if (<= (- 1.0 u1) 0.9975000023841858)
                                                                                                        (* (sqrt (- (log (- 1.0 u1)))) t_0)
                                                                                                        (* t_0 (sqrt (* (fma 0.5 u1 1.0) u1))))))
                                                                                                    float code(float cosTheta_i, float u1, float u2) {
                                                                                                    	float t_0 = fmaf(-41.341705691712875f, (u2 * u2), 6.2831854820251465f) * u2;
                                                                                                    	float tmp;
                                                                                                    	if ((1.0f - u1) <= 0.9975000023841858f) {
                                                                                                    		tmp = sqrtf(-logf((1.0f - u1))) * t_0;
                                                                                                    	} else {
                                                                                                    		tmp = t_0 * sqrtf((fmaf(0.5f, u1, 1.0f) * u1));
                                                                                                    	}
                                                                                                    	return tmp;
                                                                                                    }
                                                                                                    
                                                                                                    function code(cosTheta_i, u1, u2)
                                                                                                    	t_0 = Float32(fma(Float32(-41.341705691712875), Float32(u2 * u2), Float32(6.2831854820251465)) * u2)
                                                                                                    	tmp = Float32(0.0)
                                                                                                    	if (Float32(Float32(1.0) - u1) <= Float32(0.9975000023841858))
                                                                                                    		tmp = Float32(sqrt(Float32(-log(Float32(Float32(1.0) - u1)))) * t_0);
                                                                                                    	else
                                                                                                    		tmp = Float32(t_0 * sqrt(Float32(fma(Float32(0.5), u1, Float32(1.0)) * u1)));
                                                                                                    	end
                                                                                                    	return tmp
                                                                                                    end
                                                                                                    
                                                                                                    \begin{array}{l}
                                                                                                    t_0 := \mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\\
                                                                                                    \mathbf{if}\;1 - u1 \leq 0.9975000023841858:\\
                                                                                                    \;\;\;\;\sqrt{-\log \left(1 - u1\right)} \cdot t\_0\\
                                                                                                    
                                                                                                    \mathbf{else}:\\
                                                                                                    \;\;\;\;t\_0 \cdot \sqrt{\mathsf{fma}\left(0.5, u1, 1\right) \cdot u1}\\
                                                                                                    
                                                                                                    
                                                                                                    \end{array}
                                                                                                    
                                                                                                    Derivation
                                                                                                    1. Split input into 2 regimes
                                                                                                    2. if (-.f32 #s(literal 1 binary32) u1) < 0.997500002

                                                                                                      1. Initial program 57.4%

                                                                                                        \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                      2. Evaluated real constant57.4%

                                                                                                        \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                      3. Taylor expanded in u2 around 0

                                                                                                        \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                      4. Step-by-step derivation
                                                                                                        1. Applied rewrites53.3%

                                                                                                          \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                        2. Step-by-step derivation
                                                                                                          1. Applied rewrites53.3%

                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right) \]

                                                                                                          if 0.997500002 < (-.f32 #s(literal 1 binary32) u1)

                                                                                                          1. Initial program 57.4%

                                                                                                            \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                          2. Evaluated real constant57.4%

                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                          3. Taylor expanded in u2 around 0

                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                          4. Step-by-step derivation
                                                                                                            1. Applied rewrites53.3%

                                                                                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                            2. Taylor expanded in u1 around 0

                                                                                                              \[\leadsto \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                            3. Step-by-step derivation
                                                                                                              1. Applied rewrites80.1%

                                                                                                                \[\leadsto \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                              2. Step-by-step derivation
                                                                                                                1. Applied rewrites80.1%

                                                                                                                  \[\leadsto \left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right) \cdot \sqrt{\mathsf{fma}\left(0.5, u1, 1\right) \cdot u1} \]
                                                                                                              3. Recombined 2 regimes into one program.
                                                                                                              4. Add Preprocessing

                                                                                                              Alternative 14: 86.3% accurate, 1.8× speedup?

                                                                                                              \[\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} \mathbf{if}\;1 - u1 \leq 0.9975000023841858:\\ \;\;\;\;u2 \cdot \left(6.2831854820251465 \cdot \sqrt{-\mathsf{log1p}\left(-u1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right) \cdot \sqrt{\mathsf{fma}\left(0.5, u1, 1\right) \cdot u1}\\ \end{array} \]
                                                                                                              (FPCore (cosTheta_i u1 u2)
                                                                                                                :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)))
                                                                                                                (if (<= (- 1.0 u1) 0.9975000023841858)
                                                                                                                (* u2 (* 6.2831854820251465 (sqrt (- (log1p (- u1))))))
                                                                                                                (*
                                                                                                                 (* (fma -41.341705691712875 (* u2 u2) 6.2831854820251465) u2)
                                                                                                                 (sqrt (* (fma 0.5 u1 1.0) u1)))))
                                                                                                              float code(float cosTheta_i, float u1, float u2) {
                                                                                                              	float tmp;
                                                                                                              	if ((1.0f - u1) <= 0.9975000023841858f) {
                                                                                                              		tmp = u2 * (6.2831854820251465f * sqrtf(-log1pf(-u1)));
                                                                                                              	} else {
                                                                                                              		tmp = (fmaf(-41.341705691712875f, (u2 * u2), 6.2831854820251465f) * u2) * sqrtf((fmaf(0.5f, u1, 1.0f) * u1));
                                                                                                              	}
                                                                                                              	return tmp;
                                                                                                              }
                                                                                                              
                                                                                                              function code(cosTheta_i, u1, u2)
                                                                                                              	tmp = Float32(0.0)
                                                                                                              	if (Float32(Float32(1.0) - u1) <= Float32(0.9975000023841858))
                                                                                                              		tmp = Float32(u2 * Float32(Float32(6.2831854820251465) * sqrt(Float32(-log1p(Float32(-u1))))));
                                                                                                              	else
                                                                                                              		tmp = Float32(Float32(fma(Float32(-41.341705691712875), Float32(u2 * u2), Float32(6.2831854820251465)) * u2) * sqrt(Float32(fma(Float32(0.5), u1, Float32(1.0)) * u1)));
                                                                                                              	end
                                                                                                              	return tmp
                                                                                                              end
                                                                                                              
                                                                                                              \begin{array}{l}
                                                                                                              \mathbf{if}\;1 - u1 \leq 0.9975000023841858:\\
                                                                                                              \;\;\;\;u2 \cdot \left(6.2831854820251465 \cdot \sqrt{-\mathsf{log1p}\left(-u1\right)}\right)\\
                                                                                                              
                                                                                                              \mathbf{else}:\\
                                                                                                              \;\;\;\;\left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right) \cdot \sqrt{\mathsf{fma}\left(0.5, u1, 1\right) \cdot u1}\\
                                                                                                              
                                                                                                              
                                                                                                              \end{array}
                                                                                                              
                                                                                                              Derivation
                                                                                                              1. Split input into 2 regimes
                                                                                                              2. if (-.f32 #s(literal 1 binary32) u1) < 0.997500002

                                                                                                                1. Initial program 57.4%

                                                                                                                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                2. Evaluated real constant57.4%

                                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                3. Taylor expanded in u2 around 0

                                                                                                                  \[\leadsto u2 \cdot \left(\frac{-762619864465648886625}{18446744073709551616} \cdot \left({u2}^{2} \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) + \frac{13176795}{2097152} \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                4. Step-by-step derivation
                                                                                                                  1. Applied rewrites53.3%

                                                                                                                    \[\leadsto u2 \cdot \mathsf{fma}\left(-41.341705691712875, {u2}^{2} \cdot \sqrt{-\log \left(1 - u1\right)}, 6.2831854820251465 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                  2. Taylor expanded in u2 around 0

                                                                                                                    \[\leadsto u2 \cdot \left(\frac{13176795}{2097152} \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                  3. Step-by-step derivation
                                                                                                                    1. Applied rewrites50.1%

                                                                                                                      \[\leadsto u2 \cdot \left(6.2831854820251465 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                    2. Step-by-step derivation
                                                                                                                      1. Applied rewrites81.0%

                                                                                                                        \[\leadsto u2 \cdot \left(6.2831854820251465 \cdot \sqrt{-\mathsf{log1p}\left(-u1\right)}\right) \]

                                                                                                                      if 0.997500002 < (-.f32 #s(literal 1 binary32) u1)

                                                                                                                      1. Initial program 57.4%

                                                                                                                        \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                      2. Evaluated real constant57.4%

                                                                                                                        \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                      3. Taylor expanded in u2 around 0

                                                                                                                        \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                                      4. Step-by-step derivation
                                                                                                                        1. Applied rewrites53.3%

                                                                                                                          \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                        2. Taylor expanded in u1 around 0

                                                                                                                          \[\leadsto \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                        3. Step-by-step derivation
                                                                                                                          1. Applied rewrites80.1%

                                                                                                                            \[\leadsto \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                          2. Step-by-step derivation
                                                                                                                            1. Applied rewrites80.1%

                                                                                                                              \[\leadsto \left(\mathsf{fma}\left(-41.341705691712875, u2 \cdot u2, 6.2831854820251465\right) \cdot u2\right) \cdot \sqrt{\mathsf{fma}\left(0.5, u1, 1\right) \cdot u1} \]
                                                                                                                          3. Recombined 2 regimes into one program.
                                                                                                                          4. Add Preprocessing

                                                                                                                          Alternative 15: 84.2% accurate, 1.7× speedup?

                                                                                                                          \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.017999999225139618:\\ \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\mathsf{log1p}\left(-u1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;u2 \cdot \mathsf{fma}\left(\sqrt{u1}, 6.2831854820251465, \left(\left(u2 \cdot u2\right) \cdot \sqrt{u1}\right) \cdot -41.341705691712875\right)\\ \end{array} \]
                                                                                                                          (FPCore (cosTheta_i u1 u2)
                                                                                                                            :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)))
                                                                                                                            (if (<= (* (* 2.0 PI) u2) 0.017999999225139618)
                                                                                                                            (* 6.2831854820251465 (* u2 (sqrt (- (log1p (- u1))))))
                                                                                                                            (*
                                                                                                                             u2
                                                                                                                             (fma
                                                                                                                              (sqrt u1)
                                                                                                                              6.2831854820251465
                                                                                                                              (* (* (* u2 u2) (sqrt u1)) -41.341705691712875)))))
                                                                                                                          float code(float cosTheta_i, float u1, float u2) {
                                                                                                                          	float tmp;
                                                                                                                          	if (((2.0f * ((float) M_PI)) * u2) <= 0.017999999225139618f) {
                                                                                                                          		tmp = 6.2831854820251465f * (u2 * sqrtf(-log1pf(-u1)));
                                                                                                                          	} else {
                                                                                                                          		tmp = u2 * fmaf(sqrtf(u1), 6.2831854820251465f, (((u2 * u2) * sqrtf(u1)) * -41.341705691712875f));
                                                                                                                          	}
                                                                                                                          	return tmp;
                                                                                                                          }
                                                                                                                          
                                                                                                                          function code(cosTheta_i, u1, u2)
                                                                                                                          	tmp = Float32(0.0)
                                                                                                                          	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.017999999225139618))
                                                                                                                          		tmp = Float32(Float32(6.2831854820251465) * Float32(u2 * sqrt(Float32(-log1p(Float32(-u1))))));
                                                                                                                          	else
                                                                                                                          		tmp = Float32(u2 * fma(sqrt(u1), Float32(6.2831854820251465), Float32(Float32(Float32(u2 * u2) * sqrt(u1)) * Float32(-41.341705691712875))));
                                                                                                                          	end
                                                                                                                          	return tmp
                                                                                                                          end
                                                                                                                          
                                                                                                                          \begin{array}{l}
                                                                                                                          \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.017999999225139618:\\
                                                                                                                          \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\mathsf{log1p}\left(-u1\right)}\right)\\
                                                                                                                          
                                                                                                                          \mathbf{else}:\\
                                                                                                                          \;\;\;\;u2 \cdot \mathsf{fma}\left(\sqrt{u1}, 6.2831854820251465, \left(\left(u2 \cdot u2\right) \cdot \sqrt{u1}\right) \cdot -41.341705691712875\right)\\
                                                                                                                          
                                                                                                                          
                                                                                                                          \end{array}
                                                                                                                          
                                                                                                                          Derivation
                                                                                                                          1. Split input into 2 regimes
                                                                                                                          2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.0179999992

                                                                                                                            1. Initial program 57.4%

                                                                                                                              \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                            2. Evaluated real constant57.4%

                                                                                                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                            3. Taylor expanded in u2 around 0

                                                                                                                              \[\leadsto \frac{13176795}{2097152} \cdot \left(u2 \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                            4. Step-by-step derivation
                                                                                                                              1. Applied rewrites50.1%

                                                                                                                                \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                              2. Step-by-step derivation
                                                                                                                                1. Applied rewrites80.9%

                                                                                                                                  \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\mathsf{log1p}\left(-u1\right)}\right) \]

                                                                                                                                if 0.0179999992 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                                                                                                                                1. Initial program 57.4%

                                                                                                                                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                2. Evaluated real constant57.4%

                                                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                3. Taylor expanded in u2 around 0

                                                                                                                                  \[\leadsto u2 \cdot \left(\frac{-762619864465648886625}{18446744073709551616} \cdot \left({u2}^{2} \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) + \frac{13176795}{2097152} \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                                4. Step-by-step derivation
                                                                                                                                  1. Applied rewrites53.3%

                                                                                                                                    \[\leadsto u2 \cdot \mathsf{fma}\left(-41.341705691712875, {u2}^{2} \cdot \sqrt{-\log \left(1 - u1\right)}, 6.2831854820251465 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                                  2. Taylor expanded in u1 around 0

                                                                                                                                    \[\leadsto u2 \cdot \mathsf{fma}\left(-41.341705691712875, {u2}^{2} \cdot \sqrt{u1}, 6.2831854820251465 \cdot \sqrt{u1}\right) \]
                                                                                                                                  3. Step-by-step derivation
                                                                                                                                    1. Applied rewrites70.5%

                                                                                                                                      \[\leadsto u2 \cdot \mathsf{fma}\left(-41.341705691712875, {u2}^{2} \cdot \sqrt{u1}, 6.2831854820251465 \cdot \sqrt{u1}\right) \]
                                                                                                                                    2. Step-by-step derivation
                                                                                                                                      1. Applied rewrites70.5%

                                                                                                                                        \[\leadsto u2 \cdot \mathsf{fma}\left(\sqrt{u1}, 6.2831854820251465, \left(\left(u2 \cdot u2\right) \cdot \sqrt{u1}\right) \cdot -41.341705691712875\right) \]
                                                                                                                                    3. Recombined 2 regimes into one program.
                                                                                                                                    4. Add Preprocessing

                                                                                                                                    Alternative 16: 84.2% accurate, 1.8× speedup?

                                                                                                                                    \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.017999999225139618:\\ \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\mathsf{log1p}\left(-u1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1} \cdot \mathsf{fma}\left(-41.341705691712875 \cdot \left(u2 \cdot u2\right), u2, 6.2831854820251465 \cdot u2\right)\\ \end{array} \]
                                                                                                                                    (FPCore (cosTheta_i u1 u2)
                                                                                                                                      :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)))
                                                                                                                                      (if (<= (* (* 2.0 PI) u2) 0.017999999225139618)
                                                                                                                                      (* 6.2831854820251465 (* u2 (sqrt (- (log1p (- u1))))))
                                                                                                                                      (*
                                                                                                                                       (sqrt u1)
                                                                                                                                       (fma
                                                                                                                                        (* -41.341705691712875 (* u2 u2))
                                                                                                                                        u2
                                                                                                                                        (* 6.2831854820251465 u2)))))
                                                                                                                                    float code(float cosTheta_i, float u1, float u2) {
                                                                                                                                    	float tmp;
                                                                                                                                    	if (((2.0f * ((float) M_PI)) * u2) <= 0.017999999225139618f) {
                                                                                                                                    		tmp = 6.2831854820251465f * (u2 * sqrtf(-log1pf(-u1)));
                                                                                                                                    	} else {
                                                                                                                                    		tmp = sqrtf(u1) * fmaf((-41.341705691712875f * (u2 * u2)), u2, (6.2831854820251465f * u2));
                                                                                                                                    	}
                                                                                                                                    	return tmp;
                                                                                                                                    }
                                                                                                                                    
                                                                                                                                    function code(cosTheta_i, u1, u2)
                                                                                                                                    	tmp = Float32(0.0)
                                                                                                                                    	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.017999999225139618))
                                                                                                                                    		tmp = Float32(Float32(6.2831854820251465) * Float32(u2 * sqrt(Float32(-log1p(Float32(-u1))))));
                                                                                                                                    	else
                                                                                                                                    		tmp = Float32(sqrt(u1) * fma(Float32(Float32(-41.341705691712875) * Float32(u2 * u2)), u2, Float32(Float32(6.2831854820251465) * u2)));
                                                                                                                                    	end
                                                                                                                                    	return tmp
                                                                                                                                    end
                                                                                                                                    
                                                                                                                                    \begin{array}{l}
                                                                                                                                    \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.017999999225139618:\\
                                                                                                                                    \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\mathsf{log1p}\left(-u1\right)}\right)\\
                                                                                                                                    
                                                                                                                                    \mathbf{else}:\\
                                                                                                                                    \;\;\;\;\sqrt{u1} \cdot \mathsf{fma}\left(-41.341705691712875 \cdot \left(u2 \cdot u2\right), u2, 6.2831854820251465 \cdot u2\right)\\
                                                                                                                                    
                                                                                                                                    
                                                                                                                                    \end{array}
                                                                                                                                    
                                                                                                                                    Derivation
                                                                                                                                    1. Split input into 2 regimes
                                                                                                                                    2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.0179999992

                                                                                                                                      1. Initial program 57.4%

                                                                                                                                        \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                      2. Evaluated real constant57.4%

                                                                                                                                        \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                      3. Taylor expanded in u2 around 0

                                                                                                                                        \[\leadsto \frac{13176795}{2097152} \cdot \left(u2 \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                                      4. Step-by-step derivation
                                                                                                                                        1. Applied rewrites50.1%

                                                                                                                                          \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                                        2. Step-by-step derivation
                                                                                                                                          1. Applied rewrites80.9%

                                                                                                                                            \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\mathsf{log1p}\left(-u1\right)}\right) \]

                                                                                                                                          if 0.0179999992 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                                                                                                                                          1. Initial program 57.4%

                                                                                                                                            \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                          2. Evaluated real constant57.4%

                                                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                          3. Taylor expanded in u2 around 0

                                                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                                                          4. Step-by-step derivation
                                                                                                                                            1. Applied rewrites53.3%

                                                                                                                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                            2. Taylor expanded in u1 around 0

                                                                                                                                              \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                            3. Step-by-step derivation
                                                                                                                                              1. Applied rewrites70.5%

                                                                                                                                                \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                              2. Step-by-step derivation
                                                                                                                                                1. Applied rewrites70.5%

                                                                                                                                                  \[\leadsto \sqrt{u1} \cdot \mathsf{fma}\left(-41.341705691712875 \cdot \left(u2 \cdot u2\right), u2, 6.2831854820251465 \cdot u2\right) \]
                                                                                                                                              3. Recombined 2 regimes into one program.
                                                                                                                                              4. Add Preprocessing

                                                                                                                                              Alternative 17: 82.9% accurate, 1.7× speedup?

                                                                                                                                              \[\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} \mathbf{if}\;1 - u1 \leq 0.998199999332428:\\ \;\;\;\;\sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot 6.2831854820251465\right)\\ \mathbf{elif}\;1 - u1 \leq 0.9999985098838806:\\ \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1} \cdot \mathsf{fma}\left(-41.341705691712875 \cdot \left(u2 \cdot u2\right), u2, 6.2831854820251465 \cdot u2\right)\\ \end{array} \]
                                                                                                                                              (FPCore (cosTheta_i u1 u2)
                                                                                                                                                :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)))
                                                                                                                                                (if (<= (- 1.0 u1) 0.998199999332428)
                                                                                                                                                (* (sqrt (- (log (- 1.0 u1)))) (* u2 6.2831854820251465))
                                                                                                                                                (if (<= (- 1.0 u1) 0.9999985098838806)
                                                                                                                                                  (* 6.2831854820251465 (* u2 (sqrt (fma (* 0.5 u1) u1 u1))))
                                                                                                                                                  (*
                                                                                                                                                   (sqrt u1)
                                                                                                                                                   (fma
                                                                                                                                                    (* -41.341705691712875 (* u2 u2))
                                                                                                                                                    u2
                                                                                                                                                    (* 6.2831854820251465 u2))))))
                                                                                                                                              float code(float cosTheta_i, float u1, float u2) {
                                                                                                                                              	float tmp;
                                                                                                                                              	if ((1.0f - u1) <= 0.998199999332428f) {
                                                                                                                                              		tmp = sqrtf(-logf((1.0f - u1))) * (u2 * 6.2831854820251465f);
                                                                                                                                              	} else if ((1.0f - u1) <= 0.9999985098838806f) {
                                                                                                                                              		tmp = 6.2831854820251465f * (u2 * sqrtf(fmaf((0.5f * u1), u1, u1)));
                                                                                                                                              	} else {
                                                                                                                                              		tmp = sqrtf(u1) * fmaf((-41.341705691712875f * (u2 * u2)), u2, (6.2831854820251465f * u2));
                                                                                                                                              	}
                                                                                                                                              	return tmp;
                                                                                                                                              }
                                                                                                                                              
                                                                                                                                              function code(cosTheta_i, u1, u2)
                                                                                                                                              	tmp = Float32(0.0)
                                                                                                                                              	if (Float32(Float32(1.0) - u1) <= Float32(0.998199999332428))
                                                                                                                                              		tmp = Float32(sqrt(Float32(-log(Float32(Float32(1.0) - u1)))) * Float32(u2 * Float32(6.2831854820251465)));
                                                                                                                                              	elseif (Float32(Float32(1.0) - u1) <= Float32(0.9999985098838806))
                                                                                                                                              		tmp = Float32(Float32(6.2831854820251465) * Float32(u2 * sqrt(fma(Float32(Float32(0.5) * u1), u1, u1))));
                                                                                                                                              	else
                                                                                                                                              		tmp = Float32(sqrt(u1) * fma(Float32(Float32(-41.341705691712875) * Float32(u2 * u2)), u2, Float32(Float32(6.2831854820251465) * u2)));
                                                                                                                                              	end
                                                                                                                                              	return tmp
                                                                                                                                              end
                                                                                                                                              
                                                                                                                                              \begin{array}{l}
                                                                                                                                              \mathbf{if}\;1 - u1 \leq 0.998199999332428:\\
                                                                                                                                              \;\;\;\;\sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot 6.2831854820251465\right)\\
                                                                                                                                              
                                                                                                                                              \mathbf{elif}\;1 - u1 \leq 0.9999985098838806:\\
                                                                                                                                              \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)\\
                                                                                                                                              
                                                                                                                                              \mathbf{else}:\\
                                                                                                                                              \;\;\;\;\sqrt{u1} \cdot \mathsf{fma}\left(-41.341705691712875 \cdot \left(u2 \cdot u2\right), u2, 6.2831854820251465 \cdot u2\right)\\
                                                                                                                                              
                                                                                                                                              
                                                                                                                                              \end{array}
                                                                                                                                              
                                                                                                                                              Derivation
                                                                                                                                              1. Split input into 3 regimes
                                                                                                                                              2. if (-.f32 #s(literal 1 binary32) u1) < 0.998199999

                                                                                                                                                1. Initial program 57.4%

                                                                                                                                                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                2. Evaluated real constant57.4%

                                                                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                3. Taylor expanded in u2 around 0

                                                                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                4. Step-by-step derivation
                                                                                                                                                  1. Applied rewrites53.3%

                                                                                                                                                    \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                  2. Taylor expanded in u2 around 0

                                                                                                                                                    \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \frac{13176795}{2097152}\right) \]
                                                                                                                                                  3. Step-by-step derivation
                                                                                                                                                    1. Applied rewrites50.1%

                                                                                                                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot 6.2831854820251465\right) \]

                                                                                                                                                    if 0.998199999 < (-.f32 #s(literal 1 binary32) u1) < 0.99999851

                                                                                                                                                    1. Initial program 57.4%

                                                                                                                                                      \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                    2. Evaluated real constant57.4%

                                                                                                                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                    3. Taylor expanded in u2 around 0

                                                                                                                                                      \[\leadsto \frac{13176795}{2097152} \cdot \left(u2 \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                                                    4. Step-by-step derivation
                                                                                                                                                      1. Applied rewrites50.1%

                                                                                                                                                        \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                                                      2. Taylor expanded in u1 around 0

                                                                                                                                                        \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)}\right) \]
                                                                                                                                                      3. Step-by-step derivation
                                                                                                                                                        1. Applied rewrites73.9%

                                                                                                                                                          \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)}\right) \]
                                                                                                                                                        2. Step-by-step derivation
                                                                                                                                                          1. Applied rewrites73.9%

                                                                                                                                                            \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right) \]

                                                                                                                                                          if 0.99999851 < (-.f32 #s(literal 1 binary32) u1)

                                                                                                                                                          1. Initial program 57.4%

                                                                                                                                                            \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                          2. Evaluated real constant57.4%

                                                                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                          3. Taylor expanded in u2 around 0

                                                                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                          4. Step-by-step derivation
                                                                                                                                                            1. Applied rewrites53.3%

                                                                                                                                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                            2. Taylor expanded in u1 around 0

                                                                                                                                                              \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                            3. Step-by-step derivation
                                                                                                                                                              1. Applied rewrites70.5%

                                                                                                                                                                \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                              2. Step-by-step derivation
                                                                                                                                                                1. Applied rewrites70.5%

                                                                                                                                                                  \[\leadsto \sqrt{u1} \cdot \mathsf{fma}\left(-41.341705691712875 \cdot \left(u2 \cdot u2\right), u2, 6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                              3. Recombined 3 regimes into one program.
                                                                                                                                                              4. Add Preprocessing

                                                                                                                                                              Alternative 18: 82.9% accurate, 1.8× speedup?

                                                                                                                                                              \[\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} \mathbf{if}\;1 - u1 \leq 0.998199999332428:\\ \;\;\;\;\sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot 6.2831854820251465\right)\\ \mathbf{elif}\;1 - u1 \leq 0.9999985098838806:\\ \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1} \cdot \left(u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right) - -6.2831854820251465\right)\right)\\ \end{array} \]
                                                                                                                                                              (FPCore (cosTheta_i u1 u2)
                                                                                                                                                                :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)))
                                                                                                                                                                (if (<= (- 1.0 u1) 0.998199999332428)
                                                                                                                                                                (* (sqrt (- (log (- 1.0 u1)))) (* u2 6.2831854820251465))
                                                                                                                                                                (if (<= (- 1.0 u1) 0.9999985098838806)
                                                                                                                                                                  (* 6.2831854820251465 (* u2 (sqrt (fma (* 0.5 u1) u1 u1))))
                                                                                                                                                                  (*
                                                                                                                                                                   (sqrt u1)
                                                                                                                                                                   (*
                                                                                                                                                                    u2
                                                                                                                                                                    (- (* -41.341705691712875 (* u2 u2)) -6.2831854820251465))))))
                                                                                                                                                              float code(float cosTheta_i, float u1, float u2) {
                                                                                                                                                              	float tmp;
                                                                                                                                                              	if ((1.0f - u1) <= 0.998199999332428f) {
                                                                                                                                                              		tmp = sqrtf(-logf((1.0f - u1))) * (u2 * 6.2831854820251465f);
                                                                                                                                                              	} else if ((1.0f - u1) <= 0.9999985098838806f) {
                                                                                                                                                              		tmp = 6.2831854820251465f * (u2 * sqrtf(fmaf((0.5f * u1), u1, u1)));
                                                                                                                                                              	} else {
                                                                                                                                                              		tmp = sqrtf(u1) * (u2 * ((-41.341705691712875f * (u2 * u2)) - -6.2831854820251465f));
                                                                                                                                                              	}
                                                                                                                                                              	return tmp;
                                                                                                                                                              }
                                                                                                                                                              
                                                                                                                                                              function code(cosTheta_i, u1, u2)
                                                                                                                                                              	tmp = Float32(0.0)
                                                                                                                                                              	if (Float32(Float32(1.0) - u1) <= Float32(0.998199999332428))
                                                                                                                                                              		tmp = Float32(sqrt(Float32(-log(Float32(Float32(1.0) - u1)))) * Float32(u2 * Float32(6.2831854820251465)));
                                                                                                                                                              	elseif (Float32(Float32(1.0) - u1) <= Float32(0.9999985098838806))
                                                                                                                                                              		tmp = Float32(Float32(6.2831854820251465) * Float32(u2 * sqrt(fma(Float32(Float32(0.5) * u1), u1, u1))));
                                                                                                                                                              	else
                                                                                                                                                              		tmp = Float32(sqrt(u1) * Float32(u2 * Float32(Float32(Float32(-41.341705691712875) * Float32(u2 * u2)) - Float32(-6.2831854820251465))));
                                                                                                                                                              	end
                                                                                                                                                              	return tmp
                                                                                                                                                              end
                                                                                                                                                              
                                                                                                                                                              \begin{array}{l}
                                                                                                                                                              \mathbf{if}\;1 - u1 \leq 0.998199999332428:\\
                                                                                                                                                              \;\;\;\;\sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot 6.2831854820251465\right)\\
                                                                                                                                                              
                                                                                                                                                              \mathbf{elif}\;1 - u1 \leq 0.9999985098838806:\\
                                                                                                                                                              \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)\\
                                                                                                                                                              
                                                                                                                                                              \mathbf{else}:\\
                                                                                                                                                              \;\;\;\;\sqrt{u1} \cdot \left(u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right) - -6.2831854820251465\right)\right)\\
                                                                                                                                                              
                                                                                                                                                              
                                                                                                                                                              \end{array}
                                                                                                                                                              
                                                                                                                                                              Derivation
                                                                                                                                                              1. Split input into 3 regimes
                                                                                                                                                              2. if (-.f32 #s(literal 1 binary32) u1) < 0.998199999

                                                                                                                                                                1. Initial program 57.4%

                                                                                                                                                                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                2. Evaluated real constant57.4%

                                                                                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                3. Taylor expanded in u2 around 0

                                                                                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                4. Step-by-step derivation
                                                                                                                                                                  1. Applied rewrites53.3%

                                                                                                                                                                    \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                  2. Taylor expanded in u2 around 0

                                                                                                                                                                    \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \frac{13176795}{2097152}\right) \]
                                                                                                                                                                  3. Step-by-step derivation
                                                                                                                                                                    1. Applied rewrites50.1%

                                                                                                                                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot 6.2831854820251465\right) \]

                                                                                                                                                                    if 0.998199999 < (-.f32 #s(literal 1 binary32) u1) < 0.99999851

                                                                                                                                                                    1. Initial program 57.4%

                                                                                                                                                                      \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                    2. Evaluated real constant57.4%

                                                                                                                                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                    3. Taylor expanded in u2 around 0

                                                                                                                                                                      \[\leadsto \frac{13176795}{2097152} \cdot \left(u2 \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                                                                    4. Step-by-step derivation
                                                                                                                                                                      1. Applied rewrites50.1%

                                                                                                                                                                        \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                                                                      2. Taylor expanded in u1 around 0

                                                                                                                                                                        \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)}\right) \]
                                                                                                                                                                      3. Step-by-step derivation
                                                                                                                                                                        1. Applied rewrites73.9%

                                                                                                                                                                          \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)}\right) \]
                                                                                                                                                                        2. Step-by-step derivation
                                                                                                                                                                          1. Applied rewrites73.9%

                                                                                                                                                                            \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right) \]

                                                                                                                                                                          if 0.99999851 < (-.f32 #s(literal 1 binary32) u1)

                                                                                                                                                                          1. Initial program 57.4%

                                                                                                                                                                            \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                          2. Evaluated real constant57.4%

                                                                                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                          3. Taylor expanded in u2 around 0

                                                                                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                          4. Step-by-step derivation
                                                                                                                                                                            1. Applied rewrites53.3%

                                                                                                                                                                              \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                            2. Taylor expanded in u1 around 0

                                                                                                                                                                              \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                            3. Step-by-step derivation
                                                                                                                                                                              1. Applied rewrites70.5%

                                                                                                                                                                                \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                              2. Step-by-step derivation
                                                                                                                                                                                1. Applied rewrites70.5%

                                                                                                                                                                                  \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right) - -6.2831854820251465\right)\right) \]
                                                                                                                                                                              3. Recombined 3 regimes into one program.
                                                                                                                                                                              4. Add Preprocessing

                                                                                                                                                                              Alternative 19: 82.9% accurate, 1.8× speedup?

                                                                                                                                                                              \[\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} \mathbf{if}\;1 - u1 \leq 0.998199999332428:\\ \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right)\\ \mathbf{elif}\;1 - u1 \leq 0.9999985098838806:\\ \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1} \cdot \left(u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right) - -6.2831854820251465\right)\right)\\ \end{array} \]
                                                                                                                                                                              (FPCore (cosTheta_i u1 u2)
                                                                                                                                                                                :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)))
                                                                                                                                                                                (if (<= (- 1.0 u1) 0.998199999332428)
                                                                                                                                                                                (* 6.2831854820251465 (* u2 (sqrt (- (log (- 1.0 u1))))))
                                                                                                                                                                                (if (<= (- 1.0 u1) 0.9999985098838806)
                                                                                                                                                                                  (* 6.2831854820251465 (* u2 (sqrt (fma (* 0.5 u1) u1 u1))))
                                                                                                                                                                                  (*
                                                                                                                                                                                   (sqrt u1)
                                                                                                                                                                                   (*
                                                                                                                                                                                    u2
                                                                                                                                                                                    (- (* -41.341705691712875 (* u2 u2)) -6.2831854820251465))))))
                                                                                                                                                                              float code(float cosTheta_i, float u1, float u2) {
                                                                                                                                                                              	float tmp;
                                                                                                                                                                              	if ((1.0f - u1) <= 0.998199999332428f) {
                                                                                                                                                                              		tmp = 6.2831854820251465f * (u2 * sqrtf(-logf((1.0f - u1))));
                                                                                                                                                                              	} else if ((1.0f - u1) <= 0.9999985098838806f) {
                                                                                                                                                                              		tmp = 6.2831854820251465f * (u2 * sqrtf(fmaf((0.5f * u1), u1, u1)));
                                                                                                                                                                              	} else {
                                                                                                                                                                              		tmp = sqrtf(u1) * (u2 * ((-41.341705691712875f * (u2 * u2)) - -6.2831854820251465f));
                                                                                                                                                                              	}
                                                                                                                                                                              	return tmp;
                                                                                                                                                                              }
                                                                                                                                                                              
                                                                                                                                                                              function code(cosTheta_i, u1, u2)
                                                                                                                                                                              	tmp = Float32(0.0)
                                                                                                                                                                              	if (Float32(Float32(1.0) - u1) <= Float32(0.998199999332428))
                                                                                                                                                                              		tmp = Float32(Float32(6.2831854820251465) * Float32(u2 * sqrt(Float32(-log(Float32(Float32(1.0) - u1))))));
                                                                                                                                                                              	elseif (Float32(Float32(1.0) - u1) <= Float32(0.9999985098838806))
                                                                                                                                                                              		tmp = Float32(Float32(6.2831854820251465) * Float32(u2 * sqrt(fma(Float32(Float32(0.5) * u1), u1, u1))));
                                                                                                                                                                              	else
                                                                                                                                                                              		tmp = Float32(sqrt(u1) * Float32(u2 * Float32(Float32(Float32(-41.341705691712875) * Float32(u2 * u2)) - Float32(-6.2831854820251465))));
                                                                                                                                                                              	end
                                                                                                                                                                              	return tmp
                                                                                                                                                                              end
                                                                                                                                                                              
                                                                                                                                                                              \begin{array}{l}
                                                                                                                                                                              \mathbf{if}\;1 - u1 \leq 0.998199999332428:\\
                                                                                                                                                                              \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right)\\
                                                                                                                                                                              
                                                                                                                                                                              \mathbf{elif}\;1 - u1 \leq 0.9999985098838806:\\
                                                                                                                                                                              \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)\\
                                                                                                                                                                              
                                                                                                                                                                              \mathbf{else}:\\
                                                                                                                                                                              \;\;\;\;\sqrt{u1} \cdot \left(u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right) - -6.2831854820251465\right)\right)\\
                                                                                                                                                                              
                                                                                                                                                                              
                                                                                                                                                                              \end{array}
                                                                                                                                                                              
                                                                                                                                                                              Derivation
                                                                                                                                                                              1. Split input into 3 regimes
                                                                                                                                                                              2. if (-.f32 #s(literal 1 binary32) u1) < 0.998199999

                                                                                                                                                                                1. Initial program 57.4%

                                                                                                                                                                                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                                2. Evaluated real constant57.4%

                                                                                                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                                3. Taylor expanded in u2 around 0

                                                                                                                                                                                  \[\leadsto \frac{13176795}{2097152} \cdot \left(u2 \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                                                                                4. Step-by-step derivation
                                                                                                                                                                                  1. Applied rewrites50.1%

                                                                                                                                                                                    \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]

                                                                                                                                                                                  if 0.998199999 < (-.f32 #s(literal 1 binary32) u1) < 0.99999851

                                                                                                                                                                                  1. Initial program 57.4%

                                                                                                                                                                                    \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                                  2. Evaluated real constant57.4%

                                                                                                                                                                                    \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                                  3. Taylor expanded in u2 around 0

                                                                                                                                                                                    \[\leadsto \frac{13176795}{2097152} \cdot \left(u2 \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                                                                                  4. Step-by-step derivation
                                                                                                                                                                                    1. Applied rewrites50.1%

                                                                                                                                                                                      \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                                                                                    2. Taylor expanded in u1 around 0

                                                                                                                                                                                      \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)}\right) \]
                                                                                                                                                                                    3. Step-by-step derivation
                                                                                                                                                                                      1. Applied rewrites73.9%

                                                                                                                                                                                        \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)}\right) \]
                                                                                                                                                                                      2. Step-by-step derivation
                                                                                                                                                                                        1. Applied rewrites73.9%

                                                                                                                                                                                          \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right) \]

                                                                                                                                                                                        if 0.99999851 < (-.f32 #s(literal 1 binary32) u1)

                                                                                                                                                                                        1. Initial program 57.4%

                                                                                                                                                                                          \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                                        2. Evaluated real constant57.4%

                                                                                                                                                                                          \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                                        3. Taylor expanded in u2 around 0

                                                                                                                                                                                          \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                        4. Step-by-step derivation
                                                                                                                                                                                          1. Applied rewrites53.3%

                                                                                                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                          2. Taylor expanded in u1 around 0

                                                                                                                                                                                            \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                          3. Step-by-step derivation
                                                                                                                                                                                            1. Applied rewrites70.5%

                                                                                                                                                                                              \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                            2. Step-by-step derivation
                                                                                                                                                                                              1. Applied rewrites70.5%

                                                                                                                                                                                                \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right) - -6.2831854820251465\right)\right) \]
                                                                                                                                                                                            3. Recombined 3 regimes into one program.
                                                                                                                                                                                            4. Add Preprocessing

                                                                                                                                                                                            Alternative 20: 77.4% accurate, 2.0× speedup?

                                                                                                                                                                                            \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.017999999225139618:\\ \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1} \cdot \left(u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right) - -6.2831854820251465\right)\right)\\ \end{array} \]
                                                                                                                                                                                            (FPCore (cosTheta_i u1 u2)
                                                                                                                                                                                              :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)))
                                                                                                                                                                                              (if (<= (* (* 2.0 PI) u2) 0.017999999225139618)
                                                                                                                                                                                              (* 6.2831854820251465 (* u2 (sqrt (fma (* 0.5 u1) u1 u1))))
                                                                                                                                                                                              (*
                                                                                                                                                                                               (sqrt u1)
                                                                                                                                                                                               (* u2 (- (* -41.341705691712875 (* u2 u2)) -6.2831854820251465)))))
                                                                                                                                                                                            float code(float cosTheta_i, float u1, float u2) {
                                                                                                                                                                                            	float tmp;
                                                                                                                                                                                            	if (((2.0f * ((float) M_PI)) * u2) <= 0.017999999225139618f) {
                                                                                                                                                                                            		tmp = 6.2831854820251465f * (u2 * sqrtf(fmaf((0.5f * u1), u1, u1)));
                                                                                                                                                                                            	} else {
                                                                                                                                                                                            		tmp = sqrtf(u1) * (u2 * ((-41.341705691712875f * (u2 * u2)) - -6.2831854820251465f));
                                                                                                                                                                                            	}
                                                                                                                                                                                            	return tmp;
                                                                                                                                                                                            }
                                                                                                                                                                                            
                                                                                                                                                                                            function code(cosTheta_i, u1, u2)
                                                                                                                                                                                            	tmp = Float32(0.0)
                                                                                                                                                                                            	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.017999999225139618))
                                                                                                                                                                                            		tmp = Float32(Float32(6.2831854820251465) * Float32(u2 * sqrt(fma(Float32(Float32(0.5) * u1), u1, u1))));
                                                                                                                                                                                            	else
                                                                                                                                                                                            		tmp = Float32(sqrt(u1) * Float32(u2 * Float32(Float32(Float32(-41.341705691712875) * Float32(u2 * u2)) - Float32(-6.2831854820251465))));
                                                                                                                                                                                            	end
                                                                                                                                                                                            	return tmp
                                                                                                                                                                                            end
                                                                                                                                                                                            
                                                                                                                                                                                            \begin{array}{l}
                                                                                                                                                                                            \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.017999999225139618:\\
                                                                                                                                                                                            \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)\\
                                                                                                                                                                                            
                                                                                                                                                                                            \mathbf{else}:\\
                                                                                                                                                                                            \;\;\;\;\sqrt{u1} \cdot \left(u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right) - -6.2831854820251465\right)\right)\\
                                                                                                                                                                                            
                                                                                                                                                                                            
                                                                                                                                                                                            \end{array}
                                                                                                                                                                                            
                                                                                                                                                                                            Derivation
                                                                                                                                                                                            1. Split input into 2 regimes
                                                                                                                                                                                            2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.0179999992

                                                                                                                                                                                              1. Initial program 57.4%

                                                                                                                                                                                                \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                                              2. Evaluated real constant57.4%

                                                                                                                                                                                                \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                                              3. Taylor expanded in u2 around 0

                                                                                                                                                                                                \[\leadsto \frac{13176795}{2097152} \cdot \left(u2 \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                                                                                              4. Step-by-step derivation
                                                                                                                                                                                                1. Applied rewrites50.1%

                                                                                                                                                                                                  \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                                                                                                2. Taylor expanded in u1 around 0

                                                                                                                                                                                                  \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)}\right) \]
                                                                                                                                                                                                3. Step-by-step derivation
                                                                                                                                                                                                  1. Applied rewrites73.9%

                                                                                                                                                                                                    \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)}\right) \]
                                                                                                                                                                                                  2. Step-by-step derivation
                                                                                                                                                                                                    1. Applied rewrites73.9%

                                                                                                                                                                                                      \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right) \]

                                                                                                                                                                                                    if 0.0179999992 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                                                                                                                                                                                                    1. Initial program 57.4%

                                                                                                                                                                                                      \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                                                    2. Evaluated real constant57.4%

                                                                                                                                                                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                                                    3. Taylor expanded in u2 around 0

                                                                                                                                                                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                                    4. Step-by-step derivation
                                                                                                                                                                                                      1. Applied rewrites53.3%

                                                                                                                                                                                                        \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                                      2. Taylor expanded in u1 around 0

                                                                                                                                                                                                        \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                                      3. Step-by-step derivation
                                                                                                                                                                                                        1. Applied rewrites70.5%

                                                                                                                                                                                                          \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                                        2. Step-by-step derivation
                                                                                                                                                                                                          1. Applied rewrites70.5%

                                                                                                                                                                                                            \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(-41.341705691712875 \cdot \left(u2 \cdot u2\right) - -6.2831854820251465\right)\right) \]
                                                                                                                                                                                                        3. Recombined 2 regimes into one program.
                                                                                                                                                                                                        4. Add Preprocessing

                                                                                                                                                                                                        Alternative 21: 77.4% accurate, 2.1× speedup?

                                                                                                                                                                                                        \[\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} \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.017999999225139618:\\ \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{u1} \cdot \left(u2 \cdot \mathsf{fma}\left(-41.341705691712875 \cdot u2, u2, 6.2831854820251465\right)\right)\\ \end{array} \]
                                                                                                                                                                                                        (FPCore (cosTheta_i u1 u2)
                                                                                                                                                                                                          :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)))
                                                                                                                                                                                                          (if (<= (* (* 2.0 PI) u2) 0.017999999225139618)
                                                                                                                                                                                                          (* 6.2831854820251465 (* u2 (sqrt (fma (* 0.5 u1) u1 u1))))
                                                                                                                                                                                                          (*
                                                                                                                                                                                                           (sqrt u1)
                                                                                                                                                                                                           (* u2 (fma (* -41.341705691712875 u2) u2 6.2831854820251465)))))
                                                                                                                                                                                                        float code(float cosTheta_i, float u1, float u2) {
                                                                                                                                                                                                        	float tmp;
                                                                                                                                                                                                        	if (((2.0f * ((float) M_PI)) * u2) <= 0.017999999225139618f) {
                                                                                                                                                                                                        		tmp = 6.2831854820251465f * (u2 * sqrtf(fmaf((0.5f * u1), u1, u1)));
                                                                                                                                                                                                        	} else {
                                                                                                                                                                                                        		tmp = sqrtf(u1) * (u2 * fmaf((-41.341705691712875f * u2), u2, 6.2831854820251465f));
                                                                                                                                                                                                        	}
                                                                                                                                                                                                        	return tmp;
                                                                                                                                                                                                        }
                                                                                                                                                                                                        
                                                                                                                                                                                                        function code(cosTheta_i, u1, u2)
                                                                                                                                                                                                        	tmp = Float32(0.0)
                                                                                                                                                                                                        	if (Float32(Float32(Float32(2.0) * Float32(pi)) * u2) <= Float32(0.017999999225139618))
                                                                                                                                                                                                        		tmp = Float32(Float32(6.2831854820251465) * Float32(u2 * sqrt(fma(Float32(Float32(0.5) * u1), u1, u1))));
                                                                                                                                                                                                        	else
                                                                                                                                                                                                        		tmp = Float32(sqrt(u1) * Float32(u2 * fma(Float32(Float32(-41.341705691712875) * u2), u2, Float32(6.2831854820251465))));
                                                                                                                                                                                                        	end
                                                                                                                                                                                                        	return tmp
                                                                                                                                                                                                        end
                                                                                                                                                                                                        
                                                                                                                                                                                                        \begin{array}{l}
                                                                                                                                                                                                        \mathbf{if}\;\left(2 \cdot \pi\right) \cdot u2 \leq 0.017999999225139618:\\
                                                                                                                                                                                                        \;\;\;\;6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)\\
                                                                                                                                                                                                        
                                                                                                                                                                                                        \mathbf{else}:\\
                                                                                                                                                                                                        \;\;\;\;\sqrt{u1} \cdot \left(u2 \cdot \mathsf{fma}\left(-41.341705691712875 \cdot u2, u2, 6.2831854820251465\right)\right)\\
                                                                                                                                                                                                        
                                                                                                                                                                                                        
                                                                                                                                                                                                        \end{array}
                                                                                                                                                                                                        
                                                                                                                                                                                                        Derivation
                                                                                                                                                                                                        1. Split input into 2 regimes
                                                                                                                                                                                                        2. if (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2) < 0.0179999992

                                                                                                                                                                                                          1. Initial program 57.4%

                                                                                                                                                                                                            \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                                                          2. Evaluated real constant57.4%

                                                                                                                                                                                                            \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                                                          3. Taylor expanded in u2 around 0

                                                                                                                                                                                                            \[\leadsto \frac{13176795}{2097152} \cdot \left(u2 \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                                                                                                          4. Step-by-step derivation
                                                                                                                                                                                                            1. Applied rewrites50.1%

                                                                                                                                                                                                              \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                                                                                                            2. Taylor expanded in u1 around 0

                                                                                                                                                                                                              \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)}\right) \]
                                                                                                                                                                                                            3. Step-by-step derivation
                                                                                                                                                                                                              1. Applied rewrites73.9%

                                                                                                                                                                                                                \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)}\right) \]
                                                                                                                                                                                                              2. Step-by-step derivation
                                                                                                                                                                                                                1. Applied rewrites73.9%

                                                                                                                                                                                                                  \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right) \]

                                                                                                                                                                                                                if 0.0179999992 < (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) u2)

                                                                                                                                                                                                                1. Initial program 57.4%

                                                                                                                                                                                                                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                                                                2. Evaluated real constant57.4%

                                                                                                                                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                                                                3. Taylor expanded in u2 around 0

                                                                                                                                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(\frac{13176795}{2097152} + \frac{-762619864465648886625}{18446744073709551616} \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                                                4. Step-by-step derivation
                                                                                                                                                                                                                  1. Applied rewrites53.3%

                                                                                                                                                                                                                    \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                                                  2. Taylor expanded in u1 around 0

                                                                                                                                                                                                                    \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                                                  3. Step-by-step derivation
                                                                                                                                                                                                                    1. Applied rewrites70.5%

                                                                                                                                                                                                                      \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \left(6.2831854820251465 + -41.341705691712875 \cdot {u2}^{2}\right)\right) \]
                                                                                                                                                                                                                    2. Step-by-step derivation
                                                                                                                                                                                                                      1. Applied rewrites70.5%

                                                                                                                                                                                                                        \[\leadsto \sqrt{u1} \cdot \left(u2 \cdot \mathsf{fma}\left(-41.341705691712875 \cdot u2, u2, 6.2831854820251465\right)\right) \]
                                                                                                                                                                                                                    3. Recombined 2 regimes into one program.
                                                                                                                                                                                                                    4. Add Preprocessing

                                                                                                                                                                                                                    Alternative 22: 73.9% accurate, 3.3× speedup?

                                                                                                                                                                                                                    \[\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)\]
                                                                                                                                                                                                                    \[6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right) \]
                                                                                                                                                                                                                    (FPCore (cosTheta_i u1 u2)
                                                                                                                                                                                                                      :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)))
                                                                                                                                                                                                                      (* 6.2831854820251465 (* u2 (sqrt (fma (* 0.5 u1) u1 u1)))))
                                                                                                                                                                                                                    float code(float cosTheta_i, float u1, float u2) {
                                                                                                                                                                                                                    	return 6.2831854820251465f * (u2 * sqrtf(fmaf((0.5f * u1), u1, u1)));
                                                                                                                                                                                                                    }
                                                                                                                                                                                                                    
                                                                                                                                                                                                                    function code(cosTheta_i, u1, u2)
                                                                                                                                                                                                                    	return Float32(Float32(6.2831854820251465) * Float32(u2 * sqrt(fma(Float32(Float32(0.5) * u1), u1, u1))))
                                                                                                                                                                                                                    end
                                                                                                                                                                                                                    
                                                                                                                                                                                                                    6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right)
                                                                                                                                                                                                                    
                                                                                                                                                                                                                    Derivation
                                                                                                                                                                                                                    1. Initial program 57.4%

                                                                                                                                                                                                                      \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                                                                    2. Evaluated real constant57.4%

                                                                                                                                                                                                                      \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                                                                    3. Taylor expanded in u2 around 0

                                                                                                                                                                                                                      \[\leadsto \frac{13176795}{2097152} \cdot \left(u2 \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                                                                                                                    4. Step-by-step derivation
                                                                                                                                                                                                                      1. Applied rewrites50.1%

                                                                                                                                                                                                                        \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                                                                                                                      2. Taylor expanded in u1 around 0

                                                                                                                                                                                                                        \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + \frac{1}{2} \cdot u1\right)}\right) \]
                                                                                                                                                                                                                      3. Step-by-step derivation
                                                                                                                                                                                                                        1. Applied rewrites73.9%

                                                                                                                                                                                                                          \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1 \cdot \left(1 + 0.5 \cdot u1\right)}\right) \]
                                                                                                                                                                                                                        2. Step-by-step derivation
                                                                                                                                                                                                                          1. Applied rewrites73.9%

                                                                                                                                                                                                                            \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{\mathsf{fma}\left(0.5 \cdot u1, u1, u1\right)}\right) \]
                                                                                                                                                                                                                          2. Add Preprocessing

                                                                                                                                                                                                                          Alternative 23: 66.1% accurate, 3.5× speedup?

                                                                                                                                                                                                                          \[\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)\]
                                                                                                                                                                                                                          \[2 \cdot \left(\left(u2 \cdot \pi\right) \cdot \frac{u1}{\sqrt{u1}}\right) \]
                                                                                                                                                                                                                          (FPCore (cosTheta_i u1 u2)
                                                                                                                                                                                                                            :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)))
                                                                                                                                                                                                                            (* 2.0 (* (* u2 PI) (/ u1 (sqrt u1)))))
                                                                                                                                                                                                                          float code(float cosTheta_i, float u1, float u2) {
                                                                                                                                                                                                                          	return 2.0f * ((u2 * ((float) M_PI)) * (u1 / sqrtf(u1)));
                                                                                                                                                                                                                          }
                                                                                                                                                                                                                          
                                                                                                                                                                                                                          function code(cosTheta_i, u1, u2)
                                                                                                                                                                                                                          	return Float32(Float32(2.0) * Float32(Float32(u2 * Float32(pi)) * Float32(u1 / sqrt(u1))))
                                                                                                                                                                                                                          end
                                                                                                                                                                                                                          
                                                                                                                                                                                                                          function tmp = code(cosTheta_i, u1, u2)
                                                                                                                                                                                                                          	tmp = single(2.0) * ((u2 * single(pi)) * (u1 / sqrt(u1)));
                                                                                                                                                                                                                          end
                                                                                                                                                                                                                          
                                                                                                                                                                                                                          2 \cdot \left(\left(u2 \cdot \pi\right) \cdot \frac{u1}{\sqrt{u1}}\right)
                                                                                                                                                                                                                          
                                                                                                                                                                                                                          Derivation
                                                                                                                                                                                                                          1. Initial program 57.4%

                                                                                                                                                                                                                            \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                                                                          2. Taylor expanded in u2 around 0

                                                                                                                                                                                                                            \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right)\right) \]
                                                                                                                                                                                                                          3. Step-by-step derivation
                                                                                                                                                                                                                            1. Applied rewrites50.1%

                                                                                                                                                                                                                              \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \sqrt{-\log \left(1 - u1\right)}\right)\right) \]
                                                                                                                                                                                                                            2. Taylor expanded in u1 around 0

                                                                                                                                                                                                                              \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \sqrt{u1}\right)\right) \]
                                                                                                                                                                                                                            3. Step-by-step derivation
                                                                                                                                                                                                                              1. Applied rewrites66.1%

                                                                                                                                                                                                                                \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \sqrt{u1}\right)\right) \]
                                                                                                                                                                                                                              2. Step-by-step derivation
                                                                                                                                                                                                                                1. lift-sqrt.f32N/A

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{\sqrt{u1}} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                                2. pow1/2N/A

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{{u1}^{\frac{1}{2}}} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                                3. metadata-evalN/A

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{{u1}^{\left(1 - \frac{1}{2}\right)}} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                                4. pow-divN/A

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{\frac{{u1}^{1}}{{u1}^{\frac{1}{2}}}} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                                5. pow1N/A

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{\frac{u1}{{u1}^{\frac{1}{2}}}} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                                6. pow1/2N/A

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{\frac{u1}{\sqrt{u1}}} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                                7. lift-sqrt.f32N/A

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{\frac{u1}{\sqrt{u1}}} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                                8. mult-flipN/A

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{u1 \cdot \frac{1}{\sqrt{u1}}} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                                9. lift-/.f32N/A

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{u1 \cdot \frac{1}{\sqrt{u1}}} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                                10. *-commutativeN/A

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{\frac{1}{\sqrt{u1}} \cdot u1} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                                11. lift-*.f3266.0%

                                                                                                                                                                                                                                  \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{\frac{1}{\sqrt{u1}} \cdot u1} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                              3. Applied rewrites66.0%

                                                                                                                                                                                                                                \[\leadsto 2 \cdot \left(u2 \cdot \left(\pi \cdot \left(\frac{1}{\sqrt{u1}} \cdot u1\right)\right)\right) \]
                                                                                                                                                                                                                              4. Step-by-step derivation
                                                                                                                                                                                                                                1. Applied rewrites66.1%

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

                                                                                                                                                                                                                                Alternative 24: 66.1% accurate, 6.2× speedup?

                                                                                                                                                                                                                                \[\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)\]
                                                                                                                                                                                                                                \[6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1}\right) \]
                                                                                                                                                                                                                                (FPCore (cosTheta_i u1 u2)
                                                                                                                                                                                                                                  :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)))
                                                                                                                                                                                                                                  (* 6.2831854820251465 (* u2 (sqrt u1))))
                                                                                                                                                                                                                                float code(float cosTheta_i, float u1, float u2) {
                                                                                                                                                                                                                                	return 6.2831854820251465f * (u2 * sqrtf(u1));
                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                
                                                                                                                                                                                                                                real(4) function code(costheta_i, u1, u2)
                                                                                                                                                                                                                                use fmin_fmax_functions
                                                                                                                                                                                                                                    real(4), intent (in) :: costheta_i
                                                                                                                                                                                                                                    real(4), intent (in) :: u1
                                                                                                                                                                                                                                    real(4), intent (in) :: u2
                                                                                                                                                                                                                                    code = 6.2831854820251465e0 * (u2 * sqrt(u1))
                                                                                                                                                                                                                                end function
                                                                                                                                                                                                                                
                                                                                                                                                                                                                                function code(cosTheta_i, u1, u2)
                                                                                                                                                                                                                                	return Float32(Float32(6.2831854820251465) * Float32(u2 * sqrt(u1)))
                                                                                                                                                                                                                                end
                                                                                                                                                                                                                                
                                                                                                                                                                                                                                function tmp = code(cosTheta_i, u1, u2)
                                                                                                                                                                                                                                	tmp = single(6.2831854820251465) * (u2 * sqrt(u1));
                                                                                                                                                                                                                                end
                                                                                                                                                                                                                                
                                                                                                                                                                                                                                6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1}\right)
                                                                                                                                                                                                                                
                                                                                                                                                                                                                                Derivation
                                                                                                                                                                                                                                1. Initial program 57.4%

                                                                                                                                                                                                                                  \[\sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(\left(2 \cdot \pi\right) \cdot u2\right) \]
                                                                                                                                                                                                                                2. Evaluated real constant57.4%

                                                                                                                                                                                                                                  \[\leadsto \sqrt{-\log \left(1 - u1\right)} \cdot \sin \left(6.2831854820251465 \cdot u2\right) \]
                                                                                                                                                                                                                                3. Taylor expanded in u2 around 0

                                                                                                                                                                                                                                  \[\leadsto \frac{13176795}{2097152} \cdot \left(u2 \cdot \sqrt{\mathsf{neg}\left(\log \left(1 - u1\right)\right)}\right) \]
                                                                                                                                                                                                                                4. Step-by-step derivation
                                                                                                                                                                                                                                  1. Applied rewrites50.1%

                                                                                                                                                                                                                                    \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{-\log \left(1 - u1\right)}\right) \]
                                                                                                                                                                                                                                  2. Taylor expanded in u1 around 0

                                                                                                                                                                                                                                    \[\leadsto 6.2831854820251465 \cdot \left(u2 \cdot \sqrt{u1}\right) \]
                                                                                                                                                                                                                                  3. Step-by-step derivation
                                                                                                                                                                                                                                    1. Applied rewrites66.1%

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

                                                                                                                                                                                                                                    Reproduce

                                                                                                                                                                                                                                    ?
                                                                                                                                                                                                                                    herbie shell --seed 2026070 
                                                                                                                                                                                                                                    (FPCore (cosTheta_i u1 u2)
                                                                                                                                                                                                                                      :name "Beckmann 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 (- (log (- 1.0 u1)))) (sin (* (* 2.0 PI) u2))))