?

Average Accuracy: 61.7% → 99.3%
Time: 22.9s
Precision: binary32
Cost: 9984

?

\[\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{fma}\left(\mathsf{log1p}\left(4 \cdot u\right), s, s \cdot \left(-\mathsf{log1p}\left(u \cdot \left(u \cdot -16\right)\right)\right)\right) \]
(FPCore (s u) :precision binary32 (* s (log (/ 1.0 (- 1.0 (* 4.0 u))))))
(FPCore (s u)
 :precision binary32
 (fma (log1p (* 4.0 u)) s (* s (- (log1p (* u (* u -16.0)))))))
float code(float s, float u) {
	return s * logf((1.0f / (1.0f - (4.0f * u))));
}
float code(float s, float u) {
	return fmaf(log1pf((4.0f * u)), s, (s * -log1pf((u * (u * -16.0f)))));
}
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 fma(log1p(Float32(Float32(4.0) * u)), s, Float32(s * Float32(-log1p(Float32(u * Float32(u * Float32(-16.0)))))))
end
s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right)
\mathsf{fma}\left(\mathsf{log1p}\left(4 \cdot u\right), s, s \cdot \left(-\mathsf{log1p}\left(u \cdot \left(u \cdot -16\right)\right)\right)\right)

Error?

Derivation?

  1. Initial program 61.7%

    \[s \cdot \log \left(\frac{1}{1 - 4 \cdot u}\right) \]
  2. Applied egg-rr87.7%

    \[\leadsto s \cdot \color{blue}{\left(\log \left(\frac{1}{1 - {\left(4 \cdot u\right)}^{2}}\right) + \mathsf{log1p}\left(4 \cdot u\right)\right)} \]
    Proof

    [Start]61.7

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

    flip-- [=>]61.1

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

    associate-/r/ [=>]60.8

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

    log-prod [=>]60.9

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

    metadata-eval [=>]60.9

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

    pow2 [=>]60.9

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

    log1p-udef [<=]87.7

    \[ s \cdot \left(\log \left(\frac{1}{1 - {\left(4 \cdot u\right)}^{2}}\right) + \color{blue}{\mathsf{log1p}\left(4 \cdot u\right)}\right) \]
  3. Simplified99.1%

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

    [Start]87.7

    \[ s \cdot \left(\log \left(\frac{1}{1 - {\left(4 \cdot u\right)}^{2}}\right) + \mathsf{log1p}\left(4 \cdot u\right)\right) \]

    +-commutative [=>]87.7

    \[ s \cdot \color{blue}{\left(\mathsf{log1p}\left(4 \cdot u\right) + \log \left(\frac{1}{1 - {\left(4 \cdot u\right)}^{2}}\right)\right)} \]

    log-rec [=>]88.9

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

    unsub-neg [=>]88.9

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

    sub-neg [=>]88.9

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

    log1p-def [=>]99.1

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

    unpow2 [=>]99.1

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

    swap-sqr [=>]99.1

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

    metadata-eval [=>]99.1

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

    unpow2 [<=]99.1

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

    *-commutative [=>]99.1

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

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

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

    unpow2 [=>]99.1

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

    metadata-eval [=>]99.1

    \[ s \cdot \left(\mathsf{log1p}\left(4 \cdot u\right) - \mathsf{log1p}\left(\left(u \cdot u\right) \cdot \color{blue}{-16}\right)\right) \]
  4. Applied egg-rr99.3%

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

    [Start]99.1

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

    sub-neg [=>]99.1

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

    distribute-rgt-in [=>]99.1

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

    fma-def [=>]99.3

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

    associate-*l* [=>]99.3

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

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

Alternatives

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

Error

Reproduce?

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