| Alternative 1 | |
|---|---|
| Error | 0.5 |
| Cost | 13376 |
\[\frac{1}{1 + \left(c + \frac{\sqrt{1 + cosTheta \cdot -2}}{cosTheta \cdot \left(\sqrt{\pi} \cdot e^{cosTheta \cdot cosTheta}\right)}\right)}
\]
(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
(+
(+ 1.0 c)
(/
(exp (* cosTheta (- cosTheta)))
(* (/ cosTheta (sqrt (- (- 1.0 cosTheta) cosTheta))) (sqrt PI))))))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 / ((1.0f + c) + (expf((cosTheta * -cosTheta)) / ((cosTheta / sqrtf(((1.0f - cosTheta) - cosTheta))) * sqrtf(((float) M_PI)))));
}
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(Float32(Float32(1.0) + c) + Float32(exp(Float32(cosTheta * Float32(-cosTheta))) / Float32(Float32(cosTheta / sqrt(Float32(Float32(Float32(1.0) - cosTheta) - cosTheta))) * sqrt(Float32(pi)))))) 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
function tmp = code(cosTheta, c) tmp = single(1.0) / ((single(1.0) + c) + (exp((cosTheta * -cosTheta)) / ((cosTheta / sqrt(((single(1.0) - cosTheta) - cosTheta))) * sqrt(single(pi))))); 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}{\left(1 + c\right) + \frac{e^{cosTheta \cdot \left(-cosTheta\right)}}{\frac{cosTheta}{\sqrt{\left(1 - cosTheta\right) - cosTheta}} \cdot \sqrt{\pi}}}
Results
Initial program 0.7
Simplified0.7
[Start]0.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}}
\] |
|---|---|
rational.json-simplify-2 [=>]0.7 | \[ \frac{1}{\left(1 + c\right) + \color{blue}{e^{\left(-cosTheta\right) \cdot cosTheta} \cdot \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right)}}
\] |
rational.json-simplify-43 [=>]0.7 | \[ \frac{1}{\left(1 + c\right) + \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}\right)}}
\] |
rational.json-simplify-2 [=>]0.7 | \[ \frac{1}{\left(1 + c\right) + \frac{1}{\sqrt{\pi}} \cdot \left(\frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta} \cdot e^{\color{blue}{cosTheta \cdot \left(-cosTheta\right)}}\right)}
\] |
Applied egg-rr0.5
Applied egg-rr0.5
Final simplification0.5
| Alternative 1 | |
|---|---|
| Error | 0.5 |
| Cost | 13376 |
| Alternative 2 | |
|---|---|
| Error | 0.6 |
| Cost | 13344 |
| Alternative 3 | |
|---|---|
| Error | 0.8 |
| Cost | 13312 |
| Alternative 4 | |
|---|---|
| Error | 0.7 |
| Cost | 13280 |
| Alternative 5 | |
|---|---|
| Error | 0.7 |
| Cost | 13280 |
| Alternative 6 | |
|---|---|
| Error | 1.2 |
| Cost | 10304 |
| Alternative 7 | |
|---|---|
| Error | 1.2 |
| Cost | 6976 |
| Alternative 8 | |
|---|---|
| Error | 1.6 |
| Cost | 6848 |
| Alternative 9 | |
|---|---|
| Error | 1.6 |
| Cost | 6784 |
| Alternative 10 | |
|---|---|
| Error | 2.3 |
| Cost | 6464 |
| Alternative 11 | |
|---|---|
| Error | 28.5 |
| Cost | 96 |
| Alternative 12 | |
|---|---|
| Error | 28.5 |
| Cost | 32 |
herbie shell --seed 2023074
(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))))))