| Alternative 1 | |
|---|---|
| Accuracy | 98.3% |
| Cost | 16544 |
\[\frac{1}{\left(1 + c\right) + \frac{\frac{\frac{\sqrt{1 - \left(cosTheta + cosTheta\right)}}{cosTheta}}{\sqrt{\pi}}}{{\left(e^{cosTheta}\right)}^{cosTheta}}}
\]
(FPCore (cosTheta c)
:precision binary32
(/
1.0
(+
(+ 1.0 c)
(*
(* (/ 1.0 (sqrt PI)) (/ (sqrt (- (- 1.0 cosTheta) cosTheta)) cosTheta))
(exp (* (- cosTheta) cosTheta))))))(FPCore (cosTheta c)
:precision binary32
(/
1.0
(+
c
(+
1.0
(/
(/ (sqrt (fma cosTheta -2.0 1.0)) (* cosTheta (sqrt PI)))
(pow (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))));
}
float code(float cosTheta, float c) {
return 1.0f / (c + (1.0f + ((sqrtf(fmaf(cosTheta, -2.0f, 1.0f)) / (cosTheta * sqrtf(((float) M_PI)))) / powf(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 code(cosTheta, c) return Float32(Float32(1.0) / Float32(c + Float32(Float32(1.0) + Float32(Float32(sqrt(fma(cosTheta, Float32(-2.0), Float32(1.0))) / Float32(cosTheta * sqrt(Float32(pi)))) / (exp(cosTheta) ^ cosTheta))))) end
\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}}
\frac{1}{c + \left(1 + \frac{\frac{\sqrt{\mathsf{fma}\left(cosTheta, -2, 1\right)}}{cosTheta \cdot \sqrt{\pi}}}{{\left(e^{cosTheta}\right)}^{cosTheta}}\right)}
Initial program 97.8%
Simplified98.4%
[Start]97.8 | \[ \frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\] |
|---|---|
+-commutative [=>]97.8 | \[ \frac{1}{\color{blue}{\left(c + 1\right)} + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\] |
associate-+l+ [=>]97.8 | \[ \frac{1}{\color{blue}{c + \left(1 + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}\right)}}
\] |
distribute-lft-neg-out [=>]97.8 | \[ \frac{1}{c + \left(1 + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\color{blue}{-cosTheta \cdot cosTheta}}\right)}
\] |
exp-neg [=>]97.7 | \[ \frac{1}{c + \left(1 + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot \color{blue}{\frac{1}{e^{cosTheta \cdot cosTheta}}}\right)}
\] |
associate-*r/ [=>]97.8 | \[ \frac{1}{c + \left(1 + \color{blue}{\frac{\left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot 1}{e^{cosTheta \cdot cosTheta}}}\right)}
\] |
associate-/l* [=>]97.8 | \[ \frac{1}{c + \left(1 + \color{blue}{\frac{\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}{\frac{e^{cosTheta \cdot cosTheta}}{1}}}\right)}
\] |
/-rgt-identity [=>]97.8 | \[ \frac{1}{c + \left(1 + \frac{\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}}{\color{blue}{e^{cosTheta \cdot cosTheta}}}\right)}
\] |
Final simplification98.4%
| Alternative 1 | |
|---|---|
| Accuracy | 98.3% |
| Cost | 16544 |
| Alternative 2 | |
|---|---|
| Accuracy | 98.0% |
| Cost | 13344 |
| Alternative 3 | |
|---|---|
| Accuracy | 98.0% |
| Cost | 13312 |
| Alternative 4 | |
|---|---|
| Accuracy | 97.5% |
| Cost | 13248 |
| Alternative 5 | |
|---|---|
| Accuracy | 97.4% |
| Cost | 10176 |
| Alternative 6 | |
|---|---|
| Accuracy | 96.9% |
| Cost | 10048 |
| Alternative 7 | |
|---|---|
| Accuracy | 96.3% |
| Cost | 6944 |
| Alternative 8 | |
|---|---|
| Accuracy | 96.1% |
| Cost | 6912 |
| Alternative 9 | |
|---|---|
| Accuracy | 95.5% |
| Cost | 6848 |
| Alternative 10 | |
|---|---|
| Accuracy | 94.9% |
| Cost | 6784 |
| Alternative 11 | |
|---|---|
| Accuracy | 95.5% |
| Cost | 6784 |
| Alternative 12 | |
|---|---|
| Accuracy | 93.0% |
| Cost | 6464 |
| Alternative 13 | |
|---|---|
| Accuracy | 10.8% |
| Cost | 96 |
| Alternative 14 | |
|---|---|
| Accuracy | 10.8% |
| Cost | 32 |
herbie shell --seed 2023151
(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))))))