Beckmann Sample, normalization factor

Percentage Accurate: 97.8% → 98.3%
Time: 11.8s
Alternatives: 8
Speedup: N/A×

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

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

Initial Program: 97.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, N/A× speedup?

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

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

    \[\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. lift-*.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\left(1 + c\right) + \frac{1 \cdot \frac{{\left(\left(1 - cosTheta\right) - cosTheta\right)}^{\frac{1}{2}}}{cosTheta}}{\color{blue}{\sqrt{\mathsf{PI}\left(\right)}}} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
    18. lift-PI.f3298.5

      \[\leadsto \frac{1}{\left(1 + c\right) + \frac{1 \cdot \frac{{\left(\left(1 - cosTheta\right) - cosTheta\right)}^{0.5}}{cosTheta}}{\sqrt{\color{blue}{\pi}}} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}} \]
  4. Applied rewrites98.5%

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

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

Alternative 2: 98.0% accurate, N/A× speedup?

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

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

    \[\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. Taylor expanded in c around 0

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

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

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

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

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

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

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

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

Alternative 3: 98.0% accurate, N/A× speedup?

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

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

    \[\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. Taylor expanded in c around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\left(c + 1\right) + \frac{{\left(e^{-1}\right)}^{\left(cosTheta \cdot cosTheta\right)} \cdot {\left(cosTheta \cdot \left(\frac{1}{cosTheta \cdot \pi} - 2 \cdot \frac{\mathsf{neg}\left(1\right)}{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}\right)\right)}^{\frac{1}{2}}}{cosTheta}} \]
    8. metadata-evalN/A

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

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

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

      \[\leadsto \frac{1}{\left(c + 1\right) + \frac{{\left(e^{-1}\right)}^{\left(cosTheta \cdot cosTheta\right)} \cdot {\left(cosTheta \cdot \left(\frac{1}{cosTheta \cdot \pi} - 2 \cdot \frac{-1}{-\pi}\right)\right)}^{0.5}}{cosTheta}} \]
  8. Applied rewrites98.1%

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

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

Alternative 4: 97.6% accurate, N/A× speedup?

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

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

    \[\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. Taylor expanded in cosTheta around 0

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1 \cdot \sqrt{\pi}, \mathsf{fma}\left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}, {\left(\mathsf{fma}\left(\frac{1}{\sqrt{\pi}}, -1, c\right) + 1\right)}^{2}, \left(\frac{1}{\sqrt{\pi}} \cdot -1.5\right) \cdot \pi\right) \cdot \left(\mathsf{fma}\left(\frac{1}{\sqrt{\pi}}, -1, c\right) + 1\right), \mathsf{fma}\left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}, \left(\frac{1}{\sqrt{\pi}} \cdot -1.5\right) \cdot \left(\mathsf{fma}\left(\frac{1}{\sqrt{\pi}}, -1, c\right) + 1\right), \left(0.5 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \pi\right)\right) - \mathsf{fma}\left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}, {\left(\mathsf{fma}\left(\frac{1}{\sqrt{\pi}}, -1, c\right) + 1\right)}^{2}, \left(\frac{1}{\sqrt{\pi}} \cdot -1.5\right) \cdot \pi\right), cosTheta, \left(-\pi\right) \cdot \left(\mathsf{fma}\left(\frac{1}{\sqrt{\pi}}, -1, c\right) + 1\right)\right), cosTheta, \sqrt{\pi}\right) \cdot cosTheta} \]
  5. Final simplification97.9%

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

Alternative 5: 52.9% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(cosTheta \cdot cosTheta\right) \cdot cosTheta\\ t_1 := {\left({\pi}^{3}\right)}^{0.5}\\ t_2 := -1 \cdot t\_1\\ t_3 := \frac{1}{\sqrt{\pi}}\\ t_4 := 1 + \left(c - t\_3\right)\\ t_5 := 2 + -2 \cdot t\_3\\ t_6 := t\_2 \cdot t\_5\\ t_7 := {t\_4}^{2}\\ t_8 := \pi \cdot t\_4\\ t_9 := 1 - t\_3\\ t_10 := t\_2 \cdot \left(t\_9 \cdot t\_9\right)\\ t_11 := \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_10\right)\\ t_12 := \pi \cdot t\_9\\ \mathbf{if}\;\left(1 + c\right) + \left(t\_3 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-1 \cdot cosTheta\right) \cdot cosTheta} \leq 1999999991808:\\ \;\;\;\;\left(t\_0 \cdot \left(\mathsf{fma}\left(-1, \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_4 \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_2 \cdot t\_7\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_8\right)\right), \mathsf{fma}\left(-1, \frac{t\_8}{cosTheta \cdot cosTheta}, \frac{1}{t\_0} \cdot \sqrt{\pi}\right)\right) - \mathsf{fma}\left(-1.5, \frac{-1}{cosTheta} \cdot \left(-1 \cdot \sqrt{\pi}\right), \left(-1 \cdot \frac{t\_7}{cosTheta}\right) \cdot t\_1\right)\right)\right) \cdot cosTheta\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-1 \cdot {c}^{3}\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, t\_1 \cdot \left(t\_9 \cdot t\_5\right), t\_10\right)\right), 1.5 \cdot \pi\right) - t\_6\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, \frac{\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, t\_12, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_9 \cdot t\_11\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_12\right)\right) - t\_11\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, t\_1 \cdot t\_9, t\_6\right)\right) \cdot \sqrt{\pi} - t\_2\right)\right)}{c}, t\_0 \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot cosTheta\\ \end{array} \end{array} \]
(FPCore (cosTheta c)
 :precision binary32
 (let* ((t_0 (* (* cosTheta cosTheta) cosTheta))
        (t_1 (pow (pow PI 3.0) 0.5))
        (t_2 (* -1.0 t_1))
        (t_3 (/ 1.0 (sqrt PI)))
        (t_4 (+ 1.0 (- c t_3)))
        (t_5 (+ 2.0 (* -2.0 t_3)))
        (t_6 (* t_2 t_5))
        (t_7 (pow t_4 2.0))
        (t_8 (* PI t_4))
        (t_9 (- 1.0 t_3))
        (t_10 (* t_2 (* t_9 t_9)))
        (t_11 (fma -1.5 (sqrt PI) t_10))
        (t_12 (* PI t_9)))
   (if (<=
        (+
         (+ 1.0 c)
         (*
          (* t_3 (/ (sqrt (- (- 1.0 cosTheta) cosTheta)) cosTheta))
          (exp (* (* -1.0 cosTheta) cosTheta))))
        1999999991808.0)
     (*
      (*
       t_0
       (-
        (fma
         -1.0
         (fma
          -1.0
          (* (sqrt PI) (* t_4 (fma -1.5 (sqrt PI) (* t_2 t_7))))
          (fma 0.5 (sqrt PI) (* 1.5 t_8)))
         (fma -1.0 (/ t_8 (* cosTheta cosTheta)) (* (/ 1.0 t_0) (sqrt PI))))
        (fma
         -1.5
         (* (/ -1.0 cosTheta) (* -1.0 (sqrt PI)))
         (* (* -1.0 (/ t_7 cosTheta)) t_1))))
      cosTheta)
     (*
      (*
       (* -1.0 (pow c 3.0))
       (fma
        -1.0
        (/
         (fma
          -1.0
          (/
           (fma
            -1.0
            (*
             cosTheta
             (fma
              -1.0
              PI
              (*
               cosTheta
               (-
                (*
                 (* -1.0 cosTheta)
                 (fma
                  -1.0
                  (*
                   (sqrt PI)
                   (fma -1.5 (sqrt PI) (fma -1.0 (* t_1 (* t_9 t_5)) t_10)))
                  (* 1.5 PI)))
                t_6))))
            (fma
             -1.0
             (* (/ 1.0 c) (sqrt PI))
             (/
              (*
               (* -1.0 cosTheta)
               (fma
                -1.0
                t_12
                (*
                 cosTheta
                 (-
                  (*
                   (* -1.0 cosTheta)
                   (fma
                    -1.0
                    (* (sqrt PI) (* t_9 t_11))
                    (fma 0.5 (sqrt PI) (* 1.5 t_12))))
                  t_11))))
              c)))
           c)
          (*
           (* cosTheta cosTheta)
           (- (* (* cosTheta (fma -1.0 (* t_1 t_9) t_6)) (sqrt PI)) t_2)))
         c)
        (* t_0 (* PI PI))))
      cosTheta))))
float code(float cosTheta, float c) {
	float t_0 = (cosTheta * cosTheta) * cosTheta;
	float t_1 = powf(powf(((float) M_PI), 3.0f), 0.5f);
	float t_2 = -1.0f * t_1;
	float t_3 = 1.0f / sqrtf(((float) M_PI));
	float t_4 = 1.0f + (c - t_3);
	float t_5 = 2.0f + (-2.0f * t_3);
	float t_6 = t_2 * t_5;
	float t_7 = powf(t_4, 2.0f);
	float t_8 = ((float) M_PI) * t_4;
	float t_9 = 1.0f - t_3;
	float t_10 = t_2 * (t_9 * t_9);
	float t_11 = fmaf(-1.5f, sqrtf(((float) M_PI)), t_10);
	float t_12 = ((float) M_PI) * t_9;
	float tmp;
	if (((1.0f + c) + ((t_3 * (sqrtf(((1.0f - cosTheta) - cosTheta)) / cosTheta)) * expf(((-1.0f * cosTheta) * cosTheta)))) <= 1999999991808.0f) {
		tmp = (t_0 * (fmaf(-1.0f, fmaf(-1.0f, (sqrtf(((float) M_PI)) * (t_4 * fmaf(-1.5f, sqrtf(((float) M_PI)), (t_2 * t_7)))), fmaf(0.5f, sqrtf(((float) M_PI)), (1.5f * t_8))), fmaf(-1.0f, (t_8 / (cosTheta * cosTheta)), ((1.0f / t_0) * sqrtf(((float) M_PI))))) - fmaf(-1.5f, ((-1.0f / cosTheta) * (-1.0f * sqrtf(((float) M_PI)))), ((-1.0f * (t_7 / cosTheta)) * t_1)))) * cosTheta;
	} else {
		tmp = ((-1.0f * powf(c, 3.0f)) * fmaf(-1.0f, (fmaf(-1.0f, (fmaf(-1.0f, (cosTheta * fmaf(-1.0f, ((float) M_PI), (cosTheta * (((-1.0f * cosTheta) * fmaf(-1.0f, (sqrtf(((float) M_PI)) * fmaf(-1.5f, sqrtf(((float) M_PI)), fmaf(-1.0f, (t_1 * (t_9 * t_5)), t_10))), (1.5f * ((float) M_PI)))) - t_6)))), fmaf(-1.0f, ((1.0f / c) * sqrtf(((float) M_PI))), (((-1.0f * cosTheta) * fmaf(-1.0f, t_12, (cosTheta * (((-1.0f * cosTheta) * fmaf(-1.0f, (sqrtf(((float) M_PI)) * (t_9 * t_11)), fmaf(0.5f, sqrtf(((float) M_PI)), (1.5f * t_12)))) - t_11)))) / c))) / c), ((cosTheta * cosTheta) * (((cosTheta * fmaf(-1.0f, (t_1 * t_9), t_6)) * sqrtf(((float) M_PI))) - t_2))) / c), (t_0 * (((float) M_PI) * ((float) M_PI))))) * cosTheta;
	}
	return tmp;
}
function code(cosTheta, c)
	t_0 = Float32(Float32(cosTheta * cosTheta) * cosTheta)
	t_1 = (Float32(pi) ^ Float32(3.0)) ^ Float32(0.5)
	t_2 = Float32(Float32(-1.0) * t_1)
	t_3 = Float32(Float32(1.0) / sqrt(Float32(pi)))
	t_4 = Float32(Float32(1.0) + Float32(c - t_3))
	t_5 = Float32(Float32(2.0) + Float32(Float32(-2.0) * t_3))
	t_6 = Float32(t_2 * t_5)
	t_7 = t_4 ^ Float32(2.0)
	t_8 = Float32(Float32(pi) * t_4)
	t_9 = Float32(Float32(1.0) - t_3)
	t_10 = Float32(t_2 * Float32(t_9 * t_9))
	t_11 = fma(Float32(-1.5), sqrt(Float32(pi)), t_10)
	t_12 = Float32(Float32(pi) * t_9)
	tmp = Float32(0.0)
	if (Float32(Float32(Float32(1.0) + c) + Float32(Float32(t_3 * Float32(sqrt(Float32(Float32(Float32(1.0) - cosTheta) - cosTheta)) / cosTheta)) * exp(Float32(Float32(Float32(-1.0) * cosTheta) * cosTheta)))) <= Float32(1999999991808.0))
		tmp = Float32(Float32(t_0 * Float32(fma(Float32(-1.0), fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * Float32(t_4 * fma(Float32(-1.5), sqrt(Float32(pi)), Float32(t_2 * t_7)))), fma(Float32(0.5), sqrt(Float32(pi)), Float32(Float32(1.5) * t_8))), fma(Float32(-1.0), Float32(t_8 / Float32(cosTheta * cosTheta)), Float32(Float32(Float32(1.0) / t_0) * sqrt(Float32(pi))))) - fma(Float32(-1.5), Float32(Float32(Float32(-1.0) / cosTheta) * Float32(Float32(-1.0) * sqrt(Float32(pi)))), Float32(Float32(Float32(-1.0) * Float32(t_7 / cosTheta)) * t_1)))) * cosTheta);
	else
		tmp = Float32(Float32(Float32(Float32(-1.0) * (c ^ Float32(3.0))) * fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(cosTheta * fma(Float32(-1.0), Float32(pi), Float32(cosTheta * Float32(Float32(Float32(Float32(-1.0) * cosTheta) * fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * fma(Float32(-1.5), sqrt(Float32(pi)), fma(Float32(-1.0), Float32(t_1 * Float32(t_9 * t_5)), t_10))), Float32(Float32(1.5) * Float32(pi)))) - t_6)))), fma(Float32(-1.0), Float32(Float32(Float32(1.0) / c) * sqrt(Float32(pi))), Float32(Float32(Float32(Float32(-1.0) * cosTheta) * fma(Float32(-1.0), t_12, Float32(cosTheta * Float32(Float32(Float32(Float32(-1.0) * cosTheta) * fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * Float32(t_9 * t_11)), fma(Float32(0.5), sqrt(Float32(pi)), Float32(Float32(1.5) * t_12)))) - t_11)))) / c))) / c), Float32(Float32(cosTheta * cosTheta) * Float32(Float32(Float32(cosTheta * fma(Float32(-1.0), Float32(t_1 * t_9), t_6)) * sqrt(Float32(pi))) - t_2))) / c), Float32(t_0 * Float32(Float32(pi) * Float32(pi))))) * cosTheta);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(cosTheta \cdot cosTheta\right) \cdot cosTheta\\
t_1 := {\left({\pi}^{3}\right)}^{0.5}\\
t_2 := -1 \cdot t\_1\\
t_3 := \frac{1}{\sqrt{\pi}}\\
t_4 := 1 + \left(c - t\_3\right)\\
t_5 := 2 + -2 \cdot t\_3\\
t_6 := t\_2 \cdot t\_5\\
t_7 := {t\_4}^{2}\\
t_8 := \pi \cdot t\_4\\
t_9 := 1 - t\_3\\
t_10 := t\_2 \cdot \left(t\_9 \cdot t\_9\right)\\
t_11 := \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_10\right)\\
t_12 := \pi \cdot t\_9\\
\mathbf{if}\;\left(1 + c\right) + \left(t\_3 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-1 \cdot cosTheta\right) \cdot cosTheta} \leq 1999999991808:\\
\;\;\;\;\left(t\_0 \cdot \left(\mathsf{fma}\left(-1, \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_4 \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_2 \cdot t\_7\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_8\right)\right), \mathsf{fma}\left(-1, \frac{t\_8}{cosTheta \cdot cosTheta}, \frac{1}{t\_0} \cdot \sqrt{\pi}\right)\right) - \mathsf{fma}\left(-1.5, \frac{-1}{cosTheta} \cdot \left(-1 \cdot \sqrt{\pi}\right), \left(-1 \cdot \frac{t\_7}{cosTheta}\right) \cdot t\_1\right)\right)\right) \cdot cosTheta\\

\mathbf{else}:\\
\;\;\;\;\left(\left(-1 \cdot {c}^{3}\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, t\_1 \cdot \left(t\_9 \cdot t\_5\right), t\_10\right)\right), 1.5 \cdot \pi\right) - t\_6\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, \frac{\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, t\_12, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_9 \cdot t\_11\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_12\right)\right) - t\_11\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, t\_1 \cdot t\_9, t\_6\right)\right) \cdot \sqrt{\pi} - t\_2\right)\right)}{c}, t\_0 \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot cosTheta\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f32 (+.f32 #s(literal 1 binary32) c) (*.f32 (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (PI.f32))) (/.f32 (sqrt.f32 (-.f32 (-.f32 #s(literal 1 binary32) cosTheta) cosTheta)) cosTheta)) (exp.f32 (*.f32 (neg.f32 cosTheta) cosTheta)))) < 1999999990000

    1. Initial program 97.7%

      \[\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. Taylor expanded in cosTheta around 0

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

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

      \[\leadsto \left({cosTheta}^{3} \cdot \left(\left(-1 \cdot \left(-1 \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \left(\frac{-3}{2} \cdot \sqrt{\mathsf{PI}\left(\right)} + -1 \cdot \left(\sqrt{{\mathsf{PI}\left(\right)}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}^{2}\right)\right)\right)\right) + \left(\frac{1}{2} \cdot \sqrt{\mathsf{PI}\left(\right)} + \frac{3}{2} \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) + \left(-1 \cdot \frac{\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}{{cosTheta}^{2}} + \frac{1}{{cosTheta}^{3}} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)\right) - \left(\frac{-3}{2} \cdot \left(\frac{1}{cosTheta} \cdot \sqrt{\mathsf{PI}\left(\right)}\right) + -1 \cdot \left(\frac{{\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}^{2}}{cosTheta} \cdot \sqrt{{\mathsf{PI}\left(\right)}^{3}}\right)\right)\right)\right) \cdot cosTheta \]
    6. Applied rewrites94.6%

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

    if 1999999990000 < (+.f32 (+.f32 #s(literal 1 binary32) c) (*.f32 (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (PI.f32))) (/.f32 (sqrt.f32 (-.f32 (-.f32 #s(literal 1 binary32) cosTheta) cosTheta)) cosTheta)) (exp.f32 (*.f32 (neg.f32 cosTheta) cosTheta))))

    1. Initial program 98.2%

      \[\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. Taylor expanded in cosTheta around 0

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

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

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

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

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

      \[\leadsto \left(-1 \cdot \left({c}^{3} \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, {\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right), -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right), 1.5 \cdot \pi\right)\right) - -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, -1 \cdot \frac{cosTheta \cdot \mathsf{fma}\left(-1, \pi \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right), cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot \left(\pi \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right) - \mathsf{fma}\left(-1.5, \sqrt{\pi}, -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, {\left({\pi}^{3}\right)}^{0.5} \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right), -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right) \cdot \sqrt{\pi} - -1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right)\right)}{c}, \left(\left(cosTheta \cdot cosTheta\right) \cdot cosTheta\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right) \cdot cosTheta \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-1 \cdot cosTheta\right) \cdot cosTheta} \leq 1999999991808:\\ \;\;\;\;\left(\left(\left(cosTheta \cdot cosTheta\right) \cdot cosTheta\right) \cdot \left(\mathsf{fma}\left(-1, \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot {\left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)}^{2}\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot \left(\pi \cdot \left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right), \mathsf{fma}\left(-1, \frac{\pi \cdot \left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)}{cosTheta \cdot cosTheta}, \frac{1}{\left(cosTheta \cdot cosTheta\right) \cdot cosTheta} \cdot \sqrt{\pi}\right)\right) - \mathsf{fma}\left(-1.5, \frac{-1}{cosTheta} \cdot \left(-1 \cdot \sqrt{\pi}\right), \left(-1 \cdot \frac{{\left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)}^{2}}{cosTheta}\right) \cdot {\left({\pi}^{3}\right)}^{0.5}\right)\right)\right) \cdot cosTheta\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-1 \cdot {c}^{3}\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, {\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right), \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right), 1.5 \cdot \pi\right) - \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, \frac{\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \pi \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right), cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot \left(\pi \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1.5, \sqrt{\pi}, \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, {\left({\pi}^{3}\right)}^{0.5} \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right), \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right) \cdot \sqrt{\pi} - -1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right)\right)}{c}, \left(\left(cosTheta \cdot cosTheta\right) \cdot cosTheta\right) \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot cosTheta\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 52.9% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left({\pi}^{3}\right)}^{0.5}\\ t_1 := -1 \cdot t\_0\\ t_2 := \left(cosTheta \cdot cosTheta\right) \cdot cosTheta\\ t_3 := \frac{-1}{cosTheta} \cdot \left(-1 \cdot \sqrt{\pi}\right)\\ t_4 := \frac{1}{\sqrt{\pi}}\\ t_5 := 1 + \left(c - t\_4\right)\\ t_6 := 1 - t\_4\\ t_7 := t\_1 \cdot \left(t\_6 \cdot t\_6\right)\\ t_8 := \pi \cdot t\_6\\ t_9 := 2 + -2 \cdot t\_4\\ t_10 := t\_1 \cdot t\_9\\ t_11 := \pi \cdot t\_5\\ t_12 := \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_7\right)\\ t_13 := {t\_5}^{2}\\ \mathbf{if}\;\left(1 + c\right) + \left(t\_4 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-1 \cdot cosTheta\right) \cdot cosTheta} \leq 1999999991808:\\ \;\;\;\;\left(t\_2 \cdot \left(\mathsf{fma}\left(-1, \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_5 \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_1 \cdot t\_13\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_11\right)\right), \frac{\mathsf{fma}\left(-1, t\_11, t\_3\right)}{cosTheta \cdot cosTheta}\right) - \mathsf{fma}\left(-1.5, t\_3, \left(-1 \cdot \frac{t\_13}{cosTheta}\right) \cdot t\_0\right)\right)\right) \cdot cosTheta\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-1 \cdot {c}^{3}\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, t\_0 \cdot \left(t\_6 \cdot t\_9\right), t\_7\right)\right), 1.5 \cdot \pi\right) - t\_10\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, \frac{\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, t\_8, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_6 \cdot t\_12\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_8\right)\right) - t\_12\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, t\_0 \cdot t\_6, t\_10\right)\right) \cdot \sqrt{\pi} - t\_1\right)\right)}{c}, t\_2 \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot cosTheta\\ \end{array} \end{array} \]
(FPCore (cosTheta c)
 :precision binary32
 (let* ((t_0 (pow (pow PI 3.0) 0.5))
        (t_1 (* -1.0 t_0))
        (t_2 (* (* cosTheta cosTheta) cosTheta))
        (t_3 (* (/ -1.0 cosTheta) (* -1.0 (sqrt PI))))
        (t_4 (/ 1.0 (sqrt PI)))
        (t_5 (+ 1.0 (- c t_4)))
        (t_6 (- 1.0 t_4))
        (t_7 (* t_1 (* t_6 t_6)))
        (t_8 (* PI t_6))
        (t_9 (+ 2.0 (* -2.0 t_4)))
        (t_10 (* t_1 t_9))
        (t_11 (* PI t_5))
        (t_12 (fma -1.5 (sqrt PI) t_7))
        (t_13 (pow t_5 2.0)))
   (if (<=
        (+
         (+ 1.0 c)
         (*
          (* t_4 (/ (sqrt (- (- 1.0 cosTheta) cosTheta)) cosTheta))
          (exp (* (* -1.0 cosTheta) cosTheta))))
        1999999991808.0)
     (*
      (*
       t_2
       (-
        (fma
         -1.0
         (fma
          -1.0
          (* (sqrt PI) (* t_5 (fma -1.5 (sqrt PI) (* t_1 t_13))))
          (fma 0.5 (sqrt PI) (* 1.5 t_11)))
         (/ (fma -1.0 t_11 t_3) (* cosTheta cosTheta)))
        (fma -1.5 t_3 (* (* -1.0 (/ t_13 cosTheta)) t_0))))
      cosTheta)
     (*
      (*
       (* -1.0 (pow c 3.0))
       (fma
        -1.0
        (/
         (fma
          -1.0
          (/
           (fma
            -1.0
            (*
             cosTheta
             (fma
              -1.0
              PI
              (*
               cosTheta
               (-
                (*
                 (* -1.0 cosTheta)
                 (fma
                  -1.0
                  (*
                   (sqrt PI)
                   (fma -1.5 (sqrt PI) (fma -1.0 (* t_0 (* t_6 t_9)) t_7)))
                  (* 1.5 PI)))
                t_10))))
            (fma
             -1.0
             (* (/ 1.0 c) (sqrt PI))
             (/
              (*
               (* -1.0 cosTheta)
               (fma
                -1.0
                t_8
                (*
                 cosTheta
                 (-
                  (*
                   (* -1.0 cosTheta)
                   (fma
                    -1.0
                    (* (sqrt PI) (* t_6 t_12))
                    (fma 0.5 (sqrt PI) (* 1.5 t_8))))
                  t_12))))
              c)))
           c)
          (*
           (* cosTheta cosTheta)
           (- (* (* cosTheta (fma -1.0 (* t_0 t_6) t_10)) (sqrt PI)) t_1)))
         c)
        (* t_2 (* PI PI))))
      cosTheta))))
float code(float cosTheta, float c) {
	float t_0 = powf(powf(((float) M_PI), 3.0f), 0.5f);
	float t_1 = -1.0f * t_0;
	float t_2 = (cosTheta * cosTheta) * cosTheta;
	float t_3 = (-1.0f / cosTheta) * (-1.0f * sqrtf(((float) M_PI)));
	float t_4 = 1.0f / sqrtf(((float) M_PI));
	float t_5 = 1.0f + (c - t_4);
	float t_6 = 1.0f - t_4;
	float t_7 = t_1 * (t_6 * t_6);
	float t_8 = ((float) M_PI) * t_6;
	float t_9 = 2.0f + (-2.0f * t_4);
	float t_10 = t_1 * t_9;
	float t_11 = ((float) M_PI) * t_5;
	float t_12 = fmaf(-1.5f, sqrtf(((float) M_PI)), t_7);
	float t_13 = powf(t_5, 2.0f);
	float tmp;
	if (((1.0f + c) + ((t_4 * (sqrtf(((1.0f - cosTheta) - cosTheta)) / cosTheta)) * expf(((-1.0f * cosTheta) * cosTheta)))) <= 1999999991808.0f) {
		tmp = (t_2 * (fmaf(-1.0f, fmaf(-1.0f, (sqrtf(((float) M_PI)) * (t_5 * fmaf(-1.5f, sqrtf(((float) M_PI)), (t_1 * t_13)))), fmaf(0.5f, sqrtf(((float) M_PI)), (1.5f * t_11))), (fmaf(-1.0f, t_11, t_3) / (cosTheta * cosTheta))) - fmaf(-1.5f, t_3, ((-1.0f * (t_13 / cosTheta)) * t_0)))) * cosTheta;
	} else {
		tmp = ((-1.0f * powf(c, 3.0f)) * fmaf(-1.0f, (fmaf(-1.0f, (fmaf(-1.0f, (cosTheta * fmaf(-1.0f, ((float) M_PI), (cosTheta * (((-1.0f * cosTheta) * fmaf(-1.0f, (sqrtf(((float) M_PI)) * fmaf(-1.5f, sqrtf(((float) M_PI)), fmaf(-1.0f, (t_0 * (t_6 * t_9)), t_7))), (1.5f * ((float) M_PI)))) - t_10)))), fmaf(-1.0f, ((1.0f / c) * sqrtf(((float) M_PI))), (((-1.0f * cosTheta) * fmaf(-1.0f, t_8, (cosTheta * (((-1.0f * cosTheta) * fmaf(-1.0f, (sqrtf(((float) M_PI)) * (t_6 * t_12)), fmaf(0.5f, sqrtf(((float) M_PI)), (1.5f * t_8)))) - t_12)))) / c))) / c), ((cosTheta * cosTheta) * (((cosTheta * fmaf(-1.0f, (t_0 * t_6), t_10)) * sqrtf(((float) M_PI))) - t_1))) / c), (t_2 * (((float) M_PI) * ((float) M_PI))))) * cosTheta;
	}
	return tmp;
}
function code(cosTheta, c)
	t_0 = (Float32(pi) ^ Float32(3.0)) ^ Float32(0.5)
	t_1 = Float32(Float32(-1.0) * t_0)
	t_2 = Float32(Float32(cosTheta * cosTheta) * cosTheta)
	t_3 = Float32(Float32(Float32(-1.0) / cosTheta) * Float32(Float32(-1.0) * sqrt(Float32(pi))))
	t_4 = Float32(Float32(1.0) / sqrt(Float32(pi)))
	t_5 = Float32(Float32(1.0) + Float32(c - t_4))
	t_6 = Float32(Float32(1.0) - t_4)
	t_7 = Float32(t_1 * Float32(t_6 * t_6))
	t_8 = Float32(Float32(pi) * t_6)
	t_9 = Float32(Float32(2.0) + Float32(Float32(-2.0) * t_4))
	t_10 = Float32(t_1 * t_9)
	t_11 = Float32(Float32(pi) * t_5)
	t_12 = fma(Float32(-1.5), sqrt(Float32(pi)), t_7)
	t_13 = t_5 ^ Float32(2.0)
	tmp = Float32(0.0)
	if (Float32(Float32(Float32(1.0) + c) + Float32(Float32(t_4 * Float32(sqrt(Float32(Float32(Float32(1.0) - cosTheta) - cosTheta)) / cosTheta)) * exp(Float32(Float32(Float32(-1.0) * cosTheta) * cosTheta)))) <= Float32(1999999991808.0))
		tmp = Float32(Float32(t_2 * Float32(fma(Float32(-1.0), fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * Float32(t_5 * fma(Float32(-1.5), sqrt(Float32(pi)), Float32(t_1 * t_13)))), fma(Float32(0.5), sqrt(Float32(pi)), Float32(Float32(1.5) * t_11))), Float32(fma(Float32(-1.0), t_11, t_3) / Float32(cosTheta * cosTheta))) - fma(Float32(-1.5), t_3, Float32(Float32(Float32(-1.0) * Float32(t_13 / cosTheta)) * t_0)))) * cosTheta);
	else
		tmp = Float32(Float32(Float32(Float32(-1.0) * (c ^ Float32(3.0))) * fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(cosTheta * fma(Float32(-1.0), Float32(pi), Float32(cosTheta * Float32(Float32(Float32(Float32(-1.0) * cosTheta) * fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * fma(Float32(-1.5), sqrt(Float32(pi)), fma(Float32(-1.0), Float32(t_0 * Float32(t_6 * t_9)), t_7))), Float32(Float32(1.5) * Float32(pi)))) - t_10)))), fma(Float32(-1.0), Float32(Float32(Float32(1.0) / c) * sqrt(Float32(pi))), Float32(Float32(Float32(Float32(-1.0) * cosTheta) * fma(Float32(-1.0), t_8, Float32(cosTheta * Float32(Float32(Float32(Float32(-1.0) * cosTheta) * fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * Float32(t_6 * t_12)), fma(Float32(0.5), sqrt(Float32(pi)), Float32(Float32(1.5) * t_8)))) - t_12)))) / c))) / c), Float32(Float32(cosTheta * cosTheta) * Float32(Float32(Float32(cosTheta * fma(Float32(-1.0), Float32(t_0 * t_6), t_10)) * sqrt(Float32(pi))) - t_1))) / c), Float32(t_2 * Float32(Float32(pi) * Float32(pi))))) * cosTheta);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left({\pi}^{3}\right)}^{0.5}\\
t_1 := -1 \cdot t\_0\\
t_2 := \left(cosTheta \cdot cosTheta\right) \cdot cosTheta\\
t_3 := \frac{-1}{cosTheta} \cdot \left(-1 \cdot \sqrt{\pi}\right)\\
t_4 := \frac{1}{\sqrt{\pi}}\\
t_5 := 1 + \left(c - t\_4\right)\\
t_6 := 1 - t\_4\\
t_7 := t\_1 \cdot \left(t\_6 \cdot t\_6\right)\\
t_8 := \pi \cdot t\_6\\
t_9 := 2 + -2 \cdot t\_4\\
t_10 := t\_1 \cdot t\_9\\
t_11 := \pi \cdot t\_5\\
t_12 := \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_7\right)\\
t_13 := {t\_5}^{2}\\
\mathbf{if}\;\left(1 + c\right) + \left(t\_4 \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-1 \cdot cosTheta\right) \cdot cosTheta} \leq 1999999991808:\\
\;\;\;\;\left(t\_2 \cdot \left(\mathsf{fma}\left(-1, \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_5 \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_1 \cdot t\_13\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_11\right)\right), \frac{\mathsf{fma}\left(-1, t\_11, t\_3\right)}{cosTheta \cdot cosTheta}\right) - \mathsf{fma}\left(-1.5, t\_3, \left(-1 \cdot \frac{t\_13}{cosTheta}\right) \cdot t\_0\right)\right)\right) \cdot cosTheta\\

\mathbf{else}:\\
\;\;\;\;\left(\left(-1 \cdot {c}^{3}\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, t\_0 \cdot \left(t\_6 \cdot t\_9\right), t\_7\right)\right), 1.5 \cdot \pi\right) - t\_10\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, \frac{\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, t\_8, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_6 \cdot t\_12\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_8\right)\right) - t\_12\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, t\_0 \cdot t\_6, t\_10\right)\right) \cdot \sqrt{\pi} - t\_1\right)\right)}{c}, t\_2 \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot cosTheta\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f32 (+.f32 #s(literal 1 binary32) c) (*.f32 (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (PI.f32))) (/.f32 (sqrt.f32 (-.f32 (-.f32 #s(literal 1 binary32) cosTheta) cosTheta)) cosTheta)) (exp.f32 (*.f32 (neg.f32 cosTheta) cosTheta)))) < 1999999990000

    1. Initial program 97.7%

      \[\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. Taylor expanded in cosTheta around 0

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

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

      \[\leadsto \left({cosTheta}^{3} \cdot \left(\left(-1 \cdot \left(-1 \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \left(\frac{-3}{2} \cdot \sqrt{\mathsf{PI}\left(\right)} + -1 \cdot \left(\sqrt{{\mathsf{PI}\left(\right)}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}^{2}\right)\right)\right)\right) + \left(\frac{1}{2} \cdot \sqrt{\mathsf{PI}\left(\right)} + \frac{3}{2} \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) + \left(-1 \cdot \frac{\mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}{{cosTheta}^{2}} + \frac{1}{{cosTheta}^{3}} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)\right) - \left(\frac{-3}{2} \cdot \left(\frac{1}{cosTheta} \cdot \sqrt{\mathsf{PI}\left(\right)}\right) + -1 \cdot \left(\frac{{\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}^{2}}{cosTheta} \cdot \sqrt{{\mathsf{PI}\left(\right)}^{3}}\right)\right)\right)\right) \cdot cosTheta \]
    6. Applied rewrites94.6%

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

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

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

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

    if 1999999990000 < (+.f32 (+.f32 #s(literal 1 binary32) c) (*.f32 (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (PI.f32))) (/.f32 (sqrt.f32 (-.f32 (-.f32 #s(literal 1 binary32) cosTheta) cosTheta)) cosTheta)) (exp.f32 (*.f32 (neg.f32 cosTheta) cosTheta))))

    1. Initial program 98.2%

      \[\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. Taylor expanded in cosTheta around 0

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

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

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

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

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

      \[\leadsto \left(-1 \cdot \left({c}^{3} \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, {\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right), -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right), 1.5 \cdot \pi\right)\right) - -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, -1 \cdot \frac{cosTheta \cdot \mathsf{fma}\left(-1, \pi \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right), cosTheta \cdot \left(-1 \cdot \left(cosTheta \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot \left(\pi \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right) - \mathsf{fma}\left(-1.5, \sqrt{\pi}, -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, {\left({\pi}^{3}\right)}^{0.5} \cdot \left(1 + -1 \cdot \frac{1}{\sqrt{\pi}}\right), -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right) \cdot \sqrt{\pi} - -1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right)\right)}{c}, \left(\left(cosTheta \cdot cosTheta\right) \cdot cosTheta\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right) \cdot cosTheta \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-1 \cdot cosTheta\right) \cdot cosTheta} \leq 1999999991808:\\ \;\;\;\;\left(\left(\left(cosTheta \cdot cosTheta\right) \cdot cosTheta\right) \cdot \left(\mathsf{fma}\left(-1, \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot {\left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)}^{2}\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot \left(\pi \cdot \left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right), \frac{\mathsf{fma}\left(-1, \pi \cdot \left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right), \frac{-1}{cosTheta} \cdot \left(-1 \cdot \sqrt{\pi}\right)\right)}{cosTheta \cdot cosTheta}\right) - \mathsf{fma}\left(-1.5, \frac{-1}{cosTheta} \cdot \left(-1 \cdot \sqrt{\pi}\right), \left(-1 \cdot \frac{{\left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)}^{2}}{cosTheta}\right) \cdot {\left({\pi}^{3}\right)}^{0.5}\right)\right)\right) \cdot cosTheta\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-1 \cdot {c}^{3}\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, {\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right), \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right), 1.5 \cdot \pi\right) - \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, \frac{\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \pi \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right), cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot \left(\pi \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1.5, \sqrt{\pi}, \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, {\left({\pi}^{3}\right)}^{0.5} \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right), \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right) \cdot \sqrt{\pi} - -1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right)\right)}{c}, \left(\left(cosTheta \cdot cosTheta\right) \cdot cosTheta\right) \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot cosTheta\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 52.8% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\sqrt{\pi}}\\ t_1 := 1 + \left(c - t\_0\right)\\ t_2 := 1 - t\_0\\ t_3 := \left(cosTheta \cdot cosTheta\right) \cdot cosTheta\\ t_4 := {\left({\pi}^{3}\right)}^{0.5}\\ t_5 := -1 \cdot t\_4\\ t_6 := \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_5 \cdot {t\_1}^{2}\right)\\ t_7 := t\_5 \cdot \left(t\_2 \cdot t\_2\right)\\ t_8 := 2 + -2 \cdot t\_0\\ t_9 := t\_5 \cdot t\_8\\ t_10 := \pi \cdot t\_2\\ t_11 := \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_7\right)\\ t_12 := \pi \cdot t\_1\\ \mathbf{if}\;cosTheta \leq 1.99999996490334 \cdot 10^{-13}:\\ \;\;\;\;\left(\left(-1 \cdot {c}^{3}\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, t\_4 \cdot \left(t\_2 \cdot t\_8\right), t\_7\right)\right), 1.5 \cdot \pi\right) - t\_9\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, \frac{\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, t\_10, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_2 \cdot t\_11\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_10\right)\right) - t\_11\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, t\_4 \cdot t\_2, t\_9\right)\right) \cdot \sqrt{\pi} - t\_5\right)\right)}{c}, t\_3 \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot cosTheta\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-1 \cdot t\_3\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_1 \cdot t\_6\right), \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, t\_6, \frac{\mathsf{fma}\left(-1, \frac{-1}{cosTheta} \cdot \left(-1 \cdot \sqrt{\pi}\right), t\_12\right)}{-1 \cdot cosTheta}\right)}{cosTheta}, \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_12\right)\right)\right)\right) \cdot cosTheta\\ \end{array} \end{array} \]
(FPCore (cosTheta c)
 :precision binary32
 (let* ((t_0 (/ 1.0 (sqrt PI)))
        (t_1 (+ 1.0 (- c t_0)))
        (t_2 (- 1.0 t_0))
        (t_3 (* (* cosTheta cosTheta) cosTheta))
        (t_4 (pow (pow PI 3.0) 0.5))
        (t_5 (* -1.0 t_4))
        (t_6 (fma -1.5 (sqrt PI) (* t_5 (pow t_1 2.0))))
        (t_7 (* t_5 (* t_2 t_2)))
        (t_8 (+ 2.0 (* -2.0 t_0)))
        (t_9 (* t_5 t_8))
        (t_10 (* PI t_2))
        (t_11 (fma -1.5 (sqrt PI) t_7))
        (t_12 (* PI t_1)))
   (if (<= cosTheta 1.99999996490334e-13)
     (*
      (*
       (* -1.0 (pow c 3.0))
       (fma
        -1.0
        (/
         (fma
          -1.0
          (/
           (fma
            -1.0
            (*
             cosTheta
             (fma
              -1.0
              PI
              (*
               cosTheta
               (-
                (*
                 (* -1.0 cosTheta)
                 (fma
                  -1.0
                  (*
                   (sqrt PI)
                   (fma -1.5 (sqrt PI) (fma -1.0 (* t_4 (* t_2 t_8)) t_7)))
                  (* 1.5 PI)))
                t_9))))
            (fma
             -1.0
             (* (/ 1.0 c) (sqrt PI))
             (/
              (*
               (* -1.0 cosTheta)
               (fma
                -1.0
                t_10
                (*
                 cosTheta
                 (-
                  (*
                   (* -1.0 cosTheta)
                   (fma
                    -1.0
                    (* (sqrt PI) (* t_2 t_11))
                    (fma 0.5 (sqrt PI) (* 1.5 t_10))))
                  t_11))))
              c)))
           c)
          (*
           (* cosTheta cosTheta)
           (- (* (* cosTheta (fma -1.0 (* t_4 t_2) t_9)) (sqrt PI)) t_5)))
         c)
        (* t_3 (* PI PI))))
      cosTheta)
     (*
      (*
       (* -1.0 t_3)
       (fma
        -1.0
        (* (sqrt PI) (* t_1 t_6))
        (fma
         -1.0
         (/
          (fma
           -1.0
           t_6
           (/
            (fma -1.0 (* (/ -1.0 cosTheta) (* -1.0 (sqrt PI))) t_12)
            (* -1.0 cosTheta)))
          cosTheta)
         (fma 0.5 (sqrt PI) (* 1.5 t_12)))))
      cosTheta))))
float code(float cosTheta, float c) {
	float t_0 = 1.0f / sqrtf(((float) M_PI));
	float t_1 = 1.0f + (c - t_0);
	float t_2 = 1.0f - t_0;
	float t_3 = (cosTheta * cosTheta) * cosTheta;
	float t_4 = powf(powf(((float) M_PI), 3.0f), 0.5f);
	float t_5 = -1.0f * t_4;
	float t_6 = fmaf(-1.5f, sqrtf(((float) M_PI)), (t_5 * powf(t_1, 2.0f)));
	float t_7 = t_5 * (t_2 * t_2);
	float t_8 = 2.0f + (-2.0f * t_0);
	float t_9 = t_5 * t_8;
	float t_10 = ((float) M_PI) * t_2;
	float t_11 = fmaf(-1.5f, sqrtf(((float) M_PI)), t_7);
	float t_12 = ((float) M_PI) * t_1;
	float tmp;
	if (cosTheta <= 1.99999996490334e-13f) {
		tmp = ((-1.0f * powf(c, 3.0f)) * fmaf(-1.0f, (fmaf(-1.0f, (fmaf(-1.0f, (cosTheta * fmaf(-1.0f, ((float) M_PI), (cosTheta * (((-1.0f * cosTheta) * fmaf(-1.0f, (sqrtf(((float) M_PI)) * fmaf(-1.5f, sqrtf(((float) M_PI)), fmaf(-1.0f, (t_4 * (t_2 * t_8)), t_7))), (1.5f * ((float) M_PI)))) - t_9)))), fmaf(-1.0f, ((1.0f / c) * sqrtf(((float) M_PI))), (((-1.0f * cosTheta) * fmaf(-1.0f, t_10, (cosTheta * (((-1.0f * cosTheta) * fmaf(-1.0f, (sqrtf(((float) M_PI)) * (t_2 * t_11)), fmaf(0.5f, sqrtf(((float) M_PI)), (1.5f * t_10)))) - t_11)))) / c))) / c), ((cosTheta * cosTheta) * (((cosTheta * fmaf(-1.0f, (t_4 * t_2), t_9)) * sqrtf(((float) M_PI))) - t_5))) / c), (t_3 * (((float) M_PI) * ((float) M_PI))))) * cosTheta;
	} else {
		tmp = ((-1.0f * t_3) * fmaf(-1.0f, (sqrtf(((float) M_PI)) * (t_1 * t_6)), fmaf(-1.0f, (fmaf(-1.0f, t_6, (fmaf(-1.0f, ((-1.0f / cosTheta) * (-1.0f * sqrtf(((float) M_PI)))), t_12) / (-1.0f * cosTheta))) / cosTheta), fmaf(0.5f, sqrtf(((float) M_PI)), (1.5f * t_12))))) * cosTheta;
	}
	return tmp;
}
function code(cosTheta, c)
	t_0 = Float32(Float32(1.0) / sqrt(Float32(pi)))
	t_1 = Float32(Float32(1.0) + Float32(c - t_0))
	t_2 = Float32(Float32(1.0) - t_0)
	t_3 = Float32(Float32(cosTheta * cosTheta) * cosTheta)
	t_4 = (Float32(pi) ^ Float32(3.0)) ^ Float32(0.5)
	t_5 = Float32(Float32(-1.0) * t_4)
	t_6 = fma(Float32(-1.5), sqrt(Float32(pi)), Float32(t_5 * (t_1 ^ Float32(2.0))))
	t_7 = Float32(t_5 * Float32(t_2 * t_2))
	t_8 = Float32(Float32(2.0) + Float32(Float32(-2.0) * t_0))
	t_9 = Float32(t_5 * t_8)
	t_10 = Float32(Float32(pi) * t_2)
	t_11 = fma(Float32(-1.5), sqrt(Float32(pi)), t_7)
	t_12 = Float32(Float32(pi) * t_1)
	tmp = Float32(0.0)
	if (cosTheta <= Float32(1.99999996490334e-13))
		tmp = Float32(Float32(Float32(Float32(-1.0) * (c ^ Float32(3.0))) * fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(cosTheta * fma(Float32(-1.0), Float32(pi), Float32(cosTheta * Float32(Float32(Float32(Float32(-1.0) * cosTheta) * fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * fma(Float32(-1.5), sqrt(Float32(pi)), fma(Float32(-1.0), Float32(t_4 * Float32(t_2 * t_8)), t_7))), Float32(Float32(1.5) * Float32(pi)))) - t_9)))), fma(Float32(-1.0), Float32(Float32(Float32(1.0) / c) * sqrt(Float32(pi))), Float32(Float32(Float32(Float32(-1.0) * cosTheta) * fma(Float32(-1.0), t_10, Float32(cosTheta * Float32(Float32(Float32(Float32(-1.0) * cosTheta) * fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * Float32(t_2 * t_11)), fma(Float32(0.5), sqrt(Float32(pi)), Float32(Float32(1.5) * t_10)))) - t_11)))) / c))) / c), Float32(Float32(cosTheta * cosTheta) * Float32(Float32(Float32(cosTheta * fma(Float32(-1.0), Float32(t_4 * t_2), t_9)) * sqrt(Float32(pi))) - t_5))) / c), Float32(t_3 * Float32(Float32(pi) * Float32(pi))))) * cosTheta);
	else
		tmp = Float32(Float32(Float32(Float32(-1.0) * t_3) * fma(Float32(-1.0), Float32(sqrt(Float32(pi)) * Float32(t_1 * t_6)), fma(Float32(-1.0), Float32(fma(Float32(-1.0), t_6, Float32(fma(Float32(-1.0), Float32(Float32(Float32(-1.0) / cosTheta) * Float32(Float32(-1.0) * sqrt(Float32(pi)))), t_12) / Float32(Float32(-1.0) * cosTheta))) / cosTheta), fma(Float32(0.5), sqrt(Float32(pi)), Float32(Float32(1.5) * t_12))))) * cosTheta);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\pi}}\\
t_1 := 1 + \left(c - t\_0\right)\\
t_2 := 1 - t\_0\\
t_3 := \left(cosTheta \cdot cosTheta\right) \cdot cosTheta\\
t_4 := {\left({\pi}^{3}\right)}^{0.5}\\
t_5 := -1 \cdot t\_4\\
t_6 := \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_5 \cdot {t\_1}^{2}\right)\\
t_7 := t\_5 \cdot \left(t\_2 \cdot t\_2\right)\\
t_8 := 2 + -2 \cdot t\_0\\
t_9 := t\_5 \cdot t\_8\\
t_10 := \pi \cdot t\_2\\
t_11 := \mathsf{fma}\left(-1.5, \sqrt{\pi}, t\_7\right)\\
t_12 := \pi \cdot t\_1\\
\mathbf{if}\;cosTheta \leq 1.99999996490334 \cdot 10^{-13}:\\
\;\;\;\;\left(\left(-1 \cdot {c}^{3}\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, t\_4 \cdot \left(t\_2 \cdot t\_8\right), t\_7\right)\right), 1.5 \cdot \pi\right) - t\_9\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, \frac{\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, t\_10, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_2 \cdot t\_11\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_10\right)\right) - t\_11\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, t\_4 \cdot t\_2, t\_9\right)\right) \cdot \sqrt{\pi} - t\_5\right)\right)}{c}, t\_3 \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot cosTheta\\

\mathbf{else}:\\
\;\;\;\;\left(\left(-1 \cdot t\_3\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(t\_1 \cdot t\_6\right), \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, t\_6, \frac{\mathsf{fma}\left(-1, \frac{-1}{cosTheta} \cdot \left(-1 \cdot \sqrt{\pi}\right), t\_12\right)}{-1 \cdot cosTheta}\right)}{cosTheta}, \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot t\_12\right)\right)\right)\right) \cdot cosTheta\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if cosTheta < 1.99999996e-13

    1. Initial program 98.2%

      \[\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. Taylor expanded in cosTheta around 0

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

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

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

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

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

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

    if 1.99999996e-13 < cosTheta

    1. Initial program 97.7%

      \[\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. Taylor expanded in cosTheta around 0

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

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

      \[\leadsto \left(-1 \cdot \left({cosTheta}^{3} \cdot \left(-1 \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \left(\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right) \cdot \left(\frac{-3}{2} \cdot \sqrt{\mathsf{PI}\left(\right)} + -1 \cdot \left(\sqrt{{\mathsf{PI}\left(\right)}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}^{2}\right)\right)\right)\right) + \left(-1 \cdot \frac{-1 \cdot \left(\frac{-3}{2} \cdot \sqrt{\mathsf{PI}\left(\right)} + -1 \cdot \left(\sqrt{{\mathsf{PI}\left(\right)}^{3}} \cdot {\left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}^{2}\right)\right) + -1 \cdot \frac{-1 \cdot \left(\frac{1}{cosTheta} \cdot \sqrt{\mathsf{PI}\left(\right)}\right) + \mathsf{PI}\left(\right) \cdot \left(1 + \left(c + -1 \cdot \sqrt{\frac{1}{\mathsf{PI}\left(\right)}}\right)\right)}{cosTheta}}{cosTheta} + \left(\frac{1}{2} \cdot \sqrt{\mathsf{PI}\left(\right)} + \frac{3}{2} \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)\right) \cdot cosTheta \]
    6. Applied rewrites94.2%

      \[\leadsto \left(-1 \cdot \left(\left(\left(cosTheta \cdot cosTheta\right) \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + \left(c + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot {\left(1 + \left(c + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)}^{2}\right)\right)\right), \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \mathsf{fma}\left(-1.5, \sqrt{\pi}, -1 \cdot \left({\left({\pi}^{3}\right)}^{0.5} \cdot {\left(1 + \left(c + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)}^{2}\right)\right), -1 \cdot \frac{\mathsf{fma}\left(-1, \frac{-1}{-cosTheta} \cdot \sqrt{\pi}, \pi \cdot \left(1 + \left(c + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)}{cosTheta}\right)}{cosTheta}, \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot \left(\pi \cdot \left(1 + \left(c + -1 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right)\right)\right)\right) \cdot cosTheta \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;cosTheta \leq 1.99999996490334 \cdot 10^{-13}:\\ \;\;\;\;\left(\left(-1 \cdot {c}^{3}\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, cosTheta \cdot \mathsf{fma}\left(-1, \pi, cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \mathsf{fma}\left(-1, {\left({\pi}^{3}\right)}^{0.5} \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right), \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right), 1.5 \cdot \pi\right) - \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right), \mathsf{fma}\left(-1, \frac{1}{c} \cdot \sqrt{\pi}, \frac{\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \pi \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right), cosTheta \cdot \left(\left(-1 \cdot cosTheta\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right), \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot \left(\pi \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right) - \mathsf{fma}\left(-1.5, \sqrt{\pi}, \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(\left(1 - \frac{1}{\sqrt{\pi}}\right) \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right)}{c}\right)\right)}{c}, \left(cosTheta \cdot cosTheta\right) \cdot \left(\left(cosTheta \cdot \mathsf{fma}\left(-1, {\left({\pi}^{3}\right)}^{0.5} \cdot \left(1 - \frac{1}{\sqrt{\pi}}\right), \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot \left(2 + -2 \cdot \frac{1}{\sqrt{\pi}}\right)\right)\right) \cdot \sqrt{\pi} - -1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right)\right)}{c}, \left(\left(cosTheta \cdot cosTheta\right) \cdot cosTheta\right) \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot cosTheta\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-1 \cdot \left(\left(cosTheta \cdot cosTheta\right) \cdot cosTheta\right)\right) \cdot \mathsf{fma}\left(-1, \sqrt{\pi} \cdot \left(\left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right) \cdot \mathsf{fma}\left(-1.5, \sqrt{\pi}, \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot {\left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)}^{2}\right)\right), \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \mathsf{fma}\left(-1.5, \sqrt{\pi}, \left(-1 \cdot {\left({\pi}^{3}\right)}^{0.5}\right) \cdot {\left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)}^{2}\right), \frac{\mathsf{fma}\left(-1, \frac{-1}{cosTheta} \cdot \left(-1 \cdot \sqrt{\pi}\right), \pi \cdot \left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)\right)}{-1 \cdot cosTheta}\right)}{cosTheta}, \mathsf{fma}\left(0.5, \sqrt{\pi}, 1.5 \cdot \left(\pi \cdot \left(1 + \left(c - \frac{1}{\sqrt{\pi}}\right)\right)\right)\right)\right)\right)\right) \cdot cosTheta\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 32.9% accurate, N/A× speedup?

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

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

    \[\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. Taylor expanded in cosTheta around 0

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

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

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

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

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

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

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

Reproduce

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