| Alternative 1 | |
|---|---|
| Error | 0.2 |
| 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 (log1p (expm1 (* (log1p (* u -4.0)) (- s)))))
float code(float s, float u) {
return s * logf((1.0f / (1.0f - (4.0f * u))));
}
float code(float s, float u) {
return log1pf(expm1f((log1pf((u * -4.0f)) * -s)));
}
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 log1p(expm1(Float32(log1p(Float32(u * Float32(-4.0))) * Float32(-s)))) end
s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right)
\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(u \cdot -4\right) \cdot \left(-s\right)\right)\right)
Results
Initial program 12.2
Applied egg-rr0.2
Final simplification0.2
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 3392 |
| Alternative 2 | |
|---|---|
| Error | 2.9 |
| Cost | 416 |
| Alternative 3 | |
|---|---|
| Error | 4.2 |
| Cost | 352 |
| Alternative 4 | |
|---|---|
| Error | 4.3 |
| Cost | 288 |
| Alternative 5 | |
|---|---|
| Error | 8.5 |
| Cost | 160 |
| Alternative 6 | |
|---|---|
| Error | 8.4 |
| Cost | 160 |
herbie shell --seed 2023083
(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))))))