| Alternative 1 | |
|---|---|
| Error | 1.4 |
| Cost | 3616 |
\[3 \cdot \left(s \cdot \log \left(\frac{1}{1 - 1.3333333333333333 \cdot \left(u - 0.25\right)}\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 (let* ((t_0 (log (/ 1.0 (- 1.0 (/ (- u 0.25) 0.75)))))) (* (* 3.0 s) (* (/ 1.0 t_0) (* t_0 t_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) {
float t_0 = logf((1.0f / (1.0f - ((u - 0.25f) / 0.75f))));
return (3.0f * s) * ((1.0f / t_0) * (t_0 * t_0));
}
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
real(4) :: t_0
t_0 = log((1.0e0 / (1.0e0 - ((u - 0.25e0) / 0.75e0))))
code = (3.0e0 * s) * ((1.0e0 / t_0) * (t_0 * t_0))
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) t_0 = log(Float32(Float32(1.0) / Float32(Float32(1.0) - Float32(Float32(u - Float32(0.25)) / Float32(0.75))))) return Float32(Float32(Float32(3.0) * s) * Float32(Float32(Float32(1.0) / t_0) * Float32(t_0 * t_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) t_0 = log((single(1.0) / (single(1.0) - ((u - single(0.25)) / single(0.75))))); tmp = (single(3.0) * s) * ((single(1.0) / t_0) * (t_0 * t_0)); end
\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)
\begin{array}{l}
t_0 := \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)\\
\left(3 \cdot s\right) \cdot \left(\frac{1}{t_0} \cdot \left(t_0 \cdot t_0\right)\right)
\end{array}
Results
Initial program 1.3
Applied egg-rr1.4
Final simplification1.4
| Alternative 1 | |
|---|---|
| Error | 1.4 |
| Cost | 3616 |
| Alternative 2 | |
|---|---|
| Error | 1.3 |
| Cost | 3616 |
| Alternative 3 | |
|---|---|
| Error | 1.3 |
| Cost | 3616 |
| Alternative 4 | |
|---|---|
| Error | 1.4 |
| Cost | 3552 |
| Alternative 5 | |
|---|---|
| Error | 1.4 |
| Cost | 3552 |
| Alternative 6 | |
|---|---|
| Error | 22.4 |
| Cost | 160 |
herbie shell --seed 2023077
(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))))))