Beckmann Sample, normalization factor

Percentage Accurate: 97.8% → 97.8%
Time: 3.1s
Alternatives: 11
Speedup: 0.2×

Specification

?
\[\left(0 < cosTheta \land cosTheta < 0.9999\right) \land \left(-1 < c \land c < 1\right)\]
\[\begin{array}{l} \\ \frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \end{array} \]
(FPCore (cosTheta c)
 :precision binary32
 (/
  1.0
  (+
   (+ 1.0 c)
   (*
    (* (/ 1.0 (sqrt PI)) (/ (sqrt (- (- 1.0 cosTheta) cosTheta)) cosTheta))
    (exp (* (- cosTheta) cosTheta))))))
float code(float cosTheta, float c) {
	return 1.0f / ((1.0f + c) + (((1.0f / sqrtf(((float) M_PI))) * (sqrtf(((1.0f - cosTheta) - cosTheta)) / cosTheta)) * expf((-cosTheta * cosTheta))));
}
function code(cosTheta, c)
	return Float32(Float32(1.0) / Float32(Float32(Float32(1.0) + c) + Float32(Float32(Float32(Float32(1.0) / sqrt(Float32(pi))) * Float32(sqrt(Float32(Float32(Float32(1.0) - cosTheta) - cosTheta)) / cosTheta)) * exp(Float32(Float32(-cosTheta) * cosTheta)))))
end
function tmp = code(cosTheta, c)
	tmp = single(1.0) / ((single(1.0) + c) + (((single(1.0) / sqrt(single(pi))) * (sqrt(((single(1.0) - cosTheta) - cosTheta)) / cosTheta)) * exp((-cosTheta * cosTheta))));
end
\begin{array}{l}

\\
\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\end{array}

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 11 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: 97.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \end{array} \]
(FPCore (cosTheta c)
 :precision binary32
 (/
  1.0
  (+
   (+ 1.0 c)
   (*
    (* (/ 1.0 (sqrt PI)) (/ (sqrt (- (- 1.0 cosTheta) cosTheta)) cosTheta))
    (exp (* (- cosTheta) cosTheta))))))
float code(float cosTheta, float c) {
	return 1.0f / ((1.0f + c) + (((1.0f / sqrtf(((float) M_PI))) * (sqrtf(((1.0f - cosTheta) - cosTheta)) / cosTheta)) * expf((-cosTheta * cosTheta))));
}
function code(cosTheta, c)
	return Float32(Float32(1.0) / Float32(Float32(Float32(1.0) + c) + Float32(Float32(Float32(Float32(1.0) / sqrt(Float32(pi))) * Float32(sqrt(Float32(Float32(Float32(1.0) - cosTheta) - cosTheta)) / cosTheta)) * exp(Float32(Float32(-cosTheta) * cosTheta)))))
end
function tmp = code(cosTheta, c)
	tmp = single(1.0) / ((single(1.0) + c) + (((single(1.0) / sqrt(single(pi))) * (sqrt(((single(1.0) - cosTheta) - cosTheta)) / cosTheta)) * exp((-cosTheta * cosTheta))));
end
\begin{array}{l}

\\
\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\end{array}

Alternative 1: 97.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{\pi}}\\ t_1 := \sqrt{{\pi}^{3}}\\ t_2 := 1 + \left(c + -1 \cdot t\_0\right)\\ t_3 := -0.5 \cdot t\_0\\ t_4 := \mathsf{fma}\left(-1, t\_0, t\_3\right)\\ t_5 := \mathsf{fma}\left(-1, t\_1 \cdot {t\_2}^{2}, \pi \cdot t\_4\right)\\ cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_2 \cdot t\_5\right), \mathsf{fma}\left(-1, t\_1 \cdot \left(t\_2 \cdot t\_4\right), \pi \cdot \left(t\_0 + t\_3\right)\right)\right)\right) - t\_5\right) - \pi \cdot t\_2\right)\right) \end{array} \end{array} \]
(FPCore (cosTheta c)
 :precision binary32
 (let* ((t_0 (sqrt (/ 1.0 PI)))
        (t_1 (sqrt (pow PI 3.0)))
        (t_2 (+ 1.0 (+ c (* -1.0 t_0))))
        (t_3 (* -0.5 t_0))
        (t_4 (fma -1.0 t_0 t_3))
        (t_5 (fma -1.0 (* t_1 (pow t_2 2.0)) (* PI t_4))))
   (*
    cosTheta
    (+
     (sqrt PI)
     (*
      cosTheta
      (-
       (*
        cosTheta
        (-
         (*
          -1.0
          (*
           cosTheta
           (fma
            -1.0
            (* (sqrt PI) (* t_2 t_5))
            (fma -1.0 (* t_1 (* t_2 t_4)) (* PI (+ t_0 t_3))))))
         t_5))
       (* PI t_2)))))))
float code(float cosTheta, float c) {
	float t_0 = sqrtf((1.0f / ((float) M_PI)));
	float t_1 = sqrtf(powf(((float) M_PI), 3.0f));
	float t_2 = 1.0f + (c + (-1.0f * t_0));
	float t_3 = -0.5f * t_0;
	float t_4 = fmaf(-1.0f, t_0, t_3);
	float t_5 = fmaf(-1.0f, (t_1 * powf(t_2, 2.0f)), (((float) M_PI) * t_4));
	return cosTheta * (sqrtf(((float) M_PI)) + (cosTheta * ((cosTheta * ((-1.0f * (cosTheta * fmaf(-1.0f, (sqrtf(((float) M_PI)) * (t_2 * t_5)), fmaf(-1.0f, (t_1 * (t_2 * t_4)), (((float) M_PI) * (t_0 + t_3)))))) - t_5)) - (((float) M_PI) * t_2))));
}
function code(cosTheta, c)
	t_0 = sqrt(Float32(Float32(1.0) / Float32(pi)))
	t_1 = sqrt((Float32(pi) ^ Float32(3.0)))
	t_2 = Float32(Float32(1.0) + Float32(c + Float32(Float32(-1.0) * t_0)))
	t_3 = Float32(Float32(-0.5) * t_0)
	t_4 = fma(Float32(-1.0), t_0, t_3)
	t_5 = fma(Float32(-1.0), Float32(t_1 * (t_2 ^ Float32(2.0))), Float32(Float32(pi) * t_4))
	return Float32(cosTheta * Float32(sqrt(Float32(pi)) + Float32(cosTheta * Float32(Float32(cosTheta * Float32(Float32(Float32(-1.0) * Float32(cosTheta * fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * Float32(t_2 * t_5)), fma(Float32(-1.0), Float32(t_1 * Float32(t_2 * t_4)), Float32(Float32(pi) * Float32(t_0 + t_3)))))) - t_5)) - Float32(Float32(pi) * t_2)))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\pi}}\\
t_1 := \sqrt{{\pi}^{3}}\\
t_2 := 1 + \left(c + -1 \cdot t\_0\right)\\
t_3 := -0.5 \cdot t\_0\\
t_4 := \mathsf{fma}\left(-1, t\_0, t\_3\right)\\
t_5 := \mathsf{fma}\left(-1, t\_1 \cdot {t\_2}^{2}, \pi \cdot t\_4\right)\\
cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_2 \cdot t\_5\right), \mathsf{fma}\left(-1, t\_1 \cdot \left(t\_2 \cdot t\_4\right), \pi \cdot \left(t\_0 + t\_3\right)\right)\right)\right) - t\_5\right) - \pi \cdot t\_2\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 97.8%

    \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  2. Taylor expanded in cosTheta around 0

    \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \left(-1 \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \left(-1 \cdot \left(\sqrt{{\mathsf{PI}\left(\right)}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}^{2}\right) + \mathsf{PI}\left(\right) \cdot \left(-1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right) + \left(-1 \cdot \left(\sqrt{{\mathsf{PI}\left(\right)}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \left(-1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right) + \mathsf{PI}\left(\right) \cdot \left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right) - \left(-1 \cdot \left(\sqrt{{\mathsf{PI}\left(\right)}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}^{2}\right) + \mathsf{PI}\left(\right) \cdot \left(-1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right) - \mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)} \]
  3. Applied rewrites97.3%

    \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right)} \]
  4. Add Preprocessing

Alternative 2: 97.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{\pi}}\\ t_1 := 1 + -1 \cdot t\_0\\ t_2 := \sqrt{{\pi}^{3}}\\ t_3 := -0.5 \cdot t\_0\\ t_4 := \mathsf{fma}\left(-1, t\_0, t\_3\right)\\ t_5 := \mathsf{fma}\left(-1, t\_2 \cdot {t\_1}^{2}, \pi \cdot t\_4\right)\\ cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_1 \cdot t\_5\right), \mathsf{fma}\left(-1, t\_2 \cdot \left(t\_1 \cdot t\_4\right), \pi \cdot \left(t\_0 + t\_3\right)\right)\right)\right) - t\_5\right) - \pi \cdot t\_1\right)\right) \end{array} \end{array} \]
(FPCore (cosTheta c)
 :precision binary32
 (let* ((t_0 (sqrt (/ 1.0 PI)))
        (t_1 (+ 1.0 (* -1.0 t_0)))
        (t_2 (sqrt (pow PI 3.0)))
        (t_3 (* -0.5 t_0))
        (t_4 (fma -1.0 t_0 t_3))
        (t_5 (fma -1.0 (* t_2 (pow t_1 2.0)) (* PI t_4))))
   (*
    cosTheta
    (+
     (sqrt PI)
     (*
      cosTheta
      (-
       (*
        cosTheta
        (-
         (*
          -1.0
          (*
           cosTheta
           (fma
            -1.0
            (* (sqrt PI) (* t_1 t_5))
            (fma -1.0 (* t_2 (* t_1 t_4)) (* PI (+ t_0 t_3))))))
         t_5))
       (* PI t_1)))))))
float code(float cosTheta, float c) {
	float t_0 = sqrtf((1.0f / ((float) M_PI)));
	float t_1 = 1.0f + (-1.0f * t_0);
	float t_2 = sqrtf(powf(((float) M_PI), 3.0f));
	float t_3 = -0.5f * t_0;
	float t_4 = fmaf(-1.0f, t_0, t_3);
	float t_5 = fmaf(-1.0f, (t_2 * powf(t_1, 2.0f)), (((float) M_PI) * t_4));
	return cosTheta * (sqrtf(((float) M_PI)) + (cosTheta * ((cosTheta * ((-1.0f * (cosTheta * fmaf(-1.0f, (sqrtf(((float) M_PI)) * (t_1 * t_5)), fmaf(-1.0f, (t_2 * (t_1 * t_4)), (((float) M_PI) * (t_0 + t_3)))))) - t_5)) - (((float) M_PI) * t_1))));
}
function code(cosTheta, c)
	t_0 = sqrt(Float32(Float32(1.0) / Float32(pi)))
	t_1 = Float32(Float32(1.0) + Float32(Float32(-1.0) * t_0))
	t_2 = sqrt((Float32(pi) ^ Float32(3.0)))
	t_3 = Float32(Float32(-0.5) * t_0)
	t_4 = fma(Float32(-1.0), t_0, t_3)
	t_5 = fma(Float32(-1.0), Float32(t_2 * (t_1 ^ Float32(2.0))), Float32(Float32(pi) * t_4))
	return Float32(cosTheta * Float32(sqrt(Float32(pi)) + Float32(cosTheta * Float32(Float32(cosTheta * Float32(Float32(Float32(-1.0) * Float32(cosTheta * fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * Float32(t_1 * t_5)), fma(Float32(-1.0), Float32(t_2 * Float32(t_1 * t_4)), Float32(Float32(pi) * Float32(t_0 + t_3)))))) - t_5)) - Float32(Float32(pi) * t_1)))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\pi}}\\
t_1 := 1 + -1 \cdot t\_0\\
t_2 := \sqrt{{\pi}^{3}}\\
t_3 := -0.5 \cdot t\_0\\
t_4 := \mathsf{fma}\left(-1, t\_0, t\_3\right)\\
t_5 := \mathsf{fma}\left(-1, t\_2 \cdot {t\_1}^{2}, \pi \cdot t\_4\right)\\
cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_1 \cdot t\_5\right), \mathsf{fma}\left(-1, t\_2 \cdot \left(t\_1 \cdot t\_4\right), \pi \cdot \left(t\_0 + t\_3\right)\right)\right)\right) - t\_5\right) - \pi \cdot t\_1\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 97.8%

    \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  2. Taylor expanded in cosTheta around 0

    \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \left(-1 \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \left(-1 \cdot \left(\sqrt{{\mathsf{PI}\left(\right)}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}^{2}\right) + \mathsf{PI}\left(\right) \cdot \left(-1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right) + \left(-1 \cdot \left(\sqrt{{\mathsf{PI}\left(\right)}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \left(-1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right) + \mathsf{PI}\left(\right) \cdot \left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right) - \left(-1 \cdot \left(\sqrt{{\mathsf{PI}\left(\right)}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}^{2}\right) + \mathsf{PI}\left(\right) \cdot \left(-1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right) - \mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)} \]
  3. Applied rewrites97.3%

    \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right)} \]
  4. Taylor expanded in c around 0

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  5. Step-by-step derivation
    1. lift-/.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    2. lift-PI.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    3. lift-sqrt.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    4. lift-*.f3297.3

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  6. Applied rewrites97.3%

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  7. Taylor expanded in c around 0

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  8. Step-by-step derivation
    1. lift-/.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    2. lift-PI.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    3. lift-sqrt.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    4. lift-*.f3297.3

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  9. Applied rewrites97.3%

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  10. Taylor expanded in c around 0

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  11. Step-by-step derivation
    1. lift-/.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    2. lift-PI.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    3. lift-sqrt.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    4. lift-*.f3297.3

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  12. Applied rewrites97.3%

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  13. Taylor expanded in c around 0

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  14. Step-by-step derivation
    1. lift-/.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    2. lift-PI.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    3. lift-sqrt.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    4. lift-*.f3297.2

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  15. Applied rewrites97.2%

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  16. Taylor expanded in c around 0

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + -1 \cdot \color{blue}{\sqrt{\frac{1}{\mathsf{PI}\left(\right)}}}\right)\right)\right) \]
  17. Step-by-step derivation
    1. lift-/.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right) \]
    2. lift-PI.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) \]
    3. lift-sqrt.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, \frac{-1}{2} \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) \]
    4. lift-*.f3297.0

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) \]
  18. Applied rewrites97.0%

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + cosTheta \cdot \left(cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot \left(\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right), \pi \cdot \left(\sqrt{\frac{1}{\pi}} + -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1, \sqrt{{\pi}^{3}} \cdot {\left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)}^{2}, \pi \cdot \mathsf{fma}\left(-1, \sqrt{\frac{1}{\pi}}, -0.5 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right) - \pi \cdot \left(1 + -1 \cdot \color{blue}{\sqrt{\frac{1}{\pi}}}\right)\right)\right) \]
  19. Add Preprocessing

Alternative 3: 97.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \pi} - 2 \cdot \frac{1}{\pi}\right)}} \end{array} \]
(FPCore (cosTheta c)
 :precision binary32
 (/
  1.0
  (+
   1.0
   (*
    (/ (exp (* -1.0 (pow cosTheta 2.0))) cosTheta)
    (sqrt (* cosTheta (- (/ 1.0 (* cosTheta PI)) (* 2.0 (/ 1.0 PI)))))))))
float code(float cosTheta, float c) {
	return 1.0f / (1.0f + ((expf((-1.0f * powf(cosTheta, 2.0f))) / cosTheta) * sqrtf((cosTheta * ((1.0f / (cosTheta * ((float) M_PI))) - (2.0f * (1.0f / ((float) M_PI))))))));
}
function code(cosTheta, c)
	return Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(exp(Float32(Float32(-1.0) * (cosTheta ^ Float32(2.0)))) / cosTheta) * sqrt(Float32(cosTheta * Float32(Float32(Float32(1.0) / Float32(cosTheta * Float32(pi))) - Float32(Float32(2.0) * Float32(Float32(1.0) / Float32(pi)))))))))
end
function tmp = code(cosTheta, c)
	tmp = single(1.0) / (single(1.0) + ((exp((single(-1.0) * (cosTheta ^ single(2.0)))) / cosTheta) * sqrt((cosTheta * ((single(1.0) / (cosTheta * single(pi))) - (single(2.0) * (single(1.0) / single(pi))))))));
end
\begin{array}{l}

\\
\frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \pi} - 2 \cdot \frac{1}{\pi}\right)}}
\end{array}
Derivation
  1. Initial program 97.8%

    \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  2. Taylor expanded in c around 0

    \[\leadsto \frac{1}{\color{blue}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
  3. Step-by-step derivation
    1. lower-+.f32N/A

      \[\leadsto \frac{1}{1 + \color{blue}{\frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
    2. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \color{blue}{\sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
    3. lower-/.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\color{blue}{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
    4. lower-exp.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{\color{blue}{1 - 2 \cdot cosTheta}}{\mathsf{PI}\left(\right)}}} \]
    5. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{\color{blue}{1} - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    6. lower-pow.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    7. lower-sqrt.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    8. lower-/.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    9. lower--.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    10. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    11. lift-PI.f3297.4

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}} \]
  4. Applied rewrites97.4%

    \[\leadsto \frac{1}{\color{blue}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}}} \]
  5. Taylor expanded in cosTheta around inf

    \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \mathsf{PI}\left(\right)} - 2 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}} \]
  6. Step-by-step derivation
    1. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \mathsf{PI}\left(\right)} - 2 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}} \]
    2. lower--.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \mathsf{PI}\left(\right)} - 2 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}} \]
    3. lower-/.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \mathsf{PI}\left(\right)} - 2 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}} \]
    4. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \mathsf{PI}\left(\right)} - 2 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}} \]
    5. lift-PI.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \pi} - 2 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}} \]
    6. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \pi} - 2 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}} \]
    7. lift-/.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \pi} - 2 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}} \]
    8. lift-PI.f3297.4

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \pi} - 2 \cdot \frac{1}{\pi}\right)}} \]
  7. Applied rewrites97.4%

    \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{cosTheta \cdot \left(\frac{1}{cosTheta \cdot \pi} - 2 \cdot \frac{1}{\pi}\right)}} \]
  8. Add Preprocessing

Alternative 4: 97.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}} \end{array} \]
(FPCore (cosTheta c)
 :precision binary32
 (/
  1.0
  (+
   1.0
   (*
    (/ (exp (* -1.0 (pow cosTheta 2.0))) cosTheta)
    (sqrt (/ (- 1.0 (* 2.0 cosTheta)) PI))))))
float code(float cosTheta, float c) {
	return 1.0f / (1.0f + ((expf((-1.0f * powf(cosTheta, 2.0f))) / cosTheta) * sqrtf(((1.0f - (2.0f * cosTheta)) / ((float) M_PI)))));
}
function code(cosTheta, c)
	return Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(exp(Float32(Float32(-1.0) * (cosTheta ^ Float32(2.0)))) / cosTheta) * sqrt(Float32(Float32(Float32(1.0) - Float32(Float32(2.0) * cosTheta)) / Float32(pi))))))
end
function tmp = code(cosTheta, c)
	tmp = single(1.0) / (single(1.0) + ((exp((single(-1.0) * (cosTheta ^ single(2.0)))) / cosTheta) * sqrt(((single(1.0) - (single(2.0) * cosTheta)) / single(pi)))));
end
\begin{array}{l}

\\
\frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}}
\end{array}
Derivation
  1. Initial program 97.8%

    \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  2. Taylor expanded in c around 0

    \[\leadsto \frac{1}{\color{blue}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
  3. Step-by-step derivation
    1. lower-+.f32N/A

      \[\leadsto \frac{1}{1 + \color{blue}{\frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
    2. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \color{blue}{\sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
    3. lower-/.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\color{blue}{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
    4. lower-exp.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{\color{blue}{1 - 2 \cdot cosTheta}}{\mathsf{PI}\left(\right)}}} \]
    5. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{\color{blue}{1} - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    6. lower-pow.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    7. lower-sqrt.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    8. lower-/.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    9. lower--.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    10. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    11. lift-PI.f3297.4

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}} \]
  4. Applied rewrites97.4%

    \[\leadsto \frac{1}{\color{blue}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}}} \]
  5. Add Preprocessing

Alternative 5: 97.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \end{array} \]
(FPCore (cosTheta c)
 :precision binary32
 (/
  1.0
  (+
   (+ 1.0 c)
   (*
    (* (/ 1.0 (sqrt PI)) (/ (sqrt (- (- 1.0 cosTheta) cosTheta)) cosTheta))
    (exp (* (- cosTheta) cosTheta))))))
float code(float cosTheta, float c) {
	return 1.0f / ((1.0f + c) + (((1.0f / sqrtf(((float) M_PI))) * (sqrtf(((1.0f - cosTheta) - cosTheta)) / cosTheta)) * expf((-cosTheta * cosTheta))));
}
function code(cosTheta, c)
	return Float32(Float32(1.0) / Float32(Float32(Float32(1.0) + c) + Float32(Float32(Float32(Float32(1.0) / sqrt(Float32(pi))) * Float32(sqrt(Float32(Float32(Float32(1.0) - cosTheta) - cosTheta)) / cosTheta)) * exp(Float32(Float32(-cosTheta) * cosTheta)))))
end
function tmp = code(cosTheta, c)
	tmp = single(1.0) / ((single(1.0) + c) + (((single(1.0) / sqrt(single(pi))) * (sqrt(((single(1.0) - cosTheta) - cosTheta)) / cosTheta)) * exp((-cosTheta * cosTheta))));
end
\begin{array}{l}

\\
\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\end{array}
Derivation
  1. Initial program 97.8%

    \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  2. Add Preprocessing

Alternative 6: 95.6% accurate, 1.5× speedup?

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

\\
cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 97.8%

    \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  2. Taylor expanded in cosTheta around 0

    \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right)} \]
  3. Step-by-step derivation
    1. lower-*.f32N/A

      \[\leadsto cosTheta \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right)} \]
    2. lower-+.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + \color{blue}{-1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)}\right) \]
    3. lift-sqrt.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + \color{blue}{-1} \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    4. lift-PI.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    5. lower-*.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \color{blue}{\left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)}\right) \]
    6. lower-*.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)}\right)\right) \]
    7. lower-*.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}\right)\right)\right) \]
    8. lift-PI.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(\color{blue}{1} + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    9. lower-+.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + \color{blue}{\left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)}\right)\right)\right)\right) \]
    10. lower-+.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + \left(c + \color{blue}{-1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
  4. Applied rewrites95.6%

    \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right)\right)} \]
  5. Add Preprocessing

Alternative 7: 95.5% accurate, 1.6× speedup?

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

\\
cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 97.8%

    \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  2. Taylor expanded in cosTheta around 0

    \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right)} \]
  3. Step-by-step derivation
    1. lower-*.f32N/A

      \[\leadsto cosTheta \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right)} \]
    2. lower-+.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + \color{blue}{-1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)}\right) \]
    3. lift-sqrt.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + \color{blue}{-1} \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    4. lift-PI.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    5. lower-*.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \color{blue}{\left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)}\right) \]
    6. lower-*.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)}\right)\right) \]
    7. lower-*.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}\right)\right)\right) \]
    8. lift-PI.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(\color{blue}{1} + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    9. lower-+.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + \color{blue}{\left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)}\right)\right)\right)\right) \]
    10. lower-+.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + \left(c + \color{blue}{-1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
  4. Applied rewrites95.6%

    \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right)\right)} \]
  5. Taylor expanded in c around 0

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + -1 \cdot \color{blue}{\sqrt{\frac{1}{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right) \]
  6. Step-by-step derivation
    1. lift-/.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right) \]
    2. lift-PI.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    3. lift-sqrt.f32N/A

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
    4. lift-*.f3295.5

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right) \]
  7. Applied rewrites95.5%

    \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + -1 \cdot \color{blue}{\sqrt{\frac{1}{\pi}}}\right)\right)\right)\right) \]
  8. Add Preprocessing

Alternative 8: 94.9% accurate, 1.9× speedup?

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

\\
\frac{1}{1 + \frac{1}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}}
\end{array}
Derivation
  1. Initial program 97.8%

    \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  2. Taylor expanded in c around 0

    \[\leadsto \frac{1}{\color{blue}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
  3. Step-by-step derivation
    1. lower-+.f32N/A

      \[\leadsto \frac{1}{1 + \color{blue}{\frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
    2. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \color{blue}{\sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
    3. lower-/.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\color{blue}{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}} \]
    4. lower-exp.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{\color{blue}{1 - 2 \cdot cosTheta}}{\mathsf{PI}\left(\right)}}} \]
    5. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{\color{blue}{1} - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    6. lower-pow.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    7. lower-sqrt.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    8. lower-/.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    9. lower--.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    10. lower-*.f32N/A

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
    11. lift-PI.f3297.4

      \[\leadsto \frac{1}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}} \]
  4. Applied rewrites97.4%

    \[\leadsto \frac{1}{\color{blue}{1 + \frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}}} \]
  5. Taylor expanded in cosTheta around 0

    \[\leadsto \frac{1}{1 + \frac{1 + -1 \cdot {cosTheta}^{2}}{cosTheta} \cdot \sqrt{\color{blue}{\frac{1 - 2 \cdot cosTheta}{\pi}}}} \]
  6. Step-by-step derivation
    1. lower-/.f32N/A

      \[\leadsto \frac{1}{1 + \frac{1 + -1 \cdot {cosTheta}^{2}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\color{blue}{\pi}}}} \]
    2. lower-+.f32N/A

      \[\leadsto \frac{1}{1 + \frac{1 + -1 \cdot {cosTheta}^{2}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}} \]
    3. lift-pow.f32N/A

      \[\leadsto \frac{1}{1 + \frac{1 + -1 \cdot {cosTheta}^{2}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}} \]
    4. lift-*.f3296.4

      \[\leadsto \frac{1}{1 + \frac{1 + -1 \cdot {cosTheta}^{2}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}} \]
  7. Applied rewrites96.4%

    \[\leadsto \frac{1}{1 + \frac{1 + -1 \cdot {cosTheta}^{2}}{cosTheta} \cdot \sqrt{\color{blue}{\frac{1 - 2 \cdot cosTheta}{\pi}}}} \]
  8. Taylor expanded in cosTheta around 0

    \[\leadsto \frac{1}{1 + \frac{1}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}} \]
  9. Step-by-step derivation
    1. Applied rewrites94.9%

      \[\leadsto \frac{1}{1 + \frac{1}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\pi}}} \]
    2. Add Preprocessing

    Alternative 9: 92.9% accurate, 2.7× speedup?

    \[\begin{array}{l} \\ cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(c \cdot \pi\right)\right)\right) \end{array} \]
    (FPCore (cosTheta c)
     :precision binary32
     (* cosTheta (+ (sqrt PI) (* -1.0 (* cosTheta (* c PI))))))
    float code(float cosTheta, float c) {
    	return cosTheta * (sqrtf(((float) M_PI)) + (-1.0f * (cosTheta * (c * ((float) M_PI)))));
    }
    
    function code(cosTheta, c)
    	return Float32(cosTheta * Float32(sqrt(Float32(pi)) + Float32(Float32(-1.0) * Float32(cosTheta * Float32(c * Float32(pi))))))
    end
    
    function tmp = code(cosTheta, c)
    	tmp = cosTheta * (sqrt(single(pi)) + (single(-1.0) * (cosTheta * (c * single(pi)))));
    end
    
    \begin{array}{l}
    
    \\
    cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(c \cdot \pi\right)\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 97.8%

      \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
    2. Taylor expanded in cosTheta around 0

      \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right)} \]
    3. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto cosTheta \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right)} \]
      2. lower-+.f32N/A

        \[\leadsto cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + \color{blue}{-1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)}\right) \]
      3. lift-sqrt.f32N/A

        \[\leadsto cosTheta \cdot \left(\sqrt{\mathsf{PI}\left(\right)} + \color{blue}{-1} \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      4. lift-PI.f32N/A

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      5. lower-*.f32N/A

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \color{blue}{\left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)}\right) \]
      6. lower-*.f32N/A

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)}\right)\right) \]
      7. lower-*.f32N/A

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}\right)\right)\right) \]
      8. lift-PI.f32N/A

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(\color{blue}{1} + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      9. lower-+.f32N/A

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + \color{blue}{\left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)}\right)\right)\right)\right) \]
      10. lower-+.f32N/A

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + \left(c + \color{blue}{-1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
    4. Applied rewrites95.6%

      \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(\pi \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\pi}}\right)\right)\right)\right)\right)} \]
    5. Taylor expanded in c around inf

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(c \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
    6. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(c \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      2. lift-PI.f3292.9

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(c \cdot \pi\right)\right)\right) \]
    7. Applied rewrites92.9%

      \[\leadsto cosTheta \cdot \left(\sqrt{\pi} + -1 \cdot \left(cosTheta \cdot \left(c \cdot \color{blue}{\pi}\right)\right)\right) \]
    8. Add Preprocessing

    Alternative 10: 92.9% accurate, 7.8× speedup?

    \[\begin{array}{l} \\ cosTheta \cdot \sqrt{\pi} \end{array} \]
    (FPCore (cosTheta c) :precision binary32 (* cosTheta (sqrt PI)))
    float code(float cosTheta, float c) {
    	return cosTheta * sqrtf(((float) M_PI));
    }
    
    function code(cosTheta, c)
    	return Float32(cosTheta * sqrt(Float32(pi)))
    end
    
    function tmp = code(cosTheta, c)
    	tmp = cosTheta * sqrt(single(pi));
    end
    
    \begin{array}{l}
    
    \\
    cosTheta \cdot \sqrt{\pi}
    \end{array}
    
    Derivation
    1. Initial program 97.8%

      \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
    2. Taylor expanded in cosTheta around 0

      \[\leadsto \color{blue}{cosTheta \cdot \sqrt{\mathsf{PI}\left(\right)}} \]
    3. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto cosTheta \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right)}} \]
      2. lift-sqrt.f32N/A

        \[\leadsto cosTheta \cdot \sqrt{\mathsf{PI}\left(\right)} \]
      3. lift-PI.f3292.9

        \[\leadsto cosTheta \cdot \sqrt{\pi} \]
    4. Applied rewrites92.9%

      \[\leadsto \color{blue}{cosTheta \cdot \sqrt{\pi}} \]
    5. Add Preprocessing

    Alternative 11: 5.1% accurate, 10.0× speedup?

    \[\begin{array}{l} \\ \frac{1}{c} \end{array} \]
    (FPCore (cosTheta c) :precision binary32 (/ 1.0 c))
    float code(float cosTheta, float c) {
    	return 1.0f / c;
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(4) function code(costheta, c)
    use fmin_fmax_functions
        real(4), intent (in) :: costheta
        real(4), intent (in) :: c
        code = 1.0e0 / c
    end function
    
    function code(cosTheta, c)
    	return Float32(Float32(1.0) / c)
    end
    
    function tmp = code(cosTheta, c)
    	tmp = single(1.0) / c;
    end
    
    \begin{array}{l}
    
    \\
    \frac{1}{c}
    \end{array}
    
    Derivation
    1. Initial program 97.8%

      \[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
    2. Taylor expanded in c around inf

      \[\leadsto \color{blue}{\frac{1}{c}} \]
    3. Step-by-step derivation
      1. lower-/.f325.1

        \[\leadsto \frac{1}{\color{blue}{c}} \]
    4. Applied rewrites5.1%

      \[\leadsto \color{blue}{\frac{1}{c}} \]
    5. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025134 
    (FPCore (cosTheta c)
      :name "Beckmann Sample, normalization factor"
      :precision binary32
      :pre (and (and (< 0.0 cosTheta) (< cosTheta 0.9999)) (and (< -1.0 c) (< c 1.0)))
      (/ 1.0 (+ (+ 1.0 c) (* (* (/ 1.0 (sqrt PI)) (/ (sqrt (- (- 1.0 cosTheta) cosTheta)) cosTheta)) (exp (* (- cosTheta) cosTheta))))))