?

Average Accuracy: 95.9% → 98.3%
Time: 17.5s
Precision: binary32
Cost: 10240

?

\[\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(\left(u + -0.25\right) \cdot \left(0.8888888888888888 + u \cdot 1.7777777777777777\right)\right) - \mathsf{log1p}\left({\left(u + -0.25\right)}^{3} \cdot -2.3703703703703702\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.8888888888888888 (* u 1.7777777777777777))))
   (log1p (* (pow (+ u -0.25) 3.0) -2.3703703703703702)))))
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.8888888888888888f + (u * 1.7777777777777777f)))) - log1pf((powf((u + -0.25f), 3.0f) * -2.3703703703703702f)));
}
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(u + Float32(-0.25)) * Float32(Float32(0.8888888888888888) + Float32(u * Float32(1.7777777777777777))))) - log1p(Float32((Float32(u + Float32(-0.25)) ^ Float32(3.0)) * Float32(-2.3703703703703702)))))
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(\left(u + -0.25\right) \cdot \left(0.8888888888888888 + u \cdot 1.7777777777777777\right)\right) - \mathsf{log1p}\left({\left(u + -0.25\right)}^{3} \cdot -2.3703703703703702\right)\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. Applied egg-rr95.5%

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

    [Start]95.9

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

    flip3-- [=>]95.5

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

    associate-/r/ [=>]95.2

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

    log-prod [=>]95.4

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

    metadata-eval [=>]95.4

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

    div-sub [=>]95.2

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

    div-inv [=>]95.4

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

    fma-neg [=>]95.4

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

    metadata-eval [=>]95.4

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

    metadata-eval [=>]95.4

    \[ \left(3 \cdot s\right) \cdot \left(\log \left(\frac{1}{1 - {\left(\mathsf{fma}\left(u, 1.3333333333333333, -\color{blue}{0.3333333333333333}\right)\right)}^{3}}\right) + \log \left(1 \cdot 1 + \left(\frac{u - 0.25}{0.75} \cdot \frac{u - 0.25}{0.75} + 1 \cdot \frac{u - 0.25}{0.75}\right)\right)\right) \]

    metadata-eval [=>]95.4

    \[ \left(3 \cdot s\right) \cdot \left(\log \left(\frac{1}{1 - {\left(\mathsf{fma}\left(u, 1.3333333333333333, \color{blue}{-0.3333333333333333}\right)\right)}^{3}}\right) + \log \left(1 \cdot 1 + \left(\frac{u - 0.25}{0.75} \cdot \frac{u - 0.25}{0.75} + 1 \cdot \frac{u - 0.25}{0.75}\right)\right)\right) \]
  3. Simplified98.3%

    \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\left(u + -0.25\right) \cdot \mathsf{fma}\left(1.7777777777777777, u + -0.25, 1.3333333333333333\right)\right) - \mathsf{log1p}\left({\left(u + -0.25\right)}^{3} \cdot -2.3703703703703702\right)\right)} \]
    Proof

    [Start]95.5

    \[ \left(3 \cdot s\right) \cdot \left(\log \left(\frac{1}{1 - {\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right)}^{3}}\right) + \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right) + {\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right)}^{2}\right)\right) \]

    +-commutative [=>]95.5

    \[ \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right) + {\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right)}^{2}\right) + \log \left(\frac{1}{1 - {\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right)}^{3}}\right)\right)} \]

    log-rec [=>]96.7

    \[ \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right) + {\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right)}^{2}\right) + \color{blue}{\left(-\log \left(1 - {\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right)}^{3}\right)\right)}\right) \]

    unsub-neg [=>]96.7

    \[ \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right) + {\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right)}^{2}\right) - \log \left(1 - {\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right)}^{3}\right)\right)} \]
  4. Taylor expanded in u around 0 98.4%

    \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\left(u + -0.25\right) \cdot \color{blue}{\left(0.8888888888888888 + 1.7777777777777777 \cdot u\right)}\right) - \mathsf{log1p}\left({\left(u + -0.25\right)}^{3} \cdot -2.3703703703703702\right)\right) \]
  5. Final simplification98.4%

    \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\left(u + -0.25\right) \cdot \left(0.8888888888888888 + u \cdot 1.7777777777777777\right)\right) - \mathsf{log1p}\left({\left(u + -0.25\right)}^{3} \cdot -2.3703703703703702\right)\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
Accuracy97.9%
Cost3488
\[s \cdot \left(-3 \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
Accuracy29.9%
Cost160
\[3 \cdot \left(s \cdot u\right) \]

Error

Reproduce?

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