| Alternative 1 | |
|---|---|
| Accuracy | 99.4% |
| Cost | 3392 |
\[\mathsf{log1p}\left(u \cdot -4\right) \cdot \left(-s\right)
\]
(FPCore (s u) :precision binary32 (* s (log (/ 1.0 (- 1.0 (* 4.0 u))))))
(FPCore (s u) :precision binary32 (fma (log1p (* 4.0 u)) 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((4.0f * u)), 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(Float32(4.0) * u)), 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(4 \cdot u\right), s, s \cdot \left(-\mathsf{log1p}\left(u \cdot \left(u \cdot -16\right)\right)\right)\right)
Initial program 61.7%
Applied egg-rr87.7%
[Start]61.7 | \[ s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right)
\] |
|---|---|
flip-- [=>]61.1 | \[ s \cdot \log \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 - \left(4 \cdot u\right) \cdot \left(4 \cdot u\right)}{1 + 4 \cdot u}}}\right)
\] |
associate-/r/ [=>]60.8 | \[ s \cdot \log \color{blue}{\left(\frac{1}{1 \cdot 1 - \left(4 \cdot u\right) \cdot \left(4 \cdot u\right)} \cdot \left(1 + 4 \cdot u\right)\right)}
\] |
log-prod [=>]60.9 | \[ s \cdot \color{blue}{\left(\log \left(\frac{1}{1 \cdot 1 - \left(4 \cdot u\right) \cdot \left(4 \cdot u\right)}\right) + \log \left(1 + 4 \cdot u\right)\right)}
\] |
metadata-eval [=>]60.9 | \[ s \cdot \left(\log \left(\frac{1}{\color{blue}{1} - \left(4 \cdot u\right) \cdot \left(4 \cdot u\right)}\right) + \log \left(1 + 4 \cdot u\right)\right)
\] |
pow2 [=>]60.9 | \[ s \cdot \left(\log \left(\frac{1}{1 - \color{blue}{{\left(4 \cdot u\right)}^{2}}}\right) + \log \left(1 + 4 \cdot u\right)\right)
\] |
log1p-udef [<=]87.7 | \[ s \cdot \left(\log \left(\frac{1}{1 - {\left(4 \cdot u\right)}^{2}}\right) + \color{blue}{\mathsf{log1p}\left(4 \cdot u\right)}\right)
\] |
Simplified99.1%
[Start]87.7 | \[ s \cdot \left(\log \left(\frac{1}{1 - {\left(4 \cdot u\right)}^{2}}\right) + \mathsf{log1p}\left(4 \cdot u\right)\right)
\] |
|---|---|
+-commutative [=>]87.7 | \[ s \cdot \color{blue}{\left(\mathsf{log1p}\left(4 \cdot u\right) + \log \left(\frac{1}{1 - {\left(4 \cdot u\right)}^{2}}\right)\right)}
\] |
log-rec [=>]88.9 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) + \color{blue}{\left(-\log \left(1 - {\left(4 \cdot u\right)}^{2}\right)\right)}\right)
\] |
unsub-neg [=>]88.9 | \[ s \cdot \color{blue}{\left(\mathsf{log1p}\left(4 \cdot u\right) - \log \left(1 - {\left(4 \cdot u\right)}^{2}\right)\right)}
\] |
sub-neg [=>]88.9 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \log \color{blue}{\left(1 + \left(-{\left(4 \cdot u\right)}^{2}\right)\right)}\right)
\] |
log1p-def [=>]99.1 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \color{blue}{\mathsf{log1p}\left(-{\left(4 \cdot u\right)}^{2}\right)}\right)
\] |
unpow2 [=>]99.1 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \mathsf{log1p}\left(-\color{blue}{\left(4 \cdot u\right) \cdot \left(4 \cdot u\right)}\right)\right)
\] |
swap-sqr [=>]99.1 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \mathsf{log1p}\left(-\color{blue}{\left(4 \cdot 4\right) \cdot \left(u \cdot u\right)}\right)\right)
\] |
metadata-eval [=>]99.1 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \mathsf{log1p}\left(-\color{blue}{16} \cdot \left(u \cdot u\right)\right)\right)
\] |
unpow2 [<=]99.1 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \mathsf{log1p}\left(-16 \cdot \color{blue}{{u}^{2}}\right)\right)
\] |
*-commutative [=>]99.1 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \mathsf{log1p}\left(-\color{blue}{{u}^{2} \cdot 16}\right)\right)
\] |
distribute-rgt-neg-in [=>]99.1 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \mathsf{log1p}\left(\color{blue}{{u}^{2} \cdot \left(-16\right)}\right)\right)
\] |
unpow2 [=>]99.1 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \mathsf{log1p}\left(\color{blue}{\left(u \cdot u\right)} \cdot \left(-16\right)\right)\right)
\] |
metadata-eval [=>]99.1 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \mathsf{log1p}\left(\left(u \cdot u\right) \cdot \color{blue}{-16}\right)\right)
\] |
Applied egg-rr99.3%
[Start]99.1 | \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \mathsf{log1p}\left(\left(u \cdot u\right) \cdot -16\right)\right)
\] |
|---|---|
sub-neg [=>]99.1 | \[ s \cdot \color{blue}{\left(\mathsf{log1p}\left(4 \cdot u\right) + \left(-\mathsf{log1p}\left(\left(u \cdot u\right) \cdot -16\right)\right)\right)}
\] |
distribute-rgt-in [=>]99.1 | \[ \color{blue}{\mathsf{log1p}\left(4 \cdot u\right) \cdot s + \left(-\mathsf{log1p}\left(\left(u \cdot u\right) \cdot -16\right)\right) \cdot s}
\] |
fma-def [=>]99.3 | \[ \color{blue}{\mathsf{fma}\left(\mathsf{log1p}\left(4 \cdot u\right), s, \left(-\mathsf{log1p}\left(\left(u \cdot u\right) \cdot -16\right)\right) \cdot s\right)}
\] |
associate-*l* [=>]99.3 | \[ \mathsf{fma}\left(\mathsf{log1p}\left(4 \cdot u\right), s, \left(-\mathsf{log1p}\left(\color{blue}{u \cdot \left(u \cdot -16\right)}\right)\right) \cdot s\right)
\] |
Final simplification99.3%
| Alternative 1 | |
|---|---|
| Accuracy | 99.4% |
| Cost | 3392 |
| Alternative 2 | |
|---|---|
| Accuracy | 91.3% |
| Cost | 480 |
| Alternative 3 | |
|---|---|
| Accuracy | 91.1% |
| Cost | 448 |
| Alternative 4 | |
|---|---|
| Accuracy | 86.9% |
| Cost | 352 |
| Alternative 5 | |
|---|---|
| Accuracy | 86.7% |
| Cost | 288 |
| Alternative 6 | |
|---|---|
| Accuracy | 86.7% |
| Cost | 288 |
| Alternative 7 | |
|---|---|
| Accuracy | 73.4% |
| Cost | 160 |
| Alternative 8 | |
|---|---|
| Accuracy | 73.6% |
| Cost | 160 |
| Alternative 9 | |
|---|---|
| Accuracy | 16.5% |
| Cost | 96 |
herbie shell --seed 2023146
(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))))))