?

Average Error: 39.12% → 0.63%
Time: 10.7s
Precision: binary32
Cost: 3392

?

\[\left(0 \leq s \land s \leq 256\right) \land \left(2.328306437 \cdot 10^{-10} \leq u \land u \leq 0.25\right)\]
\[s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right) \]
\[\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 (* 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((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 Float32(log1p(Float32(u * Float32(-4.0))) * Float32(-s))
end
s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right)
\mathsf{log1p}\left(u \cdot -4\right) \cdot \left(-s\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 39.12

    \[s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right) \]
  2. Simplified0.63

    \[\leadsto \color{blue}{\mathsf{log1p}\left(u \cdot -4\right) \cdot \left(-s\right)} \]
    Proof

    [Start]39.12

    \[ s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right) \]

    log-rec [=>]36.66

    \[ s \cdot \color{blue}{\left(-\log \left(1 - 4 \cdot u\right)\right)} \]

    distribute-rgt-neg-out [=>]36.66

    \[ \color{blue}{-s \cdot \log \left(1 - 4 \cdot u\right)} \]

    distribute-lft-neg-in [=>]36.66

    \[ \color{blue}{\left(-s\right) \cdot \log \left(1 - 4 \cdot u\right)} \]

    *-commutative [<=]36.66

    \[ \color{blue}{\log \left(1 - 4 \cdot u\right) \cdot \left(-s\right)} \]

    sub-neg [=>]36.66

    \[ \log \color{blue}{\left(1 + \left(-4 \cdot u\right)\right)} \cdot \left(-s\right) \]

    log1p-def [=>]0.63

    \[ \color{blue}{\mathsf{log1p}\left(-4 \cdot u\right)} \cdot \left(-s\right) \]

    distribute-lft-neg-in [=>]0.63

    \[ \mathsf{log1p}\left(\color{blue}{\left(-4\right) \cdot u}\right) \cdot \left(-s\right) \]

    *-commutative [=>]0.63

    \[ \mathsf{log1p}\left(\color{blue}{u \cdot \left(-4\right)}\right) \cdot \left(-s\right) \]

    metadata-eval [=>]0.63

    \[ \mathsf{log1p}\left(u \cdot \color{blue}{-4}\right) \cdot \left(-s\right) \]
  3. Final simplification0.63

    \[\leadsto \mathsf{log1p}\left(u \cdot -4\right) \cdot \left(-s\right) \]

Alternatives

Alternative 1
Error11.88%
Cost352
\[-16 \cdot \frac{u \cdot s}{-4 + u \cdot 8} \]
Alternative 2
Error11.41%
Cost352
\[s \cdot \left(u \cdot \frac{16}{4 + u \cdot -8}\right) \]
Alternative 3
Error13.26%
Cost288
\[s \cdot \left(u \cdot \left(4 + u \cdot 8\right)\right) \]
Alternative 4
Error13.25%
Cost288
\[u \cdot \left(s \cdot \left(4 + u \cdot 8\right)\right) \]
Alternative 5
Error26.13%
Cost160
\[4 \cdot \left(u \cdot s\right) \]
Alternative 6
Error25.92%
Cost160
\[u \cdot \left(s \cdot 4\right) \]
Alternative 7
Error83.37%
Cost32
\[0 \]

Error

Reproduce?

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