Disney BSSRDF, sample scattering profile, upper

Percentage Accurate: 95.9% → 95.9%
Time: 9.8s
Alternatives: 13
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 13 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: 95.9% 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 96.1%

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

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

Alternative 2: 26.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;1 - \frac{u - 0.25}{0.75} \leq 0.9100000262260437:\\ \;\;\;\;\left(\log 0.6666666666666666 \cdot s\right) \cdot -3\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{log1p}\left(0.3333333333333333 + -1.3333333333333333 \cdot u\right) \cdot -3\right) \cdot s\\ \end{array} \end{array} \]
(FPCore (s u)
 :precision binary32
 (if (<= (- 1.0 (/ (- u 0.25) 0.75)) 0.9100000262260437)
   (* (* (log 0.6666666666666666) s) -3.0)
   (* (* (log1p (+ 0.3333333333333333 (* -1.3333333333333333 u))) -3.0) s)))
float code(float s, float u) {
	float tmp;
	if ((1.0f - ((u - 0.25f) / 0.75f)) <= 0.9100000262260437f) {
		tmp = (logf(0.6666666666666666f) * s) * -3.0f;
	} else {
		tmp = (log1pf((0.3333333333333333f + (-1.3333333333333333f * u))) * -3.0f) * s;
	}
	return tmp;
}
function code(s, u)
	tmp = Float32(0.0)
	if (Float32(Float32(1.0) - Float32(Float32(u - Float32(0.25)) / Float32(0.75))) <= Float32(0.9100000262260437))
		tmp = Float32(Float32(log(Float32(0.6666666666666666)) * s) * Float32(-3.0));
	else
		tmp = Float32(Float32(log1p(Float32(Float32(0.3333333333333333) + Float32(Float32(-1.3333333333333333) * u))) * Float32(-3.0)) * s);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;1 - \frac{u - 0.25}{0.75} \leq 0.9100000262260437:\\
\;\;\;\;\left(\log 0.6666666666666666 \cdot s\right) \cdot -3\\

\mathbf{else}:\\
\;\;\;\;\left(\mathsf{log1p}\left(0.3333333333333333 + -1.3333333333333333 \cdot u\right) \cdot -3\right) \cdot s\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f32 #s(literal 1 binary32) (/.f32 (-.f32 u #s(literal 1/4 binary32)) #s(literal 3/4 binary32))) < 0.910000026

    1. Initial program 96.6%

      \[\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-eval96.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 rewrites96.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. Applied rewrites9.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\log \frac{2}{3} \cdot s\right)} \cdot -3 \]
      5. lower-log.f3229.4

        \[\leadsto \left(\color{blue}{\log 0.6666666666666666} \cdot s\right) \cdot -3 \]
    8. Applied rewrites29.4%

      \[\leadsto \color{blue}{\left(\log 0.6666666666666666 \cdot s\right) \cdot -3} \]

    if 0.910000026 < (-.f32 #s(literal 1 binary32) (/.f32 (-.f32 u #s(literal 1/4 binary32)) #s(literal 3/4 binary32)))

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\left(u - \frac{1}{4}\right) \cdot \frac{-4}{3}}\right)\right) \cdot s \]
      3. lower-*.f3245.5

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-4}{3} \cdot u + \frac{1}{3}}\right)\right) \cdot s \]
      9. lower-*.f3245.4

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

      \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{-1.3333333333333333 \cdot u + 0.3333333333333333}\right)\right) \cdot s \]
  3. Recombined 2 regimes into one program.
  4. Final simplification26.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - \frac{u - 0.25}{0.75} \leq 0.9100000262260437:\\ \;\;\;\;\left(\log 0.6666666666666666 \cdot s\right) \cdot -3\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{log1p}\left(0.3333333333333333 + -1.3333333333333333 \cdot u\right) \cdot -3\right) \cdot s\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 27.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;1 - \frac{u - 0.25}{0.75} \leq 0.9100000262260437:\\ \;\;\;\;\left(\log 0.6666666666666666 \cdot s\right) \cdot -3\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{log1p}\left(-1.3333333333333333 \cdot \left(u - 0.25\right)\right) \cdot -3\right) \cdot s\\ \end{array} \end{array} \]
(FPCore (s u)
 :precision binary32
 (if (<= (- 1.0 (/ (- u 0.25) 0.75)) 0.9100000262260437)
   (* (* (log 0.6666666666666666) s) -3.0)
   (* (* (log1p (* -1.3333333333333333 (- u 0.25))) -3.0) s)))
float code(float s, float u) {
	float tmp;
	if ((1.0f - ((u - 0.25f) / 0.75f)) <= 0.9100000262260437f) {
		tmp = (logf(0.6666666666666666f) * s) * -3.0f;
	} else {
		tmp = (log1pf((-1.3333333333333333f * (u - 0.25f))) * -3.0f) * s;
	}
	return tmp;
}
function code(s, u)
	tmp = Float32(0.0)
	if (Float32(Float32(1.0) - Float32(Float32(u - Float32(0.25)) / Float32(0.75))) <= Float32(0.9100000262260437))
		tmp = Float32(Float32(log(Float32(0.6666666666666666)) * s) * Float32(-3.0));
	else
		tmp = Float32(Float32(log1p(Float32(Float32(-1.3333333333333333) * Float32(u - Float32(0.25)))) * Float32(-3.0)) * s);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;1 - \frac{u - 0.25}{0.75} \leq 0.9100000262260437:\\
\;\;\;\;\left(\log 0.6666666666666666 \cdot s\right) \cdot -3\\

\mathbf{else}:\\
\;\;\;\;\left(\mathsf{log1p}\left(-1.3333333333333333 \cdot \left(u - 0.25\right)\right) \cdot -3\right) \cdot s\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f32 #s(literal 1 binary32) (/.f32 (-.f32 u #s(literal 1/4 binary32)) #s(literal 3/4 binary32))) < 0.910000026

    1. Initial program 96.6%

      \[\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-eval96.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 rewrites96.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. Applied rewrites9.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\log \frac{2}{3} \cdot s\right)} \cdot -3 \]
      5. lower-log.f3229.4

        \[\leadsto \left(\color{blue}{\log 0.6666666666666666} \cdot s\right) \cdot -3 \]
    8. Applied rewrites29.4%

      \[\leadsto \color{blue}{\left(\log 0.6666666666666666 \cdot s\right) \cdot -3} \]

    if 0.910000026 < (-.f32 #s(literal 1 binary32) (/.f32 (-.f32 u #s(literal 1/4 binary32)) #s(literal 3/4 binary32)))

    1. Initial program 93.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot \left(u - 0.25\right)\right)\right) \cdot s} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification26.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - \frac{u - 0.25}{0.75} \leq 0.9100000262260437:\\ \;\;\;\;\left(\log 0.6666666666666666 \cdot s\right) \cdot -3\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{log1p}\left(-1.3333333333333333 \cdot \left(u - 0.25\right)\right) \cdot -3\right) \cdot s\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 27.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;1 - \frac{u - 0.25}{0.75} \leq 0.9100000262260437:\\ \;\;\;\;\left(\log 0.6666666666666666 \cdot s\right) \cdot -3\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{log1p}\left(\left(-0.25 + u\right) \cdot -1.3333333333333333\right) \cdot -3\right) \cdot s\\ \end{array} \end{array} \]
(FPCore (s u)
 :precision binary32
 (if (<= (- 1.0 (/ (- u 0.25) 0.75)) 0.9100000262260437)
   (* (* (log 0.6666666666666666) s) -3.0)
   (* (* (log1p (* (+ -0.25 u) -1.3333333333333333)) -3.0) s)))
float code(float s, float u) {
	float tmp;
	if ((1.0f - ((u - 0.25f) / 0.75f)) <= 0.9100000262260437f) {
		tmp = (logf(0.6666666666666666f) * s) * -3.0f;
	} else {
		tmp = (log1pf(((-0.25f + u) * -1.3333333333333333f)) * -3.0f) * s;
	}
	return tmp;
}
function code(s, u)
	tmp = Float32(0.0)
	if (Float32(Float32(1.0) - Float32(Float32(u - Float32(0.25)) / Float32(0.75))) <= Float32(0.9100000262260437))
		tmp = Float32(Float32(log(Float32(0.6666666666666666)) * s) * Float32(-3.0));
	else
		tmp = Float32(Float32(log1p(Float32(Float32(Float32(-0.25) + u) * Float32(-1.3333333333333333))) * Float32(-3.0)) * s);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;1 - \frac{u - 0.25}{0.75} \leq 0.9100000262260437:\\
\;\;\;\;\left(\log 0.6666666666666666 \cdot s\right) \cdot -3\\

\mathbf{else}:\\
\;\;\;\;\left(\mathsf{log1p}\left(\left(-0.25 + u\right) \cdot -1.3333333333333333\right) \cdot -3\right) \cdot s\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f32 #s(literal 1 binary32) (/.f32 (-.f32 u #s(literal 1/4 binary32)) #s(literal 3/4 binary32))) < 0.910000026

    1. Initial program 96.6%

      \[\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-eval96.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 rewrites96.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. Applied rewrites9.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\log \frac{2}{3} \cdot s\right)} \cdot -3 \]
      5. lower-log.f3229.4

        \[\leadsto \left(\color{blue}{\log 0.6666666666666666} \cdot s\right) \cdot -3 \]
    8. Applied rewrites29.4%

      \[\leadsto \color{blue}{\left(\log 0.6666666666666666 \cdot s\right) \cdot -3} \]

    if 0.910000026 < (-.f32 #s(literal 1 binary32) (/.f32 (-.f32 u #s(literal 1/4 binary32)) #s(literal 3/4 binary32)))

    1. Initial program 93.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot \left(u - 0.25\right)\right)\right) \cdot s} \]
    5. Step-by-step derivation
      1. *-rgt-identityN/A

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

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

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

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{\frac{-4}{3} \cdot \left(\left(u - \frac{1}{4}\right) \cdot 1\right)}\right)\right) \cdot s \]
      5. lower-*.f3246.0

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot \color{blue}{\left(\left(u - 0.25\right) \cdot 1\right)}\right)\right) \cdot s \]
    6. Applied rewrites46.0%

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

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\frac{-4}{3} \cdot \color{blue}{\left(\left(u - \frac{1}{4}\right) \cdot 1\right)}\right)\right) \cdot s \]
      2. *-rgt-identity46.5

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot \color{blue}{\left(u - 0.25\right)}\right)\right) \cdot s \]
      3. lift--.f32N/A

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

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

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

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

        \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot \left(\color{blue}{-0.25} + u\right)\right)\right) \cdot s \]
    8. Applied rewrites45.5%

      \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot \color{blue}{\left(-0.25 + u\right)}\right)\right) \cdot s \]
  3. Recombined 2 regimes into one program.
  4. Final simplification26.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - \frac{u - 0.25}{0.75} \leq 0.9100000262260437:\\ \;\;\;\;\left(\log 0.6666666666666666 \cdot s\right) \cdot -3\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{log1p}\left(\left(-0.25 + u\right) \cdot -1.3333333333333333\right) \cdot -3\right) \cdot s\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 95.7% 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 96.1%

    \[\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-eval96.0

      \[\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 rewrites96.0%

    \[\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 simplification96.0%

    \[\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 6: 95.5% 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 96.1%

    \[\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-eval96.0

      \[\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 rewrites96.0%

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

    \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{\mathsf{fma}\left(1.3333333333333333, u - 0.25, 1\right)}}\right) \]
  6. Applied rewrites95.9%

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

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

Alternative 7: 9.4% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 9.4% accurate, 1.1× speedup?

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

\\
\left(\mathsf{log1p}\left(\frac{u}{-0.75} - -0.3333333333333333\right) \cdot -3\right) \cdot s
\end{array}
Derivation
  1. Initial program 96.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 9.5% accurate, 1.2× speedup?

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

\\
\left(\mathsf{log1p}\left(\left(0.25 - u\right) \cdot 1.3333333333333333\right) \cdot -3\right) \cdot s
\end{array}
Derivation
  1. Initial program 96.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\frac{4}{3} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(u - \frac{1}{4}\right)\right)\right) \cdot 1\right)}\right)\right) \cdot s \]
  6. Applied rewrites34.8%

    \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{1.3333333333333333 \cdot \left(\left(0.25 - u\right) \cdot 1\right)}\right)\right) \cdot s \]
  7. Final simplification34.8%

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

Alternative 10: 14.4% accurate, 1.2× speedup?

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

\\
\left(\mathsf{log1p}\left(-1.3333333333333333 \cdot \left(u - 0.25\right)\right) \cdot -3\right) \cdot s
\end{array}
Derivation
  1. Initial program 96.1%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot \left(u - 0.25\right)\right)\right) \cdot s} \]
  5. Step-by-step derivation
    1. *-rgt-identityN/A

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

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

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

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

      \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(-1.3333333333333333 \cdot \color{blue}{\left(\left(u - 0.25\right) \cdot 1\right)}\right)\right) \cdot s \]
  6. Applied rewrites34.8%

    \[\leadsto \left(-3 \cdot \mathsf{log1p}\left(\color{blue}{-1.3333333333333333 \cdot \left(\left(u - 0.25\right) \cdot 1\right)}\right)\right) \cdot s \]
  7. Final simplification34.8%

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

Alternative 11: 28.2% accurate, 1.3× speedup?

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

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

    \[\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-eval96.0

      \[\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 rewrites96.0%

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

    \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{\mathsf{fma}\left(1.3333333333333333, u - 0.25, 1\right)}}\right) \]
  6. Taylor expanded in u around 0

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

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

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

    Alternative 12: 28.2% accurate, 1.3× speedup?

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

      \[\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-eval96.0

        \[\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 rewrites96.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\log \frac{2}{3} \cdot s\right)} \cdot -3 \]
      5. lower-log.f3228.6

        \[\leadsto \left(\color{blue}{\log 0.6666666666666666} \cdot s\right) \cdot -3 \]
    8. Applied rewrites28.6%

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

    Alternative 13: 28.2% accurate, 1.3× speedup?

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

      \[\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-eval96.0

        \[\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 rewrites96.0%

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

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\color{blue}{\mathsf{fma}\left(1.3333333333333333, u - 0.25, 1\right)}}\right) \]
    6. Taylor expanded in u around 0

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

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

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

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

        \[\leadsto \color{blue}{\left(\log \frac{3}{2} \cdot s\right)} \cdot 3 \]
      5. lower-log.f3228.6

        \[\leadsto \left(\color{blue}{\log 1.5} \cdot s\right) \cdot 3 \]
    8. Applied rewrites28.6%

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

    Reproduce

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