| Alternative 1 | |
|---|---|
| Accuracy | 98.3% |
| Cost | 3552 |
(FPCore (s u) :precision binary32 (* (* 3.0 s) (log (/ 1.0 (- 1.0 (/ (- u 0.25) 0.75))))))
(FPCore (s u)
:precision binary32
(*
s
(*
(-
(log1p (* 2.3703703703703702 (pow (- 0.25 u) 3.0)))
(log1p
(* (- 0.25 u) (- (* (- 0.25 u) 1.7777777777777777) 1.3333333333333333))))
-3.0)))float code(float s, float u) {
return (3.0f * s) * logf((1.0f / (1.0f - ((u - 0.25f) / 0.75f))));
}
float code(float s, float u) {
return s * ((log1pf((2.3703703703703702f * powf((0.25f - u), 3.0f))) - log1pf(((0.25f - u) * (((0.25f - u) * 1.7777777777777777f) - 1.3333333333333333f)))) * -3.0f);
}
function code(s, u) return Float32(Float32(Float32(3.0) * s) * log(Float32(Float32(1.0) / Float32(Float32(1.0) - Float32(Float32(u - Float32(0.25)) / Float32(0.75)))))) end
function code(s, u) return Float32(s * Float32(Float32(log1p(Float32(Float32(2.3703703703703702) * (Float32(Float32(0.25) - u) ^ Float32(3.0)))) - log1p(Float32(Float32(Float32(0.25) - u) * Float32(Float32(Float32(Float32(0.25) - u) * Float32(1.7777777777777777)) - Float32(1.3333333333333333))))) * Float32(-3.0))) end
\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)
s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(\left(0.25 - u\right) \cdot 1.7777777777777777 - 1.3333333333333333\right)\right)\right) \cdot -3\right)
Results
Initial program 95.8%
Simplified98.3%
[Start]95.8 | \[ \left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)
\] |
|---|---|
associate-*l* [=>]95.7 | \[ \color{blue}{3 \cdot \left(s \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)\right)}
\] |
*-commutative [=>]95.7 | \[ \color{blue}{\left(s \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)\right) \cdot 3}
\] |
associate-*l* [=>]95.8 | \[ \color{blue}{s \cdot \left(\log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \cdot 3\right)}
\] |
log-rec [=>]96.6 | \[ s \cdot \left(\color{blue}{\left(-\log \left(1 - \frac{u - 0.25}{0.75}\right)\right)} \cdot 3\right)
\] |
distribute-lft-neg-out [=>]96.6 | \[ s \cdot \color{blue}{\left(-\log \left(1 - \frac{u - 0.25}{0.75}\right) \cdot 3\right)}
\] |
distribute-rgt-neg-in [=>]96.6 | \[ s \cdot \color{blue}{\left(\log \left(1 - \frac{u - 0.25}{0.75}\right) \cdot \left(-3\right)\right)}
\] |
sub-neg [=>]96.6 | \[ s \cdot \left(\log \color{blue}{\left(1 + \left(-\frac{u - 0.25}{0.75}\right)\right)} \cdot \left(-3\right)\right)
\] |
log1p-def [=>]98.3 | \[ s \cdot \left(\color{blue}{\mathsf{log1p}\left(-\frac{u - 0.25}{0.75}\right)} \cdot \left(-3\right)\right)
\] |
distribute-neg-frac [=>]98.3 | \[ s \cdot \left(\mathsf{log1p}\left(\color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right) \cdot \left(-3\right)\right)
\] |
sub-neg [=>]98.3 | \[ s \cdot \left(\mathsf{log1p}\left(\frac{-\color{blue}{\left(u + \left(-0.25\right)\right)}}{0.75}\right) \cdot \left(-3\right)\right)
\] |
+-commutative [=>]98.3 | \[ s \cdot \left(\mathsf{log1p}\left(\frac{-\color{blue}{\left(\left(-0.25\right) + u\right)}}{0.75}\right) \cdot \left(-3\right)\right)
\] |
distribute-neg-in [=>]98.3 | \[ s \cdot \left(\mathsf{log1p}\left(\frac{\color{blue}{\left(-\left(-0.25\right)\right) + \left(-u\right)}}{0.75}\right) \cdot \left(-3\right)\right)
\] |
metadata-eval [=>]98.3 | \[ s \cdot \left(\mathsf{log1p}\left(\frac{\left(-\color{blue}{-0.25}\right) + \left(-u\right)}{0.75}\right) \cdot \left(-3\right)\right)
\] |
metadata-eval [=>]98.3 | \[ s \cdot \left(\mathsf{log1p}\left(\frac{\color{blue}{0.25} + \left(-u\right)}{0.75}\right) \cdot \left(-3\right)\right)
\] |
unsub-neg [=>]98.3 | \[ s \cdot \left(\mathsf{log1p}\left(\frac{\color{blue}{0.25 - u}}{0.75}\right) \cdot \left(-3\right)\right)
\] |
metadata-eval [=>]98.3 | \[ s \cdot \left(\mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right) \cdot \color{blue}{-3}\right)
\] |
Applied egg-rr95.6%
[Start]98.3 | \[ s \cdot \left(\mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right) \cdot -3\right)
\] |
|---|---|
log1p-udef [=>]96.6 | \[ s \cdot \left(\color{blue}{\log \left(1 + \frac{0.25 - u}{0.75}\right)} \cdot -3\right)
\] |
flip3-+ [=>]95.8 | \[ s \cdot \left(\log \color{blue}{\left(\frac{{1}^{3} + {\left(\frac{0.25 - u}{0.75}\right)}^{3}}{1 \cdot 1 + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)}\right)} \cdot -3\right)
\] |
log-div [=>]95.9 | \[ s \cdot \left(\color{blue}{\left(\log \left({1}^{3} + {\left(\frac{0.25 - u}{0.75}\right)}^{3}\right) - \log \left(1 \cdot 1 + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)\right)\right)} \cdot -3\right)
\] |
metadata-eval [=>]95.9 | \[ s \cdot \left(\left(\log \left(\color{blue}{1} + {\left(\frac{0.25 - u}{0.75}\right)}^{3}\right) - \log \left(1 \cdot 1 + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)\right)\right) \cdot -3\right)
\] |
pow3 [<=]95.9 | \[ s \cdot \left(\left(\log \left(1 + \color{blue}{\left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75}\right) \cdot \frac{0.25 - u}{0.75}}\right) - \log \left(1 \cdot 1 + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)\right)\right) \cdot -3\right)
\] |
log1p-udef [<=]95.9 | \[ s \cdot \left(\left(\color{blue}{\mathsf{log1p}\left(\left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75}\right) \cdot \frac{0.25 - u}{0.75}\right)} - \log \left(1 \cdot 1 + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)\right)\right) \cdot -3\right)
\] |
pow3 [=>]95.9 | \[ s \cdot \left(\left(\mathsf{log1p}\left(\color{blue}{{\left(\frac{0.25 - u}{0.75}\right)}^{3}}\right) - \log \left(1 \cdot 1 + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)\right)\right) \cdot -3\right)
\] |
div-sub [=>]95.7 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\color{blue}{\left(\frac{0.25}{0.75} - \frac{u}{0.75}\right)}}^{3}\right) - \log \left(1 \cdot 1 + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)\right)\right) \cdot -3\right)
\] |
metadata-eval [=>]95.7 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\left(\color{blue}{0.3333333333333333} - \frac{u}{0.75}\right)}^{3}\right) - \log \left(1 \cdot 1 + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)\right)\right) \cdot -3\right)
\] |
div-inv [=>]95.9 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\left(0.3333333333333333 - \color{blue}{u \cdot \frac{1}{0.75}}\right)}^{3}\right) - \log \left(1 \cdot 1 + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)\right)\right) \cdot -3\right)
\] |
metadata-eval [=>]95.9 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\left(0.3333333333333333 - u \cdot \color{blue}{1.3333333333333333}\right)}^{3}\right) - \log \left(1 \cdot 1 + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)\right)\right) \cdot -3\right)
\] |
metadata-eval [=>]95.9 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\left(0.3333333333333333 - u \cdot 1.3333333333333333\right)}^{3}\right) - \log \left(\color{blue}{1} + \left(\frac{0.25 - u}{0.75} \cdot \frac{0.25 - u}{0.75} - 1 \cdot \frac{0.25 - u}{0.75}\right)\right)\right) \cdot -3\right)
\] |
Simplified98.3%
[Start]95.6 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\left(0.3333333333333333 - u \cdot 1.3333333333333333\right)}^{3}\right) - \log \left(1 + \left({\left(0.25 - u\right)}^{2} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right)\right) \cdot -3\right)
\] |
|---|---|
cancel-sign-sub-inv [=>]95.6 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\color{blue}{\left(0.3333333333333333 + \left(-u\right) \cdot 1.3333333333333333\right)}}^{3}\right) - \log \left(1 + \left({\left(0.25 - u\right)}^{2} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right)\right) \cdot -3\right)
\] |
metadata-eval [<=]95.6 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\left(\color{blue}{0.25 \cdot 1.3333333333333333} + \left(-u\right) \cdot 1.3333333333333333\right)}^{3}\right) - \log \left(1 + \left({\left(0.25 - u\right)}^{2} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right)\right) \cdot -3\right)
\] |
mul-1-neg [<=]95.6 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\left(0.25 \cdot 1.3333333333333333 + \color{blue}{\left(-1 \cdot u\right)} \cdot 1.3333333333333333\right)}^{3}\right) - \log \left(1 + \left({\left(0.25 - u\right)}^{2} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right)\right) \cdot -3\right)
\] |
distribute-rgt-in [<=]95.8 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\color{blue}{\left(1.3333333333333333 \cdot \left(0.25 + -1 \cdot u\right)\right)}}^{3}\right) - \log \left(1 + \left({\left(0.25 - u\right)}^{2} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right)\right) \cdot -3\right)
\] |
mul-1-neg [=>]95.8 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\left(1.3333333333333333 \cdot \left(0.25 + \color{blue}{\left(-u\right)}\right)\right)}^{3}\right) - \log \left(1 + \left({\left(0.25 - u\right)}^{2} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right)\right) \cdot -3\right)
\] |
sub-neg [<=]95.8 | \[ s \cdot \left(\left(\mathsf{log1p}\left({\left(1.3333333333333333 \cdot \color{blue}{\left(0.25 - u\right)}\right)}^{3}\right) - \log \left(1 + \left({\left(0.25 - u\right)}^{2} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right)\right) \cdot -3\right)
\] |
cube-prod [=>]95.7 | \[ s \cdot \left(\left(\mathsf{log1p}\left(\color{blue}{{1.3333333333333333}^{3} \cdot {\left(0.25 - u\right)}^{3}}\right) - \log \left(1 + \left({\left(0.25 - u\right)}^{2} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right)\right) \cdot -3\right)
\] |
metadata-eval [=>]96.0 | \[ s \cdot \left(\left(\mathsf{log1p}\left(\color{blue}{2.3703703703703702} \cdot {\left(0.25 - u\right)}^{3}\right) - \log \left(1 + \left({\left(0.25 - u\right)}^{2} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right)\right) \cdot -3\right)
\] |
log1p-def [=>]97.5 | \[ s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \color{blue}{\mathsf{log1p}\left({\left(0.25 - u\right)}^{2} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)}\right) \cdot -3\right)
\] |
unpow2 [=>]97.5 | \[ s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \mathsf{log1p}\left(\color{blue}{\left(\left(0.25 - u\right) \cdot \left(0.25 - u\right)\right)} \cdot 1.7777777777777777 - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right) \cdot -3\right)
\] |
associate-*l* [=>]97.5 | \[ s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \mathsf{log1p}\left(\color{blue}{\left(0.25 - u\right) \cdot \left(\left(0.25 - u\right) \cdot 1.7777777777777777\right)} - \left(0.3333333333333333 - u \cdot 1.3333333333333333\right)\right)\right) \cdot -3\right)
\] |
cancel-sign-sub-inv [=>]97.5 | \[ s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(\left(0.25 - u\right) \cdot 1.7777777777777777\right) - \color{blue}{\left(0.3333333333333333 + \left(-u\right) \cdot 1.3333333333333333\right)}\right)\right) \cdot -3\right)
\] |
metadata-eval [<=]97.5 | \[ s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(\left(0.25 - u\right) \cdot 1.7777777777777777\right) - \left(\color{blue}{0.25 \cdot 1.3333333333333333} + \left(-u\right) \cdot 1.3333333333333333\right)\right)\right) \cdot -3\right)
\] |
mul-1-neg [<=]97.5 | \[ s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(\left(0.25 - u\right) \cdot 1.7777777777777777\right) - \left(0.25 \cdot 1.3333333333333333 + \color{blue}{\left(-1 \cdot u\right)} \cdot 1.3333333333333333\right)\right)\right) \cdot -3\right)
\] |
distribute-rgt-in [<=]98.3 | \[ s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(\left(0.25 - u\right) \cdot 1.7777777777777777\right) - \color{blue}{1.3333333333333333 \cdot \left(0.25 + -1 \cdot u\right)}\right)\right) \cdot -3\right)
\] |
mul-1-neg [=>]98.3 | \[ s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(\left(0.25 - u\right) \cdot 1.7777777777777777\right) - 1.3333333333333333 \cdot \left(0.25 + \color{blue}{\left(-u\right)}\right)\right)\right) \cdot -3\right)
\] |
sub-neg [<=]98.3 | \[ s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(\left(0.25 - u\right) \cdot 1.7777777777777777\right) - 1.3333333333333333 \cdot \color{blue}{\left(0.25 - u\right)}\right)\right) \cdot -3\right)
\] |
*-commutative [=>]98.3 | \[ s \cdot \left(\left(\mathsf{log1p}\left(2.3703703703703702 \cdot {\left(0.25 - u\right)}^{3}\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(\left(0.25 - u\right) \cdot 1.7777777777777777\right) - \color{blue}{\left(0.25 - u\right) \cdot 1.3333333333333333}\right)\right) \cdot -3\right)
\] |
Final simplification98.3%
| Alternative 1 | |
|---|---|
| Accuracy | 98.3% |
| Cost | 3552 |
| Alternative 2 | |
|---|---|
| Accuracy | 96.1% |
| Cost | 3488 |
| Alternative 3 | |
|---|---|
| Accuracy | 97.9% |
| Cost | 3488 |
| Alternative 4 | |
|---|---|
| Accuracy | 97.9% |
| Cost | 3488 |
| Alternative 5 | |
|---|---|
| Accuracy | 98.3% |
| Cost | 3488 |
| Alternative 6 | |
|---|---|
| Accuracy | 18.9% |
| Cost | 3424 |
| Alternative 7 | |
|---|---|
| Accuracy | 25.7% |
| Cost | 3424 |
| Alternative 8 | |
|---|---|
| Accuracy | 25.7% |
| Cost | 3424 |
| Alternative 9 | |
|---|---|
| Accuracy | 7.4% |
| Cost | 3296 |
herbie shell --seed 2023159
(FPCore (s u)
:name "Disney BSSRDF, sample scattering profile, upper"
:precision binary32
:pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 0.25 u) (<= u 1.0)))
(* (* 3.0 s) (log (/ 1.0 (- 1.0 (/ (- u 0.25) 0.75))))))