| Alternative 1 | |
|---|---|
| Accuracy | 99.4% |
| Cost | 3392 |

(FPCore (s u) :precision binary32 (* s (log (/ 1.0 (- 1.0 (* 4.0 u))))))
(FPCore (s u) :precision binary32 (fma (log1p (* u 4.0)) s (* s (- (log1p (* u (* u -16.0)))))))
float code(float s, float u) {
return s * logf((1.0f / (1.0f - (4.0f * u))));
}
float code(float s, float u) {
return fmaf(log1pf((u * 4.0f)), s, (s * -log1pf((u * (u * -16.0f)))));
}
function code(s, u) return Float32(s * log(Float32(Float32(1.0) / Float32(Float32(1.0) - Float32(Float32(4.0) * u))))) end
function code(s, u) return fma(log1p(Float32(u * Float32(4.0))), s, Float32(s * Float32(-log1p(Float32(u * Float32(u * Float32(-16.0))))))) end
s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right)
\mathsf{fma}\left(\mathsf{log1p}\left(u \cdot 4\right), s, s \cdot \left(-\mathsf{log1p}\left(u \cdot \left(u \cdot -16\right)\right)\right)\right)
Initial program 60.6%
Simplified99.2%
[Start]60.6 | \[ s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right)
\] |
|---|---|
*-commutative [=>]60.6 | \[ \color{blue}{\log \left(\frac{1}{1 - 4 \cdot u}\right) \cdot s}
\] |
log-rec [=>]63.6 | \[ \color{blue}{\left(-\log \left(1 - 4 \cdot u\right)\right)} \cdot s
\] |
distribute-lft-neg-out [=>]63.6 | \[ \color{blue}{-\log \left(1 - 4 \cdot u\right) \cdot s}
\] |
distribute-rgt-neg-in [=>]63.6 | \[ \color{blue}{\log \left(1 - 4 \cdot u\right) \cdot \left(-s\right)}
\] |
sub-neg [=>]63.6 | \[ \log \color{blue}{\left(1 + \left(-4 \cdot u\right)\right)} \cdot \left(-s\right)
\] |
log1p-def [=>]99.2 | \[ \color{blue}{\mathsf{log1p}\left(-4 \cdot u\right)} \cdot \left(-s\right)
\] |
*-commutative [=>]99.2 | \[ \mathsf{log1p}\left(-\color{blue}{u \cdot 4}\right) \cdot \left(-s\right)
\] |
distribute-rgt-neg-in [=>]99.2 | \[ \mathsf{log1p}\left(\color{blue}{u \cdot \left(-4\right)}\right) \cdot \left(-s\right)
\] |
metadata-eval [=>]99.2 | \[ \mathsf{log1p}\left(u \cdot \color{blue}{-4}\right) \cdot \left(-s\right)
\] |
Applied egg-rr97.7%
[Start]99.2 | \[ \mathsf{log1p}\left(u \cdot -4\right) \cdot \left(-s\right)
\] |
|---|---|
add-cube-cbrt [=>]97.8 | \[ \color{blue}{\left(\left(\sqrt[3]{\mathsf{log1p}\left(u \cdot -4\right)} \cdot \sqrt[3]{\mathsf{log1p}\left(u \cdot -4\right)}\right) \cdot \sqrt[3]{\mathsf{log1p}\left(u \cdot -4\right)}\right)} \cdot \left(-s\right)
\] |
pow2 [=>]97.7 | \[ \left(\color{blue}{{\left(\sqrt[3]{\mathsf{log1p}\left(u \cdot -4\right)}\right)}^{2}} \cdot \sqrt[3]{\mathsf{log1p}\left(u \cdot -4\right)}\right) \cdot \left(-s\right)
\] |
Applied egg-rr60.4%
[Start]97.7 | \[ \left({\left(\sqrt[3]{\mathsf{log1p}\left(u \cdot -4\right)}\right)}^{2} \cdot \sqrt[3]{\mathsf{log1p}\left(u \cdot -4\right)}\right) \cdot \left(-s\right)
\] |
|---|---|
unpow2 [=>]97.8 | \[ \left(\color{blue}{\left(\sqrt[3]{\mathsf{log1p}\left(u \cdot -4\right)} \cdot \sqrt[3]{\mathsf{log1p}\left(u \cdot -4\right)}\right)} \cdot \sqrt[3]{\mathsf{log1p}\left(u \cdot -4\right)}\right) \cdot \left(-s\right)
\] |
add-cube-cbrt [<=]99.2 | \[ \color{blue}{\mathsf{log1p}\left(u \cdot -4\right)} \cdot \left(-s\right)
\] |
log1p-udef [=>]63.6 | \[ \color{blue}{\log \left(1 + u \cdot -4\right)} \cdot \left(-s\right)
\] |
flip-+ [=>]60.4 | \[ \log \color{blue}{\left(\frac{1 \cdot 1 - \left(u \cdot -4\right) \cdot \left(u \cdot -4\right)}{1 - u \cdot -4}\right)} \cdot \left(-s\right)
\] |
log-div [=>]60.4 | \[ \color{blue}{\left(\log \left(1 \cdot 1 - \left(u \cdot -4\right) \cdot \left(u \cdot -4\right)\right) - \log \left(1 - u \cdot -4\right)\right)} \cdot \left(-s\right)
\] |
metadata-eval [=>]60.4 | \[ \left(\log \left(\color{blue}{1} - \left(u \cdot -4\right) \cdot \left(u \cdot -4\right)\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
*-commutative [=>]60.4 | \[ \left(\log \left(1 - \color{blue}{\left(-4 \cdot u\right)} \cdot \left(u \cdot -4\right)\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
*-commutative [=>]60.4 | \[ \left(\log \left(1 - \left(-4 \cdot u\right) \cdot \color{blue}{\left(-4 \cdot u\right)}\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
swap-sqr [=>]60.4 | \[ \left(\log \left(1 - \color{blue}{\left(-4 \cdot -4\right) \cdot \left(u \cdot u\right)}\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
metadata-eval [=>]60.4 | \[ \left(\log \left(1 - \color{blue}{16} \cdot \left(u \cdot u\right)\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
Simplified99.0%
[Start]60.4 | \[ \left(\log \left(1 - 16 \cdot \left(u \cdot u\right)\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
|---|---|
sub-neg [=>]60.4 | \[ \left(\log \color{blue}{\left(1 + \left(-16 \cdot \left(u \cdot u\right)\right)\right)} - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
log1p-def [=>]60.9 | \[ \left(\color{blue}{\mathsf{log1p}\left(-16 \cdot \left(u \cdot u\right)\right)} - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
unpow2 [<=]60.9 | \[ \left(\mathsf{log1p}\left(-16 \cdot \color{blue}{{u}^{2}}\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
*-commutative [=>]60.9 | \[ \left(\mathsf{log1p}\left(-\color{blue}{{u}^{2} \cdot 16}\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
distribute-rgt-neg-in [=>]60.9 | \[ \left(\mathsf{log1p}\left(\color{blue}{{u}^{2} \cdot \left(-16\right)}\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
unpow2 [=>]60.9 | \[ \left(\mathsf{log1p}\left(\color{blue}{\left(u \cdot u\right)} \cdot \left(-16\right)\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
metadata-eval [=>]60.9 | \[ \left(\mathsf{log1p}\left(\left(u \cdot u\right) \cdot \color{blue}{-16}\right) - \log \left(1 - u \cdot -4\right)\right) \cdot \left(-s\right)
\] |
sub-neg [=>]60.9 | \[ \left(\mathsf{log1p}\left(\left(u \cdot u\right) \cdot -16\right) - \log \color{blue}{\left(1 + \left(-u \cdot -4\right)\right)}\right) \cdot \left(-s\right)
\] |
log1p-def [=>]99.0 | \[ \left(\mathsf{log1p}\left(\left(u \cdot u\right) \cdot -16\right) - \color{blue}{\mathsf{log1p}\left(-u \cdot -4\right)}\right) \cdot \left(-s\right)
\] |
distribute-rgt-neg-in [=>]99.0 | \[ \left(\mathsf{log1p}\left(\left(u \cdot u\right) \cdot -16\right) - \mathsf{log1p}\left(\color{blue}{u \cdot \left(--4\right)}\right)\right) \cdot \left(-s\right)
\] |
metadata-eval [=>]99.0 | \[ \left(\mathsf{log1p}\left(\left(u \cdot u\right) \cdot -16\right) - \mathsf{log1p}\left(u \cdot \color{blue}{4}\right)\right) \cdot \left(-s\right)
\] |
Taylor expanded in s around 0 60.4%
Simplified99.0%
[Start]60.4 | \[ -1 \cdot \left(s \cdot \left(\log \left(1 + -16 \cdot {u}^{2}\right) - \log \left(1 + 4 \cdot u\right)\right)\right)
\] |
|---|---|
*-commutative [=>]60.4 | \[ \color{blue}{\left(s \cdot \left(\log \left(1 + -16 \cdot {u}^{2}\right) - \log \left(1 + 4 \cdot u\right)\right)\right) \cdot -1}
\] |
+-commutative [=>]60.4 | \[ \left(s \cdot \left(\log \color{blue}{\left(-16 \cdot {u}^{2} + 1\right)} - \log \left(1 + 4 \cdot u\right)\right)\right) \cdot -1
\] |
*-commutative [=>]60.4 | \[ \left(s \cdot \left(\log \left(\color{blue}{{u}^{2} \cdot -16} + 1\right) - \log \left(1 + 4 \cdot u\right)\right)\right) \cdot -1
\] |
unpow2 [=>]60.4 | \[ \left(s \cdot \left(\log \left(\color{blue}{\left(u \cdot u\right)} \cdot -16 + 1\right) - \log \left(1 + 4 \cdot u\right)\right)\right) \cdot -1
\] |
associate-*r* [<=]60.4 | \[ \left(s \cdot \left(\log \left(\color{blue}{u \cdot \left(u \cdot -16\right)} + 1\right) - \log \left(1 + 4 \cdot u\right)\right)\right) \cdot -1
\] |
fma-udef [<=]60.5 | \[ \left(s \cdot \left(\log \color{blue}{\left(\mathsf{fma}\left(u, u \cdot -16, 1\right)\right)} - \log \left(1 + 4 \cdot u\right)\right)\right) \cdot -1
\] |
+-commutative [=>]60.5 | \[ \left(s \cdot \left(\log \left(\mathsf{fma}\left(u, u \cdot -16, 1\right)\right) - \log \color{blue}{\left(4 \cdot u + 1\right)}\right)\right) \cdot -1
\] |
*-commutative [=>]60.5 | \[ \left(s \cdot \left(\log \left(\mathsf{fma}\left(u, u \cdot -16, 1\right)\right) - \log \left(\color{blue}{u \cdot 4} + 1\right)\right)\right) \cdot -1
\] |
fma-udef [<=]60.5 | \[ \left(s \cdot \left(\log \left(\mathsf{fma}\left(u, u \cdot -16, 1\right)\right) - \log \color{blue}{\left(\mathsf{fma}\left(u, 4, 1\right)\right)}\right)\right) \cdot -1
\] |
log-div [<=]60.4 | \[ \left(s \cdot \color{blue}{\log \left(\frac{\mathsf{fma}\left(u, u \cdot -16, 1\right)}{\mathsf{fma}\left(u, 4, 1\right)}\right)}\right) \cdot -1
\] |
associate-*l* [=>]60.4 | \[ \color{blue}{s \cdot \left(\log \left(\frac{\mathsf{fma}\left(u, u \cdot -16, 1\right)}{\mathsf{fma}\left(u, 4, 1\right)}\right) \cdot -1\right)}
\] |
metadata-eval [<=]60.4 | \[ s \cdot \left(\log \left(\frac{\mathsf{fma}\left(u, u \cdot -16, 1\right)}{\mathsf{fma}\left(u, 4, 1\right)}\right) \cdot \color{blue}{\left(-1\right)}\right)
\] |
distribute-rgt-neg-in [<=]60.4 | \[ s \cdot \color{blue}{\left(-\log \left(\frac{\mathsf{fma}\left(u, u \cdot -16, 1\right)}{\mathsf{fma}\left(u, 4, 1\right)}\right) \cdot 1\right)}
\] |
*-rgt-identity [=>]60.4 | \[ s \cdot \left(-\color{blue}{\log \left(\frac{\mathsf{fma}\left(u, u \cdot -16, 1\right)}{\mathsf{fma}\left(u, 4, 1\right)}\right)}\right)
\] |
Applied egg-rr99.4%
[Start]99.0 | \[ s \cdot \left(\mathsf{log1p}\left(u \cdot 4\right) - \mathsf{log1p}\left(u \cdot \left(u \cdot -16\right)\right)\right)
\] |
|---|---|
sub-neg [=>]99.0 | \[ s \cdot \color{blue}{\left(\mathsf{log1p}\left(u \cdot 4\right) + \left(-\mathsf{log1p}\left(u \cdot \left(u \cdot -16\right)\right)\right)\right)}
\] |
distribute-rgt-in [=>]99.0 | \[ \color{blue}{\mathsf{log1p}\left(u \cdot 4\right) \cdot s + \left(-\mathsf{log1p}\left(u \cdot \left(u \cdot -16\right)\right)\right) \cdot s}
\] |
fma-def [=>]99.4 | \[ \color{blue}{\mathsf{fma}\left(\mathsf{log1p}\left(u \cdot 4\right), s, \left(-\mathsf{log1p}\left(u \cdot \left(u \cdot -16\right)\right)\right) \cdot s\right)}
\] |
Final simplification99.4%
| Alternative 1 | |
|---|---|
| Accuracy | 99.4% |
| Cost | 3392 |
| Alternative 2 | |
|---|---|
| Accuracy | 89.1% |
| Cost | 384 |
| Alternative 3 | |
|---|---|
| Accuracy | 88.3% |
| Cost | 352 |
| Alternative 4 | |
|---|---|
| Accuracy | 87.1% |
| Cost | 288 |
| Alternative 5 | |
|---|---|
| Accuracy | 87.1% |
| Cost | 288 |
| Alternative 6 | |
|---|---|
| Accuracy | 74.0% |
| Cost | 160 |
| Alternative 7 | |
|---|---|
| Accuracy | 74.3% |
| Cost | 160 |
| Alternative 8 | |
|---|---|
| Accuracy | 8.2% |
| Cost | 96 |
herbie shell --seed 2023159
(FPCore (s u)
:name "Disney BSSRDF, sample scattering profile, lower"
:precision binary32
:pre (and (and (<= 0.0 s) (<= s 256.0)) (and (<= 2.328306437e-10 u) (<= u 0.25)))
(* s (log (/ 1.0 (- 1.0 (* 4.0 u))))))