Disney BSSRDF, sample scattering profile, upper

Percentage Accurate: 95.9% → 98.3%
Time: 12.1s
Alternatives: 12
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 12 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.3% accurate, 0.4× speedup?

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

\\
\left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\left(u + -0.25\right) \cdot \frac{u + -0.25}{-0.5625}\right) - \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, 1.3333333333333333, -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. Step-by-step derivation
    1. log-recN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\log \left(1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)\right) \]
    2. neg-mul-1N/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \left(\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    11. associate--r-N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(\left(0 - \frac{u}{\frac{3}{4}}\right) + \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    12. neg-sub0N/A

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\mathsf{neg}\left(\frac{u}{\frac{3}{4}}\right)\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    16. distribute-neg-frac2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\frac{u}{\mathsf{neg}\left(\frac{3}{4}\right)}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    17. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    19. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(s \cdot 3\right) \cdot -1\right)\right) \]
    20. associate-*l*N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(s \cdot \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    21. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    22. metadata-eval96.5%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
  3. Simplified96.5%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(0.3333333333333333 + \frac{u}{-0.75}\right) \cdot \left(s \cdot -3\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(1 + \left(\frac{u}{\frac{-3}{4}} + \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    2. associate-+r+N/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\left(1 + \frac{u}{\frac{-3}{4}}\right) + \frac{1}{3}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    3. frac-2negN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\left(1 + \frac{\mathsf{neg}\left(u\right)}{\mathsf{neg}\left(\frac{-3}{4}\right)}\right) + \frac{1}{3}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\left(1 + \frac{\mathsf{neg}\left(u\right)}{\frac{3}{4}}\right) + \frac{1}{3}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    5. distribute-frac-negN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\left(1 + \left(\mathsf{neg}\left(\frac{u}{\frac{3}{4}}\right)\right)\right) + \frac{1}{3}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    6. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\left(1 - \frac{u}{\frac{3}{4}}\right) + \frac{1}{3}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    7. associate--r-N/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(1 - \left(\frac{u}{\frac{3}{4}} - \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(1 - \left(\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    9. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    10. flip--N/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\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), \mathsf{*.f32}\left(s, -3\right)\right) \]
    11. log-divN/A

      \[\leadsto \mathsf{*.f32}\left(\left(\log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right) - \log \left(1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right), \mathsf{*.f32}\left(\color{blue}{s}, -3\right)\right) \]
    12. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{\_.f32}\left(\log \left(1 \cdot 1 - \frac{u - \frac{1}{4}}{\frac{3}{4}} \cdot \frac{u - \frac{1}{4}}{\frac{3}{4}}\right), \log \left(1 + \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right), \mathsf{*.f32}\left(\color{blue}{s}, -3\right)\right) \]
  6. Applied egg-rr97.2%

    \[\leadsto \color{blue}{\left(\mathsf{log1p}\left(-\frac{\left(u + -0.25\right) \cdot \left(u + -0.25\right)}{0.5625}\right) - \mathsf{log1p}\left(\frac{u}{0.75} + -0.3333333333333333\right)\right)} \cdot \left(s \cdot -3\right) \]
  7. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\left(\left(s \cdot -3\right) \cdot \log \left(1 + \left(\mathsf{neg}\left(\frac{\left(u + \frac{-1}{4}\right) \cdot \left(u + \frac{-1}{4}\right)}{\frac{9}{16}}\right)\right)\right)\right), \color{blue}{\left(\left(s \cdot -3\right) \cdot \left(\mathsf{neg}\left(\log \left(1 + \left(\frac{u}{\frac{3}{4}} + \frac{-1}{3}\right)\right)\right)\right)\right)}\right) \]
  8. Applied egg-rr97.5%

    \[\leadsto \color{blue}{\left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\left(u + -0.25\right) \cdot \frac{u + -0.25}{-0.5625}\right) + \left(s \cdot -3\right) \cdot \left(-\mathsf{log1p}\left(\frac{u}{0.75} + -0.3333333333333333\right)\right)} \]
  9. Step-by-step derivation
    1. div-invN/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, -3\right), \mathsf{log1p.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(u, \frac{-1}{4}\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(u, \frac{-1}{4}\right), \frac{-9}{16}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, -3\right), \mathsf{neg.f32}\left(\mathsf{log1p.f32}\left(\left(\mathsf{fma}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right)\right)\right)\right)\right) \]
    4. fma-lowering-fma.f3298.1%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, -3\right), \mathsf{log1p.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(u, \frac{-1}{4}\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(u, \frac{-1}{4}\right), \frac{-9}{16}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, -3\right), \mathsf{neg.f32}\left(\mathsf{log1p.f32}\left(\mathsf{fma.f32}\left(u, \frac{4}{3}, \frac{-1}{3}\right)\right)\right)\right)\right) \]
  10. Applied egg-rr98.1%

    \[\leadsto \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\left(u + -0.25\right) \cdot \frac{u + -0.25}{-0.5625}\right) + \left(s \cdot -3\right) \cdot \left(-\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(u, 1.3333333333333333, -0.3333333333333333\right)}\right)\right) \]
  11. Final simplification98.1%

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

Alternative 2: 97.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, -1.3333333333333333, 0.3333333333333333\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(Float32(s * Float32(-3.0)) * log1p(fma(u, Float32(-1.3333333333333333), Float32(0.3333333333333333))))
end
\begin{array}{l}

\\
\left(s \cdot -3\right) \cdot \mathsf{log1p}\left(\mathsf{fma}\left(u, -1.3333333333333333, 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. Step-by-step derivation
    1. log-recN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\log \left(1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)\right) \]
    2. neg-mul-1N/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \left(\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    11. associate--r-N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(\left(0 - \frac{u}{\frac{3}{4}}\right) + \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    12. neg-sub0N/A

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\mathsf{neg}\left(\frac{u}{\frac{3}{4}}\right)\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    16. distribute-neg-frac2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\frac{u}{\mathsf{neg}\left(\frac{3}{4}\right)}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    17. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    19. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(s \cdot 3\right) \cdot -1\right)\right) \]
    20. associate-*l*N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(s \cdot \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    21. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    22. metadata-eval96.5%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
  3. Simplified96.5%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(0.3333333333333333 + \frac{u}{-0.75}\right) \cdot \left(s \cdot -3\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(\frac{u}{\frac{-3}{4}} + \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    2. div-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(u \cdot \frac{1}{\frac{-3}{4}} + \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    3. fma-defineN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(\mathsf{fma}\left(u, \frac{1}{\frac{-3}{4}}, \frac{1}{3}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    4. fma-lowering-fma.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{fma.f32}\left(u, \left(\frac{1}{\frac{-3}{4}}\right), \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    5. metadata-eval97.8%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{fma.f32}\left(u, \frac{-4}{3}, \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
  6. Applied egg-rr97.8%

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

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

Alternative 3: 96.8% accurate, 1.0× speedup?

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

\\
\left(s \cdot -3\right) \cdot \mathsf{log1p}\left(0.3333333333333333 + u \cdot -1.3333333333333333\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. Step-by-step derivation
    1. log-recN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\log \left(1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)\right) \]
    2. neg-mul-1N/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \left(\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    11. associate--r-N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(\left(0 - \frac{u}{\frac{3}{4}}\right) + \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    12. neg-sub0N/A

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\mathsf{neg}\left(\frac{u}{\frac{3}{4}}\right)\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    16. distribute-neg-frac2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\frac{u}{\mathsf{neg}\left(\frac{3}{4}\right)}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    17. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    19. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(s \cdot 3\right) \cdot -1\right)\right) \]
    20. associate-*l*N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(s \cdot \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    21. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    22. metadata-eval96.5%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
  3. Simplified96.5%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(0.3333333333333333 + \frac{u}{-0.75}\right) \cdot \left(s \cdot -3\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in s around 0

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-3 \cdot s\right) \cdot \log \left(1 + \left(\mathsf{neg}\left(\frac{4}{3}\right)\right) \cdot \left(u - \frac{1}{4}\right)\right) \]
    10. cancel-sign-sub-invN/A

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

      \[\leadsto \mathsf{*.f32}\left(\left(-3 \cdot s\right), \color{blue}{\log \left(1 - \frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right)}\right) \]
    12. *-lowering-*.f32N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(-3, s\right), \log \left(1 + \left(\mathsf{neg}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right)\right)\right)\right) \]
    14. log1p-defineN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(-3, s\right), \left(\mathsf{log1p}\left(\mathsf{neg}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right)\right)\right)\right) \]
    15. log1p-lowering-log1p.f32N/A

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(-3, s\right), \mathsf{log1p.f32}\left(\left(\frac{-4}{3} \cdot \left(u - \frac{1}{4}\right)\right)\right)\right) \]
    18. sub-negN/A

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(-3, s\right), \mathsf{log1p.f32}\left(\left(\frac{-4}{3} \cdot u + \frac{-4}{3} \cdot \frac{-1}{4}\right)\right)\right) \]
    21. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(-3, s\right), \mathsf{log1p.f32}\left(\left(\frac{-4}{3} \cdot u + \frac{1}{3}\right)\right)\right) \]
    22. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(-3, s\right), \mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\left(\frac{-4}{3} \cdot u\right), \frac{1}{3}\right)\right)\right) \]
  7. Simplified97.0%

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

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

Alternative 4: 96.5% accurate, 1.0× speedup?

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

\\
\left(s \cdot -3\right) \cdot \mathsf{log1p}\left(0.3333333333333333 + \frac{u}{-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. Step-by-step derivation
    1. log-recN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\log \left(1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)\right) \]
    2. neg-mul-1N/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \left(\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    11. associate--r-N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(\left(0 - \frac{u}{\frac{3}{4}}\right) + \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    12. neg-sub0N/A

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\mathsf{neg}\left(\frac{u}{\frac{3}{4}}\right)\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    16. distribute-neg-frac2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\frac{u}{\mathsf{neg}\left(\frac{3}{4}\right)}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    17. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    19. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(s \cdot 3\right) \cdot -1\right)\right) \]
    20. associate-*l*N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(s \cdot \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    21. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    22. metadata-eval96.5%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
  3. Simplified96.5%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(0.3333333333333333 + \frac{u}{-0.75}\right) \cdot \left(s \cdot -3\right)} \]
  4. Add Preprocessing
  5. Final simplification96.5%

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

Alternative 5: 94.7% accurate, 1.0× speedup?

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

\\
\left(s \cdot -3\right) \cdot \log \left(1.3333333333333333 + \frac{u}{-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. Step-by-step derivation
    1. log-recN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\log \left(1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)\right) \]
    2. neg-mul-1N/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \left(\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    11. associate--r-N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(\left(0 - \frac{u}{\frac{3}{4}}\right) + \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    12. neg-sub0N/A

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\mathsf{neg}\left(\frac{u}{\frac{3}{4}}\right)\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    16. distribute-neg-frac2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\frac{u}{\mathsf{neg}\left(\frac{3}{4}\right)}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    17. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    19. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(s \cdot 3\right) \cdot -1\right)\right) \]
    20. associate-*l*N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(s \cdot \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    21. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    22. metadata-eval96.5%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
  3. Simplified96.5%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(0.3333333333333333 + \frac{u}{-0.75}\right) \cdot \left(s \cdot -3\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(1 + \left(\frac{u}{\frac{-3}{4}} + \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    2. associate-+r+N/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\left(1 + \frac{u}{\frac{-3}{4}}\right) + \frac{1}{3}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    3. frac-2negN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\left(1 + \frac{\mathsf{neg}\left(u\right)}{\mathsf{neg}\left(\frac{-3}{4}\right)}\right) + \frac{1}{3}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\left(1 + \frac{\mathsf{neg}\left(u\right)}{\frac{3}{4}}\right) + \frac{1}{3}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    5. distribute-frac-negN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\left(1 + \left(\mathsf{neg}\left(\frac{u}{\frac{3}{4}}\right)\right)\right) + \frac{1}{3}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    6. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(\left(1 - \frac{u}{\frac{3}{4}}\right) + \frac{1}{3}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    7. associate--r-N/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(1 - \left(\frac{u}{\frac{3}{4}} - \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(1 - \left(\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    9. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\log \left(1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    10. log-lowering-log.f32N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(1 - \left(\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(1 - \left(\frac{u}{\frac{3}{4}} - \frac{1}{3}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    13. associate--r-N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(\left(1 - \frac{u}{\frac{3}{4}}\right) + \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    14. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(\left(1 + \left(\mathsf{neg}\left(\frac{u}{\frac{3}{4}}\right)\right)\right) + \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    15. distribute-frac-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(\left(1 + \frac{\mathsf{neg}\left(u\right)}{\frac{3}{4}}\right) + \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(\left(1 + \frac{\mathsf{neg}\left(u\right)}{\mathsf{neg}\left(\frac{-3}{4}\right)}\right) + \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    17. frac-2negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(\left(1 + \frac{u}{\frac{-3}{4}}\right) + \frac{1}{3}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    18. associate-+r+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(1 + \left(\frac{u}{\frac{-3}{4}} + \frac{1}{3}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    19. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(1 + \left(\frac{1}{3} + \frac{u}{\frac{-3}{4}}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    20. associate-+r+N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(\left(1 + \frac{1}{3}\right) + \frac{u}{\frac{-3}{4}}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    21. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(\frac{4}{3} + \frac{u}{\frac{-3}{4}}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    22. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(\frac{1}{\frac{3}{4}} + \frac{u}{\frac{-3}{4}}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    23. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\left(\frac{u}{\frac{-3}{4}} + \frac{1}{\frac{3}{4}}\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
    24. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log.f32}\left(\mathsf{+.f32}\left(\left(\frac{u}{\frac{-3}{4}}\right), \left(\frac{1}{\frac{3}{4}}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
  6. Applied egg-rr95.1%

    \[\leadsto \color{blue}{\log \left(\frac{u}{-0.75} + 1.3333333333333333\right)} \cdot \left(s \cdot -3\right) \]
  7. Final simplification95.1%

    \[\leadsto \left(s \cdot -3\right) \cdot \log \left(1.3333333333333333 + \frac{u}{-0.75}\right) \]
  8. Add Preprocessing

Alternative 6: 25.7% accurate, 1.1× speedup?

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

\\
s \cdot \left(\left(u + \log 0.75\right) \cdot 3\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 inf

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \left(\frac{4}{3} \cdot \frac{1}{u} - \frac{4}{3}\right)\right)\right)\right)\right) \]
    2. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \left(\frac{4}{3} \cdot \frac{1}{u} + \left(\mathsf{neg}\left(\frac{4}{3}\right)\right)\right)\right)\right)\right)\right) \]
    3. metadata-evalN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \left(\frac{-4}{3} + \frac{4}{3} \cdot \frac{1}{u}\right)\right)\right)\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\frac{-4}{3}, \left(\frac{4}{3} \cdot \frac{1}{u}\right)\right)\right)\right)\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\frac{-4}{3}, \left(\frac{\frac{4}{3} \cdot 1}{u}\right)\right)\right)\right)\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\frac{-4}{3}, \left(\frac{\frac{4}{3}}{u}\right)\right)\right)\right)\right)\right) \]
    8. /-lowering-/.f3294.5%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\frac{-4}{3}, \mathsf{/.f32}\left(\frac{4}{3}, u\right)\right)\right)\right)\right)\right) \]
  5. Simplified94.5%

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

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

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

      \[\leadsto \mathsf{neg}\left(\log \left(u \cdot \left(\frac{-4}{3} + \frac{\frac{4}{3}}{u}\right)\right) \cdot \left(3 \cdot s\right)\right) \]
  7. Applied egg-rr95.5%

    \[\leadsto \color{blue}{\left(\log \left(\frac{1}{1.3333333333333333 + u \cdot -1.3333333333333333}\right) \cdot 3\right) \cdot s} \]
  8. Taylor expanded in u around 0

    \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(\color{blue}{\left(u + \log \frac{3}{4}\right)}, 3\right), s\right) \]
  9. Step-by-step derivation
    1. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(u, \log \frac{3}{4}\right), 3\right), s\right) \]
    2. log-lowering-log.f3225.7%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(u, \mathsf{log.f32}\left(\frac{3}{4}\right)\right), 3\right), s\right) \]
  10. Simplified25.7%

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

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

Alternative 7: 25.7% accurate, 1.1× speedup?

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

\\
\left(u + \log 0.75\right) \cdot \left(s \cdot 3\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. associate-*r*N/A

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, 3\right), \left(\color{blue}{u} + \log \frac{3}{4}\right)\right) \]
    7. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, 3\right), \mathsf{+.f32}\left(u, \color{blue}{\log \frac{3}{4}}\right)\right) \]
    8. log-lowering-log.f3225.7%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, 3\right), \mathsf{+.f32}\left(u, \mathsf{log.f32}\left(\frac{3}{4}\right)\right)\right) \]
  5. Simplified25.7%

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

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

Alternative 8: 25.7% accurate, 1.1× 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 inf

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \left(\frac{4}{3} \cdot \frac{1}{u} - \frac{4}{3}\right)\right)\right)\right)\right) \]
    2. sub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \left(\frac{4}{3} \cdot \frac{1}{u} + \left(\mathsf{neg}\left(\frac{4}{3}\right)\right)\right)\right)\right)\right)\right) \]
    3. metadata-evalN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \left(\frac{-4}{3} + \frac{4}{3} \cdot \frac{1}{u}\right)\right)\right)\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\frac{-4}{3}, \left(\frac{4}{3} \cdot \frac{1}{u}\right)\right)\right)\right)\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\frac{-4}{3}, \left(\frac{\frac{4}{3} \cdot 1}{u}\right)\right)\right)\right)\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\frac{-4}{3}, \left(\frac{\frac{4}{3}}{u}\right)\right)\right)\right)\right)\right) \]
    8. /-lowering-/.f3294.5%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(u, \mathsf{+.f32}\left(\frac{-4}{3}, \mathsf{/.f32}\left(\frac{4}{3}, u\right)\right)\right)\right)\right)\right) \]
  5. Simplified94.5%

    \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{u \cdot \left(-1.3333333333333333 + \frac{1.3333333333333333}{u}\right)}}\right) \]
  6. 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)} \]
  7. Step-by-step derivation
    1. distribute-lft-outN/A

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(3, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(u, \color{blue}{\log \frac{3}{4}}\right)\right)\right) \]
    6. log-lowering-log.f3225.7%

      \[\leadsto \mathsf{*.f32}\left(3, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(u, \mathsf{log.f32}\left(\frac{3}{4}\right)\right)\right)\right) \]
  8. Simplified25.7%

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

Alternative 9: 7.4% accurate, 1.1× 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 \color{blue}{3 \cdot \left(s \cdot \log \frac{3}{4}\right)} \]
  4. Step-by-step derivation
    1. associate-*r*N/A

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(s, \mathsf{*.f32}\left(3, \color{blue}{\log \frac{3}{4}}\right)\right) \]
    6. log-lowering-log.f327.6%

      \[\leadsto \mathsf{*.f32}\left(s, \mathsf{*.f32}\left(3, \mathsf{log.f32}\left(\frac{3}{4}\right)\right)\right) \]
  5. Simplified7.6%

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \log \frac{3}{4}\right), 3\right) \]
    5. log-lowering-log.f327.6%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{log.f32}\left(\frac{3}{4}\right)\right), 3\right) \]
  7. Applied egg-rr7.6%

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

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

Alternative 10: 7.4% accurate, 1.1× speedup?

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

\\
\log 0.75 \cdot \left(s \cdot 3\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 \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \color{blue}{\log \frac{3}{4}}\right) \]
  4. Step-by-step derivation
    1. log-lowering-log.f327.6%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(3, s\right), \mathsf{log.f32}\left(\frac{3}{4}\right)\right) \]
  5. Simplified7.6%

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

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

Alternative 11: 7.4% accurate, 1.1× speedup?

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

\\
s \cdot \left(\log 0.75 \cdot 3\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 \log \frac{3}{4}\right)} \]
  4. Step-by-step derivation
    1. associate-*r*N/A

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(s, \mathsf{*.f32}\left(3, \color{blue}{\log \frac{3}{4}}\right)\right) \]
    6. log-lowering-log.f327.6%

      \[\leadsto \mathsf{*.f32}\left(s, \mathsf{*.f32}\left(3, \mathsf{log.f32}\left(\frac{3}{4}\right)\right)\right) \]
  5. Simplified7.6%

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

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

Alternative 12: 7.4% accurate, 1.1× speedup?

\[\begin{array}{l} \\ -3 \cdot \left(s \cdot \log 1.3333333333333333\right) \end{array} \]
(FPCore (s u) :precision binary32 (* -3.0 (* s (log 1.3333333333333333))))
float code(float s, float u) {
	return -3.0f * (s * logf(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))
end function
function code(s, u)
	return Float32(Float32(-3.0) * Float32(s * log(Float32(1.3333333333333333))))
end
function tmp = code(s, u)
	tmp = single(-3.0) * (s * log(single(1.3333333333333333)));
end
\begin{array}{l}

\\
-3 \cdot \left(s \cdot \log 1.3333333333333333\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. Step-by-step derivation
    1. log-recN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \left(\mathsf{neg}\left(\log \left(1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right)\right) \]
    2. neg-mul-1N/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    10. div-subN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(0 - \left(\frac{u}{\frac{3}{4}} - \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    11. associate--r-N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\left(\left(0 - \frac{u}{\frac{3}{4}}\right) + \frac{\frac{1}{4}}{\frac{3}{4}}\right)\right), \left(\left(\color{blue}{3} \cdot s\right) \cdot -1\right)\right) \]
    12. neg-sub0N/A

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\mathsf{neg}\left(\frac{u}{\frac{3}{4}}\right)\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    16. distribute-neg-frac2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \left(\frac{u}{\mathsf{neg}\left(\frac{3}{4}\right)}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    17. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(3 \cdot s\right) \cdot -1\right)\right) \]
    19. *-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(\left(s \cdot 3\right) \cdot -1\right)\right) \]
    20. associate-*l*N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \left(s \cdot \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    21. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, \color{blue}{\left(3 \cdot -1\right)}\right)\right) \]
    22. metadata-eval96.5%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{log1p.f32}\left(\mathsf{+.f32}\left(\frac{1}{3}, \mathsf{/.f32}\left(u, \frac{-3}{4}\right)\right)\right), \mathsf{*.f32}\left(s, -3\right)\right) \]
  3. Simplified96.5%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(0.3333333333333333 + \frac{u}{-0.75}\right) \cdot \left(s \cdot -3\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in u around 0

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

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

      \[\leadsto \mathsf{*.f32}\left(-3, \mathsf{*.f32}\left(s, \color{blue}{\log \frac{4}{3}}\right)\right) \]
    3. log-lowering-log.f327.6%

      \[\leadsto \mathsf{*.f32}\left(-3, \mathsf{*.f32}\left(s, \mathsf{log.f32}\left(\frac{4}{3}\right)\right)\right) \]
  7. Simplified7.6%

    \[\leadsto \color{blue}{-3 \cdot \left(s \cdot \log 1.3333333333333333\right)} \]
  8. Add Preprocessing

Reproduce

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