Disney BSSRDF, sample scattering profile, upper

Percentage Accurate: 96.0% → 96.5%
Time: 5.0s
Alternatives: 16
Speedup: 1.2×

Specification

?
\[\left(0 \leq s \land s \leq 256\right) \land \left(0.25 \leq u \land u \leq 1\right)\]
\[\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right) \]
(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
\left(3 \cdot s\right) \cdot \log \left(\frac{1}{1 - \frac{u - 0.25}{0.75}}\right)

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 16 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?

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

Alternative 1: 96.5% accurate, 1.0× speedup?

\[\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{-0.8630462288856506 \cdot s}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
(FPCore (s u)
  :precision binary32
  (*
 (+
  1.0
  (/ (* (* (- (log (- 1.0 u))) s) 3.0) (* -0.8630462288856506 s)))
 (* -0.8630462288856506 s)))
float code(float s, float u) {
	return (1.0f + (((-logf((1.0f - u)) * s) * 3.0f) / (-0.8630462288856506f * s))) * (-0.8630462288856506f * 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 = (1.0e0 + (((-log((1.0e0 - u)) * s) * 3.0e0) / ((-0.8630462288856506e0) * s))) * ((-0.8630462288856506e0) * s)
end function
function code(s, u)
	return Float32(Float32(Float32(1.0) + Float32(Float32(Float32(Float32(-log(Float32(Float32(1.0) - u))) * s) * Float32(3.0)) / Float32(Float32(-0.8630462288856506) * s))) * Float32(Float32(-0.8630462288856506) * s))
end
function tmp = code(s, u)
	tmp = (single(1.0) + (((-log((single(1.0) - u)) * s) * single(3.0)) / (single(-0.8630462288856506) * s))) * (single(-0.8630462288856506) * s);
end
\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{-0.8630462288856506 \cdot s}\right) \cdot \left(-0.8630462288856506 \cdot s\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

Alternative 2: 96.5% accurate, 1.1× speedup?

\[-0.8630462288856506 \cdot s + -3 \cdot \left(s \cdot \log \left(1 - u\right)\right) \]
(FPCore (s u)
  :precision binary32
  (+ (* -0.8630462288856506 s) (* -3.0 (* s (log (- 1.0 u))))))
float code(float s, float u) {
	return (-0.8630462288856506f * s) + (-3.0f * (s * logf((1.0f - u))));
}
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 = ((-0.8630462288856506e0) * s) + ((-3.0e0) * (s * log((1.0e0 - u))))
end function
function code(s, u)
	return Float32(Float32(Float32(-0.8630462288856506) * s) + Float32(Float32(-3.0) * Float32(s * log(Float32(Float32(1.0) - u)))))
end
function tmp = code(s, u)
	tmp = (single(-0.8630462288856506) * s) + (single(-3.0) * (s * log((single(1.0) - u))));
end
-0.8630462288856506 \cdot s + -3 \cdot \left(s \cdot \log \left(1 - u\right)\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

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

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

      \[\leadsto \left(1 + \color{blue}{\frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\frac{-14479513}{16777216} \cdot s}}\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    4. sum-to-mult-revN/A

      \[\leadsto \color{blue}{\frac{-14479513}{16777216} \cdot s + \left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3} \]
    5. lower-+.f3296.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-14479513}{16777216} \cdot s + \color{blue}{-3} \cdot \left(s \cdot \log \left(1 - u\right)\right) \]
    16. lower-*.f3296.3%

      \[\leadsto -0.8630462288856506 \cdot s + -3 \cdot \color{blue}{\left(s \cdot \log \left(1 - u\right)\right)} \]
  9. Applied rewrites96.3%

    \[\leadsto \color{blue}{-0.8630462288856506 \cdot s + -3 \cdot \left(s \cdot \log \left(1 - u\right)\right)} \]
  10. Add Preprocessing

Alternative 3: 96.3% accurate, 1.1× speedup?

\[\left(1 + 3.476059450342011 \cdot \log \left(1 - u\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
(FPCore (s u)
  :precision binary32
  (*
 (+ 1.0 (* 3.476059450342011 (log (- 1.0 u))))
 (* -0.8630462288856506 s)))
float code(float s, float u) {
	return (1.0f + (3.476059450342011f * logf((1.0f - u)))) * (-0.8630462288856506f * 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 = (1.0e0 + (3.476059450342011e0 * log((1.0e0 - u)))) * ((-0.8630462288856506e0) * s)
end function
function code(s, u)
	return Float32(Float32(Float32(1.0) + Float32(Float32(3.476059450342011) * log(Float32(Float32(1.0) - u)))) * Float32(Float32(-0.8630462288856506) * s))
end
function tmp = code(s, u)
	tmp = (single(1.0) + (single(3.476059450342011) * log((single(1.0) - u)))) * (single(-0.8630462288856506) * s);
end
\left(1 + 3.476059450342011 \cdot \log \left(1 - u\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

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

      \[\leadsto \left(1 + \frac{50331648}{14479513} \cdot \color{blue}{\log \left(1 - u\right)}\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    2. lower-log.f32N/A

      \[\leadsto \left(1 + \frac{50331648}{14479513} \cdot \log \left(1 - u\right)\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    3. lower--.f3296.5%

      \[\leadsto \left(1 + 3.476059450342011 \cdot \log \left(1 - u\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  10. Applied rewrites96.5%

    \[\leadsto \left(1 + \color{blue}{3.476059450342011 \cdot \log \left(1 - u\right)}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  11. Add Preprocessing

Alternative 4: 96.2% accurate, 1.1× speedup?

\[\left(\left(-\log \left(-1.3333333333333333 \cdot u - -1.3333333333333333\right)\right) \cdot 3\right) \cdot s \]
(FPCore (s u)
  :precision binary32
  (*
 (* (- (log (- (* -1.3333333333333333 u) -1.3333333333333333))) 3.0)
 s))
float code(float s, float u) {
	return (-logf(((-1.3333333333333333f * u) - -1.3333333333333333f)) * 3.0f) * 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 = (-log((((-1.3333333333333333e0) * u) - (-1.3333333333333333e0))) * 3.0e0) * s
end function
function code(s, u)
	return Float32(Float32(Float32(-log(Float32(Float32(Float32(-1.3333333333333333) * u) - Float32(-1.3333333333333333)))) * Float32(3.0)) * s)
end
function tmp = code(s, u)
	tmp = (-log(((single(-1.3333333333333333) * u) - single(-1.3333333333333333))) * single(3.0)) * s;
end
\left(\left(-\log \left(-1.3333333333333333 \cdot u - -1.3333333333333333\right)\right) \cdot 3\right) \cdot s
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. sub-flipN/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. add-flipN/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) - \left(\mathsf{neg}\left(1\right)\right)}}\right) \]
    5. metadata-evalN/A

      \[\leadsto \left(3 \cdot s\right) \cdot \log \left(\frac{1}{\left(\mathsf{neg}\left(\frac{u - \frac{1}{4}}{\frac{3}{4}}\right)\right) - \color{blue}{-1}}\right) \]
    6. 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) \]
    7. 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) \]
    8. 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) \]
    9. mult-flip-revN/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) \]
    10. *-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) \]
    11. 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) \]
    12. 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) \]
    13. metadata-eval95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\left(-\log \left(\frac{-4}{3} \cdot u - \frac{-4}{3}\right)\right)} \cdot 3\right) \cdot s \]
    11. lower-log.f3296.2%

      \[\leadsto \left(\left(-\color{blue}{\log \left(-1.3333333333333333 \cdot u - -1.3333333333333333\right)}\right) \cdot 3\right) \cdot s \]
  7. Applied rewrites96.2%

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

Alternative 5: 96.2% accurate, 1.2× speedup?

\[\left(3 \cdot s\right) \cdot \left(-0.28768208622932434 - \log \left(1 - u\right)\right) \]
(FPCore (s u)
  :precision binary32
  (* (* 3.0 s) (- -0.28768208622932434 (log (- 1.0 u)))))
float code(float s, float u) {
	return (3.0f * s) * (-0.28768208622932434f - logf((1.0f - u)));
}
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) * ((-0.28768208622932434e0) - log((1.0e0 - u)))
end function
function code(s, u)
	return Float32(Float32(Float32(3.0) * s) * Float32(Float32(-0.28768208622932434) - log(Float32(Float32(1.0) - u))))
end
function tmp = code(s, u)
	tmp = (single(3.0) * s) * (single(-0.28768208622932434) - log((single(1.0) - u)));
end
\left(3 \cdot s\right) \cdot \left(-0.28768208622932434 - \log \left(1 - u\right)\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(3 \cdot s\right) \cdot \color{blue}{\left(\log 0.75 - \log \left(1 - u\right)\right)} \]
  4. Evaluated real constant96.5%

    \[\leadsto \left(3 \cdot s\right) \cdot \left(\color{blue}{-0.28768208622932434} - \log \left(1 - u\right)\right) \]
  5. Add Preprocessing

Alternative 6: 40.6% accurate, 1.9× speedup?

\[\left(1 + \frac{u \cdot \left(3 \cdot s + u \cdot \left(1.5 \cdot s + u \cdot \left(s + 0.75 \cdot \left(s \cdot u\right)\right)\right)\right)}{-0.8630462288856506 \cdot s}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
(FPCore (s u)
  :precision binary32
  (*
 (+
  1.0
  (/
   (*
    u
    (+ (* 3.0 s) (* u (+ (* 1.5 s) (* u (+ s (* 0.75 (* s u))))))))
   (* -0.8630462288856506 s)))
 (* -0.8630462288856506 s)))
float code(float s, float u) {
	return (1.0f + ((u * ((3.0f * s) + (u * ((1.5f * s) + (u * (s + (0.75f * (s * u)))))))) / (-0.8630462288856506f * s))) * (-0.8630462288856506f * 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 = (1.0e0 + ((u * ((3.0e0 * s) + (u * ((1.5e0 * s) + (u * (s + (0.75e0 * (s * u)))))))) / ((-0.8630462288856506e0) * s))) * ((-0.8630462288856506e0) * s)
end function
function code(s, u)
	return Float32(Float32(Float32(1.0) + Float32(Float32(u * Float32(Float32(Float32(3.0) * s) + Float32(u * Float32(Float32(Float32(1.5) * s) + Float32(u * Float32(s + Float32(Float32(0.75) * Float32(s * u)))))))) / Float32(Float32(-0.8630462288856506) * s))) * Float32(Float32(-0.8630462288856506) * s))
end
function tmp = code(s, u)
	tmp = (single(1.0) + ((u * ((single(3.0) * s) + (u * ((single(1.5) * s) + (u * (s + (single(0.75) * (s * u)))))))) / (single(-0.8630462288856506) * s))) * (single(-0.8630462288856506) * s);
end
\left(1 + \frac{u \cdot \left(3 \cdot s + u \cdot \left(1.5 \cdot s + u \cdot \left(s + 0.75 \cdot \left(s \cdot u\right)\right)\right)\right)}{-0.8630462288856506 \cdot s}\right) \cdot \left(-0.8630462288856506 \cdot s\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(1 + \frac{u \cdot \left(3 \cdot s + u \cdot \left(\frac{3}{2} \cdot s + u \cdot \left(s + \frac{3}{4} \cdot \color{blue}{\left(s \cdot u\right)}\right)\right)\right)}{\frac{-14479513}{16777216} \cdot s}\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    10. lower-*.f3240.6%

      \[\leadsto \left(1 + \frac{u \cdot \left(3 \cdot s + u \cdot \left(1.5 \cdot s + u \cdot \left(s + 0.75 \cdot \left(s \cdot \color{blue}{u}\right)\right)\right)\right)}{-0.8630462288856506 \cdot s}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  10. Applied rewrites40.6%

    \[\leadsto \left(1 + \frac{\color{blue}{u \cdot \left(3 \cdot s + u \cdot \left(1.5 \cdot s + u \cdot \left(s + 0.75 \cdot \left(s \cdot u\right)\right)\right)\right)}}{-0.8630462288856506 \cdot s}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  11. Add Preprocessing

Alternative 7: 40.6% accurate, 2.0× speedup?

\[\left(1 + \frac{\left(\left(u \cdot \left(1 + u \cdot \left(0.5 + u \cdot \left(0.3333333333333333 + 0.25 \cdot u\right)\right)\right)\right) \cdot s\right) \cdot 3}{-0.8630462288856506 \cdot s}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
(FPCore (s u)
  :precision binary32
  (*
 (+
  1.0
  (/
   (*
    (*
     (*
      u
      (+ 1.0 (* u (+ 0.5 (* u (+ 0.3333333333333333 (* 0.25 u)))))))
     s)
    3.0)
   (* -0.8630462288856506 s)))
 (* -0.8630462288856506 s)))
float code(float s, float u) {
	return (1.0f + ((((u * (1.0f + (u * (0.5f + (u * (0.3333333333333333f + (0.25f * u))))))) * s) * 3.0f) / (-0.8630462288856506f * s))) * (-0.8630462288856506f * 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 = (1.0e0 + ((((u * (1.0e0 + (u * (0.5e0 + (u * (0.3333333333333333e0 + (0.25e0 * u))))))) * s) * 3.0e0) / ((-0.8630462288856506e0) * s))) * ((-0.8630462288856506e0) * s)
end function
function code(s, u)
	return Float32(Float32(Float32(1.0) + Float32(Float32(Float32(Float32(u * Float32(Float32(1.0) + Float32(u * Float32(Float32(0.5) + Float32(u * Float32(Float32(0.3333333333333333) + Float32(Float32(0.25) * u))))))) * s) * Float32(3.0)) / Float32(Float32(-0.8630462288856506) * s))) * Float32(Float32(-0.8630462288856506) * s))
end
function tmp = code(s, u)
	tmp = (single(1.0) + ((((u * (single(1.0) + (u * (single(0.5) + (u * (single(0.3333333333333333) + (single(0.25) * u))))))) * s) * single(3.0)) / (single(-0.8630462288856506) * s))) * (single(-0.8630462288856506) * s);
end
\left(1 + \frac{\left(\left(u \cdot \left(1 + u \cdot \left(0.5 + u \cdot \left(0.3333333333333333 + 0.25 \cdot u\right)\right)\right)\right) \cdot s\right) \cdot 3}{-0.8630462288856506 \cdot s}\right) \cdot \left(-0.8630462288856506 \cdot s\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

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

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

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

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

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

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

      \[\leadsto \left(1 + \frac{\left(\left(u \cdot \left(1 + u \cdot \left(\frac{1}{2} + u \cdot \left(\frac{1}{3} + \color{blue}{\frac{1}{4} \cdot u}\right)\right)\right)\right) \cdot s\right) \cdot 3}{\frac{-14479513}{16777216} \cdot s}\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    7. lower-*.f3240.6%

      \[\leadsto \left(1 + \frac{\left(\left(u \cdot \left(1 + u \cdot \left(0.5 + u \cdot \left(0.3333333333333333 + 0.25 \cdot \color{blue}{u}\right)\right)\right)\right) \cdot s\right) \cdot 3}{-0.8630462288856506 \cdot s}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  10. Applied rewrites40.6%

    \[\leadsto \left(1 + \frac{\left(\color{blue}{\left(u \cdot \left(1 + u \cdot \left(0.5 + u \cdot \left(0.3333333333333333 + 0.25 \cdot u\right)\right)\right)\right)} \cdot s\right) \cdot 3}{-0.8630462288856506 \cdot s}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  11. Add Preprocessing

Alternative 8: 40.6% accurate, 3.2× speedup?

\[\left(1 + u \cdot \left(u \cdot \left(u \cdot \left(-0.8690148625855028 \cdot u - 1.158686483447337\right) - 1.7380297251710055\right) - 3.476059450342011\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
(FPCore (s u)
  :precision binary32
  (*
 (+
  1.0
  (*
   u
   (-
    (*
     u
     (-
      (* u (- (* -0.8690148625855028 u) 1.158686483447337))
      1.7380297251710055))
    3.476059450342011)))
 (* -0.8630462288856506 s)))
float code(float s, float u) {
	return (1.0f + (u * ((u * ((u * ((-0.8690148625855028f * u) - 1.158686483447337f)) - 1.7380297251710055f)) - 3.476059450342011f))) * (-0.8630462288856506f * 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 = (1.0e0 + (u * ((u * ((u * (((-0.8690148625855028e0) * u) - 1.158686483447337e0)) - 1.7380297251710055e0)) - 3.476059450342011e0))) * ((-0.8630462288856506e0) * s)
end function
function code(s, u)
	return Float32(Float32(Float32(1.0) + Float32(u * Float32(Float32(u * Float32(Float32(u * Float32(Float32(Float32(-0.8690148625855028) * u) - Float32(1.158686483447337))) - Float32(1.7380297251710055))) - Float32(3.476059450342011)))) * Float32(Float32(-0.8630462288856506) * s))
end
function tmp = code(s, u)
	tmp = (single(1.0) + (u * ((u * ((u * ((single(-0.8690148625855028) * u) - single(1.158686483447337))) - single(1.7380297251710055))) - single(3.476059450342011)))) * (single(-0.8630462288856506) * s);
end
\left(1 + u \cdot \left(u \cdot \left(u \cdot \left(-0.8690148625855028 \cdot u - 1.158686483447337\right) - 1.7380297251710055\right) - 3.476059450342011\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

    \[\leadsto \left(1 + \color{blue}{u \cdot \left(u \cdot \left(u \cdot \left(\frac{-12582912}{14479513} \cdot u - \frac{16777216}{14479513}\right) - \frac{25165824}{14479513}\right) - \frac{50331648}{14479513}\right)}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  9. Step-by-step derivation
    1. lower-*.f32N/A

      \[\leadsto \left(1 + u \cdot \color{blue}{\left(u \cdot \left(u \cdot \left(\frac{-12582912}{14479513} \cdot u - \frac{16777216}{14479513}\right) - \frac{25165824}{14479513}\right) - \frac{50331648}{14479513}\right)}\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    2. lower--.f32N/A

      \[\leadsto \left(1 + u \cdot \left(u \cdot \left(u \cdot \left(\frac{-12582912}{14479513} \cdot u - \frac{16777216}{14479513}\right) - \frac{25165824}{14479513}\right) - \color{blue}{\frac{50331648}{14479513}}\right)\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    3. lower-*.f32N/A

      \[\leadsto \left(1 + u \cdot \left(u \cdot \left(u \cdot \left(\frac{-12582912}{14479513} \cdot u - \frac{16777216}{14479513}\right) - \frac{25165824}{14479513}\right) - \frac{50331648}{14479513}\right)\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    4. lower--.f32N/A

      \[\leadsto \left(1 + u \cdot \left(u \cdot \left(u \cdot \left(\frac{-12582912}{14479513} \cdot u - \frac{16777216}{14479513}\right) - \frac{25165824}{14479513}\right) - \frac{50331648}{14479513}\right)\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    5. lower-*.f32N/A

      \[\leadsto \left(1 + u \cdot \left(u \cdot \left(u \cdot \left(\frac{-12582912}{14479513} \cdot u - \frac{16777216}{14479513}\right) - \frac{25165824}{14479513}\right) - \frac{50331648}{14479513}\right)\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    6. lower--.f32N/A

      \[\leadsto \left(1 + u \cdot \left(u \cdot \left(u \cdot \left(\frac{-12582912}{14479513} \cdot u - \frac{16777216}{14479513}\right) - \frac{25165824}{14479513}\right) - \frac{50331648}{14479513}\right)\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    7. lower-*.f3240.6%

      \[\leadsto \left(1 + u \cdot \left(u \cdot \left(u \cdot \left(-0.8690148625855028 \cdot u - 1.158686483447337\right) - 1.7380297251710055\right) - 3.476059450342011\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  10. Applied rewrites40.6%

    \[\leadsto \left(1 + \color{blue}{u \cdot \left(u \cdot \left(u \cdot \left(-0.8690148625855028 \cdot u - 1.158686483447337\right) - 1.7380297251710055\right) - 3.476059450342011\right)}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  11. Add Preprocessing

Alternative 9: 36.7% accurate, 3.5× speedup?

\[-0.8630462288856506 \cdot s + u \cdot \left(3 \cdot s + u \cdot \left(1.5 \cdot s + s \cdot u\right)\right) \]
(FPCore (s u)
  :precision binary32
  (+
 (* -0.8630462288856506 s)
 (* u (+ (* 3.0 s) (* u (+ (* 1.5 s) (* s u)))))))
float code(float s, float u) {
	return (-0.8630462288856506f * s) + (u * ((3.0f * s) + (u * ((1.5f * s) + (s * u)))));
}
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 = ((-0.8630462288856506e0) * s) + (u * ((3.0e0 * s) + (u * ((1.5e0 * s) + (s * u)))))
end function
function code(s, u)
	return Float32(Float32(Float32(-0.8630462288856506) * s) + Float32(u * Float32(Float32(Float32(3.0) * s) + Float32(u * Float32(Float32(Float32(1.5) * s) + Float32(s * u))))))
end
function tmp = code(s, u)
	tmp = (single(-0.8630462288856506) * s) + (u * ((single(3.0) * s) + (u * ((single(1.5) * s) + (s * u)))));
end
-0.8630462288856506 \cdot s + u \cdot \left(3 \cdot s + u \cdot \left(1.5 \cdot s + s \cdot u\right)\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-14479513}{16777216} \cdot s + u \cdot \left(3 \cdot s + u \cdot \left(\frac{3}{2} \cdot s + \color{blue}{s} \cdot u\right)\right) \]
    9. lower-*.f3236.7%

      \[\leadsto -0.8630462288856506 \cdot s + u \cdot \left(3 \cdot s + u \cdot \left(1.5 \cdot s + s \cdot \color{blue}{u}\right)\right) \]
  10. Applied rewrites36.7%

    \[\leadsto \color{blue}{-0.8630462288856506 \cdot s + u \cdot \left(3 \cdot s + u \cdot \left(1.5 \cdot s + s \cdot u\right)\right)} \]
  11. Add Preprocessing

Alternative 10: 36.7% accurate, 4.0× speedup?

\[\left(1 + u \cdot \left(u \cdot \left(-1.158686483447337 \cdot u - 1.7380297251710055\right) - 3.476059450342011\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
(FPCore (s u)
  :precision binary32
  (*
 (+
  1.0
  (*
   u
   (-
    (* u (- (* -1.158686483447337 u) 1.7380297251710055))
    3.476059450342011)))
 (* -0.8630462288856506 s)))
float code(float s, float u) {
	return (1.0f + (u * ((u * ((-1.158686483447337f * u) - 1.7380297251710055f)) - 3.476059450342011f))) * (-0.8630462288856506f * 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 = (1.0e0 + (u * ((u * (((-1.158686483447337e0) * u) - 1.7380297251710055e0)) - 3.476059450342011e0))) * ((-0.8630462288856506e0) * s)
end function
function code(s, u)
	return Float32(Float32(Float32(1.0) + Float32(u * Float32(Float32(u * Float32(Float32(Float32(-1.158686483447337) * u) - Float32(1.7380297251710055))) - Float32(3.476059450342011)))) * Float32(Float32(-0.8630462288856506) * s))
end
function tmp = code(s, u)
	tmp = (single(1.0) + (u * ((u * ((single(-1.158686483447337) * u) - single(1.7380297251710055))) - single(3.476059450342011)))) * (single(-0.8630462288856506) * s);
end
\left(1 + u \cdot \left(u \cdot \left(-1.158686483447337 \cdot u - 1.7380297251710055\right) - 3.476059450342011\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

    \[\leadsto \left(1 + \color{blue}{u \cdot \left(u \cdot \left(\frac{-16777216}{14479513} \cdot u - \frac{25165824}{14479513}\right) - \frac{50331648}{14479513}\right)}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  9. Step-by-step derivation
    1. lower-*.f32N/A

      \[\leadsto \left(1 + u \cdot \color{blue}{\left(u \cdot \left(\frac{-16777216}{14479513} \cdot u - \frac{25165824}{14479513}\right) - \frac{50331648}{14479513}\right)}\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    2. lower--.f32N/A

      \[\leadsto \left(1 + u \cdot \left(u \cdot \left(\frac{-16777216}{14479513} \cdot u - \frac{25165824}{14479513}\right) - \color{blue}{\frac{50331648}{14479513}}\right)\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    3. lower-*.f32N/A

      \[\leadsto \left(1 + u \cdot \left(u \cdot \left(\frac{-16777216}{14479513} \cdot u - \frac{25165824}{14479513}\right) - \frac{50331648}{14479513}\right)\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    4. lower--.f32N/A

      \[\leadsto \left(1 + u \cdot \left(u \cdot \left(\frac{-16777216}{14479513} \cdot u - \frac{25165824}{14479513}\right) - \frac{50331648}{14479513}\right)\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    5. lower-*.f3236.7%

      \[\leadsto \left(1 + u \cdot \left(u \cdot \left(-1.158686483447337 \cdot u - 1.7380297251710055\right) - 3.476059450342011\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  10. Applied rewrites36.7%

    \[\leadsto \left(1 + \color{blue}{u \cdot \left(u \cdot \left(-1.158686483447337 \cdot u - 1.7380297251710055\right) - 3.476059450342011\right)}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  11. Add Preprocessing

Alternative 11: 32.2% accurate, 4.3× speedup?

\[-0.8630462288856506 \cdot s + u \cdot \left(1.5 \cdot \left(s \cdot u\right) + 3 \cdot s\right) \]
(FPCore (s u)
  :precision binary32
  (+ (* -0.8630462288856506 s) (* u (+ (* 1.5 (* s u)) (* 3.0 s)))))
float code(float s, float u) {
	return (-0.8630462288856506f * s) + (u * ((1.5f * (s * u)) + (3.0f * 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 = ((-0.8630462288856506e0) * s) + (u * ((1.5e0 * (s * u)) + (3.0e0 * s)))
end function
function code(s, u)
	return Float32(Float32(Float32(-0.8630462288856506) * s) + Float32(u * Float32(Float32(Float32(1.5) * Float32(s * u)) + Float32(Float32(3.0) * s))))
end
function tmp = code(s, u)
	tmp = (single(-0.8630462288856506) * s) + (u * ((single(1.5) * (s * u)) + (single(3.0) * s)));
end
-0.8630462288856506 \cdot s + u \cdot \left(1.5 \cdot \left(s \cdot u\right) + 3 \cdot s\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

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

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

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

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

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

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

      \[\leadsto \frac{-14479513}{16777216} \cdot s + u \cdot \left(\frac{3}{2} \cdot \left(s \cdot u\right) + 3 \cdot s\right) \]
    7. lower-*.f3232.2%

      \[\leadsto -0.8630462288856506 \cdot s + u \cdot \left(1.5 \cdot \left(s \cdot u\right) + 3 \cdot \color{blue}{s}\right) \]
  10. Applied rewrites32.2%

    \[\leadsto \color{blue}{-0.8630462288856506 \cdot s + u \cdot \left(1.5 \cdot \left(s \cdot u\right) + 3 \cdot s\right)} \]
  11. Add Preprocessing

Alternative 12: 32.2% accurate, 5.1× speedup?

\[\left(1 + u \cdot \left(-1.7380297251710055 \cdot u - 3.476059450342011\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
(FPCore (s u)
  :precision binary32
  (*
 (+ 1.0 (* u (- (* -1.7380297251710055 u) 3.476059450342011)))
 (* -0.8630462288856506 s)))
float code(float s, float u) {
	return (1.0f + (u * ((-1.7380297251710055f * u) - 3.476059450342011f))) * (-0.8630462288856506f * 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 = (1.0e0 + (u * (((-1.7380297251710055e0) * u) - 3.476059450342011e0))) * ((-0.8630462288856506e0) * s)
end function
function code(s, u)
	return Float32(Float32(Float32(1.0) + Float32(u * Float32(Float32(Float32(-1.7380297251710055) * u) - Float32(3.476059450342011)))) * Float32(Float32(-0.8630462288856506) * s))
end
function tmp = code(s, u)
	tmp = (single(1.0) + (u * ((single(-1.7380297251710055) * u) - single(3.476059450342011)))) * (single(-0.8630462288856506) * s);
end
\left(1 + u \cdot \left(-1.7380297251710055 \cdot u - 3.476059450342011\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

    \[\leadsto \left(1 + \color{blue}{u \cdot \left(\frac{-25165824}{14479513} \cdot u - \frac{50331648}{14479513}\right)}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  9. Step-by-step derivation
    1. lower-*.f32N/A

      \[\leadsto \left(1 + u \cdot \color{blue}{\left(\frac{-25165824}{14479513} \cdot u - \frac{50331648}{14479513}\right)}\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    2. lower--.f32N/A

      \[\leadsto \left(1 + u \cdot \left(\frac{-25165824}{14479513} \cdot u - \color{blue}{\frac{50331648}{14479513}}\right)\right) \cdot \left(\frac{-14479513}{16777216} \cdot s\right) \]
    3. lower-*.f3232.2%

      \[\leadsto \left(1 + u \cdot \left(-1.7380297251710055 \cdot u - 3.476059450342011\right)\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  10. Applied rewrites32.2%

    \[\leadsto \left(1 + \color{blue}{u \cdot \left(-1.7380297251710055 \cdot u - 3.476059450342011\right)}\right) \cdot \left(-0.8630462288856506 \cdot s\right) \]
  11. Add Preprocessing

Alternative 13: 25.8% accurate, 7.3× speedup?

\[-0.8630462288856506 \cdot s + 3 \cdot \left(s \cdot u\right) \]
(FPCore (s u)
  :precision binary32
  (+ (* -0.8630462288856506 s) (* 3.0 (* s u))))
float code(float s, float u) {
	return (-0.8630462288856506f * s) + (3.0f * (s * u));
}
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 = ((-0.8630462288856506e0) * s) + (3.0e0 * (s * u))
end function
function code(s, u)
	return Float32(Float32(Float32(-0.8630462288856506) * s) + Float32(Float32(3.0) * Float32(s * u)))
end
function tmp = code(s, u)
	tmp = (single(-0.8630462288856506) * s) + (single(3.0) * (s * u));
end
-0.8630462288856506 \cdot s + 3 \cdot \left(s \cdot u\right)
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-log.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\log 0.421875 \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right)} \]
  6. Evaluated real constant96.2%

    \[\leadsto \left(1 + \frac{\left(\left(-\log \left(1 - u\right)\right) \cdot s\right) \cdot 3}{\color{blue}{-0.8630462288856506} \cdot s}\right) \cdot \left(\log 0.421875 \cdot s\right) \]
  7. Evaluated real constant96.2%

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

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

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

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

      \[\leadsto \frac{-14479513}{16777216} \cdot s + 3 \cdot \color{blue}{\left(s \cdot u\right)} \]
    4. lower-*.f3225.8%

      \[\leadsto -0.8630462288856506 \cdot s + 3 \cdot \left(s \cdot \color{blue}{u}\right) \]
  10. Applied rewrites25.8%

    \[\leadsto \color{blue}{-0.8630462288856506 \cdot s + 3 \cdot \left(s \cdot u\right)} \]
  11. Add Preprocessing

Alternative 14: 7.4% accurate, 12.6× speedup?

\[\left(3 \cdot s\right) \cdot -0.28768208622932434 \]
(FPCore (s u)
  :precision binary32
  (* (* 3.0 s) -0.28768208622932434))
float code(float s, float u) {
	return (3.0f * s) * -0.28768208622932434f;
}
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) * (-0.28768208622932434e0)
end function
function code(s, u)
	return Float32(Float32(Float32(3.0) * s) * Float32(-0.28768208622932434))
end
function tmp = code(s, u)
	tmp = (single(3.0) * s) * single(-0.28768208622932434);
end
\left(3 \cdot s\right) \cdot -0.28768208622932434
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 \log \frac{3}{4}\right)} \]
  3. Step-by-step derivation
    1. lower-*.f32N/A

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

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

      \[\leadsto 3 \cdot \left(s \cdot \log 0.75\right) \]
  4. Applied rewrites7.4%

    \[\leadsto \color{blue}{3 \cdot \left(s \cdot \log 0.75\right)} \]
  5. Evaluated real constant7.4%

    \[\leadsto 3 \cdot \left(s \cdot -0.28768208622932434\right) \]
  6. Step-by-step derivation
    1. lift-*.f32N/A

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

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

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

      \[\leadsto \left(3 \cdot s\right) \cdot \frac{-9653009}{33554432} \]
    5. lower-*.f327.4%

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

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

Alternative 15: 7.4% accurate, 12.6× speedup?

\[3 \cdot \left(s \cdot -0.28768208622932434\right) \]
(FPCore (s u)
  :precision binary32
  (* 3.0 (* s -0.28768208622932434)))
float code(float s, float u) {
	return 3.0f * (s * -0.28768208622932434f);
}
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 * (-0.28768208622932434e0))
end function
function code(s, u)
	return Float32(Float32(3.0) * Float32(s * Float32(-0.28768208622932434)))
end
function tmp = code(s, u)
	tmp = single(3.0) * (s * single(-0.28768208622932434));
end
3 \cdot \left(s \cdot -0.28768208622932434\right)
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 \log \frac{3}{4}\right)} \]
  3. Step-by-step derivation
    1. lower-*.f32N/A

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

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

      \[\leadsto 3 \cdot \left(s \cdot \log 0.75\right) \]
  4. Applied rewrites7.4%

    \[\leadsto \color{blue}{3 \cdot \left(s \cdot \log 0.75\right)} \]
  5. Evaluated real constant7.4%

    \[\leadsto 3 \cdot \left(s \cdot -0.28768208622932434\right) \]
  6. Add Preprocessing

Alternative 16: 7.4% accurate, 23.2× speedup?

\[s \cdot -0.863046258687973 \]
(FPCore (s u)
  :precision binary32
  (* s -0.863046258687973))
float code(float s, float u) {
	return s * -0.863046258687973f;
}
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 = s * (-0.863046258687973e0)
end function
function code(s, u)
	return Float32(s * Float32(-0.863046258687973))
end
function tmp = code(s, u)
	tmp = s * single(-0.863046258687973);
end
s \cdot -0.863046258687973
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 \log \frac{3}{4}\right)} \]
  3. Step-by-step derivation
    1. lower-*.f32N/A

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

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

      \[\leadsto 3 \cdot \left(s \cdot \log 0.75\right) \]
  4. Applied rewrites7.4%

    \[\leadsto \color{blue}{3 \cdot \left(s \cdot \log 0.75\right)} \]
  5. Evaluated real constant7.4%

    \[\leadsto 3 \cdot \left(s \cdot -0.28768208622932434\right) \]
  6. Step-by-step derivation
    1. lift-*.f32N/A

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

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

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

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

      \[\leadsto s \cdot \color{blue}{\left(\frac{-9653009}{33554432} \cdot 3\right)} \]
    6. metadata-eval7.4%

      \[\leadsto s \cdot -0.863046258687973 \]
  7. Applied rewrites7.4%

    \[\leadsto s \cdot \color{blue}{-0.863046258687973} \]
  8. Add Preprocessing

Reproduce

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