Disney BSSRDF, sample scattering profile, upper

?

Percentage Accurate: 96.0% → 98.3%
Time: 13.9s
Precision: binary32
Cost: 3552

?

\[\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) \]
\[\left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\frac{\left(-u\right) - -0.25}{0.75}\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) (- (log1p (/ (- (- u) -0.25) 0.75)))))
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) * -log1pf(((-u - -0.25f) / 0.75f));
}
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(Float32(3.0) * s) * Float32(-log1p(Float32(Float32(Float32(-u) - Float32(-0.25)) / Float32(0.75)))))
end
\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)
\left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\frac{\left(-u\right) - -0.25}{0.75}\right)\right)

Local Percentage Accuracy vs ?

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 6 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 96.3%

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

    \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\frac{-\left(u + -0.25\right)}{0.75}\right)\right)} \]
    Step-by-step derivation

    [Start]96.3%

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

    log-rec [=>]96.9%

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

    sub-neg [=>]96.9%

    \[ \left(3 \cdot s\right) \cdot \left(-\log \color{blue}{\left(1 + \left(-\frac{u - 0.25}{0.75}\right)\right)}\right) \]

    log1p-def [=>]98.5%

    \[ \left(3 \cdot s\right) \cdot \left(-\color{blue}{\mathsf{log1p}\left(-\frac{u - 0.25}{0.75}\right)}\right) \]

    distribute-neg-frac [=>]98.5%

    \[ \left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right)\right) \]

    sub-neg [=>]98.5%

    \[ \left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\frac{-\color{blue}{\left(u + \left(-0.25\right)\right)}}{0.75}\right)\right) \]

    metadata-eval [=>]98.5%

    \[ \left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\frac{-\left(u + \color{blue}{-0.25}\right)}{0.75}\right)\right) \]
  3. Final simplification98.5%

    \[\leadsto \left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\frac{\left(-u\right) - -0.25}{0.75}\right)\right) \]

Alternatives

Alternative 1
Accuracy98.3%
Cost3552
\[\left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\frac{\left(-u\right) - -0.25}{0.75}\right)\right) \]
Alternative 2
Accuracy96.2%
Cost3488
\[-3 \cdot \left(s \cdot \log \left(1.3333333333333333 + u \cdot -1.3333333333333333\right)\right) \]
Alternative 3
Accuracy97.8%
Cost3488
\[-3 \cdot \left(s \cdot \mathsf{log1p}\left(\left(0.25 - u\right) \cdot 1.3333333333333333\right)\right) \]
Alternative 4
Accuracy98.3%
Cost3488
\[s \cdot \left(\mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right) \cdot -3\right) \]
Alternative 5
Accuracy30.3%
Cost160
\[3 \cdot \left(s \cdot u\right) \]
Alternative 6
Accuracy30.3%
Cost160
\[\left(3 \cdot s\right) \cdot u \]

Reproduce?

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