| Alternative 1 | |
|---|---|
| Accuracy | 98.3% |
| Cost | 3680 |
\[\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\]
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (- (log (- 1.0 u0))) (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (- (log1p (- u0))) (+ (/ cos2phi (* alphax alphax)) (/ (/ sin2phi alphay) alphay))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return -logf((1.0f - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)));
}
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return -log1pf(-u0) / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay));
}
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(-log(Float32(Float32(1.0) - u0))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay)))) end
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(-log1p(Float32(-u0))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) / alphay))) end
\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}
Results
Initial program 60.8%
Simplified98.3%
[Start]60.8 | \[ \frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\] |
|---|---|
sub-neg [=>]60.8 | \[ \frac{-\log \color{blue}{\left(1 + \left(-u0\right)\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\] |
log1p-def [=>]98.3 | \[ \frac{-\color{blue}{\mathsf{log1p}\left(-u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\] |
Applied egg-rr98.2%
[Start]98.3 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\] |
|---|---|
frac-2neg [=>]98.3 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{-sin2phi}{-alphay \cdot alphay}}}
\] |
clear-num [=>]98.2 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{1}{\frac{-alphay \cdot alphay}{-sin2phi}}}}
\] |
associate-/r/ [=>]98.2 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{1}{-alphay \cdot alphay} \cdot \left(-sin2phi\right)}}
\] |
distribute-rgt-neg-in [=>]98.2 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{1}{\color{blue}{alphay \cdot \left(-alphay\right)}} \cdot \left(-sin2phi\right)}
\] |
Applied egg-rr98.3%
[Start]98.2 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{1}{alphay \cdot \left(-alphay\right)} \cdot \left(-sin2phi\right)}
\] |
|---|---|
associate-*l/ [=>]98.3 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{1 \cdot \left(-sin2phi\right)}{alphay \cdot \left(-alphay\right)}}}
\] |
*-un-lft-identity [<=]98.3 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\color{blue}{-sin2phi}}{alphay \cdot \left(-alphay\right)}}
\] |
associate-/r* [=>]98.3 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{-sin2phi}{alphay}}{-alphay}}}
\] |
add-sqr-sqrt [=>]-0.0 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{\color{blue}{\sqrt{-sin2phi} \cdot \sqrt{-sin2phi}}}{alphay}}{-alphay}}
\] |
sqrt-unprod [=>]35.4 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{\color{blue}{\sqrt{\left(-sin2phi\right) \cdot \left(-sin2phi\right)}}}{alphay}}{-alphay}}
\] |
sqr-neg [=>]35.4 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{\sqrt{\color{blue}{sin2phi \cdot sin2phi}}}{alphay}}{-alphay}}
\] |
sqrt-unprod [<=]34.0 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{\color{blue}{\sqrt{sin2phi} \cdot \sqrt{sin2phi}}}{alphay}}{-alphay}}
\] |
add-sqr-sqrt [<=]34.0 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{\color{blue}{sin2phi}}{alphay}}{-alphay}}
\] |
add-sqr-sqrt [=>]-0.0 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{\color{blue}{\sqrt{-alphay} \cdot \sqrt{-alphay}}}}
\] |
sqrt-unprod [=>]98.3 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{\color{blue}{\sqrt{\left(-alphay\right) \cdot \left(-alphay\right)}}}}
\] |
sqr-neg [=>]98.3 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{\sqrt{\color{blue}{alphay \cdot alphay}}}}
\] |
sqrt-unprod [<=]97.8 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{\color{blue}{\sqrt{alphay} \cdot \sqrt{alphay}}}}
\] |
add-sqr-sqrt [<=]98.3 | \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{\color{blue}{alphay}}}
\] |
Final simplification98.3%
| Alternative 1 | |
|---|---|
| Accuracy | 98.3% |
| Cost | 3680 |
| Alternative 2 | |
|---|---|
| Accuracy | 92.6% |
| Cost | 3556 |
| Alternative 3 | |
|---|---|
| Accuracy | 83.1% |
| Cost | 740 |
| Alternative 4 | |
|---|---|
| Accuracy | 81.1% |
| Cost | 676 |
| Alternative 5 | |
|---|---|
| Accuracy | 81.1% |
| Cost | 676 |
| Alternative 6 | |
|---|---|
| Accuracy | 66.3% |
| Cost | 612 |
| Alternative 7 | |
|---|---|
| Accuracy | 81.1% |
| Cost | 612 |
| Alternative 8 | |
|---|---|
| Accuracy | 87.0% |
| Cost | 608 |
| Alternative 9 | |
|---|---|
| Accuracy | 66.4% |
| Cost | 420 |
| Alternative 10 | |
|---|---|
| Accuracy | 66.4% |
| Cost | 420 |
| Alternative 11 | |
|---|---|
| Accuracy | 66.4% |
| Cost | 420 |
| Alternative 12 | |
|---|---|
| Accuracy | 66.4% |
| Cost | 420 |
| Alternative 13 | |
|---|---|
| Accuracy | 75.5% |
| Cost | 416 |
| Alternative 14 | |
|---|---|
| Accuracy | 23.5% |
| Cost | 224 |
| Alternative 15 | |
|---|---|
| Accuracy | 23.5% |
| Cost | 224 |
| Alternative 16 | |
|---|---|
| Accuracy | 23.5% |
| Cost | 224 |
herbie shell --seed 2023138
(FPCore (alphax alphay u0 cos2phi sin2phi)
:name "Beckmann Distribution sample, tan2theta, alphax != alphay, u1 <= 0.5"
:precision binary32
:pre (and (and (and (and (and (<= 0.0001 alphax) (<= alphax 1.0)) (and (<= 0.0001 alphay) (<= alphay 1.0))) (and (<= 2.328306437e-10 u0) (<= u0 1.0))) (and (<= 0.0 cos2phi) (<= cos2phi 1.0))) (<= 0.0 sin2phi))
(/ (- (log (- 1.0 u0))) (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))