| Alternative 1 | |
|---|---|
| Error | 1.2 |
| Cost | 3488 |
\[-3 \cdot \left(s \cdot \log \left(1.3333333333333333 + u \cdot -1.3333333333333333\right)\right)
\]
(FPCore (s u) :precision binary32 (* (* 3.0 s) (log (/ 1.0 (- 1.0 (/ (- u 0.25) 0.75))))))
(FPCore (s u) :precision binary32 (* -3.0 (* s (log1p (/ (- 0.25 u) 0.75)))))
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 -3.0f * (s * log1pf(((0.25f - u) / 0.75f)));
}
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(Float32(-3.0) * Float32(s * log1p(Float32(Float32(Float32(0.25) - u) / Float32(0.75))))) end
\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)
-3 \cdot \left(s \cdot \mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right)\right)
Results
Initial program 1.3
Simplified0.6
[Start]1.3 | \[ \left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)
\] |
|---|---|
associate-*l* [=>]1.3 | \[ \color{blue}{3 \cdot \left(s \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)\right)}
\] |
log-rec [=>]1.1 | \[ 3 \cdot \left(s \cdot \color{blue}{\left(-\log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right)
\] |
sub-neg [=>]1.1 | \[ 3 \cdot \left(s \cdot \left(-\log \color{blue}{\left(1 + \left(-\frac{u - 0.25}{0.75}\right)\right)}\right)\right)
\] |
log1p-def [=>]0.6 | \[ 3 \cdot \left(s \cdot \left(-\color{blue}{\mathsf{log1p}\left(-\frac{u - 0.25}{0.75}\right)}\right)\right)
\] |
distribute-neg-frac [=>]0.6 | \[ 3 \cdot \left(s \cdot \left(-\mathsf{log1p}\left(\color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right)\right)\right)
\] |
sub-neg [=>]0.6 | \[ 3 \cdot \left(s \cdot \left(-\mathsf{log1p}\left(\frac{-\color{blue}{\left(u + \left(-0.25\right)\right)}}{0.75}\right)\right)\right)
\] |
metadata-eval [=>]0.6 | \[ 3 \cdot \left(s \cdot \left(-\mathsf{log1p}\left(\frac{-\left(u + \color{blue}{-0.25}\right)}{0.75}\right)\right)\right)
\] |
Final simplification0.6
| Alternative 1 | |
|---|---|
| Error | 1.2 |
| Cost | 3488 |
| Alternative 2 | |
|---|---|
| Error | 0.7 |
| Cost | 3488 |
| Alternative 3 | |
|---|---|
| Error | 0.7 |
| Cost | 3488 |
| Alternative 4 | |
|---|---|
| Error | 0.7 |
| Cost | 3488 |
| Alternative 5 | |
|---|---|
| Error | 0.6 |
| Cost | 3488 |
| Alternative 6 | |
|---|---|
| Error | 26.0 |
| Cost | 3424 |
| Alternative 7 | |
|---|---|
| Error | 23.8 |
| Cost | 3424 |
| Alternative 8 | |
|---|---|
| Error | 23.8 |
| Cost | 3424 |
| Alternative 9 | |
|---|---|
| Error | 29.6 |
| Cost | 3296 |
herbie shell --seed 2023027
(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))))))