Disney BSSRDF, sample scattering profile, lower

?

Percentage Accurate: 61.2% → 99.4%
Time: 20.8s
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)

Local Percentage Accuracy?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 9 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each of Herbie's proposed alternatives. Up and to the right is better. Each dot represents an alternative program; the red square represents the initial program.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 61.1%

    \[s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right) \]
  2. Simplified99.3%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(u \cdot -4\right) \cdot \left(-s\right)} \]
    Step-by-step derivation

    [Start]61.1

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

    *-commutative [=>]61.1

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

    log-rec [=>]63.7

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

    distribute-lft-neg-out [=>]63.7

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

    distribute-rgt-neg-in [=>]63.7

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

    sub-neg [=>]63.7

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

    log1p-def [=>]99.3

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

    *-commutative [=>]99.3

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

    distribute-rgt-neg-in [=>]99.3

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

    metadata-eval [=>]99.3

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

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

Alternatives

Alternative 1
Accuracy91.4%
Cost544
\[u \cdot \left(s \cdot 4\right) + s \cdot \left(u \cdot \left(u \cdot \left(8 - u \cdot -21.333333333333332\right)\right)\right) \]
Alternative 2
Accuracy91.4%
Cost480
\[s \cdot \left(\left(u \cdot u\right) \cdot \left(8 + u \cdot 21.333333333333332\right) + u \cdot 4\right) \]
Alternative 3
Accuracy91.1%
Cost448
\[s \cdot \left(u \cdot \left(\left(--4\right) - u \cdot \left(u \cdot -21.333333333333332 + -8\right)\right)\right) \]
Alternative 4
Accuracy87.1%
Cost352
\[s \cdot \left(u \cdot 4 + 8 \cdot \left(u \cdot u\right)\right) \]
Alternative 5
Accuracy86.9%
Cost288
\[s \cdot \left(u \cdot \left(4 + u \cdot 8\right)\right) \]
Alternative 6
Accuracy73.9%
Cost160
\[4 \cdot \left(u \cdot s\right) \]
Alternative 7
Accuracy74.1%
Cost160
\[u \cdot \left(s \cdot 4\right) \]
Alternative 8
Accuracy16.7%
Cost96
\[s \cdot 0 \]

Reproduce?

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