Disney BSSRDF, sample scattering profile, upper

Percentage Accurate: 96.0% → 98.2%
Time: 3.9s
Alternatives: 7
Speedup: 1.2×

Specification

?
\[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
\[\begin{array}{l} \\ \left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \end{array} \]
(FPCore (s u)
 :precision binary32
 (* (* 3.0 s) (log (/ 1.0 (- 1.0 (/ (- u 0.25) 0.75))))))
float code(float s, float u) {
	return (3.0f * s) * logf((1.0f / (1.0f - ((u - 0.25f) / 0.75f))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(s, u)
use fmin_fmax_functions
    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}

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 7 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))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(s, u)
use fmin_fmax_functions
    real(4), intent (in) :: s
    real(4), intent (in) :: u
    code = (3.0e0 * s) * log((1.0e0 / (1.0e0 - ((u - 0.25e0) / 0.75e0))))
end function
function code(s, u)
	return Float32(Float32(Float32(3.0) * s) * log(Float32(Float32(1.0) / Float32(Float32(1.0) - Float32(Float32(u - Float32(0.25)) / Float32(0.75))))))
end
function tmp = code(s, u)
	tmp = (single(3.0) * s) * log((single(1.0) / (single(1.0) - ((u - single(0.25)) / single(0.75)))));
end
\begin{array}{l}

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

Alternative 1: 98.2% accurate, 0.3× speedup?

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

\\
\left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(1.3333333333333333 \cdot \left(u - 0.25\right)\right) - \mathsf{log1p}\left(-1.7777777777777777 \cdot e^{\log \left(u - 0.25\right) \cdot 2}\right)\right)
\end{array}
Derivation
  1. Initial program 96.0%

    \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
  2. Step-by-step derivation
    1. 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. lift--.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \log \left(1 - \frac{16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    10. fp-cancel-sub-sign-invN/A

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

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

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    13. lower-*.f32N/A

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    14. lower-pow.f32N/A

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    15. lift--.f3298.2

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(1.3333333333333333 \cdot \left(u - 0.25\right)\right) - \mathsf{log1p}\left(-1.7777777777777777 \cdot {\left(u - 0.25\right)}^{2}\right)\right) \]
  6. Applied rewrites98.2%

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

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

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    3. pow-to-expN/A

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot e^{\log \left(u - \frac{1}{4}\right) \cdot 2}\right)\right) \]
    4. lower-exp.f32N/A

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot e^{\log \left(u - \frac{1}{4}\right) \cdot 2}\right)\right) \]
    5. lower-*.f32N/A

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot e^{\log \left(u - \frac{1}{4}\right) \cdot 2}\right)\right) \]
    6. lower-log.f32N/A

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot e^{\log \left(u - \frac{1}{4}\right) \cdot 2}\right)\right) \]
    7. lift--.f3298.2

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(1.3333333333333333 \cdot \left(u - 0.25\right)\right) - \mathsf{log1p}\left(-1.7777777777777777 \cdot e^{\log \left(u - 0.25\right) \cdot 2}\right)\right) \]
  8. Applied rewrites98.2%

    \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(1.3333333333333333 \cdot \left(u - 0.25\right)\right) - \mathsf{log1p}\left(-1.7777777777777777 \cdot e^{\log \left(u - 0.25\right) \cdot 2}\right)\right) \]
  9. Add Preprocessing

Alternative 2: 98.2% accurate, 0.6× speedup?

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

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

    \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
  2. 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. lift--.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \log \left(1 - \frac{16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    10. fp-cancel-sub-sign-invN/A

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

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

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    13. lower-*.f32N/A

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    14. lower-pow.f32N/A

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    15. lift--.f3298.2

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(1.3333333333333333 \cdot \left(u - 0.25\right)\right) - \mathsf{log1p}\left(-1.7777777777777777 \cdot {\left(u - 0.25\right)}^{2}\right)\right) \]
  6. Applied rewrites98.2%

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

    \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot \left(\frac{1}{16} + u \cdot \left(u - \frac{1}{2}\right)\right)\right)\right) \]
  8. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(1.3333333333333333 \cdot \left(u - 0.25\right)\right) - \mathsf{log1p}\left(-1.7777777777777777 \cdot \mathsf{fma}\left(u - 0.5, u, 0.0625\right)\right)\right) \]
  9. Applied rewrites98.2%

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

Alternative 3: 98.1% accurate, 0.6× speedup?

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

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

    \[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
  2. Step-by-step derivation
    1. 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. lift--.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \log \left(1 - \frac{16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    10. fp-cancel-sub-sign-invN/A

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

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

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    13. lower-*.f32N/A

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    14. lower-pow.f32N/A

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(\frac{-16}{9} \cdot {\left(u - \frac{1}{4}\right)}^{2}\right)\right) \]
    15. lift--.f3298.2

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(1.3333333333333333 \cdot \left(u - 0.25\right)\right) - \mathsf{log1p}\left(-1.7777777777777777 \cdot {\left(u - 0.25\right)}^{2}\right)\right) \]
  6. Applied rewrites98.2%

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

    \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(\frac{4}{3} \cdot \left(u - \frac{1}{4}\right)\right) - \mathsf{log1p}\left(u \cdot \left(\frac{8}{9} + \frac{-16}{9} \cdot u\right) - \frac{1}{9}\right)\right) \]
  8. Step-by-step derivation
    1. lower--.f32N/A

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

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

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

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

      \[\leadsto \left(s \cdot 3\right) \cdot \left(\mathsf{log1p}\left(1.3333333333333333 \cdot \left(u - 0.25\right)\right) - \mathsf{log1p}\left(\mathsf{fma}\left(-1.7777777777777777, u, 0.8888888888888888\right) \cdot u - 0.1111111111111111\right)\right) \]
  9. Applied rewrites98.1%

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

Alternative 4: 98.0% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(s \cdot 3\right) \cdot \left(-\log \left(1 - \frac{\color{blue}{u - \frac{1}{4}}}{\frac{3}{4}}\right)\right) \]
    14. lift--.f3296.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 97.9% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(-\mathsf{log1p}\left(\frac{-4}{3} \cdot \left(u - \frac{1}{4}\right)\right)\right) \cdot s\right) \cdot 3 \]
    11. lift--.f3297.9

      \[\leadsto \left(\left(-\mathsf{log1p}\left(-1.3333333333333333 \cdot \left(u - 0.25\right)\right)\right) \cdot s\right) \cdot 3 \]
  4. Applied rewrites97.9%

    \[\leadsto \color{blue}{\left(\left(-\mathsf{log1p}\left(-1.3333333333333333 \cdot \left(u - 0.25\right)\right)\right) \cdot s\right) \cdot 3} \]
  5. Taylor expanded in u around 0

    \[\leadsto \left(\left(-\mathsf{log1p}\left(\frac{1}{3} + \frac{-4}{3} \cdot u\right)\right) \cdot s\right) \cdot 3 \]
  6. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

Alternative 6: 96.9% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(-\mathsf{log1p}\left(\frac{-4}{3} \cdot \left(u - \frac{1}{4}\right)\right)\right) \cdot s\right) \cdot 3 \]
    11. lift--.f3297.9

      \[\leadsto \left(\left(-\mathsf{log1p}\left(-1.3333333333333333 \cdot \left(u - 0.25\right)\right)\right) \cdot s\right) \cdot 3 \]
  4. Applied rewrites97.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(-\log \left(\mathsf{fma}\left(\frac{-4}{3}, u - \frac{1}{4}, 1\right)\right)\right) \cdot s\right) \cdot 3 \]
    11. lift--.f3296.6

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

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

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

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

      \[\leadsto \left(\left(-\log \left(\mathsf{fma}\left(-1.3333333333333333, u, 1.3333333333333333\right)\right)\right) \cdot s\right) \cdot 3 \]
  9. Applied rewrites96.9%

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

Alternative 7: 30.0% accurate, 12.6× speedup?

\[\begin{array}{l} \\ 3 \cdot \left(u \cdot s\right) \end{array} \]
(FPCore (s u) :precision binary32 (* 3.0 (* u s)))
float code(float s, float u) {
	return 3.0f * (u * s);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(s, u)
use fmin_fmax_functions
    real(4), intent (in) :: s
    real(4), intent (in) :: u
    code = 3.0e0 * (u * s)
end function
function code(s, u)
	return Float32(Float32(3.0) * Float32(u * s))
end
function tmp = code(s, u)
	tmp = single(3.0) * (u * s);
end
\begin{array}{l}

\\
3 \cdot \left(u \cdot s\right)
\end{array}
Derivation
  1. Initial program 96.0%

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

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

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

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

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

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

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

      \[\leadsto 3 \cdot \mathsf{fma}\left(u, s, \log \frac{3}{4} \cdot s\right) \]
    7. lower-log.f3225.9

      \[\leadsto 3 \cdot \mathsf{fma}\left(u, s, \log 0.75 \cdot s\right) \]
  4. Applied rewrites25.9%

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

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

      \[\leadsto 3 \cdot \left(u \cdot s\right) \]
    2. lower-*.f3230.0

      \[\leadsto 3 \cdot \left(u \cdot s\right) \]
  7. Applied rewrites30.0%

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

Reproduce

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