Disney BSSRDF, sample scattering profile, upper

Percentage Accurate: 95.9% → 100.0%
Time: 17.5s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
\[\begin{array}{l} \\ \left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \end{array} \]
(FPCore (s u)
 :precision binary32
 (* (* 3.0 s) (log (/ 1.0 (- 1.0 (/ (- 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))));
}
real(4) function code(s, u)
    real(4), intent (in) :: s
    real(4), intent (in) :: u
    code = (3.0e0 * s) * log((1.0e0 / (1.0e0 - ((u - 0.25e0) / 0.75e0))))
end function
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 tmp = code(s, u)
	tmp = (single(3.0) * s) * log((single(1.0) / (single(1.0) - ((u - single(0.25)) / single(0.75)))));
end
\begin{array}{l}

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

Sampling outcomes in binary32 precision:

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.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
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.

Initial Program: 95.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \end{array} \]
(FPCore (s u)
 :precision binary32
 (* (* 3.0 s) (log (/ 1.0 (- 1.0 (/ (- 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))));
}
real(4) function code(s, u)
    real(4), intent (in) :: s
    real(4), intent (in) :: u
    code = (3.0e0 * s) * log((1.0e0 / (1.0e0 - ((u - 0.25e0) / 0.75e0))))
end function
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 tmp = code(s, u)
	tmp = (single(3.0) * s) * log((single(1.0) / (single(1.0) - ((u - single(0.25)) / single(0.75)))));
end
\begin{array}{l}

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

Alternative 1: 100.0% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \langle \left( s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right) \right)_{\text{binary64}} \rangle_{\text{binary32}} \end{array} \]
(FPCore (s u)
 :precision binary32
 (cast
  (!
   :precision
   binary64
   (* s (* -3.0 (log1p (+ (* -1.3333333333333333 u) 0.3333333333333333)))))))
float code(float s, float u) {
	double tmp = ((double) s) * (-3.0 * log1p(((-1.3333333333333333 * ((double) u)) + 0.3333333333333333)));
	return (float) tmp;
}
function code(s, u)
	tmp = Float64(Float64(s) * Float64(-3.0 * log1p(Float64(Float64(-1.3333333333333333 * Float64(u)) + 0.3333333333333333))))
	return Float32(tmp)
end
\begin{array}{l}

\\
\langle \left( s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right) \right)_{\text{binary64}} \rangle_{\text{binary32}}
\end{array}
Derivation
  1. Initial program 100.0%

    \[\langle s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right) \rangle_{\text{binary64}} \]
  2. Final simplification100.0%

    \[\leadsto \langle s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right) \rangle_{\text{binary64}} \]

Alternative 2: 99.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ s \cdot \langle \left( \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right) \right)_{\text{binary64}} \rangle_{\text{binary32}} \end{array} \]
(FPCore (s u)
 :precision binary32
 (*
  s
  (cast
   (!
    :precision
    binary64
    (* -3.0 (log1p (+ (* -1.3333333333333333 u) 0.3333333333333333)))))))
float code(float s, float u) {
	double tmp = -3.0 * log1p(((-1.3333333333333333 * ((double) u)) + 0.3333333333333333));
	return s * ((float) tmp);
}
function code(s, u)
	tmp = Float64(-3.0 * log1p(Float64(Float64(-1.3333333333333333 * Float64(u)) + 0.3333333333333333)))
	return Float32(s * Float32(tmp))
end
\begin{array}{l}

\\
s \cdot \langle \left( \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right) \right)_{\text{binary64}} \rangle_{\text{binary32}}
\end{array}
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. Step-by-step derivation
    1. *-commutative95.9%

      \[\leadsto \color{blue}{\left(s \cdot 3\right)} \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. associate-*l*95.9%

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

      \[\leadsto s \cdot \left(3 \cdot \color{blue}{\left(-\log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right) \]
    4. neg-mul-196.9%

      \[\leadsto s \cdot \left(3 \cdot \color{blue}{\left(-1 \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right) \]
    5. associate-*r*96.9%

      \[\leadsto s \cdot \color{blue}{\left(\left(3 \cdot -1\right) \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right)} \]
    6. metadata-eval96.9%

      \[\leadsto s \cdot \left(\color{blue}{-3} \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right) \]
    7. sub-neg96.9%

      \[\leadsto s \cdot \left(-3 \cdot \log \color{blue}{\left(1 + \left(-\frac{u - 0.25}{0.75}\right)\right)}\right) \]
    8. log1p-def98.5%

      \[\leadsto s \cdot \left(-3 \cdot \color{blue}{\mathsf{log1p}\left(-\frac{u - 0.25}{0.75}\right)}\right) \]
    9. distribute-neg-frac98.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right)\right) \]
    10. neg-mul-198.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{\color{blue}{-1 \cdot \left(u - 0.25\right)}}{0.75}\right)\right) \]
    11. associate-/l*98.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{\frac{0.75}{u - 0.25}}}\right)\right) \]
    12. associate-/r/98.1%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{0.75} \cdot \left(u - 0.25\right)}\right)\right) \]
    13. sub-neg98.1%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{-1}{0.75} \cdot \color{blue}{\left(u + \left(-0.25\right)\right)}\right)\right) \]
    14. distribute-lft-in97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{0.75} \cdot u + \frac{-1}{0.75} \cdot \left(-0.25\right)}\right)\right) \]
    15. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{-1.3333333333333333} \cdot u + \frac{-1}{0.75} \cdot \left(-0.25\right)\right)\right) \]
    16. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + \color{blue}{-1.3333333333333333} \cdot \left(-0.25\right)\right)\right) \]
    17. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + -1.3333333333333333 \cdot \color{blue}{-0.25}\right)\right) \]
    18. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + \color{blue}{0.3333333333333333}\right)\right) \]
  3. Simplified97.0%

    \[\leadsto \color{blue}{s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right)} \]
  4. Step-by-step derivation
    1. rewrite-binary32/binary6499.3%

      \[\leadsto \color{blue}{s \cdot \langle \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right) \rangle_{\text{binary64}}} \]
  5. Applied rewrite-once99.3%

    \[\leadsto s \cdot \color{blue}{\langle \color{blue}{\left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right)} \rangle_{\text{binary64}}} \]
  6. Final simplification99.3%

    \[\leadsto s \cdot \langle \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right) \rangle_{\text{binary64}} \]

Alternative 3: 98.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ s \cdot \left(-3 \cdot \langle \left( \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right) \right)_{\text{binary64}} \rangle_{\text{binary32}}\right) \end{array} \]
(FPCore (s u)
 :precision binary32
 (*
  s
  (*
   -3.0
   (cast
    (!
     :precision
     binary64
     (log1p (+ (* -1.3333333333333333 u) 0.3333333333333333)))))))
float code(float s, float u) {
	double tmp = log1p(((-1.3333333333333333 * ((double) u)) + 0.3333333333333333));
	return s * (-3.0f * ((float) tmp));
}
function code(s, u)
	tmp = log1p(Float64(Float64(-1.3333333333333333 * Float64(u)) + 0.3333333333333333))
	return Float32(s * Float32(Float32(-3.0) * Float32(tmp)))
end
\begin{array}{l}

\\
s \cdot \left(-3 \cdot \langle \left( \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right) \right)_{\text{binary64}} \rangle_{\text{binary32}}\right)
\end{array}
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. Step-by-step derivation
    1. *-commutative95.9%

      \[\leadsto \color{blue}{\left(s \cdot 3\right)} \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. associate-*l*95.9%

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

      \[\leadsto s \cdot \left(3 \cdot \color{blue}{\left(-\log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right) \]
    4. neg-mul-196.9%

      \[\leadsto s \cdot \left(3 \cdot \color{blue}{\left(-1 \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right) \]
    5. associate-*r*96.9%

      \[\leadsto s \cdot \color{blue}{\left(\left(3 \cdot -1\right) \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right)} \]
    6. metadata-eval96.9%

      \[\leadsto s \cdot \left(\color{blue}{-3} \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right) \]
    7. sub-neg96.9%

      \[\leadsto s \cdot \left(-3 \cdot \log \color{blue}{\left(1 + \left(-\frac{u - 0.25}{0.75}\right)\right)}\right) \]
    8. log1p-def98.5%

      \[\leadsto s \cdot \left(-3 \cdot \color{blue}{\mathsf{log1p}\left(-\frac{u - 0.25}{0.75}\right)}\right) \]
    9. distribute-neg-frac98.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right)\right) \]
    10. neg-mul-198.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{\color{blue}{-1 \cdot \left(u - 0.25\right)}}{0.75}\right)\right) \]
    11. associate-/l*98.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{\frac{0.75}{u - 0.25}}}\right)\right) \]
    12. associate-/r/98.1%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{0.75} \cdot \left(u - 0.25\right)}\right)\right) \]
    13. sub-neg98.1%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{-1}{0.75} \cdot \color{blue}{\left(u + \left(-0.25\right)\right)}\right)\right) \]
    14. distribute-lft-in97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{0.75} \cdot u + \frac{-1}{0.75} \cdot \left(-0.25\right)}\right)\right) \]
    15. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{-1.3333333333333333} \cdot u + \frac{-1}{0.75} \cdot \left(-0.25\right)\right)\right) \]
    16. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + \color{blue}{-1.3333333333333333} \cdot \left(-0.25\right)\right)\right) \]
    17. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + -1.3333333333333333 \cdot \color{blue}{-0.25}\right)\right) \]
    18. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + \color{blue}{0.3333333333333333}\right)\right) \]
  3. Simplified97.0%

    \[\leadsto \color{blue}{s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right)} \]
  4. Step-by-step derivation
    1. rewrite-binary32/binary6498.9%

      \[\leadsto \color{blue}{s \cdot \left(-3 \cdot \langle \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right) \rangle_{\text{binary64}}\right)} \]
  5. Applied rewrite-once98.9%

    \[\leadsto s \cdot \left(-3 \cdot \color{blue}{\langle \color{blue}{\mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)} \rangle_{\text{binary64}}}\right) \]
  6. Final simplification98.9%

    \[\leadsto s \cdot \left(-3 \cdot \langle \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right) \rangle_{\text{binary64}}\right) \]

Alternative 4: 96.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ -3 \cdot \left(s \cdot \log \left(1.3333333333333333 - u \cdot 1.3333333333333333\right)\right) \end{array} \]
(FPCore (s u)
 :precision binary32
 (* -3.0 (* s (log (- 1.3333333333333333 (* u 1.3333333333333333))))))
float code(float s, float u) {
	return -3.0f * (s * logf((1.3333333333333333f - (u * 1.3333333333333333f))));
}
real(4) function code(s, u)
    real(4), intent (in) :: s
    real(4), intent (in) :: u
    code = (-3.0e0) * (s * log((1.3333333333333333e0 - (u * 1.3333333333333333e0))))
end function
function code(s, u)
	return Float32(Float32(-3.0) * Float32(s * log(Float32(Float32(1.3333333333333333) - Float32(u * Float32(1.3333333333333333))))))
end
function tmp = code(s, u)
	tmp = single(-3.0) * (s * log((single(1.3333333333333333) - (u * single(1.3333333333333333)))));
end
\begin{array}{l}

\\
-3 \cdot \left(s \cdot \log \left(1.3333333333333333 - u \cdot 1.3333333333333333\right)\right)
\end{array}
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. Step-by-step derivation
    1. remove-double-neg95.9%

      \[\leadsto \color{blue}{-\left(-\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)\right)} \]
    2. distribute-rgt-neg-in95.9%

      \[\leadsto -\color{blue}{\left(3 \cdot s\right) \cdot \left(-\log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)\right)} \]
    3. distribute-rgt-neg-in95.9%

      \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \left(-\left(-\log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)\right)\right)} \]
    4. log-rec96.8%

      \[\leadsto \left(3 \cdot s\right) \cdot \left(-\left(-\color{blue}{\left(-\log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right)\right) \]
    5. remove-double-neg96.8%

      \[\leadsto \left(3 \cdot s\right) \cdot \left(-\color{blue}{\log \left(1 - \frac{u - 0.25}{0.75}\right)}\right) \]
    6. div-sub95.8%

      \[\leadsto \left(3 \cdot s\right) \cdot \left(-\log \left(1 - \color{blue}{\left(\frac{u}{0.75} - \frac{0.25}{0.75}\right)}\right)\right) \]
    7. metadata-eval95.8%

      \[\leadsto \left(3 \cdot s\right) \cdot \left(-\log \left(1 - \left(\frac{u}{0.75} - \color{blue}{0.3333333333333333}\right)\right)\right) \]
  3. Simplified95.8%

    \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \left(-\log \left(1 - \left(\frac{u}{0.75} - 0.3333333333333333\right)\right)\right)} \]
  4. Taylor expanded in s around 0 96.4%

    \[\leadsto \color{blue}{-3 \cdot \left(s \cdot \log \left(1.3333333333333333 - 1.3333333333333333 \cdot u\right)\right)} \]
  5. Final simplification96.4%

    \[\leadsto -3 \cdot \left(s \cdot \log \left(1.3333333333333333 - u \cdot 1.3333333333333333\right)\right) \]

Alternative 5: 97.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ -3 \cdot \left(s \cdot \mathsf{log1p}\left(\left(0.25 - u\right) \cdot 1.3333333333333333\right)\right) \end{array} \]
(FPCore (s u)
 :precision binary32
 (* -3.0 (* s (log1p (* (- 0.25 u) 1.3333333333333333)))))
float code(float s, float u) {
	return -3.0f * (s * log1pf(((0.25f - u) * 1.3333333333333333f)));
}
function code(s, u)
	return Float32(Float32(-3.0) * Float32(s * log1p(Float32(Float32(Float32(0.25) - u) * Float32(1.3333333333333333)))))
end
\begin{array}{l}

\\
-3 \cdot \left(s \cdot \mathsf{log1p}\left(\left(0.25 - u\right) \cdot 1.3333333333333333\right)\right)
\end{array}
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. Step-by-step derivation
    1. *-commutative95.9%

      \[\leadsto \color{blue}{\left(s \cdot 3\right)} \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. associate-*l*95.9%

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

      \[\leadsto s \cdot \left(3 \cdot \color{blue}{\left(-\log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right) \]
    4. neg-mul-196.9%

      \[\leadsto s \cdot \left(3 \cdot \color{blue}{\left(-1 \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right) \]
    5. associate-*r*96.9%

      \[\leadsto s \cdot \color{blue}{\left(\left(3 \cdot -1\right) \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right)} \]
    6. metadata-eval96.9%

      \[\leadsto s \cdot \left(\color{blue}{-3} \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right) \]
    7. sub-neg96.9%

      \[\leadsto s \cdot \left(-3 \cdot \log \color{blue}{\left(1 + \left(-\frac{u - 0.25}{0.75}\right)\right)}\right) \]
    8. log1p-def98.5%

      \[\leadsto s \cdot \left(-3 \cdot \color{blue}{\mathsf{log1p}\left(-\frac{u - 0.25}{0.75}\right)}\right) \]
    9. distribute-neg-frac98.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right)\right) \]
    10. neg-mul-198.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{\color{blue}{-1 \cdot \left(u - 0.25\right)}}{0.75}\right)\right) \]
    11. associate-/l*98.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{\frac{0.75}{u - 0.25}}}\right)\right) \]
    12. associate-/r/98.1%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{0.75} \cdot \left(u - 0.25\right)}\right)\right) \]
    13. sub-neg98.1%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{-1}{0.75} \cdot \color{blue}{\left(u + \left(-0.25\right)\right)}\right)\right) \]
    14. distribute-lft-in97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{0.75} \cdot u + \frac{-1}{0.75} \cdot \left(-0.25\right)}\right)\right) \]
    15. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{-1.3333333333333333} \cdot u + \frac{-1}{0.75} \cdot \left(-0.25\right)\right)\right) \]
    16. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + \color{blue}{-1.3333333333333333} \cdot \left(-0.25\right)\right)\right) \]
    17. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + -1.3333333333333333 \cdot \color{blue}{-0.25}\right)\right) \]
    18. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + \color{blue}{0.3333333333333333}\right)\right) \]
  3. Simplified97.0%

    \[\leadsto \color{blue}{s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right)} \]
  4. Step-by-step derivation
    1. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\left(-1.3333333333333333\right)} \cdot u + 0.3333333333333333\right)\right) \]
    2. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\left(-\color{blue}{\frac{1}{0.75}}\right) \cdot u + 0.3333333333333333\right)\right) \]
    3. distribute-lft-neg-in97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\left(-\frac{1}{0.75} \cdot u\right)} + 0.3333333333333333\right)\right) \]
    4. *-commutative97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\left(-\color{blue}{u \cdot \frac{1}{0.75}}\right) + 0.3333333333333333\right)\right) \]
    5. div-inv96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\left(-\color{blue}{\frac{u}{0.75}}\right) + 0.3333333333333333\right)\right) \]
    6. metadata-eval96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\left(-\frac{u}{0.75}\right) + \color{blue}{\left(--0.3333333333333333\right)}\right)\right) \]
    7. metadata-eval96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\left(-\frac{u}{0.75}\right) + \left(-\color{blue}{\left(-0.3333333333333333\right)}\right)\right)\right) \]
    8. distribute-neg-in96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{-\left(\frac{u}{0.75} + \left(-0.3333333333333333\right)\right)}\right)\right) \]
    9. sub-neg96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-\color{blue}{\left(\frac{u}{0.75} - 0.3333333333333333\right)}\right)\right) \]
    10. metadata-eval96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-\left(\frac{u}{0.75} - \color{blue}{\frac{0.25}{0.75}}\right)\right)\right) \]
    11. div-sub98.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-\color{blue}{\frac{u - 0.25}{0.75}}\right)\right) \]
    12. distribute-frac-neg98.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right)\right) \]
    13. sub-neg98.5%

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

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{-\color{blue}{\left(\left(-0.25\right) + u\right)}}{0.75}\right)\right) \]
    15. distribute-neg-in98.5%

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

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

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

    \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{0.25 + \left(-u\right)}{0.75}}\right)\right) \]
  6. Step-by-step derivation
    1. sub-neg98.5%

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

    \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{0.25 - u}{0.75}}\right)\right) \]
  8. Taylor expanded in s around 0 96.5%

    \[\leadsto \color{blue}{-3 \cdot \left(s \cdot \log \left(1 + 1.3333333333333333 \cdot \left(0.25 - u\right)\right)\right)} \]
  9. Step-by-step derivation
    1. log1p-def97.9%

      \[\leadsto -3 \cdot \left(s \cdot \color{blue}{\mathsf{log1p}\left(1.3333333333333333 \cdot \left(0.25 - u\right)\right)}\right) \]
  10. Simplified97.9%

    \[\leadsto \color{blue}{-3 \cdot \left(s \cdot \mathsf{log1p}\left(1.3333333333333333 \cdot \left(0.25 - u\right)\right)\right)} \]
  11. Final simplification97.9%

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

Alternative 6: 98.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ -3 \cdot \left(s \cdot \mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right)\right) \end{array} \]
(FPCore (s u) :precision binary32 (* -3.0 (* s (log1p (/ (- 0.25 u) 0.75)))))
float code(float s, float u) {
	return -3.0f * (s * log1pf(((0.25f - u) / 0.75f)));
}
function code(s, u)
	return Float32(Float32(-3.0) * Float32(s * log1p(Float32(Float32(Float32(0.25) - u) / Float32(0.75)))))
end
\begin{array}{l}

\\
-3 \cdot \left(s \cdot \mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right)\right)
\end{array}
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. Step-by-step derivation
    1. remove-double-neg95.9%

      \[\leadsto \color{blue}{-\left(-\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)\right)} \]
    2. distribute-rgt-neg-in95.9%

      \[\leadsto -\color{blue}{\left(3 \cdot s\right) \cdot \left(-\log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)\right)} \]
    3. distribute-rgt-neg-in95.9%

      \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \left(-\left(-\log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)\right)\right)} \]
    4. log-rec96.8%

      \[\leadsto \left(3 \cdot s\right) \cdot \left(-\left(-\color{blue}{\left(-\log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right)\right) \]
    5. remove-double-neg96.8%

      \[\leadsto \left(3 \cdot s\right) \cdot \left(-\color{blue}{\log \left(1 - \frac{u - 0.25}{0.75}\right)}\right) \]
    6. sub-neg96.8%

      \[\leadsto \left(3 \cdot s\right) \cdot \left(-\log \color{blue}{\left(1 + \left(-\frac{u - 0.25}{0.75}\right)\right)}\right) \]
    7. log1p-def98.5%

      \[\leadsto \left(3 \cdot s\right) \cdot \left(-\color{blue}{\mathsf{log1p}\left(-\frac{u - 0.25}{0.75}\right)}\right) \]
    8. distribute-neg-frac98.5%

      \[\leadsto \left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right)\right) \]
  3. 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)} \]
  4. Step-by-step derivation
    1. add-exp-log_binary3290.7%

      \[\leadsto \color{blue}{e^{\log \left(\left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\frac{-\left(u - 0.25\right)}{0.75}\right)\right)\right)}} \]
  5. Applied rewrite-once90.7%

    \[\leadsto \color{blue}{e^{\log \left(\left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\frac{-\left(u - 0.25\right)}{0.75}\right)\right)\right)}} \]
  6. Step-by-step derivation
    1. rem-exp-log98.5%

      \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\frac{-\left(u - 0.25\right)}{0.75}\right)\right)} \]
    2. distribute-rgt-neg-out98.5%

      \[\leadsto \color{blue}{-\left(3 \cdot s\right) \cdot \mathsf{log1p}\left(\frac{-\left(u - 0.25\right)}{0.75}\right)} \]
    3. distribute-lft-neg-in98.5%

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

      \[\leadsto \left(-3 \cdot s\right) \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\left(u - 0.25\right)}{0.75}\right)\right)\right)} \]
    5. log1p-def96.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \color{blue}{\log \left(1 + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\left(u - 0.25\right)}{0.75}\right)\right)\right)} \]
    6. expm1-log1p96.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \left(1 + \color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right) \]
    7. distribute-frac-neg96.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \left(1 + \color{blue}{\left(-\frac{u - 0.25}{0.75}\right)}\right) \]
    8. div-sub95.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \left(1 + \left(-\color{blue}{\left(\frac{u}{0.75} - \frac{0.25}{0.75}\right)}\right)\right) \]
    9. metadata-eval95.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \left(1 + \left(-\left(\frac{u}{0.75} - \color{blue}{0.3333333333333333}\right)\right)\right) \]
    10. sub-neg95.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \color{blue}{\left(1 - \left(\frac{u}{0.75} - 0.3333333333333333\right)\right)} \]
    11. distribute-lft-neg-in95.8%

      \[\leadsto \color{blue}{\left(\left(-3\right) \cdot s\right)} \cdot \log \left(1 - \left(\frac{u}{0.75} - 0.3333333333333333\right)\right) \]
    12. metadata-eval95.8%

      \[\leadsto \left(\color{blue}{-3} \cdot s\right) \cdot \log \left(1 - \left(\frac{u}{0.75} - 0.3333333333333333\right)\right) \]
    13. sub-neg95.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \color{blue}{\left(1 + \left(-\left(\frac{u}{0.75} - 0.3333333333333333\right)\right)\right)} \]
    14. metadata-eval95.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \left(1 + \left(-\left(\frac{u}{0.75} - \color{blue}{\frac{0.25}{0.75}}\right)\right)\right) \]
    15. div-sub96.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \left(1 + \left(-\color{blue}{\frac{u - 0.25}{0.75}}\right)\right) \]
    16. distribute-frac-neg96.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \left(1 + \color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right) \]
    17. expm1-log1p96.8%

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \left(1 + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\left(u - 0.25\right)}{0.75}\right)\right)}\right) \]
  7. Simplified98.5%

    \[\leadsto \color{blue}{\left(-3 \cdot s\right) \cdot \mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right)} \]
  8. Step-by-step derivation
    1. add-exp-log_binary3290.7%

      \[\leadsto \color{blue}{e^{\log \left(\left(-3 \cdot s\right) \cdot \mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right)\right)}} \]
  9. Applied rewrite-once90.7%

    \[\leadsto \color{blue}{e^{\log \left(\left(-3 \cdot s\right) \cdot \mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right)\right)}} \]
  10. Step-by-step derivation
    1. rem-exp-log98.5%

      \[\leadsto \color{blue}{\left(-3 \cdot s\right) \cdot \mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right)} \]
    2. associate-*l*98.3%

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

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

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

Alternative 7: 98.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right)\right) \end{array} \]
(FPCore (s u) :precision binary32 (* s (* -3.0 (log1p (/ (- 0.25 u) 0.75)))))
float code(float s, float u) {
	return s * (-3.0f * log1pf(((0.25f - u) / 0.75f)));
}
function code(s, u)
	return Float32(s * Float32(Float32(-3.0) * log1p(Float32(Float32(Float32(0.25) - u) / Float32(0.75)))))
end
\begin{array}{l}

\\
s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{0.25 - u}{0.75}\right)\right)
\end{array}
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. Step-by-step derivation
    1. *-commutative95.9%

      \[\leadsto \color{blue}{\left(s \cdot 3\right)} \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. associate-*l*95.9%

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

      \[\leadsto s \cdot \left(3 \cdot \color{blue}{\left(-\log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right) \]
    4. neg-mul-196.9%

      \[\leadsto s \cdot \left(3 \cdot \color{blue}{\left(-1 \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right)}\right) \]
    5. associate-*r*96.9%

      \[\leadsto s \cdot \color{blue}{\left(\left(3 \cdot -1\right) \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right)} \]
    6. metadata-eval96.9%

      \[\leadsto s \cdot \left(\color{blue}{-3} \cdot \log \left(1 - \frac{u - 0.25}{0.75}\right)\right) \]
    7. sub-neg96.9%

      \[\leadsto s \cdot \left(-3 \cdot \log \color{blue}{\left(1 + \left(-\frac{u - 0.25}{0.75}\right)\right)}\right) \]
    8. log1p-def98.5%

      \[\leadsto s \cdot \left(-3 \cdot \color{blue}{\mathsf{log1p}\left(-\frac{u - 0.25}{0.75}\right)}\right) \]
    9. distribute-neg-frac98.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right)\right) \]
    10. neg-mul-198.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{\color{blue}{-1 \cdot \left(u - 0.25\right)}}{0.75}\right)\right) \]
    11. associate-/l*98.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{\frac{0.75}{u - 0.25}}}\right)\right) \]
    12. associate-/r/98.1%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{0.75} \cdot \left(u - 0.25\right)}\right)\right) \]
    13. sub-neg98.1%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{-1}{0.75} \cdot \color{blue}{\left(u + \left(-0.25\right)\right)}\right)\right) \]
    14. distribute-lft-in97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-1}{0.75} \cdot u + \frac{-1}{0.75} \cdot \left(-0.25\right)}\right)\right) \]
    15. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{-1.3333333333333333} \cdot u + \frac{-1}{0.75} \cdot \left(-0.25\right)\right)\right) \]
    16. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + \color{blue}{-1.3333333333333333} \cdot \left(-0.25\right)\right)\right) \]
    17. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + -1.3333333333333333 \cdot \color{blue}{-0.25}\right)\right) \]
    18. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + \color{blue}{0.3333333333333333}\right)\right) \]
  3. Simplified97.0%

    \[\leadsto \color{blue}{s \cdot \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot u + 0.3333333333333333\right)\right)} \]
  4. Step-by-step derivation
    1. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\left(-1.3333333333333333\right)} \cdot u + 0.3333333333333333\right)\right) \]
    2. metadata-eval97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\left(-\color{blue}{\frac{1}{0.75}}\right) \cdot u + 0.3333333333333333\right)\right) \]
    3. distribute-lft-neg-in97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\left(-\frac{1}{0.75} \cdot u\right)} + 0.3333333333333333\right)\right) \]
    4. *-commutative97.0%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\left(-\color{blue}{u \cdot \frac{1}{0.75}}\right) + 0.3333333333333333\right)\right) \]
    5. div-inv96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\left(-\color{blue}{\frac{u}{0.75}}\right) + 0.3333333333333333\right)\right) \]
    6. metadata-eval96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\left(-\frac{u}{0.75}\right) + \color{blue}{\left(--0.3333333333333333\right)}\right)\right) \]
    7. metadata-eval96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\left(-\frac{u}{0.75}\right) + \left(-\color{blue}{\left(-0.3333333333333333\right)}\right)\right)\right) \]
    8. distribute-neg-in96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{-\left(\frac{u}{0.75} + \left(-0.3333333333333333\right)\right)}\right)\right) \]
    9. sub-neg96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-\color{blue}{\left(\frac{u}{0.75} - 0.3333333333333333\right)}\right)\right) \]
    10. metadata-eval96.7%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-\left(\frac{u}{0.75} - \color{blue}{\frac{0.25}{0.75}}\right)\right)\right) \]
    11. div-sub98.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(-\color{blue}{\frac{u - 0.25}{0.75}}\right)\right) \]
    12. distribute-frac-neg98.5%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-\left(u - 0.25\right)}{0.75}}\right)\right) \]
    13. sub-neg98.5%

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

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\frac{-\color{blue}{\left(\left(-0.25\right) + u\right)}}{0.75}\right)\right) \]
    15. distribute-neg-in98.5%

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

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

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

    \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{0.25 + \left(-u\right)}{0.75}}\right)\right) \]
  6. Step-by-step derivation
    1. sub-neg98.5%

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

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

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

Alternative 8: 30.1% accurate, 22.6× speedup?

\[\begin{array}{l} \\ 3 \cdot \left(s \cdot u\right) \end{array} \]
(FPCore (s u) :precision binary32 (* 3.0 (* s u)))
float code(float s, float u) {
	return 3.0f * (s * u);
}
real(4) function code(s, u)
    real(4), intent (in) :: s
    real(4), intent (in) :: u
    code = 3.0e0 * (s * u)
end function
function code(s, u)
	return Float32(Float32(3.0) * Float32(s * u))
end
function tmp = code(s, u)
	tmp = single(3.0) * (s * u);
end
\begin{array}{l}

\\
3 \cdot \left(s \cdot u\right)
\end{array}
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. Taylor expanded in u around 0 26.2%

    \[\leadsto \color{blue}{3 \cdot \left(s \cdot u\right) + 3 \cdot \left(s \cdot \log 0.75\right)} \]
  3. Step-by-step derivation
    1. distribute-lft-out26.2%

      \[\leadsto \color{blue}{3 \cdot \left(s \cdot u + s \cdot \log 0.75\right)} \]
    2. distribute-lft-out26.2%

      \[\leadsto 3 \cdot \color{blue}{\left(s \cdot \left(u + \log 0.75\right)\right)} \]
  4. Simplified26.2%

    \[\leadsto \color{blue}{3 \cdot \left(s \cdot \left(u + \log 0.75\right)\right)} \]
  5. Taylor expanded in u around inf 30.2%

    \[\leadsto 3 \cdot \left(s \cdot \color{blue}{u}\right) \]
  6. Final simplification30.2%

    \[\leadsto 3 \cdot \left(s \cdot u\right) \]

Reproduce

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