| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 10144 |
\[\frac{0.125}{s} \cdot \frac{\frac{e^{\frac{r}{-s}} + e^{\frac{r \cdot -0.3333333333333333}{s}}}{\pi}}{r}
\]
(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 (/ (/ (/ (+ (exp (/ r (- s))) (exp (/ (* r (/ 0.5 s)) -1.5))) PI) r) (* s 8.0)))
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 (((expf((r / -s)) + expf(((r * (0.5f / s)) / -1.5f))) / ((float) M_PI)) / r) / (s * 8.0f);
}
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(exp(Float32(r / Float32(-s))) + exp(Float32(Float32(r * Float32(Float32(0.5) / s)) / Float32(-1.5)))) / Float32(pi)) / r) / Float32(s * Float32(8.0))) 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 = (((exp((r / -s)) + exp(((r * (single(0.5) / s)) / single(-1.5)))) / single(pi)) / r) / (s * single(8.0)); 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{\frac{\frac{e^{\frac{r}{-s}} + e^{\frac{r \cdot \frac{0.5}{s}}{-1.5}}}{\pi}}{r}}{s \cdot 8}
Results
Initial program 0.1
Simplified0.8
[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}
\] |
|---|---|
rational.json-simplify-67 [=>]0.8 | \[ \color{blue}{\left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right) \cdot \frac{0.5}{\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}
\] |
rational.json-simplify-41 [=>]0.1 | \[ \color{blue}{\frac{0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}}{\frac{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}{0.5}}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
rational.json-simplify-67 [=>]0.8 | \[ \color{blue}{\left(\left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right) + \left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right)\right) \cdot \frac{0.5}{\frac{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}{0.5}}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
rational.json-simplify-41 [<=]0.8 | \[ \left(\left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right) + \left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right)\right) \cdot \color{blue}{\left(0.5 \cdot \frac{0.5}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}\right)} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
metadata-eval [<=]0.8 | \[ \left(\left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right) + \left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right)\right) \cdot \left(\color{blue}{\left(0.25 + 0.25\right)} \cdot \frac{0.5}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}\right) + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\] |
rational.json-simplify-67 [<=]0.8 | \[ \left(\left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right) + \left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right)\right) \cdot \color{blue}{\frac{0.25}{\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}
\] |
rational.json-simplify-43 [=>]0.8 | \[ \left(\left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right) + \left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right)\right) \cdot \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \color{blue}{e^{\frac{-r}{3 \cdot s}} \cdot \frac{0.75}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}}
\] |
rational.json-simplify-50 [=>]0.8 | \[ \left(\left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right) + \left(0.25 \cdot e^{\frac{-r}{s}} + 0.25 \cdot e^{\frac{-r}{s}}\right)\right) \cdot \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \color{blue}{\frac{0.75}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{3 \cdot s}}}
\] |
Applied egg-rr0.9
Applied egg-rr0.9
Applied egg-rr0.2
Applied egg-rr0.2
Final simplification0.2
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 10144 |
| Alternative 2 | |
|---|---|
| Error | 0.2 |
| Cost | 10144 |
| Alternative 3 | |
|---|---|
| Error | 29.1 |
| Cost | 6912 |
| Alternative 4 | |
|---|---|
| Error | 29.1 |
| Cost | 6912 |
| Alternative 5 | |
|---|---|
| Error | 29.1 |
| Cost | 6848 |
| Alternative 6 | |
|---|---|
| Error | 29.2 |
| Cost | 3744 |
| Alternative 7 | |
|---|---|
| Error | 29.2 |
| Cost | 3680 |
| Alternative 8 | |
|---|---|
| Error | 29.2 |
| Cost | 3456 |
| Alternative 9 | |
|---|---|
| Error | 29.2 |
| Cost | 3456 |
| Alternative 10 | |
|---|---|
| Error | 29.2 |
| Cost | 3392 |
| Alternative 11 | |
|---|---|
| Error | 29.2 |
| Cost | 3392 |
| Alternative 12 | |
|---|---|
| Error | 29.2 |
| Cost | 3392 |
| Alternative 13 | |
|---|---|
| Error | 32.0 |
| Cost | 160 |
herbie shell --seed 2023073
(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))))