Disney BSSRDF, sample scattering profile, upper

Percentage Accurate: 96.0% → 96.0%
Time: 9.1s
Alternatives: 10
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 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: 96.0% 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: 96.0% accurate, 1.0× speedup?

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

\\
\log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \cdot \left(s \cdot 3\right)
\end{array}
Derivation
  1. Initial program 95.8%

    \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
  2. Add Preprocessing
  3. Final simplification95.8%

    \[\leadsto \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \cdot \left(s \cdot 3\right) \]
  4. Add Preprocessing

Alternative 2: 95.8% accurate, 1.0× speedup?

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

\\
\log \left(\frac{1}{-1.3333333333333333 \cdot \left(u - 0.25\right) + 1}\right) \cdot \left(s \cdot 3\right)
\end{array}
Derivation
  1. Initial program 95.8%

    \[\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 \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}}\right) \]
    2. sub-negN/A

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

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

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

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

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

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

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

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

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\frac{1}{\color{blue}{\frac{-3}{4}}} \cdot \left(u - \frac{1}{4}\right) + 1}\right) \]
    11. metadata-eval95.5

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{-1.3333333333333333} \cdot \left(u - 0.25\right) + 1}\right) \]
  4. Applied rewrites95.5%

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

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

Alternative 3: 95.6% accurate, 1.1× speedup?

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

\\
\log \left(\frac{1}{1.3333333333333333 - 1.3333333333333333 \cdot u}\right) \cdot \left(s \cdot 3\right)
\end{array}
Derivation
  1. Initial program 95.8%

    \[\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 \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{1 - \frac{u - \frac{1}{4}}{\frac{3}{4}}}}\right) \]
    2. sub-negN/A

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

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

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

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

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

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

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

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

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\frac{1}{\color{blue}{\frac{-3}{4}}} \cdot \left(u - \frac{1}{4}\right) + 1}\right) \]
    11. metadata-eval95.5

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{-1.3333333333333333} \cdot \left(u - 0.25\right) + 1}\right) \]
  4. Applied rewrites95.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\frac{-1.3333333333333333}{\frac{1}{\color{blue}{u - 0.25}}} + 1}\right) \]
  8. Applied rewrites95.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 32.3% accurate, 1.1× speedup?

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

\\
\left(\left(1.5 \cdot u\right) \cdot u + \left(\log 0.75 + u\right) \cdot 3\right) \cdot s
\end{array}
Derivation
  1. Initial program 95.8%

    \[\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) + u \cdot \left(\frac{3}{2} \cdot \left(s \cdot u\right) + 3 \cdot s\right)} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{s \cdot \left(\left(u + \log \frac{3}{4}\right) \cdot 3 + u \cdot \left(\frac{3}{2} \cdot u\right)\right)} \]
  5. Applied rewrites14.9%

    \[\leadsto \color{blue}{s \cdot \mathsf{fma}\left(\log 0.75 + u, 3, \left(1.5 \cdot u\right) \cdot u\right)} \]
  6. Step-by-step derivation
    1. Applied rewrites32.1%

      \[\leadsto s \cdot \left(\left(\log 0.75 + u\right) \cdot 3 + \color{blue}{\left(1.5 \cdot u\right) \cdot u}\right) \]
    2. Final simplification32.1%

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

    Alternative 5: 30.3% accurate, 4.6× speedup?

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

      \[\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) + u \cdot \left(\frac{3}{2} \cdot \left(s \cdot u\right) + 3 \cdot s\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{s \cdot \left(\left(u + \log \frac{3}{4}\right) \cdot 3 + u \cdot \left(\frac{3}{2} \cdot u\right)\right)} \]
    5. Applied rewrites14.8%

      \[\leadsto \color{blue}{s \cdot \mathsf{fma}\left(\log 0.75 + u, 3, \left(1.5 \cdot u\right) \cdot u\right)} \]
    6. Taylor expanded in u around inf

      \[\leadsto \frac{3}{2} \cdot \color{blue}{\left(s \cdot {u}^{2}\right)} \]
    7. Step-by-step derivation
      1. Applied rewrites26.3%

        \[\leadsto \left(\left(u \cdot s\right) \cdot u\right) \cdot \color{blue}{1.5} \]
      2. Step-by-step derivation
        1. Applied rewrites26.3%

          \[\leadsto \left(s \cdot u\right) \cdot \left(1.5 \cdot \color{blue}{u}\right) \]
        2. Taylor expanded in u around inf

          \[\leadsto {u}^{2} \cdot \color{blue}{\left(\frac{3}{2} \cdot s + 3 \cdot \frac{s}{u}\right)} \]
        3. Step-by-step derivation
          1. Applied rewrites30.7%

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

            \[\leadsto \left(u \cdot u\right) \cdot \left(\left(\frac{3}{u} + 1.5\right) \cdot s\right) \]
          3. Add Preprocessing

          Alternative 6: 30.3% accurate, 5.8× speedup?

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

            \[\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) + u \cdot \left(\frac{3}{2} \cdot \left(s \cdot u\right) + 3 \cdot s\right)} \]
          4. Step-by-step derivation
            1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{s \cdot \left(\left(u + \log \frac{3}{4}\right) \cdot 3 + u \cdot \left(\frac{3}{2} \cdot u\right)\right)} \]
          5. Applied rewrites15.0%

            \[\leadsto \color{blue}{s \cdot \mathsf{fma}\left(\log 0.75 + u, 3, \left(1.5 \cdot u\right) \cdot u\right)} \]
          6. Step-by-step derivation
            1. Applied rewrites32.1%

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

              \[\leadsto s \cdot \left(3 \cdot u + \color{blue}{\left(\frac{3}{2} \cdot u\right)} \cdot u\right) \]
            3. Step-by-step derivation
              1. Applied rewrites30.7%

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

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

              Alternative 7: 15.4% accurate, 8.2× speedup?

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

                \[\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) + u \cdot \left(\frac{3}{2} \cdot \left(s \cdot u\right) + 3 \cdot s\right)} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{s \cdot \left(\left(u + \log \frac{3}{4}\right) \cdot 3 + u \cdot \left(\frac{3}{2} \cdot u\right)\right)} \]
              5. Applied rewrites14.9%

                \[\leadsto \color{blue}{s \cdot \mathsf{fma}\left(\log 0.75 + u, 3, \left(1.5 \cdot u\right) \cdot u\right)} \]
              6. Taylor expanded in u around inf

                \[\leadsto s \cdot \left({u}^{2} \cdot \color{blue}{\left(\frac{3}{2} + 3 \cdot \frac{1}{u}\right)}\right) \]
              7. Step-by-step derivation
                1. Applied rewrites29.9%

                  \[\leadsto s \cdot \left(\mathsf{fma}\left(1.5, u, 3\right) \cdot \color{blue}{u}\right) \]
                2. Final simplification30.0%

                  \[\leadsto \left(\mathsf{fma}\left(1.5, u, 3\right) \cdot u\right) \cdot s \]
                3. Add Preprocessing

                Alternative 8: 15.4% accurate, 8.2× speedup?

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

                  \[\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) + u \cdot \left(\frac{3}{2} \cdot \left(s \cdot u\right) + 3 \cdot s\right)} \]
                4. Step-by-step derivation
                  1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{s \cdot \left(\left(u + \log \frac{3}{4}\right) \cdot 3 + u \cdot \left(\frac{3}{2} \cdot u\right)\right)} \]
                5. Applied rewrites14.9%

                  \[\leadsto \color{blue}{s \cdot \mathsf{fma}\left(\log 0.75 + u, 3, \left(1.5 \cdot u\right) \cdot u\right)} \]
                6. Taylor expanded in u around inf

                  \[\leadsto \frac{3}{2} \cdot \color{blue}{\left(s \cdot {u}^{2}\right)} \]
                7. Step-by-step derivation
                  1. Applied rewrites26.3%

                    \[\leadsto \left(\left(u \cdot s\right) \cdot u\right) \cdot \color{blue}{1.5} \]
                  2. Taylor expanded in u around inf

                    \[\leadsto {u}^{2} \cdot \color{blue}{\left(\frac{3}{2} \cdot s + 3 \cdot \frac{s}{u}\right)} \]
                  3. Step-by-step derivation
                    1. Applied rewrites29.9%

                      \[\leadsto \left(s \cdot \mathsf{fma}\left(1.5, u, 3\right)\right) \cdot \color{blue}{u} \]
                    2. Final simplification29.9%

                      \[\leadsto \left(\mathsf{fma}\left(1.5, u, 3\right) \cdot s\right) \cdot u \]
                    3. Add Preprocessing

                    Alternative 9: 26.3% accurate, 8.7× speedup?

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

                      \[\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) + u \cdot \left(\frac{3}{2} \cdot \left(s \cdot u\right) + 3 \cdot s\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{s \cdot \left(\left(u + \log \frac{3}{4}\right) \cdot 3 + u \cdot \left(\frac{3}{2} \cdot u\right)\right)} \]
                    5. Applied rewrites14.9%

                      \[\leadsto \color{blue}{s \cdot \mathsf{fma}\left(\log 0.75 + u, 3, \left(1.5 \cdot u\right) \cdot u\right)} \]
                    6. Taylor expanded in u around inf

                      \[\leadsto \frac{3}{2} \cdot \color{blue}{\left(s \cdot {u}^{2}\right)} \]
                    7. Step-by-step derivation
                      1. Applied rewrites26.3%

                        \[\leadsto \left(\left(u \cdot s\right) \cdot u\right) \cdot \color{blue}{1.5} \]
                      2. Step-by-step derivation
                        1. Applied rewrites26.3%

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

                          \[\leadsto \left(1.5 \cdot s\right) \cdot \left(u \cdot u\right) \]
                        3. Add Preprocessing

                        Alternative 10: 26.3% accurate, 8.7× speedup?

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

                          \[\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) + u \cdot \left(\frac{3}{2} \cdot \left(s \cdot u\right) + 3 \cdot s\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \color{blue}{s \cdot \left(\left(u + \log \frac{3}{4}\right) \cdot 3 + u \cdot \left(\frac{3}{2} \cdot u\right)\right)} \]
                        5. Applied rewrites14.9%

                          \[\leadsto \color{blue}{s \cdot \mathsf{fma}\left(\log 0.75 + u, 3, \left(1.5 \cdot u\right) \cdot u\right)} \]
                        6. Taylor expanded in u around inf

                          \[\leadsto \frac{3}{2} \cdot \color{blue}{\left(s \cdot {u}^{2}\right)} \]
                        7. Step-by-step derivation
                          1. Applied rewrites26.3%

                            \[\leadsto \left(\left(u \cdot s\right) \cdot u\right) \cdot \color{blue}{1.5} \]
                          2. Step-by-step derivation
                            1. Applied rewrites26.3%

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

                              \[\leadsto \left(u \cdot s\right) \cdot \left(1.5 \cdot u\right) \]
                            3. Add Preprocessing

                            Reproduce

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