Disney BSSRDF, sample scattering profile, upper

Percentage Accurate: 95.9% → 98.4%
Time: 12.4s
Alternatives: 10
Speedup: 1.2×

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 10 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: 98.4% accurate, 0.6× speedup?

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

\\
\mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \mathsf{fma}\left(u, 1.7777777777777777, -0.4444444444444444\right)\right) \cdot \left(s \cdot -3\right)\right)
\end{array}
Derivation
  1. Initial program 96.0%

    \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-log.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
    2. lift-/.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \log \color{blue}{\left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
    3. lift--.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}}\right) \]
    4. flip--N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}}{1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}}}}\right) \]
    5. clear-numN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \log \color{blue}{\left(\frac{1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}}{1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
    6. log-divN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\log \left(1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)} \]
    7. lower--.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\log \left(1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)} \]
    8. lower-log1p.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\color{blue}{\mathsf{log1p}\left(\frac{u - \frac{1}{4}}{\frac{3}{4}}\right)} - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    9. lift-/.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\frac{u - \frac{1}{4}}{\frac{3}{4}}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    10. lift--.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\frac{\color{blue}{u - \frac{1}{4}}}{\frac{3}{4}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    11. div-subN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    12. sub-negN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\frac{u}{\frac{3}{4}} + \left(\mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    13. div-invN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{u \cdot \frac{1}{\frac{3}{4}}} + \left(\mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    14. lower-fma.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(u, \frac{1}{\frac{3}{4}}, \mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \color{blue}{\frac{4}{3}}, \mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \mathsf{neg}\left(\color{blue}{\frac{1}{3}}\right)\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    17. metadata-evalN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \color{blue}{\frac{-1}{3}}\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
  4. Applied rewrites98.3%

    \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(1.7777777777777777 \cdot \left(u + -0.25\right)\right)\right)\right)} \]
  5. Step-by-step derivation
    1. lift-*.f32N/A

      \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)} \]
    2. lift--.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)} \]
    3. sub-negN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) + \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)\right)\right)} \]
    4. distribute-lft-inN/A

      \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) + \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)\right)} \]
    5. lower-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)\right)\right)} \]
    6. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{\left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)\right)}\right) \]
    7. lower-neg.f3298.5

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \left(3 \cdot s\right) \cdot \color{blue}{\left(-\mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(1.7777777777777777 \cdot \left(u + -0.25\right)\right)\right)\right)}\right) \]
    8. lift-*.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\color{blue}{\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)}\right)\right)\right)\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\color{blue}{\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\frac{1}{4} - u\right)}\right)\right)\right)\right) \]
    10. lift--.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \color{blue}{\left(\frac{1}{4} - u\right)}\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \color{blue}{\left(\frac{1}{4} + \left(\mathsf{neg}\left(u\right)\right)\right)}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{-1}{4}\right)\right)} + \left(\mathsf{neg}\left(u\right)\right)\right)\right)\right)\right)\right) \]
    13. distribute-neg-inN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\frac{-1}{4} + u\right)\right)\right)}\right)\right)\right)\right) \]
    14. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(u + \frac{-1}{4}\right)}\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\mathsf{neg}\left(\left(u + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{4}\right)\right)}\right)\right)\right)\right)\right)\right)\right) \]
    16. sub-negN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(u - \frac{1}{4}\right)}\right)\right)\right)\right)\right)\right) \]
    17. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\color{blue}{\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\mathsf{neg}\left(\left(u - \frac{1}{4}\right)\right)\right)}\right)\right)\right)\right) \]
  6. Applied rewrites98.5%

    \[\leadsto \color{blue}{\mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\mathsf{fma}\left(1.7777777777777777, u, -0.4444444444444444\right) \cdot \left(0.25 - u\right)\right)\right)\right)} \]
  7. Taylor expanded in s around 0

    \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{-3 \cdot \left(s \cdot \log \left(1 + \left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right)\right)}\right) \]
  8. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{\left(-3 \cdot s\right) \cdot \log \left(1 + \left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right)}\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{\log \left(1 + \left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right) \cdot \left(-3 \cdot s\right)}\right) \]
    3. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{\log \left(1 + \left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right) \cdot \left(-3 \cdot s\right)}\right) \]
    4. lower-log1p.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right)} \cdot \left(-3 \cdot s\right)\right) \]
    5. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\color{blue}{\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)}\right) \cdot \left(-3 \cdot s\right)\right) \]
    6. lower--.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\color{blue}{\left(\frac{1}{4} - u\right)} \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right) \cdot \left(-3 \cdot s\right)\right) \]
    7. sub-negN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \color{blue}{\left(\frac{16}{9} \cdot u + \left(\mathsf{neg}\left(\frac{4}{9}\right)\right)\right)}\right) \cdot \left(-3 \cdot s\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\color{blue}{u \cdot \frac{16}{9}} + \left(\mathsf{neg}\left(\frac{4}{9}\right)\right)\right)\right) \cdot \left(-3 \cdot s\right)\right) \]
    9. lower-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \color{blue}{\mathsf{fma}\left(u, \frac{16}{9}, \mathsf{neg}\left(\frac{4}{9}\right)\right)}\right) \cdot \left(-3 \cdot s\right)\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \mathsf{fma}\left(u, \frac{16}{9}, \color{blue}{\frac{-4}{9}}\right)\right) \cdot \left(-3 \cdot s\right)\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \mathsf{fma}\left(u, \frac{16}{9}, \frac{-4}{9}\right)\right) \cdot \color{blue}{\left(s \cdot -3\right)}\right) \]
    12. lower-*.f3298.5

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \mathsf{fma}\left(u, 1.7777777777777777, -0.4444444444444444\right)\right) \cdot \color{blue}{\left(s \cdot -3\right)}\right) \]
  9. Applied rewrites98.5%

    \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \color{blue}{\mathsf{log1p}\left(\left(0.25 - u\right) \cdot \mathsf{fma}\left(u, 1.7777777777777777, -0.4444444444444444\right)\right) \cdot \left(s \cdot -3\right)}\right) \]
  10. Add Preprocessing

Alternative 2: 98.3% accurate, 0.6× speedup?

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

\\
\mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, \mathsf{fma}\left(u, -1.7777777777777777, 0.8888888888888888\right), -0.1111111111111111\right)\right)\right)
\end{array}
Derivation
  1. Initial program 96.0%

    \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-log.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
    2. lift-/.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \log \color{blue}{\left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
    3. lift--.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}}\right) \]
    4. flip--N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}}{1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}}}}\right) \]
    5. clear-numN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \log \color{blue}{\left(\frac{1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}}{1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
    6. log-divN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\log \left(1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)} \]
    7. lower--.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\log \left(1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)} \]
    8. lower-log1p.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\color{blue}{\mathsf{log1p}\left(\frac{u - \frac{1}{4}}{\frac{3}{4}}\right)} - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    9. lift-/.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\frac{u - \frac{1}{4}}{\frac{3}{4}}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    10. lift--.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\frac{\color{blue}{u - \frac{1}{4}}}{\frac{3}{4}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    11. div-subN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    12. sub-negN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\frac{u}{\frac{3}{4}} + \left(\mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    13. div-invN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{u \cdot \frac{1}{\frac{3}{4}}} + \left(\mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    14. lower-fma.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(u, \frac{1}{\frac{3}{4}}, \mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \color{blue}{\frac{4}{3}}, \mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \mathsf{neg}\left(\color{blue}{\frac{1}{3}}\right)\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    17. metadata-evalN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \color{blue}{\frac{-1}{3}}\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
  4. Applied rewrites98.3%

    \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(1.7777777777777777 \cdot \left(u + -0.25\right)\right)\right)\right)} \]
  5. Step-by-step derivation
    1. lift-*.f32N/A

      \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)} \]
    2. lift--.f32N/A

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)} \]
    3. sub-negN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) + \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)\right)\right)} \]
    4. distribute-lft-inN/A

      \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) + \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)\right)} \]
    5. lower-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)\right)\right)} \]
    6. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{\left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)\right)\right)\right)}\right) \]
    7. lower-neg.f3298.5

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \left(3 \cdot s\right) \cdot \color{blue}{\left(-\mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(1.7777777777777777 \cdot \left(u + -0.25\right)\right)\right)\right)}\right) \]
    8. lift-*.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\color{blue}{\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right)}\right)\right)\right)\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\color{blue}{\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\frac{1}{4} - u\right)}\right)\right)\right)\right) \]
    10. lift--.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \color{blue}{\left(\frac{1}{4} - u\right)}\right)\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \color{blue}{\left(\frac{1}{4} + \left(\mathsf{neg}\left(u\right)\right)\right)}\right)\right)\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{-1}{4}\right)\right)} + \left(\mathsf{neg}\left(u\right)\right)\right)\right)\right)\right)\right) \]
    13. distribute-neg-inN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\frac{-1}{4} + u\right)\right)\right)}\right)\right)\right)\right) \]
    14. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(u + \frac{-1}{4}\right)}\right)\right)\right)\right)\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\mathsf{neg}\left(\left(u + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{4}\right)\right)}\right)\right)\right)\right)\right)\right)\right) \]
    16. sub-negN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(u - \frac{1}{4}\right)}\right)\right)\right)\right)\right)\right) \]
    17. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\mathsf{log1p}\left(\color{blue}{\left(\frac{16}{9} \cdot \left(u + \frac{-1}{4}\right)\right) \cdot \left(\mathsf{neg}\left(\left(u - \frac{1}{4}\right)\right)\right)}\right)\right)\right)\right) \]
  6. Applied rewrites98.5%

    \[\leadsto \color{blue}{\mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \left(3 \cdot s\right) \cdot \left(-\mathsf{log1p}\left(\mathsf{fma}\left(1.7777777777777777, u, -0.4444444444444444\right) \cdot \left(0.25 - u\right)\right)\right)\right)} \]
  7. Taylor expanded in s around 0

    \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{-3 \cdot \left(s \cdot \log \left(1 + \left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right)\right)}\right) \]
  8. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{\left(-3 \cdot s\right) \cdot \log \left(1 + \left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right)}\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{\log \left(1 + \left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right) \cdot \left(-3 \cdot s\right)}\right) \]
    3. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{\log \left(1 + \left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right) \cdot \left(-3 \cdot s\right)}\right) \]
    4. lower-log1p.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \color{blue}{\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right)} \cdot \left(-3 \cdot s\right)\right) \]
    5. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\color{blue}{\left(\frac{1}{4} - u\right) \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)}\right) \cdot \left(-3 \cdot s\right)\right) \]
    6. lower--.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\color{blue}{\left(\frac{1}{4} - u\right)} \cdot \left(\frac{16}{9} \cdot u - \frac{4}{9}\right)\right) \cdot \left(-3 \cdot s\right)\right) \]
    7. sub-negN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \color{blue}{\left(\frac{16}{9} \cdot u + \left(\mathsf{neg}\left(\frac{4}{9}\right)\right)\right)}\right) \cdot \left(-3 \cdot s\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \left(\color{blue}{u \cdot \frac{16}{9}} + \left(\mathsf{neg}\left(\frac{4}{9}\right)\right)\right)\right) \cdot \left(-3 \cdot s\right)\right) \]
    9. lower-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \color{blue}{\mathsf{fma}\left(u, \frac{16}{9}, \mathsf{neg}\left(\frac{4}{9}\right)\right)}\right) \cdot \left(-3 \cdot s\right)\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \mathsf{fma}\left(u, \frac{16}{9}, \color{blue}{\frac{-4}{9}}\right)\right) \cdot \left(-3 \cdot s\right)\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \mathsf{fma}\left(u, \frac{16}{9}, \frac{-4}{9}\right)\right) \cdot \color{blue}{\left(s \cdot -3\right)}\right) \]
    12. lower-*.f3298.5

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \mathsf{fma}\left(u, 1.7777777777777777, -0.4444444444444444\right)\right) \cdot \color{blue}{\left(s \cdot -3\right)}\right) \]
  9. Applied rewrites98.5%

    \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \color{blue}{\mathsf{log1p}\left(\left(0.25 - u\right) \cdot \mathsf{fma}\left(u, 1.7777777777777777, -0.4444444444444444\right)\right) \cdot \left(s \cdot -3\right)}\right) \]
  10. Taylor expanded in u around 0

    \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right), \mathsf{log1p}\left(u \cdot \left(\frac{8}{9} + \frac{-16}{9} \cdot u\right) - \frac{1}{9}\right) \cdot \left(s \cdot -3\right)\right) \]
  11. Step-by-step derivation
    1. Applied rewrites98.4%

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \mathsf{log1p}\left(\mathsf{fma}\left(u, \mathsf{fma}\left(u, -1.7777777777777777, 0.8888888888888888\right), -0.1111111111111111\right)\right) \cdot \left(s \cdot -3\right)\right) \]
    2. Final simplification98.4%

      \[\leadsto \mathsf{fma}\left(3 \cdot s, \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right), \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, \mathsf{fma}\left(u, -1.7777777777777777, 0.8888888888888888\right), -0.1111111111111111\right)\right)\right) \]
    3. Add Preprocessing

    Alternative 3: 98.2% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ s \cdot \left(3 \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \mathsf{fma}\left(u, 1.7777777777777777, -0.4444444444444444\right)\right)\right)\right) \end{array} \]
    (FPCore (s u)
     :precision binary32
     (*
      s
      (*
       3.0
       (-
        (log1p (fma u 1.3333333333333333 -0.3333333333333333))
        (log1p (* (- 0.25 u) (fma u 1.7777777777777777 -0.4444444444444444)))))))
    float code(float s, float u) {
    	return s * (3.0f * (log1pf(fmaf(u, 1.3333333333333333f, -0.3333333333333333f)) - log1pf(((0.25f - u) * fmaf(u, 1.7777777777777777f, -0.4444444444444444f)))));
    }
    
    function code(s, u)
    	return Float32(s * Float32(Float32(3.0) * Float32(log1p(fma(u, Float32(1.3333333333333333), Float32(-0.3333333333333333))) - log1p(Float32(Float32(Float32(0.25) - u) * fma(u, Float32(1.7777777777777777), Float32(-0.4444444444444444)))))))
    end
    
    \begin{array}{l}
    
    \\
    s \cdot \left(3 \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \mathsf{fma}\left(u, 1.7777777777777777, -0.4444444444444444\right)\right)\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 96.0%

      \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-log.f32N/A

        \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
      2. lift-/.f32N/A

        \[\leadsto \left(3 \cdot s\right) \cdot \log \color{blue}{\left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
      3. lift--.f32N/A

        \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}}\right) \]
      4. flip--N/A

        \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}}{1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}}}}\right) \]
      5. clear-numN/A

        \[\leadsto \left(3 \cdot s\right) \cdot \log \color{blue}{\left(\frac{1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}}{1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
      6. log-divN/A

        \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\log \left(1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)} \]
      7. lower--.f32N/A

        \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\log \left(1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)} \]
      8. lower-log1p.f32N/A

        \[\leadsto \left(3 \cdot s\right) \cdot \left(\color{blue}{\mathsf{log1p}\left(\frac{u - \frac{1}{4}}{\frac{3}{4}}\right)} - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
      9. lift-/.f32N/A

        \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\frac{u - \frac{1}{4}}{\frac{3}{4}}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
      10. lift--.f32N/A

        \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\frac{\color{blue}{u - \frac{1}{4}}}{\frac{3}{4}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
      11. div-subN/A

        \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
      12. sub-negN/A

        \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\frac{u}{\frac{3}{4}} + \left(\mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
      13. div-invN/A

        \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{u \cdot \frac{1}{\frac{3}{4}}} + \left(\mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
      14. lower-fma.f32N/A

        \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(u, \frac{1}{\frac{3}{4}}, \mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)}\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \color{blue}{\frac{4}{3}}, \mathsf{neg}\left(\frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \mathsf{neg}\left(\color{blue}{\frac{1}{3}}\right)\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \color{blue}{\frac{-1}{3}}\right)\right) - \log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) \]
    4. Applied rewrites98.3%

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \left(1.7777777777777777 \cdot \left(u + -0.25\right)\right)\right)\right)} \]
    5. Applied rewrites95.7%

      \[\leadsto \color{blue}{\left(\log \left(\frac{\mathsf{fma}\left(u, 1.3333333333333333, 0.6666666666666666\right)}{\mathsf{fma}\left(\mathsf{fma}\left(1.7777777777777777, u, -0.4444444444444444\right), 0.25 - u, 1\right)}\right) \cdot 3\right) \cdot s} \]
    6. Step-by-step derivation
      1. lift-log.f32N/A

        \[\leadsto \left(\color{blue}{\log \left(\frac{\mathsf{fma}\left(u, \frac{4}{3}, \frac{2}{3}\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right), \frac{1}{4} - u, 1\right)}\right)} \cdot 3\right) \cdot s \]
      2. lift-/.f32N/A

        \[\leadsto \left(\log \color{blue}{\left(\frac{\mathsf{fma}\left(u, \frac{4}{3}, \frac{2}{3}\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right), \frac{1}{4} - u, 1\right)}\right)} \cdot 3\right) \cdot s \]
      3. log-divN/A

        \[\leadsto \left(\color{blue}{\left(\log \left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{2}{3}\right)\right) - \log \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right), \frac{1}{4} - u, 1\right)\right)\right)} \cdot 3\right) \cdot s \]
      4. lift-fma.f32N/A

        \[\leadsto \left(\left(\log \color{blue}{\left(u \cdot \frac{4}{3} + \frac{2}{3}\right)} - \log \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right), \frac{1}{4} - u, 1\right)\right)\right) \cdot 3\right) \cdot s \]
      5. metadata-evalN/A

        \[\leadsto \left(\left(\log \left(u \cdot \frac{4}{3} + \color{blue}{\left(\frac{-1}{3} + 1\right)}\right) - \log \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right), \frac{1}{4} - u, 1\right)\right)\right) \cdot 3\right) \cdot s \]
      6. associate-+l+N/A

        \[\leadsto \left(\left(\log \color{blue}{\left(\left(u \cdot \frac{4}{3} + \frac{-1}{3}\right) + 1\right)} - \log \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right), \frac{1}{4} - u, 1\right)\right)\right) \cdot 3\right) \cdot s \]
      7. lift-fma.f32N/A

        \[\leadsto \left(\left(\log \left(\color{blue}{\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)} + 1\right) - \log \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right), \frac{1}{4} - u, 1\right)\right)\right) \cdot 3\right) \cdot s \]
      8. +-commutativeN/A

        \[\leadsto \left(\left(\log \color{blue}{\left(1 + \mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right)} - \log \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right), \frac{1}{4} - u, 1\right)\right)\right) \cdot 3\right) \cdot s \]
      9. lift-log1p.f32N/A

        \[\leadsto \left(\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right)} - \log \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right), \frac{1}{4} - u, 1\right)\right)\right) \cdot 3\right) \cdot s \]
      10. lift-fma.f32N/A

        \[\leadsto \left(\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \log \color{blue}{\left(\mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right) \cdot \left(\frac{1}{4} - u\right) + 1\right)}\right) \cdot 3\right) \cdot s \]
      11. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \log \left(\color{blue}{\left(\frac{1}{4} - u\right) \cdot \mathsf{fma}\left(\frac{16}{9}, u, \frac{-4}{9}\right)} + 1\right)\right) \cdot 3\right) \cdot s \]
      12. lift-fma.f32N/A

        \[\leadsto \left(\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \log \left(\left(\frac{1}{4} - u\right) \cdot \color{blue}{\left(\frac{16}{9} \cdot u + \frac{-4}{9}\right)} + 1\right)\right) \cdot 3\right) \cdot s \]
      13. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \log \left(\left(\frac{1}{4} - u\right) \cdot \left(\color{blue}{u \cdot \frac{16}{9}} + \frac{-4}{9}\right) + 1\right)\right) \cdot 3\right) \cdot s \]
      14. lift-fma.f32N/A

        \[\leadsto \left(\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \log \left(\left(\frac{1}{4} - u\right) \cdot \color{blue}{\mathsf{fma}\left(u, \frac{16}{9}, \frac{-4}{9}\right)} + 1\right)\right) \cdot 3\right) \cdot s \]
      15. lift-*.f32N/A

        \[\leadsto \left(\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \log \left(\color{blue}{\left(\frac{1}{4} - u\right) \cdot \mathsf{fma}\left(u, \frac{16}{9}, \frac{-4}{9}\right)} + 1\right)\right) \cdot 3\right) \cdot s \]
      16. +-commutativeN/A

        \[\leadsto \left(\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \log \color{blue}{\left(1 + \left(\frac{1}{4} - u\right) \cdot \mathsf{fma}\left(u, \frac{16}{9}, \frac{-4}{9}\right)\right)}\right) \cdot 3\right) \cdot s \]
      17. lift-log1p.f32N/A

        \[\leadsto \left(\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right) - \color{blue}{\mathsf{log1p}\left(\left(\frac{1}{4} - u\right) \cdot \mathsf{fma}\left(u, \frac{16}{9}, \frac{-4}{9}\right)\right)}\right) \cdot 3\right) \cdot s \]
      18. lower--.f3298.4

        \[\leadsto \left(\color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \mathsf{fma}\left(u, 1.7777777777777777, -0.4444444444444444\right)\right)\right)} \cdot 3\right) \cdot s \]
    7. Applied rewrites98.4%

      \[\leadsto \left(\color{blue}{\left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \mathsf{fma}\left(u, 1.7777777777777777, -0.4444444444444444\right)\right)\right)} \cdot 3\right) \cdot s \]
    8. Final simplification98.4%

      \[\leadsto s \cdot \left(3 \cdot \left(\mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right) - \mathsf{log1p}\left(\left(0.25 - u\right) \cdot \mathsf{fma}\left(u, 1.7777777777777777, -0.4444444444444444\right)\right)\right)\right) \]
    9. Add Preprocessing

    Alternative 4: 98.3% accurate, 1.1× 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 96.0%

      \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f32N/A

        \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
      2. lift-*.f32N/A

        \[\leadsto \color{blue}{\left(3 \cdot s\right)} \cdot \log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right) \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{3 \cdot \left(s \cdot \log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)\right)} \]
      4. *-commutativeN/A

        \[\leadsto 3 \cdot \color{blue}{\left(\log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right) \cdot s\right)} \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(3 \cdot \log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)\right) \cdot s} \]
      6. lower-*.f32N/A

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

      \[\leadsto \color{blue}{\left(-3 \cdot \mathsf{log1p}\left(-\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right)\right) \cdot s} \]
    5. Step-by-step derivation
      1. lift-neg.f32N/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\mathsf{neg}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right)}\right)\right) \cdot s \]
      2. lift-fma.f32N/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{neg}\left(\color{blue}{\left(u \cdot \frac{4}{3} + \frac{-1}{3}\right)}\right)\right)\right) \cdot s \]
      3. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{neg}\left(\left(u \cdot \frac{4}{3} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}\right)\right)\right)\right) \cdot s \]
      4. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{neg}\left(\left(u \cdot \frac{4}{3} + \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{4}}{\frac{3}{4}}}\right)\right)\right)\right)\right)\right) \cdot s \]
      5. sub-negN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{neg}\left(\color{blue}{\left(u \cdot \frac{4}{3} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)}\right)\right)\right) \cdot s \]
      6. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{neg}\left(\left(u \cdot \color{blue}{\frac{1}{\frac{3}{4}}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right)\right) \cdot s \]
      7. div-invN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{neg}\left(\left(\color{blue}{\frac{u}{\frac{3}{4}}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right)\right) \cdot s \]
      8. div-subN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{neg}\left(\color{blue}{\frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)\right)\right) \cdot s \]
      9. frac-2negN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{neg}\left(\color{blue}{\frac{\mathsf{neg}\left(\left(u - \frac{1}{4}\right)\right)}{\mathsf{neg}\left(\frac{3}{4}\right)}}\right)\right)\right) \cdot s \]
      10. distribute-neg-fracN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(u - \frac{1}{4}\right)\right)\right)\right)}{\mathsf{neg}\left(\frac{3}{4}\right)}}\right)\right) \cdot s \]
      11. frac-2negN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{\mathsf{neg}\left(\left(u - \frac{1}{4}\right)\right)}{\frac{3}{4}}}\right)\right) \cdot s \]
      12. lower-/.f32N/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{\mathsf{neg}\left(\left(u - \frac{1}{4}\right)\right)}{\frac{3}{4}}}\right)\right) \cdot s \]
      13. sub-negN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\frac{\mathsf{neg}\left(\color{blue}{\left(u + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)}\right)}{\frac{3}{4}}\right)\right) \cdot s \]
      14. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\frac{\mathsf{neg}\left(\left(u + \color{blue}{\frac{-1}{4}}\right)\right)}{\frac{3}{4}}\right)\right) \cdot s \]
      15. +-commutativeN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\frac{\mathsf{neg}\left(\color{blue}{\left(\frac{-1}{4} + u\right)}\right)}{\frac{3}{4}}\right)\right) \cdot s \]
      16. distribute-neg-inN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\frac{\color{blue}{\left(\mathsf{neg}\left(\frac{-1}{4}\right)\right) + \left(\mathsf{neg}\left(u\right)\right)}}{\frac{3}{4}}\right)\right) \cdot s \]
      17. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\frac{\color{blue}{\frac{1}{4}} + \left(\mathsf{neg}\left(u\right)\right)}{\frac{3}{4}}\right)\right) \cdot s \]
      18. sub-negN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\frac{\color{blue}{\frac{1}{4} - u}}{\frac{3}{4}}\right)\right) \cdot s \]
      19. lift--.f3298.3

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

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

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

    Alternative 5: 97.9% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ s \cdot \left(-3 \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, -1.3333333333333333, 0.3333333333333333\right)\right)\right) \end{array} \]
    (FPCore (s u)
     :precision binary32
     (* s (* -3.0 (log1p (fma u -1.3333333333333333 0.3333333333333333)))))
    float code(float s, float u) {
    	return s * (-3.0f * log1pf(fmaf(u, -1.3333333333333333f, 0.3333333333333333f)));
    }
    
    function code(s, u)
    	return Float32(s * Float32(Float32(-3.0) * log1p(fma(u, Float32(-1.3333333333333333), Float32(0.3333333333333333)))))
    end
    
    \begin{array}{l}
    
    \\
    s \cdot \left(-3 \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, -1.3333333333333333, 0.3333333333333333\right)\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 96.0%

      \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f32N/A

        \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)} \]
      2. lift-*.f32N/A

        \[\leadsto \color{blue}{\left(3 \cdot s\right)} \cdot \log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right) \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{3 \cdot \left(s \cdot \log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)\right)} \]
      4. *-commutativeN/A

        \[\leadsto 3 \cdot \color{blue}{\left(\log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right) \cdot s\right)} \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(3 \cdot \log \left(\frac{1}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}\right)\right) \cdot s} \]
      6. lower-*.f32N/A

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

      \[\leadsto \color{blue}{\left(-3 \cdot \mathsf{log1p}\left(-\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)\right)\right) \cdot s} \]
    5. Step-by-step derivation
      1. lift-neg.f32N/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\mathsf{neg}\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right)}\right)\right) \cdot s \]
      2. lift-fma.f32N/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{neg}\left(\color{blue}{\left(u \cdot \frac{4}{3} + \frac{-1}{3}\right)}\right)\right)\right) \cdot s \]
      3. distribute-neg-inN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\left(\mathsf{neg}\left(u \cdot \frac{4}{3}\right)\right) + \left(\mathsf{neg}\left(\frac{-1}{3}\right)\right)}\right)\right) \cdot s \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{u \cdot \left(\mathsf{neg}\left(\frac{4}{3}\right)\right)} + \left(\mathsf{neg}\left(\frac{-1}{3}\right)\right)\right)\right) \cdot s \]
      5. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(u \cdot \color{blue}{\frac{-4}{3}} + \left(\mathsf{neg}\left(\frac{-1}{3}\right)\right)\right)\right) \cdot s \]
      6. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(u \cdot \color{blue}{\frac{1}{\frac{-3}{4}}} + \left(\mathsf{neg}\left(\frac{-1}{3}\right)\right)\right)\right) \cdot s \]
      7. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(u \cdot \frac{1}{\color{blue}{\mathsf{neg}\left(\frac{3}{4}\right)}} + \left(\mathsf{neg}\left(\frac{-1}{3}\right)\right)\right)\right) \cdot s \]
      8. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(u \cdot \frac{1}{\mathsf{neg}\left(\frac{3}{4}\right)} + \color{blue}{\frac{1}{3}}\right)\right) \cdot s \]
      9. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(u \cdot \frac{1}{\mathsf{neg}\left(\frac{3}{4}\right)} + \color{blue}{\frac{\frac{1}{4}}{\frac{3}{4}}}\right)\right) \cdot s \]
      10. lower-fma.f32N/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(u, \frac{1}{\mathsf{neg}\left(\frac{3}{4}\right)}, \frac{\frac{1}{4}}{\frac{3}{4}}\right)}\right)\right) \cdot s \]
      11. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, \frac{1}{\color{blue}{\frac{-3}{4}}}, \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right) \cdot s \]
      12. metadata-evalN/A

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, \color{blue}{\frac{-4}{3}}, \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right) \cdot s \]
      13. metadata-eval97.8

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, -1.3333333333333333, \color{blue}{0.3333333333333333}\right)\right)\right) \cdot s \]
    6. Applied rewrites97.8%

      \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(u, -1.3333333333333333, 0.3333333333333333\right)}\right)\right) \cdot s \]
    7. Final simplification97.8%

      \[\leadsto s \cdot \left(-3 \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, -1.3333333333333333, 0.3333333333333333\right)\right)\right) \]
    8. Add Preprocessing

    Alternative 6: 97.9% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right) \end{array} \]
    (FPCore (s u)
     :precision binary32
     (* (* s -3.0) (log1p (fma -1.3333333333333333 u 0.3333333333333333))))
    float code(float s, float u) {
    	return (s * -3.0f) * log1pf(fmaf(-1.3333333333333333f, u, 0.3333333333333333f));
    }
    
    function code(s, u)
    	return Float32(Float32(s * Float32(-3.0)) * log1p(fma(Float32(-1.3333333333333333), u, Float32(0.3333333333333333))))
    end
    
    \begin{array}{l}
    
    \\
    \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 96.0%

      \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in s around 0

      \[\leadsto \color{blue}{3 \cdot \left(s \cdot \log \left(\frac{1}{1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)}\right)} \]
      2. log-recN/A

        \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\log \left(1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right)\right)\right)} \]
      3. distribute-rgt-neg-outN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\left(3 \cdot s\right) \cdot \log \left(1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right)\right)} \]
      4. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(3 \cdot s\right)\right) \cdot \log \left(1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right)} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(3\right)\right) \cdot s\right)} \cdot \log \left(1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \left(\color{blue}{-3} \cdot s\right) \cdot \log \left(1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) \]
      7. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(-3 \cdot s\right) \cdot \log \left(1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right)} \]
      8. *-commutativeN/A

        \[\leadsto \color{blue}{\left(s \cdot -3\right)} \cdot \log \left(1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) \]
      9. lower-*.f32N/A

        \[\leadsto \color{blue}{\left(s \cdot -3\right)} \cdot \log \left(1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) \]
      10. sub-negN/A

        \[\leadsto \left(s \cdot -3\right) \cdot \log \color{blue}{\left(1 + \left(\mathsf{neg}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right)\right)\right)} \]
      11. lower-log1p.f32N/A

        \[\leadsto \left(s \cdot -3\right) \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right)\right)} \]
      12. distribute-lft-neg-inN/A

        \[\leadsto \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{4}{3}\right)\right) \cdot \left(u - \frac{1}{4}\right)}\right) \]
      13. metadata-evalN/A

        \[\leadsto \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\color{blue}{\frac{-4}{3}} \cdot \left(u - \frac{1}{4}\right)\right) \]
      14. sub-negN/A

        \[\leadsto \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\frac{-4}{3} \cdot \color{blue}{\left(u + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)}\right) \]
      15. distribute-lft-inN/A

        \[\leadsto \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\color{blue}{\frac{-4}{3} \cdot u + \frac{-4}{3} \cdot \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)}\right) \]
      16. metadata-evalN/A

        \[\leadsto \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\frac{-4}{3} \cdot u + \frac{-4}{3} \cdot \color{blue}{\frac{-1}{4}}\right) \]
      17. metadata-evalN/A

        \[\leadsto \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\frac{-4}{3} \cdot u + \color{blue}{\frac{1}{3}}\right) \]
      18. lower-fma.f3297.8

        \[\leadsto \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)}\right) \]
    5. Applied rewrites97.8%

      \[\leadsto \color{blue}{\left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\mathsf{fma}\left(-1.3333333333333333, u, 0.3333333333333333\right)\right)} \]
    6. Add Preprocessing

    Alternative 7: 25.7% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ \left(3 \cdot s\right) \cdot \left(u + \log 0.75\right) \end{array} \]
    (FPCore (s u) :precision binary32 (* (* 3.0 s) (+ u (log 0.75))))
    float code(float s, float u) {
    	return (3.0f * s) * (u + logf(0.75f));
    }
    
    real(4) function code(s, u)
        real(4), intent (in) :: s
        real(4), intent (in) :: u
        code = (3.0e0 * s) * (u + log(0.75e0))
    end function
    
    function code(s, u)
    	return Float32(Float32(Float32(3.0) * s) * Float32(u + log(Float32(0.75))))
    end
    
    function tmp = code(s, u)
    	tmp = (single(3.0) * s) * (u + log(single(0.75)));
    end
    
    \begin{array}{l}
    
    \\
    \left(3 \cdot s\right) \cdot \left(u + \log 0.75\right)
    \end{array}
    
    Derivation
    1. Initial program 96.0%

      \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in u around 0

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(u + \log \frac{3}{4}\right)} \]
    4. Step-by-step derivation
      1. lower-+.f32N/A

        \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(u + \log \frac{3}{4}\right)} \]
      2. lower-log.f3225.9

        \[\leadsto \left(3 \cdot s\right) \cdot \left(u + \color{blue}{\log 0.75}\right) \]
    5. Applied rewrites25.9%

      \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(u + \log 0.75\right)} \]
    6. Add Preprocessing

    Alternative 8: 25.7% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ 3 \cdot \left(s \cdot \left(u + \log 0.75\right)\right) \end{array} \]
    (FPCore (s u) :precision binary32 (* 3.0 (* s (+ u (log 0.75)))))
    float code(float s, float u) {
    	return 3.0f * (s * (u + logf(0.75f)));
    }
    
    real(4) function code(s, u)
        real(4), intent (in) :: s
        real(4), intent (in) :: u
        code = 3.0e0 * (s * (u + log(0.75e0)))
    end function
    
    function code(s, u)
    	return Float32(Float32(3.0) * Float32(s * Float32(u + log(Float32(0.75)))))
    end
    
    function tmp = code(s, u)
    	tmp = single(3.0) * (s * (u + log(single(0.75))));
    end
    
    \begin{array}{l}
    
    \\
    3 \cdot \left(s \cdot \left(u + \log 0.75\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 96.0%

      \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in u around 0

      \[\leadsto \color{blue}{3 \cdot \left(s \cdot u\right) + 3 \cdot \left(s \cdot \log \frac{3}{4}\right)} \]
    4. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \color{blue}{3 \cdot \left(s \cdot u + s \cdot \log \frac{3}{4}\right)} \]
      2. lower-*.f32N/A

        \[\leadsto \color{blue}{3 \cdot \left(s \cdot u + s \cdot \log \frac{3}{4}\right)} \]
      3. distribute-lft-outN/A

        \[\leadsto 3 \cdot \color{blue}{\left(s \cdot \left(u + \log \frac{3}{4}\right)\right)} \]
      4. *-commutativeN/A

        \[\leadsto 3 \cdot \color{blue}{\left(\left(u + \log \frac{3}{4}\right) \cdot s\right)} \]
      5. lower-*.f32N/A

        \[\leadsto 3 \cdot \color{blue}{\left(\left(u + \log \frac{3}{4}\right) \cdot s\right)} \]
      6. lower-+.f32N/A

        \[\leadsto 3 \cdot \left(\color{blue}{\left(u + \log \frac{3}{4}\right)} \cdot s\right) \]
      7. lower-log.f3225.9

        \[\leadsto 3 \cdot \left(\left(u + \color{blue}{\log 0.75}\right) \cdot s\right) \]
    5. Applied rewrites25.9%

      \[\leadsto \color{blue}{3 \cdot \left(\left(u + \log 0.75\right) \cdot s\right)} \]
    6. Final simplification25.9%

      \[\leadsto 3 \cdot \left(s \cdot \left(u + \log 0.75\right)\right) \]
    7. Add Preprocessing

    Alternative 9: 7.4% accurate, 1.3× speedup?

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

      \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in u around 0

      \[\leadsto \left(3 \cdot s\right) \cdot \log \color{blue}{\frac{3}{4}} \]
    4. Step-by-step derivation
      1. Applied rewrites7.7%

        \[\leadsto \left(3 \cdot s\right) \cdot \log \color{blue}{0.75} \]
      2. Step-by-step derivation
        1. lift-*.f32N/A

          \[\leadsto \color{blue}{\left(3 \cdot s\right) \cdot \log \frac{3}{4}} \]
        2. lift-*.f32N/A

          \[\leadsto \color{blue}{\left(3 \cdot s\right)} \cdot \log \frac{3}{4} \]
        3. associate-*l*N/A

          \[\leadsto \color{blue}{3 \cdot \left(s \cdot \log \frac{3}{4}\right)} \]
        4. *-commutativeN/A

          \[\leadsto \color{blue}{\left(s \cdot \log \frac{3}{4}\right) \cdot 3} \]
        5. lower-*.f32N/A

          \[\leadsto \color{blue}{\left(s \cdot \log \frac{3}{4}\right) \cdot 3} \]
        6. lower-*.f327.7

          \[\leadsto \color{blue}{\left(s \cdot \log 0.75\right)} \cdot 3 \]
      3. Applied rewrites7.7%

        \[\leadsto \color{blue}{\left(s \cdot \log 0.75\right) \cdot 3} \]
      4. Final simplification7.7%

        \[\leadsto 3 \cdot \left(s \cdot \log 0.75\right) \]
      5. Add Preprocessing

      Alternative 10: 7.4% accurate, 1.3× speedup?

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

        \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in u around 0

        \[\leadsto \left(3 \cdot s\right) \cdot \log \color{blue}{\frac{3}{4}} \]
      4. Step-by-step derivation
        1. Applied rewrites7.7%

          \[\leadsto \left(3 \cdot s\right) \cdot \log \color{blue}{0.75} \]
        2. Add Preprocessing

        Reproduce

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