| Alternative 1 | |
|---|---|
| Accuracy | 97.5% |
| Cost | 10144 |
\[\left(e^{\frac{r}{s} \cdot -0.3333333333333333} + e^{-\frac{r}{s}}\right) \cdot \frac{0.125}{r \cdot \left(s \cdot \pi\right)}
\]
(FPCore (s r) :precision binary32 (+ (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r)) (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r))))
(FPCore (s r) :precision binary32 (* 0.125 (/ (+ (exp (* (/ r s) -0.3333333333333333)) (exp (- (/ r s)))) (* s (* r PI)))))
float code(float s, float r) {
return ((0.25f * expf((-r / s))) / (((2.0f * ((float) M_PI)) * s) * r)) + ((0.75f * expf((-r / (3.0f * s)))) / (((6.0f * ((float) M_PI)) * s) * r));
}
float code(float s, float r) {
return 0.125f * ((expf(((r / s) * -0.3333333333333333f)) + expf(-(r / s))) / (s * (r * ((float) M_PI))));
}
function code(s, r) return Float32(Float32(Float32(Float32(0.25) * exp(Float32(Float32(-r) / s))) / Float32(Float32(Float32(Float32(2.0) * Float32(pi)) * s) * r)) + Float32(Float32(Float32(0.75) * exp(Float32(Float32(-r) / Float32(Float32(3.0) * s)))) / Float32(Float32(Float32(Float32(6.0) * Float32(pi)) * s) * r))) end
function code(s, r) return Float32(Float32(0.125) * Float32(Float32(exp(Float32(Float32(r / s) * Float32(-0.3333333333333333))) + exp(Float32(-Float32(r / s)))) / Float32(s * Float32(r * Float32(pi))))) end
function tmp = code(s, r) tmp = ((single(0.25) * exp((-r / s))) / (((single(2.0) * single(pi)) * s) * r)) + ((single(0.75) * exp((-r / (single(3.0) * s)))) / (((single(6.0) * single(pi)) * s) * r)); end
function tmp = code(s, r) tmp = single(0.125) * ((exp(((r / s) * single(-0.3333333333333333))) + exp(-(r / s))) / (s * (r * single(pi)))); end
\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
0.125 \cdot \frac{e^{\frac{r}{s} \cdot -0.3333333333333333} + e^{-\frac{r}{s}}}{s \cdot \left(r \cdot \pi\right)}
Results
Initial program 99.6%
Simplified95.7%
[Start]99.6 | \[ \frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
|---|---|
associate-*l/ [<=]97.6 | \[ \color{blue}{\frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
associate-*l* [=>]97.6 | \[ \frac{0.25}{\color{blue}{\left(2 \cdot \pi\right) \cdot \left(s \cdot r\right)}} \cdot e^{\frac{-r}{s}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
associate-*l* [=>]97.6 | \[ \frac{0.25}{\color{blue}{2 \cdot \left(\pi \cdot \left(s \cdot r\right)\right)}} \cdot e^{\frac{-r}{s}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
associate-/r* [=>]97.6 | \[ \color{blue}{\frac{\frac{0.25}{2}}{\pi \cdot \left(s \cdot r\right)}} \cdot e^{\frac{-r}{s}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
metadata-eval [=>]97.6 | \[ \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{s}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
metadata-eval [<=]97.6 | \[ \frac{\color{blue}{\frac{0.75}{6}}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{s}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
associate-/r* [<=]97.6 | \[ \color{blue}{\frac{0.75}{6 \cdot \left(\pi \cdot \left(s \cdot r\right)\right)}} \cdot e^{\frac{-r}{s}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
associate-*l* [<=]97.6 | \[ \frac{0.75}{\color{blue}{\left(6 \cdot \pi\right) \cdot \left(s \cdot r\right)}} \cdot e^{\frac{-r}{s}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
associate-*l* [<=]97.6 | \[ \frac{0.75}{\color{blue}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{s}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
associate-*l/ [<=]97.6 | \[ \frac{0.75}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \color{blue}{\frac{0.75}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{3 \cdot s}}}
\] |
distribute-lft-out [=>]97.6 | \[ \color{blue}{\frac{0.75}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \cdot \left(e^{\frac{-r}{s}} + e^{\frac{-r}{3 \cdot s}}\right)}
\] |
Taylor expanded in r around inf 99.5%
Final simplification99.5%
| Alternative 1 | |
|---|---|
| Accuracy | 97.5% |
| Cost | 10144 |
| Alternative 2 | |
|---|---|
| Accuracy | 97.5% |
| Cost | 10144 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.5% |
| Cost | 10144 |
| Alternative 4 | |
|---|---|
| Accuracy | 11.8% |
| Cost | 9792 |
| Alternative 5 | |
|---|---|
| Accuracy | 44.0% |
| Cost | 9792 |
| Alternative 6 | |
|---|---|
| Accuracy | 9.4% |
| Cost | 6816 |
| Alternative 7 | |
|---|---|
| Accuracy | 9.4% |
| Cost | 6816 |
| Alternative 8 | |
|---|---|
| Accuracy | 9.4% |
| Cost | 6816 |
| Alternative 9 | |
|---|---|
| Accuracy | 8.9% |
| Cost | 3456 |
| Alternative 10 | |
|---|---|
| Accuracy | 8.9% |
| Cost | 3392 |
| Alternative 11 | |
|---|---|
| Accuracy | 8.9% |
| Cost | 3392 |
herbie shell --seed 2023139
(FPCore (s r)
:name "Disney BSSRDF, PDF of scattering profile"
:precision binary32
:pre (and (and (<= 0.0 s) (<= s 256.0)) (and (< 1e-6 r) (< r 1000000.0)))
(+ (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r)) (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r))))