| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 13728 |
\[\frac{0.25}{s \cdot \left(2 \cdot \pi\right)} \cdot \frac{e^{\frac{-r}{s}}}{r} + \frac{e^{\frac{-r}{s \cdot 3}}}{r} \cdot \frac{0.75}{s \cdot \left(\pi \cdot 6\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.25 (* s (* 2.0 PI))) (/ (exp (/ (- r) s)) r)) (* (* (/ 1.0 (* (* s PI) -6.0)) -0.75) (/ (exp (/ (- r) (* s 3.0))) r))))
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.25f / (s * (2.0f * ((float) M_PI)))) * (expf((-r / s)) / r)) + (((1.0f / ((s * ((float) M_PI)) * -6.0f)) * -0.75f) * (expf((-r / (s * 3.0f))) / r));
}
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(Float32(Float32(0.25) / Float32(s * Float32(Float32(2.0) * Float32(pi)))) * Float32(exp(Float32(Float32(-r) / s)) / r)) + Float32(Float32(Float32(Float32(1.0) / Float32(Float32(s * Float32(pi)) * Float32(-6.0))) * Float32(-0.75)) * Float32(exp(Float32(Float32(-r) / Float32(s * Float32(3.0)))) / r))) 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.25) / (s * (single(2.0) * single(pi)))) * (exp((-r / s)) / r)) + (((single(1.0) / ((s * single(pi)) * single(-6.0))) * single(-0.75)) * (exp((-r / (s * single(3.0)))) / r)); 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}
\frac{0.25}{s \cdot \left(2 \cdot \pi\right)} \cdot \frac{e^{\frac{-r}{s}}}{r} + \left(\frac{1}{\left(s \cdot \pi\right) \cdot -6} \cdot -0.75\right) \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r}
Results
Initial program 0.1
Simplified0.1
[Start]0.1 | \[ \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}
\] |
|---|---|
times-frac [=>]0.1 | \[ \color{blue}{\frac{0.25}{\left(2 \cdot \pi\right) \cdot s} \cdot \frac{e^{\frac{-r}{s}}}{r}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
*-commutative [=>]0.1 | \[ \frac{0.25}{\color{blue}{s \cdot \left(2 \cdot \pi\right)}} \cdot \frac{e^{\frac{-r}{s}}}{r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
distribute-frac-neg [=>]0.1 | \[ \frac{0.25}{s \cdot \left(2 \cdot \pi\right)} \cdot \frac{e^{\color{blue}{-\frac{r}{s}}}}{r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
times-frac [=>]0.1 | \[ \frac{0.25}{s \cdot \left(2 \cdot \pi\right)} \cdot \frac{e^{-\frac{r}{s}}}{r} + \color{blue}{\frac{0.75}{\left(6 \cdot \pi\right) \cdot s} \cdot \frac{e^{\frac{-r}{3 \cdot s}}}{r}}
\] |
*-commutative [=>]0.1 | \[ \frac{0.25}{s \cdot \left(2 \cdot \pi\right)} \cdot \frac{e^{-\frac{r}{s}}}{r} + \frac{0.75}{\color{blue}{s \cdot \left(6 \cdot \pi\right)}} \cdot \frac{e^{\frac{-r}{3 \cdot s}}}{r}
\] |
*-commutative [=>]0.1 | \[ \frac{0.25}{s \cdot \left(2 \cdot \pi\right)} \cdot \frac{e^{-\frac{r}{s}}}{r} + \frac{0.75}{s \cdot \color{blue}{\left(\pi \cdot 6\right)}} \cdot \frac{e^{\frac{-r}{3 \cdot s}}}{r}
\] |
*-commutative [=>]0.1 | \[ \frac{0.25}{s \cdot \left(2 \cdot \pi\right)} \cdot \frac{e^{-\frac{r}{s}}}{r} + \frac{0.75}{s \cdot \left(\pi \cdot 6\right)} \cdot \frac{e^{\frac{-r}{\color{blue}{s \cdot 3}}}}{r}
\] |
Applied egg-rr0.2
Final simplification0.2
| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 13728 |
| Alternative 2 | |
|---|---|
| Error | 0.2 |
| Cost | 13664 |
| Alternative 3 | |
|---|---|
| Error | 0.2 |
| Cost | 13632 |
| Alternative 4 | |
|---|---|
| Error | 0.2 |
| Cost | 10208 |
| Alternative 5 | |
|---|---|
| Error | 0.2 |
| Cost | 10144 |
| Alternative 6 | |
|---|---|
| Error | 0.2 |
| Cost | 10144 |
| Alternative 7 | |
|---|---|
| Error | 17.9 |
| Cost | 9792 |
| Alternative 8 | |
|---|---|
| Error | 28.9 |
| Cost | 6816 |
| Alternative 9 | |
|---|---|
| Error | 29.1 |
| Cost | 3520 |
| Alternative 10 | |
|---|---|
| Error | 29.1 |
| Cost | 3456 |
| Alternative 11 | |
|---|---|
| Error | 29.1 |
| Cost | 3456 |
| Alternative 12 | |
|---|---|
| Error | 29.1 |
| Cost | 3392 |
| Alternative 13 | |
|---|---|
| Error | 29.1 |
| Cost | 3392 |
| Alternative 14 | |
|---|---|
| Error | 29.1 |
| Cost | 3392 |
herbie shell --seed 2023047
(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))))