Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.9%
Time: 6.4s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
(FPCore (x y z)
  :precision binary64
  (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
	return ((x - ((y + 0.5) * log(y))) + y) - z;
}
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(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
	return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z):
	return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z)
	return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z)
end
function tmp = code(x, y, z)
	tmp = ((x - ((y + 0.5) * log(y))) + y) - z;
end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.8% accurate, 1.0× speedup?

\[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
(FPCore (x y z)
  :precision binary64
  (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
	return ((x - ((y + 0.5) * log(y))) + y) - z;
}
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(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
	return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z):
	return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z)
	return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z)
end
function tmp = code(x, y, z)
	tmp = ((x - ((y + 0.5) * log(y))) + y) - z;
end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\mathsf{fma}\left(-0.5 - y, \log y, y\right) - \left(z - x\right) \]
(FPCore (x y z)
  :precision binary64
  (- (fma (- -0.5 y) (log y) y) (- z x)))
double code(double x, double y, double z) {
	return fma((-0.5 - y), log(y), y) - (z - x);
}
function code(x, y, z)
	return Float64(fma(Float64(-0.5 - y), log(y), y) - Float64(z - x))
end
code[x_, y_, z_] := N[(N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + y), $MachinePrecision] - N[(z - x), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(-0.5 - y, \log y, y\right) - \left(z - x\right)
Derivation
  1. Initial program 99.8%

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
    2. sub-negate-revN/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\left(z - \left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)\right)\right)} \]
    3. lift-+.f64N/A

      \[\leadsto \mathsf{neg}\left(\left(z - \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)}\right)\right) \]
    4. add-flipN/A

      \[\leadsto \mathsf{neg}\left(\left(z - \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) - \left(\mathsf{neg}\left(y\right)\right)\right)}\right)\right) \]
    5. lift--.f64N/A

      \[\leadsto \mathsf{neg}\left(\left(z - \left(\color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
    6. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\left(z - \left(\left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) - \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
    7. fp-cancel-sub-sign-invN/A

      \[\leadsto \mathsf{neg}\left(\left(z - \left(\color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} - \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
    8. associate--l+N/A

      \[\leadsto \mathsf{neg}\left(\left(z - \color{blue}{\left(x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y - \left(\mathsf{neg}\left(y\right)\right)\right)\right)}\right)\right) \]
    9. associate--r+N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\left(z - x\right) - \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y - \left(\mathsf{neg}\left(y\right)\right)\right)\right)}\right) \]
    10. sub-negateN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y - \left(\mathsf{neg}\left(y\right)\right)\right) - \left(z - x\right)} \]
    11. lower--.f64N/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y - \left(\mathsf{neg}\left(y\right)\right)\right) - \left(z - x\right)} \]
    12. add-flip-revN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + y\right)} - \left(z - x\right) \]
    13. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, y\right)} - \left(z - x\right) \]
    14. lift-+.f64N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, y\right) - \left(z - x\right) \]
    15. add-flipN/A

      \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, y\right) - \left(z - x\right) \]
    16. sub-negateN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, y\right) - \left(z - x\right) \]
    17. lower--.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, y\right) - \left(z - x\right) \]
    18. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}} - y, \log y, y\right) - \left(z - x\right) \]
    19. lower--.f6499.9%

      \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, y\right) - \color{blue}{\left(z - x\right)} \]
  3. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, y\right) - \left(z - x\right)} \]
  4. Add Preprocessing

Alternative 2: 99.9% accurate, 1.0× speedup?

\[\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right) \]
(FPCore (x y z)
  :precision binary64
  (fma (- -0.5 y) (log y) (- (+ y x) z)))
double code(double x, double y, double z) {
	return fma((-0.5 - y), log(y), ((y + x) - z));
}
function code(x, y, z)
	return fma(Float64(-0.5 - y), log(y), Float64(Float64(y + x) - z))
end
code[x_, y_, z_] := N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right)
Derivation
  1. Initial program 99.8%

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
    2. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
    3. associate--l+N/A

      \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + \left(y - z\right)} \]
    4. lift--.f64N/A

      \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(y - z\right) \]
    5. lift-*.f64N/A

      \[\leadsto \left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) + \left(y - z\right) \]
    6. fp-cancel-sub-sign-invN/A

      \[\leadsto \color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} + \left(y - z\right) \]
    7. associate-+l+N/A

      \[\leadsto \color{blue}{x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right)} \]
    8. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right) + x} \]
    9. associate-+l+N/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(\left(y - z\right) + x\right)} \]
    10. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, \left(y - z\right) + x\right)} \]
    11. lift-+.f64N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, \left(y - z\right) + x\right) \]
    12. add-flipN/A

      \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, \left(y - z\right) + x\right) \]
    13. sub-negateN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
    14. lower--.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}} - y, \log y, \left(y - z\right) + x\right) \]
    16. sub-flipN/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} + x\right) \]
    17. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} + x\right) \]
    18. associate-+l+N/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) + \left(y + x\right)}\right) \]
    19. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(x + y\right)}\right) \]
    20. associate-+r+N/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + x\right) + y}\right) \]
    21. remove-double-negN/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + y\right) \]
    22. distribute-neg-inN/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(\left(z + \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)} + y\right) \]
    23. sub-flipN/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(\color{blue}{\left(z - x\right)}\right)\right) + y\right) \]
    24. sub-negate-revN/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(x - z\right)} + y\right) \]
    25. associate--r-N/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{x - \left(z - y\right)}\right) \]
  3. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right)} \]
  4. Add Preprocessing

Alternative 3: 89.4% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;y \leq 5.2 \cdot 10^{+34}:\\ \;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, x - z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, y - z\right)\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (if (<= y 5.2e+34)
  (fma (- -0.5 y) (log y) (- x z))
  (fma (- -0.5 y) (log y) (- y z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 5.2e+34) {
		tmp = fma((-0.5 - y), log(y), (x - z));
	} else {
		tmp = fma((-0.5 - y), log(y), (y - z));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= 5.2e+34)
		tmp = fma(Float64(-0.5 - y), log(y), Float64(x - z));
	else
		tmp = fma(Float64(-0.5 - y), log(y), Float64(y - z));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, 5.2e+34], N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(x - z), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq 5.2 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, x - z\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, y - z\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 5.1999999999999999e34

    1. Initial program 99.8%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
      2. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
      3. associate--l+N/A

        \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + \left(y - z\right)} \]
      4. lift--.f64N/A

        \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(y - z\right) \]
      5. lift-*.f64N/A

        \[\leadsto \left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) + \left(y - z\right) \]
      6. fp-cancel-sub-sign-invN/A

        \[\leadsto \color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} + \left(y - z\right) \]
      7. associate-+l+N/A

        \[\leadsto \color{blue}{x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right)} \]
      8. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right) + x} \]
      9. associate-+l+N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(\left(y - z\right) + x\right)} \]
      10. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, \left(y - z\right) + x\right)} \]
      11. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, \left(y - z\right) + x\right) \]
      12. add-flipN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, \left(y - z\right) + x\right) \]
      13. sub-negateN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}} - y, \log y, \left(y - z\right) + x\right) \]
      16. sub-flipN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} + x\right) \]
      17. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} + x\right) \]
      18. associate-+l+N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) + \left(y + x\right)}\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(x + y\right)}\right) \]
      20. associate-+r+N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + x\right) + y}\right) \]
      21. remove-double-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + y\right) \]
      22. distribute-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(\left(z + \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)} + y\right) \]
      23. sub-flipN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(\color{blue}{\left(z - x\right)}\right)\right) + y\right) \]
      24. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(x - z\right)} + y\right) \]
      25. associate--r-N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{x - \left(z - y\right)}\right) \]
    3. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
    5. Step-by-step derivation
      1. lower--.f6479.5%

        \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, x - \color{blue}{z}\right) \]
    6. Applied rewrites79.5%

      \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]

    if 5.1999999999999999e34 < y

    1. Initial program 99.8%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
      2. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
      3. associate--l+N/A

        \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + \left(y - z\right)} \]
      4. lift--.f64N/A

        \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(y - z\right) \]
      5. lift-*.f64N/A

        \[\leadsto \left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) + \left(y - z\right) \]
      6. fp-cancel-sub-sign-invN/A

        \[\leadsto \color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} + \left(y - z\right) \]
      7. associate-+l+N/A

        \[\leadsto \color{blue}{x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right)} \]
      8. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right) + x} \]
      9. associate-+l+N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(\left(y - z\right) + x\right)} \]
      10. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, \left(y - z\right) + x\right)} \]
      11. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, \left(y - z\right) + x\right) \]
      12. add-flipN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, \left(y - z\right) + x\right) \]
      13. sub-negateN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}} - y, \log y, \left(y - z\right) + x\right) \]
      16. sub-flipN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} + x\right) \]
      17. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} + x\right) \]
      18. associate-+l+N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) + \left(y + x\right)}\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(x + y\right)}\right) \]
      20. associate-+r+N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + x\right) + y}\right) \]
      21. remove-double-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + y\right) \]
      22. distribute-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(\left(z + \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)} + y\right) \]
      23. sub-flipN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(\color{blue}{\left(z - x\right)}\right)\right) + y\right) \]
      24. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(x - z\right)} + y\right) \]
      25. associate--r-N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{x - \left(z - y\right)}\right) \]
    3. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right)} \]
    4. Taylor expanded in x around 0

      \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{y} - z\right) \]
    5. Step-by-step derivation
      1. Applied rewrites70.6%

        \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{y} - z\right) \]
    6. Recombined 2 regimes into one program.
    7. Add Preprocessing

    Alternative 4: 89.4% accurate, 1.0× speedup?

    \[\begin{array}{l} \mathbf{if}\;y \leq 5.2 \cdot 10^{+34}:\\ \;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, x - z\right)\\ \mathbf{else}:\\ \;\;\;\;y - \mathsf{fma}\left(\log y, y - -0.5, z\right)\\ \end{array} \]
    (FPCore (x y z)
      :precision binary64
      (if (<= y 5.2e+34)
      (fma (- -0.5 y) (log y) (- x z))
      (- y (fma (log y) (- y -0.5) z))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (y <= 5.2e+34) {
    		tmp = fma((-0.5 - y), log(y), (x - z));
    	} else {
    		tmp = y - fma(log(y), (y - -0.5), z);
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if (y <= 5.2e+34)
    		tmp = fma(Float64(-0.5 - y), log(y), Float64(x - z));
    	else
    		tmp = Float64(y - fma(log(y), Float64(y - -0.5), z));
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[LessEqual[y, 5.2e+34], N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(x - z), $MachinePrecision]), $MachinePrecision], N[(y - N[(N[Log[y], $MachinePrecision] * N[(y - -0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    \mathbf{if}\;y \leq 5.2 \cdot 10^{+34}:\\
    \;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, x - z\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;y - \mathsf{fma}\left(\log y, y - -0.5, z\right)\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < 5.1999999999999999e34

      1. Initial program 99.8%

        \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
      2. Step-by-step derivation
        1. lift--.f64N/A

          \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
        2. lift-+.f64N/A

          \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
        3. associate--l+N/A

          \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + \left(y - z\right)} \]
        4. lift--.f64N/A

          \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(y - z\right) \]
        5. lift-*.f64N/A

          \[\leadsto \left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) + \left(y - z\right) \]
        6. fp-cancel-sub-sign-invN/A

          \[\leadsto \color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} + \left(y - z\right) \]
        7. associate-+l+N/A

          \[\leadsto \color{blue}{x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right)} \]
        8. +-commutativeN/A

          \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right) + x} \]
        9. associate-+l+N/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(\left(y - z\right) + x\right)} \]
        10. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, \left(y - z\right) + x\right)} \]
        11. lift-+.f64N/A

          \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, \left(y - z\right) + x\right) \]
        12. add-flipN/A

          \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, \left(y - z\right) + x\right) \]
        13. sub-negateN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
        14. lower--.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}} - y, \log y, \left(y - z\right) + x\right) \]
        16. sub-flipN/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} + x\right) \]
        17. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} + x\right) \]
        18. associate-+l+N/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) + \left(y + x\right)}\right) \]
        19. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(x + y\right)}\right) \]
        20. associate-+r+N/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + x\right) + y}\right) \]
        21. remove-double-negN/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + y\right) \]
        22. distribute-neg-inN/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(\left(z + \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)} + y\right) \]
        23. sub-flipN/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(\color{blue}{\left(z - x\right)}\right)\right) + y\right) \]
        24. sub-negate-revN/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(x - z\right)} + y\right) \]
        25. associate--r-N/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{x - \left(z - y\right)}\right) \]
      3. Applied rewrites99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right)} \]
      4. Taylor expanded in y around 0

        \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
      5. Step-by-step derivation
        1. lower--.f6479.5%

          \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, x - \color{blue}{z}\right) \]
      6. Applied rewrites79.5%

        \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]

      if 5.1999999999999999e34 < y

      1. Initial program 99.8%

        \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
      2. Step-by-step derivation
        1. lift--.f64N/A

          \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
        2. sub-flipN/A

          \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) + \left(\mathsf{neg}\left(z\right)\right)} \]
        3. lift-+.f64N/A

          \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} + \left(\mathsf{neg}\left(z\right)\right) \]
        4. +-commutativeN/A

          \[\leadsto \color{blue}{\left(y + \left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)\right)} + \left(\mathsf{neg}\left(z\right)\right) \]
        5. lift--.f64N/A

          \[\leadsto \left(y + \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)}\right) + \left(\mathsf{neg}\left(z\right)\right) \]
        6. associate-+r-N/A

          \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(\mathsf{neg}\left(z\right)\right) \]
        7. associate-+l-N/A

          \[\leadsto \color{blue}{\left(y + x\right) - \left(\left(y + \frac{1}{2}\right) \cdot \log y - \left(\mathsf{neg}\left(z\right)\right)\right)} \]
        8. lower--.f64N/A

          \[\leadsto \color{blue}{\left(y + x\right) - \left(\left(y + \frac{1}{2}\right) \cdot \log y - \left(\mathsf{neg}\left(z\right)\right)\right)} \]
        9. lower-+.f64N/A

          \[\leadsto \color{blue}{\left(y + x\right)} - \left(\left(y + \frac{1}{2}\right) \cdot \log y - \left(\mathsf{neg}\left(z\right)\right)\right) \]
        10. add-flip-revN/A

          \[\leadsto \left(y + x\right) - \color{blue}{\left(\left(y + \frac{1}{2}\right) \cdot \log y + z\right)} \]
        11. lift-*.f64N/A

          \[\leadsto \left(y + x\right) - \left(\color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y} + z\right) \]
        12. *-commutativeN/A

          \[\leadsto \left(y + x\right) - \left(\color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)} + z\right) \]
        13. lower-fma.f6499.8%

          \[\leadsto \left(y + x\right) - \color{blue}{\mathsf{fma}\left(\log y, y + 0.5, z\right)} \]
        14. lift-+.f64N/A

          \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, \color{blue}{y + \frac{1}{2}}, z\right) \]
        15. add-flipN/A

          \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, \color{blue}{y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, z\right) \]
        16. lower--.f64N/A

          \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, \color{blue}{y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, z\right) \]
        17. metadata-eval99.8%

          \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, y - \color{blue}{-0.5}, z\right) \]
      3. Applied rewrites99.8%

        \[\leadsto \color{blue}{\left(y + x\right) - \mathsf{fma}\left(\log y, y - -0.5, z\right)} \]
      4. Taylor expanded in x around 0

        \[\leadsto \color{blue}{y} - \mathsf{fma}\left(\log y, y - -0.5, z\right) \]
      5. Step-by-step derivation
        1. Applied rewrites70.5%

          \[\leadsto \color{blue}{y} - \mathsf{fma}\left(\log y, y - -0.5, z\right) \]
      6. Recombined 2 regimes into one program.
      7. Add Preprocessing

      Alternative 5: 89.1% accurate, 1.0× speedup?

      \[\begin{array}{l} \mathbf{if}\;y \leq 5.2 \cdot 10^{+34}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, x - z\right)\\ \mathbf{else}:\\ \;\;\;\;y - \mathsf{fma}\left(\log y, y - -0.5, z\right)\\ \end{array} \]
      (FPCore (x y z)
        :precision binary64
        (if (<= y 5.2e+34)
        (fma -0.5 (log y) (- x z))
        (- y (fma (log y) (- y -0.5) z))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (y <= 5.2e+34) {
      		tmp = fma(-0.5, log(y), (x - z));
      	} else {
      		tmp = y - fma(log(y), (y - -0.5), z);
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	tmp = 0.0
      	if (y <= 5.2e+34)
      		tmp = fma(-0.5, log(y), Float64(x - z));
      	else
      		tmp = Float64(y - fma(log(y), Float64(y - -0.5), z));
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := If[LessEqual[y, 5.2e+34], N[(-0.5 * N[Log[y], $MachinePrecision] + N[(x - z), $MachinePrecision]), $MachinePrecision], N[(y - N[(N[Log[y], $MachinePrecision] * N[(y - -0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      \mathbf{if}\;y \leq 5.2 \cdot 10^{+34}:\\
      \;\;\;\;\mathsf{fma}\left(-0.5, \log y, x - z\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;y - \mathsf{fma}\left(\log y, y - -0.5, z\right)\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 5.1999999999999999e34

        1. Initial program 99.8%

          \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
        2. Step-by-step derivation
          1. lift--.f64N/A

            \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
          2. lift-+.f64N/A

            \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
          3. associate--l+N/A

            \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + \left(y - z\right)} \]
          4. lift--.f64N/A

            \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(y - z\right) \]
          5. lift-*.f64N/A

            \[\leadsto \left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) + \left(y - z\right) \]
          6. fp-cancel-sub-sign-invN/A

            \[\leadsto \color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} + \left(y - z\right) \]
          7. associate-+l+N/A

            \[\leadsto \color{blue}{x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right)} \]
          8. +-commutativeN/A

            \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right) + x} \]
          9. associate-+l+N/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(\left(y - z\right) + x\right)} \]
          10. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, \left(y - z\right) + x\right)} \]
          11. lift-+.f64N/A

            \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, \left(y - z\right) + x\right) \]
          12. add-flipN/A

            \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, \left(y - z\right) + x\right) \]
          13. sub-negateN/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
          14. lower--.f64N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
          15. metadata-evalN/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}} - y, \log y, \left(y - z\right) + x\right) \]
          16. sub-flipN/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} + x\right) \]
          17. +-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} + x\right) \]
          18. associate-+l+N/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) + \left(y + x\right)}\right) \]
          19. +-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(x + y\right)}\right) \]
          20. associate-+r+N/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + x\right) + y}\right) \]
          21. remove-double-negN/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + y\right) \]
          22. distribute-neg-inN/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(\left(z + \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)} + y\right) \]
          23. sub-flipN/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(\color{blue}{\left(z - x\right)}\right)\right) + y\right) \]
          24. sub-negate-revN/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(x - z\right)} + y\right) \]
          25. associate--r-N/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{x - \left(z - y\right)}\right) \]
        3. Applied rewrites99.9%

          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right)} \]
        4. Taylor expanded in y around 0

          \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
        5. Step-by-step derivation
          1. lower--.f6479.5%

            \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, x - \color{blue}{z}\right) \]
        6. Applied rewrites79.5%

          \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
        7. Taylor expanded in y around 0

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}}, \log y, x - z\right) \]
        8. Step-by-step derivation
          1. Applied rewrites71.0%

            \[\leadsto \mathsf{fma}\left(\color{blue}{-0.5}, \log y, x - z\right) \]

          if 5.1999999999999999e34 < y

          1. Initial program 99.8%

            \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
          2. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
            2. sub-flipN/A

              \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) + \left(\mathsf{neg}\left(z\right)\right)} \]
            3. lift-+.f64N/A

              \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} + \left(\mathsf{neg}\left(z\right)\right) \]
            4. +-commutativeN/A

              \[\leadsto \color{blue}{\left(y + \left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)\right)} + \left(\mathsf{neg}\left(z\right)\right) \]
            5. lift--.f64N/A

              \[\leadsto \left(y + \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)}\right) + \left(\mathsf{neg}\left(z\right)\right) \]
            6. associate-+r-N/A

              \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(\mathsf{neg}\left(z\right)\right) \]
            7. associate-+l-N/A

              \[\leadsto \color{blue}{\left(y + x\right) - \left(\left(y + \frac{1}{2}\right) \cdot \log y - \left(\mathsf{neg}\left(z\right)\right)\right)} \]
            8. lower--.f64N/A

              \[\leadsto \color{blue}{\left(y + x\right) - \left(\left(y + \frac{1}{2}\right) \cdot \log y - \left(\mathsf{neg}\left(z\right)\right)\right)} \]
            9. lower-+.f64N/A

              \[\leadsto \color{blue}{\left(y + x\right)} - \left(\left(y + \frac{1}{2}\right) \cdot \log y - \left(\mathsf{neg}\left(z\right)\right)\right) \]
            10. add-flip-revN/A

              \[\leadsto \left(y + x\right) - \color{blue}{\left(\left(y + \frac{1}{2}\right) \cdot \log y + z\right)} \]
            11. lift-*.f64N/A

              \[\leadsto \left(y + x\right) - \left(\color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y} + z\right) \]
            12. *-commutativeN/A

              \[\leadsto \left(y + x\right) - \left(\color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)} + z\right) \]
            13. lower-fma.f6499.8%

              \[\leadsto \left(y + x\right) - \color{blue}{\mathsf{fma}\left(\log y, y + 0.5, z\right)} \]
            14. lift-+.f64N/A

              \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, \color{blue}{y + \frac{1}{2}}, z\right) \]
            15. add-flipN/A

              \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, \color{blue}{y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, z\right) \]
            16. lower--.f64N/A

              \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, \color{blue}{y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, z\right) \]
            17. metadata-eval99.8%

              \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, y - \color{blue}{-0.5}, z\right) \]
          3. Applied rewrites99.8%

            \[\leadsto \color{blue}{\left(y + x\right) - \mathsf{fma}\left(\log y, y - -0.5, z\right)} \]
          4. Taylor expanded in x around 0

            \[\leadsto \color{blue}{y} - \mathsf{fma}\left(\log y, y - -0.5, z\right) \]
          5. Step-by-step derivation
            1. Applied rewrites70.5%

              \[\leadsto \color{blue}{y} - \mathsf{fma}\left(\log y, y - -0.5, z\right) \]
          6. Recombined 2 regimes into one program.
          7. Add Preprocessing

          Alternative 6: 84.5% accurate, 1.0× speedup?

          \[\begin{array}{l} \mathbf{if}\;y \leq 2.1 \cdot 10^{+124}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, x - z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right)\\ \end{array} \]
          (FPCore (x y z)
            :precision binary64
            (if (<= y 2.1e+124)
            (fma -0.5 (log y) (- x z))
            (* y (+ 1.0 (log (/ 1.0 y))))))
          double code(double x, double y, double z) {
          	double tmp;
          	if (y <= 2.1e+124) {
          		tmp = fma(-0.5, log(y), (x - z));
          	} else {
          		tmp = y * (1.0 + log((1.0 / y)));
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	tmp = 0.0
          	if (y <= 2.1e+124)
          		tmp = fma(-0.5, log(y), Float64(x - z));
          	else
          		tmp = Float64(y * Float64(1.0 + log(Float64(1.0 / y))));
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := If[LessEqual[y, 2.1e+124], N[(-0.5 * N[Log[y], $MachinePrecision] + N[(x - z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 + N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          \mathbf{if}\;y \leq 2.1 \cdot 10^{+124}:\\
          \;\;\;\;\mathsf{fma}\left(-0.5, \log y, x - z\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right)\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < 2.1000000000000001e124

            1. Initial program 99.8%

              \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
            2. Step-by-step derivation
              1. lift--.f64N/A

                \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
              2. lift-+.f64N/A

                \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
              3. associate--l+N/A

                \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + \left(y - z\right)} \]
              4. lift--.f64N/A

                \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(y - z\right) \]
              5. lift-*.f64N/A

                \[\leadsto \left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) + \left(y - z\right) \]
              6. fp-cancel-sub-sign-invN/A

                \[\leadsto \color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} + \left(y - z\right) \]
              7. associate-+l+N/A

                \[\leadsto \color{blue}{x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right)} \]
              8. +-commutativeN/A

                \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right) + x} \]
              9. associate-+l+N/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(\left(y - z\right) + x\right)} \]
              10. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, \left(y - z\right) + x\right)} \]
              11. lift-+.f64N/A

                \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, \left(y - z\right) + x\right) \]
              12. add-flipN/A

                \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, \left(y - z\right) + x\right) \]
              13. sub-negateN/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
              14. lower--.f64N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
              15. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}} - y, \log y, \left(y - z\right) + x\right) \]
              16. sub-flipN/A

                \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} + x\right) \]
              17. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} + x\right) \]
              18. associate-+l+N/A

                \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) + \left(y + x\right)}\right) \]
              19. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(x + y\right)}\right) \]
              20. associate-+r+N/A

                \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + x\right) + y}\right) \]
              21. remove-double-negN/A

                \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + y\right) \]
              22. distribute-neg-inN/A

                \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(\left(z + \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)} + y\right) \]
              23. sub-flipN/A

                \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(\color{blue}{\left(z - x\right)}\right)\right) + y\right) \]
              24. sub-negate-revN/A

                \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(x - z\right)} + y\right) \]
              25. associate--r-N/A

                \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{x - \left(z - y\right)}\right) \]
            3. Applied rewrites99.9%

              \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right)} \]
            4. Taylor expanded in y around 0

              \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
            5. Step-by-step derivation
              1. lower--.f6479.5%

                \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, x - \color{blue}{z}\right) \]
            6. Applied rewrites79.5%

              \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
            7. Taylor expanded in y around 0

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}}, \log y, x - z\right) \]
            8. Step-by-step derivation
              1. Applied rewrites71.0%

                \[\leadsto \mathsf{fma}\left(\color{blue}{-0.5}, \log y, x - z\right) \]

              if 2.1000000000000001e124 < y

              1. Initial program 99.8%

                \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
              2. Step-by-step derivation
                1. lift--.f64N/A

                  \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
                2. lift-+.f64N/A

                  \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
                3. associate--l+N/A

                  \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + \left(y - z\right)} \]
                4. lift--.f64N/A

                  \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(y - z\right) \]
                5. lift-*.f64N/A

                  \[\leadsto \left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) + \left(y - z\right) \]
                6. fp-cancel-sub-sign-invN/A

                  \[\leadsto \color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} + \left(y - z\right) \]
                7. associate-+l+N/A

                  \[\leadsto \color{blue}{x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right)} \]
                8. +-commutativeN/A

                  \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right) + x} \]
                9. associate-+l+N/A

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(\left(y - z\right) + x\right)} \]
                10. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, \left(y - z\right) + x\right)} \]
                11. lift-+.f64N/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, \left(y - z\right) + x\right) \]
                12. add-flipN/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, \left(y - z\right) + x\right) \]
                13. sub-negateN/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
                14. lower--.f64N/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
                15. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}} - y, \log y, \left(y - z\right) + x\right) \]
                16. sub-flipN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} + x\right) \]
                17. +-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} + x\right) \]
                18. associate-+l+N/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) + \left(y + x\right)}\right) \]
                19. +-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(x + y\right)}\right) \]
                20. associate-+r+N/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + x\right) + y}\right) \]
                21. remove-double-negN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + y\right) \]
                22. distribute-neg-inN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(\left(z + \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)} + y\right) \]
                23. sub-flipN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(\color{blue}{\left(z - x\right)}\right)\right) + y\right) \]
                24. sub-negate-revN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(x - z\right)} + y\right) \]
                25. associate--r-N/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{x - \left(z - y\right)}\right) \]
              3. Applied rewrites99.9%

                \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right)} \]
              4. Taylor expanded in y around 0

                \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
              5. Step-by-step derivation
                1. lower--.f6479.5%

                  \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, x - \color{blue}{z}\right) \]
              6. Applied rewrites79.5%

                \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
              7. Taylor expanded in y around inf

                \[\leadsto \color{blue}{y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right)} \]
              8. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto y \cdot \color{blue}{\left(1 + \log \left(\frac{1}{y}\right)\right)} \]
                2. lower-+.f64N/A

                  \[\leadsto y \cdot \left(1 + \color{blue}{\log \left(\frac{1}{y}\right)}\right) \]
                3. lower-log.f64N/A

                  \[\leadsto y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right) \]
                4. lower-/.f6430.2%

                  \[\leadsto y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right) \]
              9. Applied rewrites30.2%

                \[\leadsto \color{blue}{y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right)} \]
            9. Recombined 2 regimes into one program.
            10. Add Preprocessing

            Alternative 7: 84.5% accurate, 1.1× speedup?

            \[\begin{array}{l} \mathbf{if}\;y \leq 2.1 \cdot 10^{+124}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, x - z\right)\\ \mathbf{else}:\\ \;\;\;\;y - \log y \cdot \left(0.5 + y\right)\\ \end{array} \]
            (FPCore (x y z)
              :precision binary64
              (if (<= y 2.1e+124)
              (fma -0.5 (log y) (- x z))
              (- y (* (log y) (+ 0.5 y)))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (y <= 2.1e+124) {
            		tmp = fma(-0.5, log(y), (x - z));
            	} else {
            		tmp = y - (log(y) * (0.5 + y));
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (y <= 2.1e+124)
            		tmp = fma(-0.5, log(y), Float64(x - z));
            	else
            		tmp = Float64(y - Float64(log(y) * Float64(0.5 + y)));
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[y, 2.1e+124], N[(-0.5 * N[Log[y], $MachinePrecision] + N[(x - z), $MachinePrecision]), $MachinePrecision], N[(y - N[(N[Log[y], $MachinePrecision] * N[(0.5 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            \mathbf{if}\;y \leq 2.1 \cdot 10^{+124}:\\
            \;\;\;\;\mathsf{fma}\left(-0.5, \log y, x - z\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;y - \log y \cdot \left(0.5 + y\right)\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < 2.1000000000000001e124

              1. Initial program 99.8%

                \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
              2. Step-by-step derivation
                1. lift--.f64N/A

                  \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
                2. lift-+.f64N/A

                  \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
                3. associate--l+N/A

                  \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + \left(y - z\right)} \]
                4. lift--.f64N/A

                  \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(y - z\right) \]
                5. lift-*.f64N/A

                  \[\leadsto \left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) + \left(y - z\right) \]
                6. fp-cancel-sub-sign-invN/A

                  \[\leadsto \color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} + \left(y - z\right) \]
                7. associate-+l+N/A

                  \[\leadsto \color{blue}{x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right)} \]
                8. +-commutativeN/A

                  \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right) + x} \]
                9. associate-+l+N/A

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(\left(y - z\right) + x\right)} \]
                10. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, \left(y - z\right) + x\right)} \]
                11. lift-+.f64N/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, \left(y - z\right) + x\right) \]
                12. add-flipN/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, \left(y - z\right) + x\right) \]
                13. sub-negateN/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
                14. lower--.f64N/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
                15. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}} - y, \log y, \left(y - z\right) + x\right) \]
                16. sub-flipN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} + x\right) \]
                17. +-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} + x\right) \]
                18. associate-+l+N/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) + \left(y + x\right)}\right) \]
                19. +-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(x + y\right)}\right) \]
                20. associate-+r+N/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + x\right) + y}\right) \]
                21. remove-double-negN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + y\right) \]
                22. distribute-neg-inN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(\left(z + \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)} + y\right) \]
                23. sub-flipN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(\color{blue}{\left(z - x\right)}\right)\right) + y\right) \]
                24. sub-negate-revN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(x - z\right)} + y\right) \]
                25. associate--r-N/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{x - \left(z - y\right)}\right) \]
              3. Applied rewrites99.9%

                \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right)} \]
              4. Taylor expanded in y around 0

                \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
              5. Step-by-step derivation
                1. lower--.f6479.5%

                  \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, x - \color{blue}{z}\right) \]
              6. Applied rewrites79.5%

                \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
              7. Taylor expanded in y around 0

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}}, \log y, x - z\right) \]
              8. Step-by-step derivation
                1. Applied rewrites71.0%

                  \[\leadsto \mathsf{fma}\left(\color{blue}{-0.5}, \log y, x - z\right) \]

                if 2.1000000000000001e124 < y

                1. Initial program 99.8%

                  \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                2. Step-by-step derivation
                  1. lift--.f64N/A

                    \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
                  2. sub-flipN/A

                    \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) + \left(\mathsf{neg}\left(z\right)\right)} \]
                  3. lift-+.f64N/A

                    \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} + \left(\mathsf{neg}\left(z\right)\right) \]
                  4. +-commutativeN/A

                    \[\leadsto \color{blue}{\left(y + \left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)\right)} + \left(\mathsf{neg}\left(z\right)\right) \]
                  5. lift--.f64N/A

                    \[\leadsto \left(y + \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)}\right) + \left(\mathsf{neg}\left(z\right)\right) \]
                  6. associate-+r-N/A

                    \[\leadsto \color{blue}{\left(\left(y + x\right) - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(\mathsf{neg}\left(z\right)\right) \]
                  7. associate-+l-N/A

                    \[\leadsto \color{blue}{\left(y + x\right) - \left(\left(y + \frac{1}{2}\right) \cdot \log y - \left(\mathsf{neg}\left(z\right)\right)\right)} \]
                  8. lower--.f64N/A

                    \[\leadsto \color{blue}{\left(y + x\right) - \left(\left(y + \frac{1}{2}\right) \cdot \log y - \left(\mathsf{neg}\left(z\right)\right)\right)} \]
                  9. lower-+.f64N/A

                    \[\leadsto \color{blue}{\left(y + x\right)} - \left(\left(y + \frac{1}{2}\right) \cdot \log y - \left(\mathsf{neg}\left(z\right)\right)\right) \]
                  10. add-flip-revN/A

                    \[\leadsto \left(y + x\right) - \color{blue}{\left(\left(y + \frac{1}{2}\right) \cdot \log y + z\right)} \]
                  11. lift-*.f64N/A

                    \[\leadsto \left(y + x\right) - \left(\color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y} + z\right) \]
                  12. *-commutativeN/A

                    \[\leadsto \left(y + x\right) - \left(\color{blue}{\log y \cdot \left(y + \frac{1}{2}\right)} + z\right) \]
                  13. lower-fma.f6499.8%

                    \[\leadsto \left(y + x\right) - \color{blue}{\mathsf{fma}\left(\log y, y + 0.5, z\right)} \]
                  14. lift-+.f64N/A

                    \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, \color{blue}{y + \frac{1}{2}}, z\right) \]
                  15. add-flipN/A

                    \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, \color{blue}{y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, z\right) \]
                  16. lower--.f64N/A

                    \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, \color{blue}{y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, z\right) \]
                  17. metadata-eval99.8%

                    \[\leadsto \left(y + x\right) - \mathsf{fma}\left(\log y, y - \color{blue}{-0.5}, z\right) \]
                3. Applied rewrites99.8%

                  \[\leadsto \color{blue}{\left(y + x\right) - \mathsf{fma}\left(\log y, y - -0.5, z\right)} \]
                4. Taylor expanded in x around 0

                  \[\leadsto \color{blue}{y} - \mathsf{fma}\left(\log y, y - -0.5, z\right) \]
                5. Step-by-step derivation
                  1. Applied rewrites70.5%

                    \[\leadsto \color{blue}{y} - \mathsf{fma}\left(\log y, y - -0.5, z\right) \]
                  2. Taylor expanded in z around 0

                    \[\leadsto y - \color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)} \]
                  3. Step-by-step derivation
                    1. lower-*.f64N/A

                      \[\leadsto y - \log y \cdot \color{blue}{\left(\frac{1}{2} + y\right)} \]
                    2. lower-log.f64N/A

                      \[\leadsto y - \log y \cdot \left(\color{blue}{\frac{1}{2}} + y\right) \]
                    3. lower-+.f6443.2%

                      \[\leadsto y - \log y \cdot \left(0.5 + \color{blue}{y}\right) \]
                  4. Applied rewrites43.2%

                    \[\leadsto y - \color{blue}{\log y \cdot \left(0.5 + y\right)} \]
                6. Recombined 2 regimes into one program.
                7. Add Preprocessing

                Alternative 8: 71.0% accurate, 1.4× speedup?

                \[\mathsf{fma}\left(-0.5, \log y, x - z\right) \]
                (FPCore (x y z)
                  :precision binary64
                  (fma -0.5 (log y) (- x z)))
                double code(double x, double y, double z) {
                	return fma(-0.5, log(y), (x - z));
                }
                
                function code(x, y, z)
                	return fma(-0.5, log(y), Float64(x - z))
                end
                
                code[x_, y_, z_] := N[(-0.5 * N[Log[y], $MachinePrecision] + N[(x - z), $MachinePrecision]), $MachinePrecision]
                
                \mathsf{fma}\left(-0.5, \log y, x - z\right)
                
                Derivation
                1. Initial program 99.8%

                  \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                2. Step-by-step derivation
                  1. lift--.f64N/A

                    \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z} \]
                  2. lift-+.f64N/A

                    \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
                  3. associate--l+N/A

                    \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + \left(y - z\right)} \]
                  4. lift--.f64N/A

                    \[\leadsto \color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + \left(y - z\right) \]
                  5. lift-*.f64N/A

                    \[\leadsto \left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) + \left(y - z\right) \]
                  6. fp-cancel-sub-sign-invN/A

                    \[\leadsto \color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} + \left(y - z\right) \]
                  7. associate-+l+N/A

                    \[\leadsto \color{blue}{x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right)} \]
                  8. +-commutativeN/A

                    \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(y - z\right)\right) + x} \]
                  9. associate-+l+N/A

                    \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + \left(\left(y - z\right) + x\right)} \]
                  10. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, \left(y - z\right) + x\right)} \]
                  11. lift-+.f64N/A

                    \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, \left(y - z\right) + x\right) \]
                  12. add-flipN/A

                    \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, \left(y - z\right) + x\right) \]
                  13. sub-negateN/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
                  14. lower--.f64N/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, \left(y - z\right) + x\right) \]
                  15. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}} - y, \log y, \left(y - z\right) + x\right) \]
                  16. sub-flipN/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} + x\right) \]
                  17. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} + x\right) \]
                  18. associate-+l+N/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) + \left(y + x\right)}\right) \]
                  19. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(x + y\right)}\right) \]
                  20. associate-+r+N/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + x\right) + y}\right) \]
                  21. remove-double-negN/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\left(\mathsf{neg}\left(z\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + y\right) \]
                  22. distribute-neg-inN/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(\mathsf{neg}\left(\left(z + \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)} + y\right) \]
                  23. sub-flipN/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \left(\mathsf{neg}\left(\color{blue}{\left(z - x\right)}\right)\right) + y\right) \]
                  24. sub-negate-revN/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{\left(x - z\right)} + y\right) \]
                  25. associate--r-N/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{x - \left(z - y\right)}\right) \]
                3. Applied rewrites99.9%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, \left(y + x\right) - z\right)} \]
                4. Taylor expanded in y around 0

                  \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
                5. Step-by-step derivation
                  1. lower--.f6479.5%

                    \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, x - \color{blue}{z}\right) \]
                6. Applied rewrites79.5%

                  \[\leadsto \mathsf{fma}\left(-0.5 - y, \log y, \color{blue}{x - z}\right) \]
                7. Taylor expanded in y around 0

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}}, \log y, x - z\right) \]
                8. Step-by-step derivation
                  1. Applied rewrites71.0%

                    \[\leadsto \mathsf{fma}\left(\color{blue}{-0.5}, \log y, x - z\right) \]
                  2. Add Preprocessing

                  Alternative 9: 57.3% accurate, 3.1× speedup?

                  \[1 \cdot x - z \]
                  (FPCore (x y z)
                    :precision binary64
                    (- (* 1.0 x) z))
                  double code(double x, double y, double z) {
                  	return (1.0 * x) - z;
                  }
                  
                  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(8) function code(x, y, z)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      code = (1.0d0 * x) - z
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	return (1.0 * x) - z;
                  }
                  
                  def code(x, y, z):
                  	return (1.0 * x) - z
                  
                  function code(x, y, z)
                  	return Float64(Float64(1.0 * x) - z)
                  end
                  
                  function tmp = code(x, y, z)
                  	tmp = (1.0 * x) - z;
                  end
                  
                  code[x_, y_, z_] := N[(N[(1.0 * x), $MachinePrecision] - z), $MachinePrecision]
                  
                  1 \cdot x - z
                  
                  Derivation
                  1. Initial program 99.8%

                    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                  2. Step-by-step derivation
                    1. lift-+.f64N/A

                      \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
                    2. add-flipN/A

                      \[\leadsto \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) - \left(\mathsf{neg}\left(y\right)\right)\right)} - z \]
                    3. lift--.f64N/A

                      \[\leadsto \left(\color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} - \left(\mathsf{neg}\left(y\right)\right)\right) - z \]
                    4. lift-*.f64N/A

                      \[\leadsto \left(\left(x - \color{blue}{\left(y + \frac{1}{2}\right) \cdot \log y}\right) - \left(\mathsf{neg}\left(y\right)\right)\right) - z \]
                    5. fp-cancel-sub-sign-invN/A

                      \[\leadsto \left(\color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y\right)} - \left(\mathsf{neg}\left(y\right)\right)\right) - z \]
                    6. associate--l+N/A

                      \[\leadsto \color{blue}{\left(x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y - \left(\mathsf{neg}\left(y\right)\right)\right)\right)} - z \]
                    7. sum-to-multN/A

                      \[\leadsto \color{blue}{\left(1 + \frac{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y - \left(\mathsf{neg}\left(y\right)\right)}{x}\right) \cdot x} - z \]
                    8. lower-unsound-*.f64N/A

                      \[\leadsto \color{blue}{\left(1 + \frac{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y - \left(\mathsf{neg}\left(y\right)\right)}{x}\right) \cdot x} - z \]
                    9. lower-unsound-+.f64N/A

                      \[\leadsto \color{blue}{\left(1 + \frac{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y - \left(\mathsf{neg}\left(y\right)\right)}{x}\right)} \cdot x - z \]
                    10. lower-unsound-/.f64N/A

                      \[\leadsto \left(1 + \color{blue}{\frac{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y - \left(\mathsf{neg}\left(y\right)\right)}{x}}\right) \cdot x - z \]
                    11. add-flip-revN/A

                      \[\leadsto \left(1 + \frac{\color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right)\right) \cdot \log y + y}}{x}\right) \cdot x - z \]
                    12. lower-fma.f64N/A

                      \[\leadsto \left(1 + \frac{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), \log y, y\right)}}{x}\right) \cdot x - z \]
                    13. lift-+.f64N/A

                      \[\leadsto \left(1 + \frac{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y + \frac{1}{2}\right)}\right), \log y, y\right)}{x}\right) \cdot x - z \]
                    14. add-flipN/A

                      \[\leadsto \left(1 + \frac{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}\right), \log y, y\right)}{x}\right) \cdot x - z \]
                    15. sub-negateN/A

                      \[\leadsto \left(1 + \frac{\mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, y\right)}{x}\right) \cdot x - z \]
                    16. lower--.f64N/A

                      \[\leadsto \left(1 + \frac{\mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, \log y, y\right)}{x}\right) \cdot x - z \]
                    17. metadata-eval88.1%

                      \[\leadsto \left(1 + \frac{\mathsf{fma}\left(\color{blue}{-0.5} - y, \log y, y\right)}{x}\right) \cdot x - z \]
                  3. Applied rewrites88.1%

                    \[\leadsto \color{blue}{\left(1 + \frac{\mathsf{fma}\left(-0.5 - y, \log y, y\right)}{x}\right) \cdot x} - z \]
                  4. Taylor expanded in x around inf

                    \[\leadsto \color{blue}{1} \cdot x - z \]
                  5. Step-by-step derivation
                    1. Applied rewrites57.3%

                      \[\leadsto \color{blue}{1} \cdot x - z \]
                    2. Add Preprocessing

                    Alternative 10: 29.1% accurate, 10.2× speedup?

                    \[-z \]
                    (FPCore (x y z)
                      :precision binary64
                      (- z))
                    double code(double x, double y, double z) {
                    	return -z;
                    }
                    
                    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(8) function code(x, y, z)
                    use fmin_fmax_functions
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        code = -z
                    end function
                    
                    public static double code(double x, double y, double z) {
                    	return -z;
                    }
                    
                    def code(x, y, z):
                    	return -z
                    
                    function code(x, y, z)
                    	return Float64(-z)
                    end
                    
                    function tmp = code(x, y, z)
                    	tmp = -z;
                    end
                    
                    code[x_, y_, z_] := (-z)
                    
                    -z
                    
                    Derivation
                    1. Initial program 99.8%

                      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                    2. Taylor expanded in z around inf

                      \[\leadsto \color{blue}{-1 \cdot z} \]
                    3. Step-by-step derivation
                      1. lower-*.f6429.1%

                        \[\leadsto -1 \cdot \color{blue}{z} \]
                    4. Applied rewrites29.1%

                      \[\leadsto \color{blue}{-1 \cdot z} \]
                    5. Step-by-step derivation
                      1. lift-*.f64N/A

                        \[\leadsto -1 \cdot \color{blue}{z} \]
                      2. mul-1-negN/A

                        \[\leadsto \mathsf{neg}\left(z\right) \]
                      3. lower-neg.f6429.1%

                        \[\leadsto -z \]
                    6. Applied rewrites29.1%

                      \[\leadsto -z \]
                    7. Add Preprocessing

                    Reproduce

                    ?
                    herbie shell --seed 2025212 
                    (FPCore (x y z)
                      :name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
                      :precision binary64
                      (- (+ (- x (* (+ y 0.5) (log y))) y) z))