?

Average Accuracy: 95.9% → 98.3%
Time: 15.1s
Precision: binary32
Cost: 3488

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 95.9%

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

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

    [Start]95.9

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

    associate-*l* [=>]95.8

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

    *-commutative [=>]95.8

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

    associate-*l* [=>]95.8

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

    log-rec [=>]96.7

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

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

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

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

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

    sub-neg [=>]96.7

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

    log1p-def [=>]98.3

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

    distribute-neg-frac [=>]98.3

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

    sub-neg [=>]98.3

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

    +-commutative [=>]98.3

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

    distribute-neg-in [=>]98.3

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

    metadata-eval [=>]98.3

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

    metadata-eval [=>]98.3

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

    unsub-neg [=>]98.3

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

    metadata-eval [=>]98.3

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

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

Alternatives

Alternative 1
Accuracy96.1%
Cost3488
\[-3 \cdot \left(s \cdot \log \left(1.3333333333333333 + u \cdot -1.3333333333333333\right)\right) \]
Alternative 2
Accuracy97.9%
Cost3488
\[-3 \cdot \left(s \cdot \mathsf{log1p}\left(\left(0.25 - u\right) \cdot 1.3333333333333333\right)\right) \]
Alternative 3
Accuracy19.1%
Cost3424
\[-3 \cdot \left(s \cdot \mathsf{log1p}\left(u \cdot -1.3333333333333333\right)\right) \]
Alternative 4
Accuracy25.8%
Cost3424
\[3 \cdot \left(s \cdot \left(u + \log 0.75\right)\right) \]
Alternative 5
Accuracy25.8%
Cost3424
\[\left(s \cdot 3\right) \cdot \left(u + \log 0.75\right) \]
Alternative 6
Accuracy10.4%
Cost160
\[-3 \cdot \left(s \cdot 0\right) \]

Error

Reproduce?

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