Average Error: 1.3 → 1.0
Time: 7.1s
Precision: binary32
\[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
\[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
\[-3 \cdot \left(s \cdot \log \left(\mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\right)\right)\right) \]
\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)
-3 \cdot \left(s \cdot \log \left(\mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\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
 (* -3.0 (* s (log (fma u -1.3333333333333333 1.3333333333333333)))))
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 * logf(fmaf(u, -1.3333333333333333f, 1.3333333333333333f)));
}

Error

Bits error versus s

Bits error versus u

Derivation

  1. Initial program 1.3

    \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
  2. Simplified1.0

    \[\leadsto \color{blue}{s \cdot \left(\log \left(\mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\right)\right) \cdot -3\right)} \]
  3. Taylor expanded in s around 0 1.2

    \[\leadsto \color{blue}{-3 \cdot \left(s \cdot \log \left(1.3333333333333333 - 1.3333333333333333 \cdot u\right)\right)} \]
  4. Simplified1.0

    \[\leadsto \color{blue}{-3 \cdot \left(s \cdot \log \left(\mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\right)\right)\right)} \]
  5. Applied associate-*r*_binary321.0

    \[\leadsto \color{blue}{\left(-3 \cdot s\right) \cdot \log \left(\mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\right)\right)} \]
  6. Applied *-un-lft-identity_binary321.0

    \[\leadsto \left(-3 \cdot s\right) \cdot \log \color{blue}{\left(1 \cdot \mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\right)\right)} \]
  7. Applied log-prod_binary321.0

    \[\leadsto \left(-3 \cdot s\right) \cdot \color{blue}{\left(\log 1 + \log \left(\mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\right)\right)\right)} \]
  8. Applied distribute-rgt-in_binary321.0

    \[\leadsto \color{blue}{\log 1 \cdot \left(-3 \cdot s\right) + \log \left(\mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\right)\right) \cdot \left(-3 \cdot s\right)} \]
  9. Simplified1.0

    \[\leadsto \color{blue}{0} + \log \left(\mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\right)\right) \cdot \left(-3 \cdot s\right) \]
  10. Simplified1.0

    \[\leadsto 0 + \color{blue}{-3 \cdot \left(s \cdot \log \left(\mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\right)\right)\right)} \]
  11. Final simplification1.0

    \[\leadsto -3 \cdot \left(s \cdot \log \left(\mathsf{fma}\left(u, -1.3333333333333333, 1.3333333333333333\right)\right)\right) \]

Reproduce

herbie shell --seed 2022076 
(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))))))