Beckmann Sample, normalization factor

Percentage Accurate: 97.9% → 98.4%
Time: 17.9s
Alternatives: 18
Speedup: 1.5×

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}

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 18 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.9% 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: 98.4% accurate, 1.0× speedup?

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

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

    \[\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
  3. Step-by-step derivation
    1. associate-*l/N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\left(\frac{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}{\sqrt{\mathsf{PI}\left(\right)}}\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
    2. clear-numN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\left(\frac{1}{\frac{\sqrt{\mathsf{PI}\left(\right)}}{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}}\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}\right)\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
    4. *-lft-identityN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    5. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), \color{blue}{cosTheta}\right)\right)\right)\right)\right) \]
    6. pow1/2N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    7. pow-lowering-pow.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI}\left(\right), \frac{1}{2}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    8. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    9. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\left(\sqrt{\left(1 - cosTheta\right) - cosTheta}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    10. pow1/2N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\left({\left(\left(1 - cosTheta\right) - cosTheta\right)}^{\frac{1}{2}}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    11. pow-lowering-pow.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left(\left(1 - cosTheta\right) - cosTheta\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    12. associate--l-N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left(1 - \left(cosTheta + cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \left(cosTheta + cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    14. count-2N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \left(2 \cdot cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    15. *-lowering-*.f3298.6%

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(2, cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
  4. Applied egg-rr98.6%

    \[\leadsto \frac{1}{\left(1 + c\right) + \color{blue}{\frac{1}{\frac{{\pi}^{0.5}}{\frac{{\left(1 - 2 \cdot cosTheta\right)}^{0.5}}{cosTheta}}}} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  5. Final simplification98.6%

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

Alternative 2: 98.2% accurate, 1.5× speedup?

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

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

    \[\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
  3. Step-by-step derivation
    1. associate-*l/N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\left(\frac{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}{\sqrt{\mathsf{PI}\left(\right)}}\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
    2. clear-numN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\left(\frac{1}{\frac{\sqrt{\mathsf{PI}\left(\right)}}{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}}\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}\right)\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
    4. *-lft-identityN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    5. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), \color{blue}{cosTheta}\right)\right)\right)\right)\right) \]
    6. pow1/2N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    7. pow-lowering-pow.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI}\left(\right), \frac{1}{2}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    8. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    9. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\left(\sqrt{\left(1 - cosTheta\right) - cosTheta}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    10. pow1/2N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\left({\left(\left(1 - cosTheta\right) - cosTheta\right)}^{\frac{1}{2}}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    11. pow-lowering-pow.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left(\left(1 - cosTheta\right) - cosTheta\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    12. associate--l-N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left(1 - \left(cosTheta + cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    13. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \left(cosTheta + cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    14. count-2N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \left(2 \cdot cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    15. *-lowering-*.f3298.6%

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(2, cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
  4. Applied egg-rr98.6%

    \[\leadsto \frac{1}{\left(1 + c\right) + \color{blue}{\frac{1}{\frac{{\pi}^{0.5}}{\frac{{\left(1 - 2 \cdot cosTheta\right)}^{0.5}}{cosTheta}}}} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  5. Step-by-step derivation
    1. pow1/2N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{\frac{{\left(1 - 2 \cdot cosTheta\right)}^{\frac{1}{2}}}{cosTheta}}\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    2. associate-/r/N/A

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{{\left(1 - 2 \cdot cosTheta\right)}^{\frac{1}{2}}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), \color{blue}{cosTheta}\right)\right)\right)\right)\right) \]
    4. clear-numN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left(\frac{1}{\frac{{\left(1 - 2 \cdot cosTheta\right)}^{\frac{1}{2}}}{\sqrt{\mathsf{PI}\left(\right)}}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    5. unpow1/2N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left(\frac{1}{\frac{\sqrt{1 - 2 \cdot cosTheta}}{\sqrt{\mathsf{PI}\left(\right)}}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    6. sqrt-divN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left(\frac{1}{\sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    7. pow1/2N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left(\frac{1}{{\left(\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    8. pow-flipN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left({\left(\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left({\left(\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}\right)}^{\frac{-1}{2}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    10. pow-lowering-pow.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\left(\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\left(1 - 2 \cdot cosTheta\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    12. sub-negN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\left(1 + \left(\mathsf{neg}\left(2 \cdot cosTheta\right)\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    13. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \left(\mathsf{neg}\left(2 \cdot cosTheta\right)\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    14. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \left(\mathsf{neg}\left(cosTheta \cdot 2\right)\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    15. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \left(cosTheta \cdot \left(\mathsf{neg}\left(2\right)\right)\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    16. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, \left(\mathsf{neg}\left(2\right)\right)\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    17. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    18. PI-lowering-PI.f3298.5%

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right), \mathsf{PI.f32}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
  6. Applied egg-rr98.5%

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

    \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\color{blue}{1}, \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right), \mathsf{PI.f32}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
  8. Step-by-step derivation
    1. Simplified98.5%

      \[\leadsto \frac{1}{\color{blue}{1} + \frac{1}{{\left(\frac{1 + cosTheta \cdot -2}{\pi}\right)}^{-0.5} \cdot cosTheta} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
    2. Final simplification98.5%

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

    Alternative 3: 97.7% accurate, 1.5× speedup?

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

      \[\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
    3. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\left(\frac{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}{\sqrt{\mathsf{PI}\left(\right)}}\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\left(\frac{1}{\frac{\sqrt{\mathsf{PI}\left(\right)}}{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}}\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}\right)\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
      4. *-lft-identityN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      5. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), \color{blue}{cosTheta}\right)\right)\right)\right)\right) \]
      6. pow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      7. pow-lowering-pow.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI}\left(\right), \frac{1}{2}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      8. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\left(\sqrt{\left(1 - cosTheta\right) - cosTheta}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      10. pow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\left({\left(\left(1 - cosTheta\right) - cosTheta\right)}^{\frac{1}{2}}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      11. pow-lowering-pow.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left(\left(1 - cosTheta\right) - cosTheta\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      12. associate--l-N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left(1 - \left(cosTheta + cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      13. --lowering--.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \left(cosTheta + cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      14. count-2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \left(2 \cdot cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f3298.6%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(2, cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    4. Applied egg-rr98.6%

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

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

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \color{blue}{\left(\frac{e^{\mathsf{neg}\left({cosTheta}^{2}\right)}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}\right)}\right)\right) \]
      4. associate-*l/N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\left(e^{\mathsf{neg}\left({cosTheta}^{2}\right)} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}\right), \color{blue}{cosTheta}\right)\right)\right) \]
    7. Simplified98.1%

      \[\leadsto \color{blue}{\frac{1}{1 + \frac{e^{0 - cosTheta \cdot cosTheta} \cdot \sqrt{\frac{1 + cosTheta \cdot -2}{\pi}}}{cosTheta}}} \]
    8. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{exp.f32}\left(\left(\mathsf{neg}\left(cosTheta \cdot cosTheta\right)\right)\right), \mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      2. distribute-lft-neg-outN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{exp.f32}\left(\mathsf{*.f32}\left(\left(\mathsf{neg}\left(cosTheta\right)\right), cosTheta\right)\right), \mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      4. neg-lowering-neg.f3298.1%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right), \mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right), \mathsf{PI.f32}\left(\right)\right)\right)\right), cosTheta\right)\right)\right) \]
    9. Applied egg-rr98.1%

      \[\leadsto \frac{1}{1 + \frac{e^{\color{blue}{\left(-cosTheta\right) \cdot cosTheta}} \cdot \sqrt{\frac{1 + cosTheta \cdot -2}{\pi}}}{cosTheta}} \]
    10. Final simplification98.1%

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

    Alternative 4: 97.7% accurate, 1.5× speedup?

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

      \[\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. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
      3. associate-+l+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
      8. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      9. exp-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    3. Simplified98.4%

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

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

        \[\leadsto \frac{1}{1 + \frac{1}{cosTheta \cdot e^{{cosTheta}^{2}}} \cdot \sqrt{\frac{1 + \left(\mathsf{neg}\left(2\right)\right) \cdot cosTheta}{\mathsf{PI}\left(\right)}}} \]
      2. cancel-sign-sub-invN/A

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

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

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

        \[\leadsto \frac{1}{1 + \frac{e^{\mathsf{neg}\left({cosTheta}^{2}\right)}}{cosTheta} \cdot \sqrt{\frac{\color{blue}{1 - 2 \cdot cosTheta}}{\mathsf{PI}\left(\right)}}} \]
      6. mul-1-negN/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)}}} \]
      7. /-lowering-/.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \color{blue}{\left(\frac{e^{-1 \cdot {cosTheta}^{2}}}{cosTheta} \cdot \sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}\right)}\right)\right) \]
    7. Simplified98.1%

      \[\leadsto \color{blue}{\frac{1}{1 + \frac{\sqrt{\frac{1 - cosTheta \cdot 2}{\pi}}}{cosTheta \cdot e^{cosTheta \cdot cosTheta}}}} \]
    8. Final simplification98.1%

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

    Alternative 5: 95.8% accurate, 1.5× speedup?

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

      \[\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. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
      3. associate-+l+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
      8. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      9. exp-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    3. Simplified98.4%

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right)\right), \mathsf{*.f32}\left(cosTheta, \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)}\right)}\right)\right)\right)\right)\right) \]
      2. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right)\right), \mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      3. PI-lowering-PI.f3296.5%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right)\right), \mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right)\right) \]
    7. Simplified96.5%

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

    Alternative 6: 95.6% accurate, 1.5× speedup?

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

      \[\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. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
      3. associate-+l+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
      8. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      9. exp-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    3. Simplified98.4%

      \[\leadsto \color{blue}{\frac{1}{c + \left(1 + \frac{\sqrt{1 + cosTheta \cdot -2}}{e^{cosTheta \cdot cosTheta} \cdot \left(\sqrt{\pi} \cdot cosTheta\right)}\right)}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(cosTheta, \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)}\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\sqrt{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\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)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\sqrt{\mathsf{PI}\left(\right)} - \color{blue}{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. --lowering--.f32N/A

        \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), \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)\right) \]
      5. sqrt-lowering-sqrt.f32N/A

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

        \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \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)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \left(\left(cosTheta \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
    7. Simplified96.4%

      \[\leadsto \color{blue}{cosTheta \cdot \left(\sqrt{\pi} - \left(\left(1 + c\right) - \sqrt{\frac{1}{\pi}}\right) \cdot \left(cosTheta \cdot \pi\right)\right)} \]
    8. Step-by-step derivation
      1. sub-negN/A

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), cosTheta\right), \left(\color{blue}{\left(\mathsf{neg}\left(\left(\left(1 + c\right) - \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot \left(cosTheta \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \cdot cosTheta\right)\right) \]
      5. pow1/2N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right), cosTheta\right), \left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(1 + c\right) - \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot \left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \cdot cosTheta\right)\right) \]
      6. pow-lowering-pow.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI}\left(\right), \frac{1}{2}\right), cosTheta\right), \left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(1 + c\right) - \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot \left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \cdot cosTheta\right)\right) \]
      7. PI-lowering-PI.f32N/A

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), cosTheta\right), \mathsf{*.f32}\left(\left(\mathsf{neg}\left(\left(\left(1 + c\right) - \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot \left(cosTheta \cdot \mathsf{PI}\left(\right)\right)\right)\right), \color{blue}{cosTheta}\right)\right) \]
    9. Applied egg-rr96.4%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right), \color{blue}{\left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} - 1\right)}\right)\right) \]
      7. *-commutativeN/A

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left({cosTheta}^{2}\right)\right), \left(\sqrt{\color{blue}{\frac{1}{\mathsf{PI}\left(\right)}}} - 1\right)\right)\right) \]
      10. unpow2N/A

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(cosTheta, cosTheta\right)\right), \left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(cosTheta, cosTheta\right)\right), \left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + -1\right)\right)\right) \]
      14. +-lowering-+.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(cosTheta, cosTheta\right)\right), \mathsf{+.f32}\left(\left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right), \color{blue}{-1}\right)\right)\right) \]
      15. sqrt-lowering-sqrt.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(cosTheta, cosTheta\right)\right), \mathsf{+.f32}\left(\mathsf{sqrt.f32}\left(\left(\frac{1}{\mathsf{PI}\left(\right)}\right)\right), -1\right)\right)\right) \]
      16. /-lowering-/.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(cosTheta, cosTheta\right)\right), \mathsf{+.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI}\left(\right)\right)\right), -1\right)\right)\right) \]
      17. PI-lowering-PI.f3296.4%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(cosTheta, cosTheta\right)\right), \mathsf{+.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI.f32}\left(\right)\right)\right), -1\right)\right)\right) \]
    12. Simplified96.4%

      \[\leadsto \color{blue}{cosTheta \cdot \sqrt{\pi} + \left(\pi \cdot \left(cosTheta \cdot cosTheta\right)\right) \cdot \left(\sqrt{\frac{1}{\pi}} + -1\right)} \]
    13. Final simplification96.4%

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

    Alternative 7: 95.8% accurate, 2.5× speedup?

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

      \[\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. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
      3. associate-+l+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
      8. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      9. exp-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    3. Simplified98.4%

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + cosTheta \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{cosTheta}\right)\right)\right) \]
    7. Simplified95.8%

      \[\leadsto \frac{1}{c + \color{blue}{\frac{cosTheta + \left(\left(-cosTheta\right) + 1\right) \cdot \sqrt{\frac{1}{\pi}}}{cosTheta}}} \]
    8. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \left(\frac{\frac{cosTheta \cdot cosTheta - \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)}{cosTheta - \left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}}}{cosTheta}\right)\right)\right) \]
      2. associate-/l/N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\left(cosTheta \cdot cosTheta - \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{\left(cosTheta \cdot \left(cosTheta - \left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}\right)\right)\right) \]
    9. Applied egg-rr96.4%

      \[\leadsto \frac{1}{c + \color{blue}{\frac{cosTheta \cdot cosTheta - \frac{1}{\pi} \cdot \left(\left(1 - cosTheta\right) \cdot \left(1 - cosTheta\right)\right)}{cosTheta \cdot \left(cosTheta - \frac{1 - cosTheta}{{\pi}^{0.5}}\right)}}} \]
    10. Final simplification96.4%

      \[\leadsto \frac{1}{c + \frac{cosTheta \cdot cosTheta + \frac{1}{\pi} \cdot \left(\left(1 - cosTheta\right) \cdot \left(cosTheta + -1\right)\right)}{cosTheta \cdot \left(cosTheta + \frac{cosTheta + -1}{{\pi}^{0.5}}\right)}} \]
    11. Add Preprocessing

    Alternative 8: 95.5% accurate, 2.6× speedup?

    \[\begin{array}{l} \\ \frac{1}{c + \frac{cosTheta + \frac{cosTheta \cdot cosTheta + -1}{{\pi}^{0.5} \cdot \frac{1 + cosTheta \cdot cosTheta}{cosTheta + -1}}}{cosTheta}} \end{array} \]
    (FPCore (cosTheta c)
     :precision binary32
     (/
      1.0
      (+
       c
       (/
        (+
         cosTheta
         (/
          (+ (* cosTheta cosTheta) -1.0)
          (* (pow PI 0.5) (/ (+ 1.0 (* cosTheta cosTheta)) (+ cosTheta -1.0)))))
        cosTheta))))
    float code(float cosTheta, float c) {
    	return 1.0f / (c + ((cosTheta + (((cosTheta * cosTheta) + -1.0f) / (powf(((float) M_PI), 0.5f) * ((1.0f + (cosTheta * cosTheta)) / (cosTheta + -1.0f))))) / cosTheta));
    }
    
    function code(cosTheta, c)
    	return Float32(Float32(1.0) / Float32(c + Float32(Float32(cosTheta + Float32(Float32(Float32(cosTheta * cosTheta) + Float32(-1.0)) / Float32((Float32(pi) ^ Float32(0.5)) * Float32(Float32(Float32(1.0) + Float32(cosTheta * cosTheta)) / Float32(cosTheta + Float32(-1.0)))))) / cosTheta)))
    end
    
    function tmp = code(cosTheta, c)
    	tmp = single(1.0) / (c + ((cosTheta + (((cosTheta * cosTheta) + single(-1.0)) / ((single(pi) ^ single(0.5)) * ((single(1.0) + (cosTheta * cosTheta)) / (cosTheta + single(-1.0)))))) / cosTheta));
    end
    
    \begin{array}{l}
    
    \\
    \frac{1}{c + \frac{cosTheta + \frac{cosTheta \cdot cosTheta + -1}{{\pi}^{0.5} \cdot \frac{1 + cosTheta \cdot cosTheta}{cosTheta + -1}}}{cosTheta}}
    \end{array}
    
    Derivation
    1. Initial program 97.9%

      \[\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. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
      3. associate-+l+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
      8. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      9. exp-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    3. Simplified98.4%

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + cosTheta \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{cosTheta}\right)\right)\right) \]
    7. Simplified95.8%

      \[\leadsto \frac{1}{c + \color{blue}{\frac{cosTheta + \left(\left(-cosTheta\right) + 1\right) \cdot \sqrt{\frac{1}{\pi}}}{cosTheta}}} \]
    8. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) - 1} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right)\right)\right) \]
      2. sqrt-divN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) - 1} \cdot \frac{\sqrt{1}}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) - 1} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right)\right)\right) \]
      4. unpow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) - 1} \cdot \frac{1}{{\mathsf{PI}\left(\right)}^{\frac{1}{2}}}\right)\right), cosTheta\right)\right)\right) \]
      5. frac-timesN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1\right) \cdot 1}{\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}}\right)\right), cosTheta\right)\right)\right) \]
      6. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1\right) \cdot 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      8. sqr-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(cosTheta \cdot cosTheta - 1 \cdot 1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(cosTheta \cdot cosTheta - 1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      10. sub-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(cosTheta \cdot cosTheta + \left(\mathsf{neg}\left(1\right)\right)\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(cosTheta \cdot cosTheta + -1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      12. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\left(cosTheta \cdot cosTheta\right), -1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      13. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      14. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + \left(\mathsf{neg}\left(1\right)\right)\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + -1\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      17. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(\left(\mathsf{neg}\left(cosTheta\right)\right), -1\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      18. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), -1\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      19. pow-lowering-pow.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), -1\right), \mathsf{pow.f32}\left(\mathsf{PI}\left(\right), \frac{1}{2}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      20. PI-lowering-PI.f3295.8%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), -1\right), \mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
    9. Applied egg-rr95.8%

      \[\leadsto \frac{1}{c + \frac{cosTheta + \color{blue}{\frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\left(\left(-cosTheta\right) + -1\right) \cdot {\pi}^{0.5}}}}{cosTheta}} \]
    10. Applied egg-rr96.2%

      \[\leadsto \frac{1}{c + \frac{cosTheta + \frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\color{blue}{\frac{1 + cosTheta \cdot cosTheta}{-1 - \left(-cosTheta\right)}} \cdot {\pi}^{0.5}}}{cosTheta}} \]
    11. Final simplification96.2%

      \[\leadsto \frac{1}{c + \frac{cosTheta + \frac{cosTheta \cdot cosTheta + -1}{{\pi}^{0.5} \cdot \frac{1 + cosTheta \cdot cosTheta}{cosTheta + -1}}}{cosTheta}} \]
    12. Add Preprocessing

    Alternative 9: 95.1% accurate, 2.8× speedup?

    \[\begin{array}{l} \\ \frac{1}{c + \frac{cosTheta + \frac{1}{\frac{{\pi}^{0.5}}{1 - cosTheta}}}{cosTheta}} \end{array} \]
    (FPCore (cosTheta c)
     :precision binary32
     (/
      1.0
      (+ c (/ (+ cosTheta (/ 1.0 (/ (pow PI 0.5) (- 1.0 cosTheta)))) cosTheta))))
    float code(float cosTheta, float c) {
    	return 1.0f / (c + ((cosTheta + (1.0f / (powf(((float) M_PI), 0.5f) / (1.0f - cosTheta)))) / cosTheta));
    }
    
    function code(cosTheta, c)
    	return Float32(Float32(1.0) / Float32(c + Float32(Float32(cosTheta + Float32(Float32(1.0) / Float32((Float32(pi) ^ Float32(0.5)) / Float32(Float32(1.0) - cosTheta)))) / cosTheta)))
    end
    
    function tmp = code(cosTheta, c)
    	tmp = single(1.0) / (c + ((cosTheta + (single(1.0) / ((single(pi) ^ single(0.5)) / (single(1.0) - cosTheta)))) / cosTheta));
    end
    
    \begin{array}{l}
    
    \\
    \frac{1}{c + \frac{cosTheta + \frac{1}{\frac{{\pi}^{0.5}}{1 - cosTheta}}}{cosTheta}}
    \end{array}
    
    Derivation
    1. Initial program 97.9%

      \[\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. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
      3. associate-+l+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
      8. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      9. exp-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    3. Simplified98.4%

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + cosTheta \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{cosTheta}\right)\right)\right) \]
    7. Simplified95.8%

      \[\leadsto \frac{1}{c + \color{blue}{\frac{cosTheta + \left(\left(-cosTheta\right) + 1\right) \cdot \sqrt{\frac{1}{\pi}}}{cosTheta}}} \]
    8. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) - 1} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right)\right)\right) \]
      2. sqrt-divN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) - 1} \cdot \frac{\sqrt{1}}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) - 1} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right)\right)\right) \]
      4. unpow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) - 1} \cdot \frac{1}{{\mathsf{PI}\left(\right)}^{\frac{1}{2}}}\right)\right), cosTheta\right)\right)\right) \]
      5. frac-timesN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1\right) \cdot 1}{\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}}\right)\right), cosTheta\right)\right)\right) \]
      6. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1\right) \cdot 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1 \cdot 1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      8. sqr-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(cosTheta \cdot cosTheta - 1 \cdot 1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(cosTheta \cdot cosTheta - 1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      10. sub-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(cosTheta \cdot cosTheta + \left(\mathsf{neg}\left(1\right)\right)\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(cosTheta \cdot cosTheta + -1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      12. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\left(cosTheta \cdot cosTheta\right), -1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      13. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right) \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right)\right)\right) \]
      14. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) - 1\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + \left(\mathsf{neg}\left(1\right)\right)\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + -1\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      17. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(\left(\mathsf{neg}\left(cosTheta\right)\right), -1\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      18. neg-lowering-neg.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), -1\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      19. pow-lowering-pow.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), -1\right), \mathsf{pow.f32}\left(\mathsf{PI}\left(\right), \frac{1}{2}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      20. PI-lowering-PI.f3295.8%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), -1\right), 1\right), \mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), -1\right), \mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
    9. Applied egg-rr95.8%

      \[\leadsto \frac{1}{c + \frac{cosTheta + \color{blue}{\frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\left(\left(-cosTheta\right) + -1\right) \cdot {\pi}^{0.5}}}}{cosTheta}} \]
    10. Step-by-step derivation
      1. pow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + -1\right) \cdot \sqrt{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right)\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right)\right)\right) \]
      3. clear-numN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{1}{\frac{\sqrt{\mathsf{PI}\left(\right)}}{\frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}}}\right)\right), cosTheta\right)\right)\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{\frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}}\right)\right)\right), cosTheta\right)\right)\right) \]
      5. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), \left(\frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      6. pow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right), \left(\frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      7. pow-lowering-pow.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI}\left(\right), \frac{1}{2}\right), \left(\frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      8. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\frac{\left(cosTheta \cdot cosTheta + -1\right) \cdot 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      9. *-rgt-identityN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\frac{cosTheta \cdot cosTheta + -1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\frac{cosTheta \cdot cosTheta + \left(\mathsf{neg}\left(1\right)\right)}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\frac{cosTheta \cdot cosTheta - 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      12. sqr-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - 1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot \left(\mathsf{neg}\left(cosTheta\right)\right) - -1 \cdot -1}{\left(\mathsf{neg}\left(cosTheta\right)\right) + -1}\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      14. flip--N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\left(\mathsf{neg}\left(cosTheta\right)\right) - -1\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\left(\mathsf{neg}\left(cosTheta\right)\right) + \left(\mathsf{neg}\left(-1\right)\right)\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      17. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{+.f32}\left(\left(\mathsf{neg}\left(cosTheta\right)\right), 1\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      18. neg-lowering-neg.f3295.9%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), 1\right)\right)\right)\right), cosTheta\right)\right)\right) \]
    11. Applied egg-rr95.9%

      \[\leadsto \frac{1}{c + \frac{cosTheta + \color{blue}{\frac{1}{\frac{{\pi}^{0.5}}{\left(-cosTheta\right) + 1}}}}{cosTheta}} \]
    12. Final simplification95.9%

      \[\leadsto \frac{1}{c + \frac{cosTheta + \frac{1}{\frac{{\pi}^{0.5}}{1 - cosTheta}}}{cosTheta}} \]
    13. Add Preprocessing

    Alternative 10: 95.1% accurate, 2.8× speedup?

    \[\begin{array}{l} \\ \frac{1}{c + \frac{cosTheta + \frac{1 - cosTheta}{{\pi}^{0.5}}}{cosTheta}} \end{array} \]
    (FPCore (cosTheta c)
     :precision binary32
     (/ 1.0 (+ c (/ (+ cosTheta (/ (- 1.0 cosTheta) (pow PI 0.5))) cosTheta))))
    float code(float cosTheta, float c) {
    	return 1.0f / (c + ((cosTheta + ((1.0f - cosTheta) / powf(((float) M_PI), 0.5f))) / cosTheta));
    }
    
    function code(cosTheta, c)
    	return Float32(Float32(1.0) / Float32(c + Float32(Float32(cosTheta + Float32(Float32(Float32(1.0) - cosTheta) / (Float32(pi) ^ Float32(0.5)))) / cosTheta)))
    end
    
    function tmp = code(cosTheta, c)
    	tmp = single(1.0) / (c + ((cosTheta + ((single(1.0) - cosTheta) / (single(pi) ^ single(0.5)))) / cosTheta));
    end
    
    \begin{array}{l}
    
    \\
    \frac{1}{c + \frac{cosTheta + \frac{1 - cosTheta}{{\pi}^{0.5}}}{cosTheta}}
    \end{array}
    
    Derivation
    1. Initial program 97.9%

      \[\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. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
      3. associate-+l+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
      8. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      9. exp-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
    3. Simplified98.4%

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + cosTheta \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{cosTheta}\right)\right)\right) \]
    7. Simplified95.8%

      \[\leadsto \frac{1}{c + \color{blue}{\frac{cosTheta + \left(\left(-cosTheta\right) + 1\right) \cdot \sqrt{\frac{1}{\pi}}}{cosTheta}}} \]
    8. Step-by-step derivation
      1. +-commutativeN/A

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(cosTheta + \left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right), cosTheta\right), c\right)\right) \]
      4. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right), c\right)\right) \]
      5. sqrt-divN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \frac{\sqrt{1}}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right), c\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right), c\right)\right) \]
      7. unpow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right) \cdot \frac{1}{{\mathsf{PI}\left(\right)}^{\frac{1}{2}}}\right)\right), cosTheta\right), c\right)\right) \]
      8. un-div-invN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \left(\frac{\left(\mathsf{neg}\left(cosTheta\right)\right) + 1}{{\mathsf{PI}\left(\right)}^{\frac{1}{2}}}\right)\right), cosTheta\right), c\right)\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\left(\left(\mathsf{neg}\left(cosTheta\right)\right) + 1\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right), c\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\left(1 + \left(\mathsf{neg}\left(cosTheta\right)\right)\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right), c\right)\right) \]
      11. unsub-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\left(1 - cosTheta\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right), c\right)\right) \]
      12. --lowering--.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, cosTheta\right), \left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)\right)\right), cosTheta\right), c\right)\right) \]
      13. pow-lowering-pow.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, cosTheta\right), \mathsf{pow.f32}\left(\mathsf{PI}\left(\right), \frac{1}{2}\right)\right)\right), cosTheta\right), c\right)\right) \]
      14. PI-lowering-PI.f3295.9%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(cosTheta, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, cosTheta\right), \mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right)\right)\right), cosTheta\right), c\right)\right) \]
    9. Applied egg-rr95.9%

      \[\leadsto \frac{1}{\color{blue}{\frac{cosTheta + \frac{1 - cosTheta}{{\pi}^{0.5}}}{cosTheta} + c}} \]
    10. Final simplification95.9%

      \[\leadsto \frac{1}{c + \frac{cosTheta + \frac{1 - cosTheta}{{\pi}^{0.5}}}{cosTheta}} \]
    11. Add Preprocessing

    Alternative 11: 95.0% accurate, 2.8× speedup?

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

      \[\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
    3. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\left(\frac{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}{\sqrt{\mathsf{PI}\left(\right)}}\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\left(\frac{1}{\frac{\sqrt{\mathsf{PI}\left(\right)}}{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}}\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{1 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}\right)\right), \mathsf{exp.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)}\right)\right)\right)\right) \]
      4. *-lft-identityN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      5. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), \color{blue}{cosTheta}\right)\right)\right)\right)\right) \]
      6. pow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\left({\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      7. pow-lowering-pow.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI}\left(\right), \frac{1}{2}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      8. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\left(\sqrt{\left(1 - cosTheta\right) - cosTheta}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      10. pow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\left({\left(\left(1 - cosTheta\right) - cosTheta\right)}^{\frac{1}{2}}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      11. pow-lowering-pow.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left(\left(1 - cosTheta\right) - cosTheta\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      12. associate--l-N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left(1 - \left(cosTheta + cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      13. --lowering--.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \left(cosTheta + cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      14. count-2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \left(2 \cdot cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f3298.6%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{PI.f32}\left(\right), \frac{1}{2}\right), \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{\_.f32}\left(1, \mathsf{*.f32}\left(2, cosTheta\right)\right), \frac{1}{2}\right), cosTheta\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    4. Applied egg-rr98.6%

      \[\leadsto \frac{1}{\left(1 + c\right) + \color{blue}{\frac{1}{\frac{{\pi}^{0.5}}{\frac{{\left(1 - 2 \cdot cosTheta\right)}^{0.5}}{cosTheta}}}} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
    5. Step-by-step derivation
      1. pow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{\frac{{\left(1 - 2 \cdot cosTheta\right)}^{\frac{1}{2}}}{cosTheta}}\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      2. associate-/r/N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left(\frac{\sqrt{\mathsf{PI}\left(\right)}}{{\left(1 - 2 \cdot cosTheta\right)}^{\frac{1}{2}}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), \color{blue}{cosTheta}\right)\right)\right)\right)\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left(\frac{1}{\frac{{\left(1 - 2 \cdot cosTheta\right)}^{\frac{1}{2}}}{\sqrt{\mathsf{PI}\left(\right)}}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      5. unpow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left(\frac{1}{\frac{\sqrt{1 - 2 \cdot cosTheta}}{\sqrt{\mathsf{PI}\left(\right)}}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      6. sqrt-divN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left(\frac{1}{\sqrt{\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      7. pow1/2N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left(\frac{1}{{\left(\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      8. pow-flipN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left({\left(\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\left({\left(\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}\right)}^{\frac{-1}{2}}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      10. pow-lowering-pow.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\left(\frac{1 - 2 \cdot cosTheta}{\mathsf{PI}\left(\right)}\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      11. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\left(1 - 2 \cdot cosTheta\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      12. sub-negN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\left(1 + \left(\mathsf{neg}\left(2 \cdot cosTheta\right)\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      13. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \left(\mathsf{neg}\left(2 \cdot cosTheta\right)\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \left(\mathsf{neg}\left(cosTheta \cdot 2\right)\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      15. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \left(cosTheta \cdot \left(\mathsf{neg}\left(2\right)\right)\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, \left(\mathsf{neg}\left(2\right)\right)\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right), \mathsf{PI}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
      18. PI-lowering-PI.f3298.5%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{+.f32}\left(1, c\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right), \mathsf{PI.f32}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    6. Applied egg-rr98.5%

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\color{blue}{1}, \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(cosTheta, -2\right)\right), \mathsf{PI.f32}\left(\right)\right), \frac{-1}{2}\right), cosTheta\right)\right), \mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), cosTheta\right)\right)\right)\right)\right) \]
    8. Step-by-step derivation
      1. Simplified98.5%

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \color{blue}{\left(\frac{\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + -1 \cdot \left(cosTheta \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)}{cosTheta}\right)}\right)\right) \]
      3. Step-by-step derivation
        1. associate-*r*N/A

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + \left(-1 \cdot cosTheta\right) \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right), \color{blue}{cosTheta}\right)\right)\right) \]
        3. distribute-rgt1-inN/A

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\left(-1 \cdot cosTheta\right), 1\right), \left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right)\right)\right) \]
        6. mul-1-negN/A

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), 1\right), \left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), cosTheta\right)\right)\right) \]
        8. sqrt-lowering-sqrt.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), 1\right), \mathsf{sqrt.f32}\left(\left(\frac{1}{\mathsf{PI}\left(\right)}\right)\right)\right), cosTheta\right)\right)\right) \]
        9. /-lowering-/.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), 1\right), \mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI}\left(\right)\right)\right)\right), cosTheta\right)\right)\right) \]
        10. PI-lowering-PI.f3295.8%

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{neg.f32}\left(cosTheta\right), 1\right), \mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI.f32}\left(\right)\right)\right)\right), cosTheta\right)\right)\right) \]
      4. Simplified95.8%

        \[\leadsto \frac{1}{1 + \color{blue}{\frac{\left(\left(-cosTheta\right) + 1\right) \cdot \sqrt{\frac{1}{\pi}}}{cosTheta}}} \]
      5. Final simplification95.8%

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

      Alternative 12: 94.9% accurate, 2.8× speedup?

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

        \[\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. Step-by-step derivation
        1. /-lowering-/.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
        2. +-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
        3. associate-+l+N/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        4. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        5. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
        8. distribute-lft-neg-outN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
        9. exp-negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      3. Simplified98.4%

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{/.f32}\left(\left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} + cosTheta \cdot \left(1 + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{cosTheta}\right)\right)\right) \]
      7. Simplified95.8%

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \color{blue}{\left(\frac{1 - cosTheta}{cosTheta} \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)}\right)\right) \]
        3. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right), \color{blue}{\left(\frac{1 - cosTheta}{cosTheta}\right)}\right)\right)\right) \]
        5. sqrt-lowering-sqrt.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\left(\frac{1}{\mathsf{PI}\left(\right)}\right)\right), \left(\frac{\color{blue}{1 - cosTheta}}{cosTheta}\right)\right)\right)\right) \]
        6. /-lowering-/.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI}\left(\right)\right)\right), \left(\frac{\color{blue}{1} - cosTheta}{cosTheta}\right)\right)\right)\right) \]
        7. PI-lowering-PI.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI.f32}\left(\right)\right)\right), \left(\frac{1 - cosTheta}{cosTheta}\right)\right)\right)\right) \]
        8. div-subN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI.f32}\left(\right)\right)\right), \left(\frac{1}{cosTheta} - \color{blue}{\frac{cosTheta}{cosTheta}}\right)\right)\right)\right) \]
        9. sub-negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI.f32}\left(\right)\right)\right), \left(\frac{1}{cosTheta} + \color{blue}{\left(\mathsf{neg}\left(\frac{cosTheta}{cosTheta}\right)\right)}\right)\right)\right)\right) \]
        10. *-inversesN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI.f32}\left(\right)\right)\right), \left(\frac{1}{cosTheta} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right) \]
        11. metadata-evalN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI.f32}\left(\right)\right)\right), \left(\frac{1}{cosTheta} + -1\right)\right)\right)\right) \]
        12. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{+.f32}\left(\left(\frac{1}{cosTheta}\right), \color{blue}{-1}\right)\right)\right)\right) \]
        13. /-lowering-/.f3295.7%

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, cosTheta\right), -1\right)\right)\right)\right) \]
      10. Simplified95.7%

        \[\leadsto \color{blue}{\frac{1}{1 + \sqrt{\frac{1}{\pi}} \cdot \left(\frac{1}{cosTheta} + -1\right)}} \]
      11. Final simplification95.7%

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

      Alternative 13: 93.1% accurate, 3.0× speedup?

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

        \[\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. Step-by-step derivation
        1. /-lowering-/.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
        2. +-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
        3. associate-+l+N/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        4. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        5. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
        8. distribute-lft-neg-outN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
        9. exp-negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      3. Simplified98.4%

        \[\leadsto \color{blue}{\frac{1}{c + \left(1 + \frac{\sqrt{1 + cosTheta \cdot -2}}{e^{cosTheta \cdot cosTheta} \cdot \left(\sqrt{\pi} \cdot cosTheta\right)}\right)}} \]
      4. Add Preprocessing
      5. 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)} \]
      6. Step-by-step derivation
        1. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \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)}\right) \]
        2. mul-1-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\sqrt{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\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)\right)\right) \]
        3. unsub-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\sqrt{\mathsf{PI}\left(\right)} - \color{blue}{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. --lowering--.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), \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)\right) \]
        5. sqrt-lowering-sqrt.f32N/A

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

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \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)\right) \]
        7. associate-*r*N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \left(\left(cosTheta \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}\right)\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
        9. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
      7. Simplified96.4%

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

        \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \color{blue}{\left(c \cdot \left(cosTheta \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
      9. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(\left(cosTheta \cdot \mathsf{PI}\left(\right)\right), \color{blue}{c}\right)\right)\right) \]
        3. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(cosTheta, \mathsf{PI}\left(\right)\right), c\right)\right)\right) \]
        4. PI-lowering-PI.f3293.1%

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(cosTheta, \mathsf{PI.f32}\left(\right)\right), c\right)\right)\right) \]
      10. Simplified93.1%

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} - \color{blue}{\left(cosTheta \cdot \pi\right) \cdot c}\right) \]
      11. Final simplification93.1%

        \[\leadsto cosTheta \cdot \left(\sqrt{\pi} - c \cdot \left(\pi \cdot cosTheta\right)\right) \]
      12. Add Preprocessing

      Alternative 14: 93.1% accurate, 3.1× 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.9%

        \[\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. Step-by-step derivation
        1. /-lowering-/.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
        2. +-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
        3. associate-+l+N/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        4. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        5. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
        8. distribute-lft-neg-outN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
        9. exp-negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      3. Simplified98.4%

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

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

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

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI}\left(\right)\right)\right) \]
        3. PI-lowering-PI.f3293.1%

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right) \]
      7. Simplified93.1%

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

      Alternative 15: 10.8% accurate, 40.3× speedup?

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

        \[\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. Step-by-step derivation
        1. /-lowering-/.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
        2. +-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
        3. associate-+l+N/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        4. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        5. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
        8. distribute-lft-neg-outN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
        9. exp-negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      3. Simplified98.4%

        \[\leadsto \color{blue}{\frac{1}{c + \left(1 + \frac{\sqrt{1 + cosTheta \cdot -2}}{e^{cosTheta \cdot cosTheta} \cdot \left(\sqrt{\pi} \cdot cosTheta\right)}\right)}} \]
      4. Add Preprocessing
      5. 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)} \]
      6. Step-by-step derivation
        1. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \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)}\right) \]
        2. mul-1-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\sqrt{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\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)\right)\right) \]
        3. unsub-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\sqrt{\mathsf{PI}\left(\right)} - \color{blue}{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. --lowering--.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), \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)\right) \]
        5. sqrt-lowering-sqrt.f32N/A

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

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \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)\right) \]
        7. associate-*r*N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \left(\left(cosTheta \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}\right)\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
        9. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
      7. Simplified96.4%

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

        \[\leadsto \mathsf{*.f32}\left(cosTheta, \color{blue}{\left(-1 \cdot \left(c \cdot \left(cosTheta \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
      9. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\mathsf{neg}\left(c \cdot \left(cosTheta \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
        2. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(c \cdot \color{blue}{\left(\mathsf{neg}\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
        3. mul-1-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(c \cdot \left(-1 \cdot \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
        4. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{*.f32}\left(c, \color{blue}{\left(-1 \cdot \left(cosTheta \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
        5. mul-1-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{*.f32}\left(c, \left(\mathsf{neg}\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
        6. neg-sub0N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{*.f32}\left(c, \left(0 - \color{blue}{cosTheta \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
        7. --lowering--.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
        8. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(cosTheta, \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)\right) \]
        9. PI-lowering-PI.f3210.6%

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(cosTheta, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right) \]
      10. Simplified10.6%

        \[\leadsto cosTheta \cdot \color{blue}{\left(c \cdot \left(0 - cosTheta \cdot \pi\right)\right)} \]
      11. Final simplification10.6%

        \[\leadsto \left(-cosTheta\right) \cdot \left(c \cdot \left(\pi \cdot cosTheta\right)\right) \]
      12. Add Preprocessing

      Alternative 16: 10.8% accurate, 40.3× speedup?

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

        \[\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. Step-by-step derivation
        1. /-lowering-/.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
        2. +-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
        3. associate-+l+N/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        4. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        5. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
        8. distribute-lft-neg-outN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
        9. exp-negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      3. Simplified98.4%

        \[\leadsto \color{blue}{\frac{1}{c + \left(1 + \frac{\sqrt{1 + cosTheta \cdot -2}}{e^{cosTheta \cdot cosTheta} \cdot \left(\sqrt{\pi} \cdot cosTheta\right)}\right)}} \]
      4. Add Preprocessing
      5. 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)} \]
      6. Step-by-step derivation
        1. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \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)}\right) \]
        2. mul-1-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\sqrt{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\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)\right)\right) \]
        3. unsub-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\sqrt{\mathsf{PI}\left(\right)} - \color{blue}{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. --lowering--.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), \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)\right) \]
        5. sqrt-lowering-sqrt.f32N/A

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

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \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)\right) \]
        7. associate-*r*N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \left(\left(cosTheta \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}\right)\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
        9. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
      7. Simplified96.4%

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

        \[\leadsto \color{blue}{-1 \cdot \left(c \cdot \left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      9. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \mathsf{neg}\left(c \cdot \left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)\right) \]
        2. distribute-rgt-neg-inN/A

          \[\leadsto c \cdot \color{blue}{\left(\mathsf{neg}\left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
        3. mul-1-negN/A

          \[\leadsto c \cdot \left(-1 \cdot \color{blue}{\left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)}\right) \]
        4. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \color{blue}{\left(-1 \cdot \left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
        5. mul-1-negN/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(\mathsf{neg}\left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        6. neg-sub0N/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(0 - \color{blue}{{cosTheta}^{2} \cdot \mathsf{PI}\left(\right)}\right)\right) \]
        7. --lowering--.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \color{blue}{\left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{cosTheta}^{2}}\right)\right)\right) \]
        9. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \color{blue}{\left({cosTheta}^{2}\right)}\right)\right)\right) \]
        10. PI-lowering-PI.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left({\color{blue}{cosTheta}}^{2}\right)\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(cosTheta \cdot \color{blue}{cosTheta}\right)\right)\right)\right) \]
        12. *-lowering-*.f3210.6%

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(cosTheta, \color{blue}{cosTheta}\right)\right)\right)\right) \]
      10. Simplified10.6%

        \[\leadsto \color{blue}{c \cdot \left(0 - \pi \cdot \left(cosTheta \cdot cosTheta\right)\right)} \]
      11. Step-by-step derivation
        1. sub0-negN/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(\mathsf{neg}\left(\mathsf{PI}\left(\right) \cdot \left(cosTheta \cdot cosTheta\right)\right)\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(\mathsf{neg}\left(\left(cosTheta \cdot cosTheta\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        3. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(\left(cosTheta \cdot cosTheta\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
        4. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{*.f32}\left(\left(cosTheta \cdot cosTheta\right), \color{blue}{\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
        5. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{*.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), \left(\mathsf{neg}\left(\color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)\right) \]
        6. neg-lowering-neg.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{*.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), \mathsf{neg.f32}\left(\mathsf{PI}\left(\right)\right)\right)\right) \]
        7. PI-lowering-PI.f3210.6%

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{*.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), \mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right)\right) \]
      12. Applied egg-rr10.6%

        \[\leadsto c \cdot \color{blue}{\left(\left(cosTheta \cdot cosTheta\right) \cdot \left(-\pi\right)\right)} \]
      13. Final simplification10.6%

        \[\leadsto \left(\pi \cdot \left(cosTheta \cdot cosTheta\right)\right) \cdot \left(-c\right) \]
      14. Add Preprocessing

      Alternative 17: 10.8% accurate, 46.0× speedup?

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

        \[\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. Step-by-step derivation
        1. /-lowering-/.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
        2. +-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
        3. associate-+l+N/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        4. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        5. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
        8. distribute-lft-neg-outN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
        9. exp-negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      3. Simplified98.4%

        \[\leadsto \color{blue}{\frac{1}{c + \left(1 + \frac{\sqrt{1 + cosTheta \cdot -2}}{e^{cosTheta \cdot cosTheta} \cdot \left(\sqrt{\pi} \cdot cosTheta\right)}\right)}} \]
      4. Add Preprocessing
      5. 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)} \]
      6. Step-by-step derivation
        1. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \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)}\right) \]
        2. mul-1-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\sqrt{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\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)\right)\right) \]
        3. unsub-negN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \left(\sqrt{\mathsf{PI}\left(\right)} - \color{blue}{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. --lowering--.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\left(\sqrt{\mathsf{PI}\left(\right)}\right), \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)\right) \]
        5. sqrt-lowering-sqrt.f32N/A

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

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \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)\right) \]
        7. associate-*r*N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \left(\left(cosTheta \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}\right)\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
        9. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(cosTheta, \mathsf{\_.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right), \color{blue}{\left(cosTheta \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
      7. Simplified96.4%

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

        \[\leadsto \color{blue}{-1 \cdot \left(c \cdot \left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      9. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \mathsf{neg}\left(c \cdot \left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)\right) \]
        2. distribute-rgt-neg-inN/A

          \[\leadsto c \cdot \color{blue}{\left(\mathsf{neg}\left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
        3. mul-1-negN/A

          \[\leadsto c \cdot \left(-1 \cdot \color{blue}{\left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)}\right) \]
        4. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \color{blue}{\left(-1 \cdot \left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
        5. mul-1-negN/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(\mathsf{neg}\left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        6. neg-sub0N/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(0 - \color{blue}{{cosTheta}^{2} \cdot \mathsf{PI}\left(\right)}\right)\right) \]
        7. --lowering--.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \color{blue}{\left({cosTheta}^{2} \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{cosTheta}^{2}}\right)\right)\right) \]
        9. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \color{blue}{\left({cosTheta}^{2}\right)}\right)\right)\right) \]
        10. PI-lowering-PI.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left({\color{blue}{cosTheta}}^{2}\right)\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(cosTheta \cdot \color{blue}{cosTheta}\right)\right)\right)\right) \]
        12. *-lowering-*.f3210.6%

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(cosTheta, \color{blue}{cosTheta}\right)\right)\right)\right) \]
      10. Simplified10.6%

        \[\leadsto \color{blue}{c \cdot \left(0 - \pi \cdot \left(cosTheta \cdot cosTheta\right)\right)} \]
      11. Step-by-step derivation
        1. sub0-negN/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(\mathsf{neg}\left(\mathsf{PI}\left(\right) \cdot \left(cosTheta \cdot cosTheta\right)\right)\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(\mathsf{neg}\left(\left(cosTheta \cdot cosTheta\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        3. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(\left(cosTheta \cdot cosTheta\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
        4. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{*.f32}\left(\left(cosTheta \cdot cosTheta\right), \color{blue}{\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
        5. *-lowering-*.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{*.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), \left(\mathsf{neg}\left(\color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)\right) \]
        6. neg-lowering-neg.f32N/A

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{*.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), \mathsf{neg.f32}\left(\mathsf{PI}\left(\right)\right)\right)\right) \]
        7. PI-lowering-PI.f3210.6%

          \[\leadsto \mathsf{*.f32}\left(c, \mathsf{*.f32}\left(\mathsf{*.f32}\left(cosTheta, cosTheta\right), \mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right)\right)\right) \]
      12. Applied egg-rr10.6%

        \[\leadsto c \cdot \color{blue}{\left(\left(cosTheta \cdot cosTheta\right) \cdot \left(-\pi\right)\right)} \]
      13. Step-by-step derivation
        1. distribute-rgt-neg-outN/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(\mathsf{neg}\left(\left(cosTheta \cdot cosTheta\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        2. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{*.f32}\left(c, \left(\left(\mathsf{neg}\left(cosTheta \cdot cosTheta\right)\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \]
      14. Applied egg-rr10.5%

        \[\leadsto c \cdot \color{blue}{\left(\left(cosTheta \cdot cosTheta\right) \cdot \pi\right)} \]
      15. Final simplification10.5%

        \[\leadsto c \cdot \left(\pi \cdot \left(cosTheta \cdot cosTheta\right)\right) \]
      16. Add Preprocessing

      Alternative 18: 5.0% accurate, 107.3× 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;
      }
      
      real(4) function code(costheta, c)
          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.9%

        \[\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. Step-by-step derivation
        1. /-lowering-/.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\left(1 + c\right) + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right) \]
        2. +-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(c + 1\right) + \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)} \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)\right) \]
        3. associate-+l+N/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(c + \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        4. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \color{blue}{\left(1 + \left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right) \]
        5. +-lowering-+.f32N/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \color{blue}{\left(\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta}\right)}\right)\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \color{blue}{\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\left(\mathsf{neg}\left(cosTheta\right)\right) \cdot cosTheta} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{PI}\left(\right)}}}\right)\right)\right)\right)\right) \]
        8. distribute-lft-neg-outN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(cosTheta \cdot cosTheta\right)} \cdot \left(\frac{\color{blue}{\sqrt{\left(1 - cosTheta\right) - cosTheta}}}{cosTheta} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
        9. exp-negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{+.f32}\left(c, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{cosTheta \cdot cosTheta}} \cdot \left(\color{blue}{\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}} \cdot \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)\right)\right)\right) \]
      3. Simplified98.4%

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

        \[\leadsto \color{blue}{\frac{1}{c}} \]
      6. Step-by-step derivation
        1. /-lowering-/.f324.9%

          \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{c}\right) \]
      7. Simplified4.9%

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

      Reproduce

      ?
      herbie shell --seed 2024192 
      (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))))))