| Alternative 1 | |
|---|---|
| Error | 1.2 |
| Cost | 6784 |
\[\frac{s \cdot \log \left(\frac{1}{{\left(-1.3333333333333333 \cdot u + 1.3333333333333333\right)}^{12}}\right)}{4}
\]
(FPCore (s u) :precision binary32 (* (* 3.0 s) (log (/ 1.0 (- 1.0 (/ (- u 0.25) 0.75))))))
(FPCore (s u) :precision binary32 (/ (* s (log (/ 1.0 (pow (- 1.0 (* 1.3333333333333333 (- u 0.25))) 12.0)))) 4.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 * logf((1.0f / powf((1.0f - (1.3333333333333333f * (u - 0.25f))), 12.0f)))) / 4.0f;
}
real(4) function code(s, u)
real(4), intent (in) :: s
real(4), intent (in) :: u
code = (3.0e0 * s) * log((1.0e0 / (1.0e0 - ((u - 0.25e0) / 0.75e0))))
end function
real(4) function code(s, u)
real(4), intent (in) :: s
real(4), intent (in) :: u
code = (s * log((1.0e0 / ((1.0e0 - (1.3333333333333333e0 * (u - 0.25e0))) ** 12.0e0)))) / 4.0e0
end function
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(s * log(Float32(Float32(1.0) / (Float32(Float32(1.0) - Float32(Float32(1.3333333333333333) * Float32(u - Float32(0.25)))) ^ Float32(12.0))))) / Float32(4.0)) end
function tmp = code(s, u) tmp = (single(3.0) * s) * log((single(1.0) / (single(1.0) - ((u - single(0.25)) / single(0.75))))); end
function tmp = code(s, u) tmp = (s * log((single(1.0) / ((single(1.0) - (single(1.3333333333333333) * (u - single(0.25)))) ^ single(12.0))))) / single(4.0); end
\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)
\frac{s \cdot \log \left(\frac{1}{{\left(1 - 1.3333333333333333 \cdot \left(u - 0.25\right)\right)}^{12}}\right)}{4}
Results
Initial program 1.3
Taylor expanded in s around 0 1.4
Applied egg-rr23.8
Simplified1.4
[Start]23.8 | \[ \frac{\log \left({\left(\frac{1}{1 - 1.3333333333333333 \cdot \left(u - 0.25\right)}\right)}^{s}\right) \cdot 12}{4}
\] |
|---|---|
rational_best-simplify-1 [=>]23.8 | \[ \frac{\color{blue}{12 \cdot \log \left({\left(\frac{1}{1 - 1.3333333333333333 \cdot \left(u - 0.25\right)}\right)}^{s}\right)}}{4}
\] |
exponential-simplify-30 [=>]1.4 | \[ \frac{\color{blue}{s \cdot \log \left({\left(\frac{1}{1 - 1.3333333333333333 \cdot \left(u - 0.25\right)}\right)}^{12}\right)}}{4}
\] |
Taylor expanded in s around 0 1.1
Final simplification1.1
| Alternative 1 | |
|---|---|
| Error | 1.2 |
| Cost | 6784 |
| Alternative 2 | |
|---|---|
| Error | 1.2 |
| Cost | 3744 |
| Alternative 3 | |
|---|---|
| Error | 1.4 |
| Cost | 3616 |
| Alternative 4 | |
|---|---|
| Error | 1.3 |
| Cost | 3616 |
| Alternative 5 | |
|---|---|
| Error | 1.8 |
| Cost | 3552 |
| Alternative 6 | |
|---|---|
| Error | 1.4 |
| Cost | 3552 |
| Alternative 7 | |
|---|---|
| Error | 22.3 |
| Cost | 672 |
| Alternative 8 | |
|---|---|
| Error | 22.3 |
| Cost | 608 |
| Alternative 9 | |
|---|---|
| Error | 22.4 |
| Cost | 480 |
| Alternative 10 | |
|---|---|
| Error | 22.4 |
| Cost | 224 |
| Alternative 11 | |
|---|---|
| Error | 22.4 |
| Cost | 160 |
| Alternative 12 | |
|---|---|
| Error | 22.4 |
| Cost | 160 |
herbie shell --seed 2023099
(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))))))