| Alternative 1 | |
|---|---|
| Error | 0.3 |
| Cost | 3424 |
\[\alpha \cdot \left(\left(-\alpha\right) \cdot \mathsf{log1p}\left(-u0\right)\right)
\]
(FPCore (alpha u0) :precision binary32 (* (* (- alpha) alpha) (log (- 1.0 u0))))
(FPCore (alpha u0) :precision binary32 (* (* alpha (- alpha)) (log1p (- u0))))
float code(float alpha, float u0) {
return (-alpha * alpha) * logf((1.0f - u0));
}
float code(float alpha, float u0) {
return (alpha * -alpha) * log1pf(-u0);
}
function code(alpha, u0) return Float32(Float32(Float32(-alpha) * alpha) * log(Float32(Float32(1.0) - u0))) end
function code(alpha, u0) return Float32(Float32(alpha * Float32(-alpha)) * log1p(Float32(-u0))) end
\left(\left(-\alpha\right) \cdot \alpha\right) \cdot \log \left(1 - u0\right)
\left(\alpha \cdot \left(-\alpha\right)\right) \cdot \mathsf{log1p}\left(-u0\right)
Results
Initial program 14.0
Applied egg-rr0.3
Simplified0.3
[Start]0.3 | \[ \left(\left(-\alpha\right) \cdot \alpha\right) \cdot \left(0 + \mathsf{log1p}\left(-u0\right)\right)
\] |
|---|---|
+-lft-identity [=>]0.3 | \[ \left(\left(-\alpha\right) \cdot \alpha\right) \cdot \color{blue}{\mathsf{log1p}\left(-u0\right)}
\] |
Final simplification0.3
| Alternative 1 | |
|---|---|
| Error | 0.3 |
| Cost | 3424 |
| Alternative 2 | |
|---|---|
| Error | 2.8 |
| Cost | 480 |
| Alternative 3 | |
|---|---|
| Error | 4.1 |
| Cost | 352 |
| Alternative 4 | |
|---|---|
| Error | 4.1 |
| Cost | 352 |
| Alternative 5 | |
|---|---|
| Error | 8.2 |
| Cost | 160 |
| Alternative 6 | |
|---|---|
| Error | 8.2 |
| Cost | 160 |
| Alternative 7 | |
|---|---|
| Error | 29.6 |
| Cost | 32 |
herbie shell --seed 2023046
(FPCore (alpha u0)
:name "Beckmann Distribution sample, tan2theta, alphax == alphay"
:precision binary32
:pre (and (and (<= 0.0001 alpha) (<= alpha 1.0)) (and (<= 2.328306437e-10 u0) (<= u0 1.0)))
(* (* (- alpha) alpha) (log (- 1.0 u0))))