Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B

Percentage Accurate: 94.2% → 99.3%
Time: 5.1s
Alternatives: 12
Speedup: 0.9×

Specification

?
\[\begin{array}{l} \\ \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+
  (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
  (/
   (+
    (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
    0.083333333333333)
   x)))
double code(double x, double y, double z) {
	return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
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 - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
	return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
def code(x, y, z):
	return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
function code(x, y, z)
	return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x))
end
function tmp = code(x, y, z)
	tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 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: 94.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+
  (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
  (/
   (+
    (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
    0.083333333333333)
   x)))
double code(double x, double y, double z) {
	return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
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 - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
	return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
def code(x, y, z):
	return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
function code(x, y, z)
	return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x))
end
function tmp = code(x, y, z)
	tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
\end{array}

Alternative 1: 99.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.3 \cdot 10^{-47}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \mathsf{fma}\left(z, \frac{y - -0.0007936500793651}{x} \cdot z, \frac{0.083333333333333}{x}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.2999999999999998e-47

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(y + \frac{7936500793651}{10000000000000000}\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{\color{blue}{x}} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      7. sub-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      8. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      9. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \frac{-13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\frac{7936500793651}{10000000000000000} + y, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y + \frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      12. add-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \left(\mathsf{neg}\left(\frac{7936500793651}{10000000000000000}\right)\right), z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      13. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \frac{-7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      14. lower--.f6463.2

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x} \]
    4. Applied rewrites63.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}} \]

    if 4.2999999999999998e-47 < x

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}} \]
      2. lift-+.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\color{blue}{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}}{x} \]
      3. lift-*.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\color{blue}{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z} + \frac{83333333333333}{1000000000000000}}{x} \]
      4. lift--.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\color{blue}{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right)} \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      5. lift-*.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(\color{blue}{\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z} - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      6. lift-+.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(\color{blue}{\left(y + \frac{7936500793651}{10000000000000000}\right)} \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      7. div-addN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\left(\frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right)} \]
      8. *-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\frac{\color{blue}{z \cdot \left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right)}}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\frac{z \cdot \left(\color{blue}{z \cdot \left(y + \frac{7936500793651}{10000000000000000}\right)} - \frac{13888888888889}{5000000000000000}\right)}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      10. +-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\frac{z \cdot \left(z \cdot \color{blue}{\left(\frac{7936500793651}{10000000000000000} + y\right)} - \frac{13888888888889}{5000000000000000}\right)}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      11. associate-/l*N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\color{blue}{z \cdot \frac{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}}{x}} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      12. mult-flip-revN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(z \cdot \frac{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}}{x} + \color{blue}{\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}}\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\mathsf{fma}\left(z, \frac{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}}{x}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right)} \]
    3. Applied rewrites97.6%

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

      \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \color{blue}{\frac{y \cdot z}{x}}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
    5. Step-by-step derivation
      1. associate-/l*N/A

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

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, y \cdot \color{blue}{\frac{z}{x}}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      3. lower-/.f6484.3

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

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

      \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \color{blue}{\frac{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right)}{x}}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
    8. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, z \cdot \color{blue}{\frac{\frac{7936500793651}{10000000000000000} + y}{x}}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      2. div-addN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, z \cdot \left(\frac{\frac{7936500793651}{10000000000000000}}{x} + \color{blue}{\frac{y}{x}}\right), \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      3. mult-flip-revN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{\color{blue}{y}}{x}\right), \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) \cdot \color{blue}{z}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) \cdot \color{blue}{z}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      6. mult-flip-revN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \left(\frac{\frac{7936500793651}{10000000000000000}}{x} + \frac{y}{x}\right) \cdot z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      7. div-addN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \frac{\frac{7936500793651}{10000000000000000} + y}{x} \cdot z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      8. lower-/.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \frac{\frac{7936500793651}{10000000000000000} + y}{x} \cdot z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      9. +-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \frac{y + \frac{7936500793651}{10000000000000000}}{x} \cdot z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      10. add-flipN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \frac{y - \left(\mathsf{neg}\left(\frac{7936500793651}{10000000000000000}\right)\right)}{x} \cdot z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      11. metadata-evalN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \frac{y - \frac{-7936500793651}{10000000000000000}}{x} \cdot z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      12. lift--.f6493.9

        \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \mathsf{fma}\left(z, \frac{y - -0.0007936500793651}{x} \cdot z, \frac{0.083333333333333}{x}\right) \]
    9. Applied rewrites93.9%

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \mathsf{fma}\left(z, \color{blue}{\frac{y - -0.0007936500793651}{x} \cdot z}, \frac{0.083333333333333}{x}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 94.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.65 \cdot 10^{-10}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \mathsf{fma}\left(z, y \cdot \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 3.6499999999999998e-10

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(y + \frac{7936500793651}{10000000000000000}\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{\color{blue}{x}} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      7. sub-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      8. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      9. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \frac{-13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\frac{7936500793651}{10000000000000000} + y, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y + \frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      12. add-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \left(\mathsf{neg}\left(\frac{7936500793651}{10000000000000000}\right)\right), z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      13. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \frac{-7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      14. lower--.f6463.2

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x} \]
    4. Applied rewrites63.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}} \]

    if 3.6499999999999998e-10 < x

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}} \]
      2. lift-+.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\color{blue}{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}}{x} \]
      3. lift-*.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\color{blue}{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z} + \frac{83333333333333}{1000000000000000}}{x} \]
      4. lift--.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\color{blue}{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right)} \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      5. lift-*.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(\color{blue}{\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z} - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      6. lift-+.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(\color{blue}{\left(y + \frac{7936500793651}{10000000000000000}\right)} \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      7. div-addN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\left(\frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right)} \]
      8. *-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\frac{\color{blue}{z \cdot \left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right)}}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\frac{z \cdot \left(\color{blue}{z \cdot \left(y + \frac{7936500793651}{10000000000000000}\right)} - \frac{13888888888889}{5000000000000000}\right)}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      10. +-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\frac{z \cdot \left(z \cdot \color{blue}{\left(\frac{7936500793651}{10000000000000000} + y\right)} - \frac{13888888888889}{5000000000000000}\right)}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      11. associate-/l*N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\color{blue}{z \cdot \frac{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}}{x}} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      12. mult-flip-revN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(z \cdot \frac{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}}{x} + \color{blue}{\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}}\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\mathsf{fma}\left(z, \frac{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}}{x}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right)} \]
    3. Applied rewrites97.6%

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

      \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \color{blue}{\frac{y \cdot z}{x}}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
    5. Step-by-step derivation
      1. associate-/l*N/A

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

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, y \cdot \color{blue}{\frac{z}{x}}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      3. lower-/.f6484.3

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

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \mathsf{fma}\left(z, \color{blue}{y \cdot \frac{z}{x}}, \frac{0.083333333333333}{x}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 93.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.5 \cdot 10^{-17}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\ \mathbf{elif}\;x \leq 9.2 \cdot 10^{+145}:\\ \;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(z \cdot z\right) \cdot \left(y - -0.0007936500793651\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(z, \frac{0.0007936500793651 \cdot z}{x}, \mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right)\right) + 0.91893853320467\right) - x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 4.5e-17)
   (/
    (fma
     (fma (- y -0.0007936500793651) z -0.0027777777777778)
     z
     0.083333333333333)
    x)
   (if (<= x 9.2e+145)
     (+
      (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
      (/ (* (* z z) (- y -0.0007936500793651)) x))
     (-
      (+
       (fma
        z
        (/ (* 0.0007936500793651 z) x)
        (fma (log x) (- x 0.5) (/ 0.083333333333333 x)))
       0.91893853320467)
      x))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 4.5e-17) {
		tmp = fma(fma((y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x;
	} else if (x <= 9.2e+145) {
		tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (((z * z) * (y - -0.0007936500793651)) / x);
	} else {
		tmp = (fma(z, ((0.0007936500793651 * z) / x), fma(log(x), (x - 0.5), (0.083333333333333 / x))) + 0.91893853320467) - x;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (x <= 4.5e-17)
		tmp = Float64(fma(fma(Float64(y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x);
	elseif (x <= 9.2e+145)
		tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(z * z) * Float64(y - -0.0007936500793651)) / x));
	else
		tmp = Float64(Float64(fma(z, Float64(Float64(0.0007936500793651 * z) / x), fma(log(x), Float64(x - 0.5), Float64(0.083333333333333 / x))) + 0.91893853320467) - x);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[x, 4.5e-17], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 9.2e+145], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(z * z), $MachinePrecision] * N[(y - -0.0007936500793651), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * N[(N[(0.0007936500793651 * z), $MachinePrecision] / x), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 0.91893853320467), $MachinePrecision] - x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\

\mathbf{elif}\;x \leq 9.2 \cdot 10^{+145}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(z \cdot z\right) \cdot \left(y - -0.0007936500793651\right)}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(z, \frac{0.0007936500793651 \cdot z}{x}, \mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right)\right) + 0.91893853320467\right) - x\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 4.49999999999999978e-17

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(y + \frac{7936500793651}{10000000000000000}\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{\color{blue}{x}} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      7. sub-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      8. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      9. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \frac{-13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\frac{7936500793651}{10000000000000000} + y, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y + \frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      12. add-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \left(\mathsf{neg}\left(\frac{7936500793651}{10000000000000000}\right)\right), z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      13. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \frac{-7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      14. lower--.f6463.2

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x} \]
    4. Applied rewrites63.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}} \]

    if 4.49999999999999978e-17 < x < 9.2e145

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in z around inf

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

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{{z}^{2} \cdot \color{blue}{\left(\frac{7936500793651}{10000000000000000} + y\right)}}{x} \]
      2. unpow2N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(z \cdot z\right) \cdot \left(\color{blue}{\frac{7936500793651}{10000000000000000}} + y\right)}{x} \]
      3. lower-*.f64N/A

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

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

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(z \cdot z\right) \cdot \left(y - \color{blue}{\left(\mathsf{neg}\left(\frac{7936500793651}{10000000000000000}\right)\right)}\right)}{x} \]
      6. metadata-evalN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(z \cdot z\right) \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right)}{x} \]
      7. lower--.f6472.9

        \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(z \cdot z\right) \cdot \left(y - \color{blue}{-0.0007936500793651}\right)}{x} \]
    4. Applied rewrites72.9%

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\color{blue}{\left(z \cdot z\right) \cdot \left(y - -0.0007936500793651\right)}}{x} \]

    if 9.2e145 < x

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \left(z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}\right) + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right)\right) - x} \]
    3. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \left(z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}\right) + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right)\right) - \color{blue}{x} \]
    4. Applied rewrites94.4%

      \[\leadsto \color{blue}{\left(\left(\mathsf{fma}\left(\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot z - \frac{0.0027777777777778}{x}, z, \frac{0.083333333333333}{x}\right) + \log x \cdot \left(x - 0.5\right)\right) + 0.91893853320467\right) - x} \]
    5. Taylor expanded in y around 0

      \[\leadsto \left(\left(z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{z}{x} - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}\right) + \left(\log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right)\right) + \frac{91893853320467}{100000000000000}\right) - x \]
    6. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{7936500793651}{10000000000000000} \cdot \frac{z}{x} - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}, \log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      2. associate-*r/N/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\frac{7936500793651}{10000000000000000} \cdot z}{x} - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}, \log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      3. mult-flip-revN/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\frac{7936500793651}{10000000000000000} \cdot z}{x} - \frac{\frac{13888888888889}{5000000000000000}}{x}, \log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      4. div-subN/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\frac{7936500793651}{10000000000000000} \cdot z - \frac{13888888888889}{5000000000000000}}{x}, \log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      5. lower-/.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\frac{7936500793651}{10000000000000000} \cdot z - \frac{13888888888889}{5000000000000000}}{x}, \log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      6. sub-flipN/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\frac{7936500793651}{10000000000000000} \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right)}{x}, \log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      7. metadata-evalN/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\frac{7936500793651}{10000000000000000} \cdot z + \frac{-13888888888889}{5000000000000000}}{x}, \log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      8. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(\frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right)}{x}, \log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      9. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(\frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right)}{x}, \mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right)\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      10. lift-log.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(\frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right)}{x}, \mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right)\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      11. lift--.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(\frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right)}{x}, \mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right)\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      12. mult-flip-revN/A

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(\frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right)}{x}, \mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right)\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      13. lift-/.f6481.0

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{x}, \mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right)\right) + 0.91893853320467\right) - x \]
    7. Applied rewrites81.0%

      \[\leadsto \left(\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{x}, \mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right)\right) + 0.91893853320467\right) - x \]
    8. Taylor expanded in z around inf

      \[\leadsto \left(\mathsf{fma}\left(z, \frac{\frac{7936500793651}{10000000000000000} \cdot z}{x}, \mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right)\right) + \frac{91893853320467}{100000000000000}\right) - x \]
    9. Step-by-step derivation
      1. lower-*.f6480.5

        \[\leadsto \left(\mathsf{fma}\left(z, \frac{0.0007936500793651 \cdot z}{x}, \mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right)\right) + 0.91893853320467\right) - x \]
    10. Applied rewrites80.5%

      \[\leadsto \left(\mathsf{fma}\left(z, \frac{0.0007936500793651 \cdot z}{x}, \mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right)\right) + 0.91893853320467\right) - x \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 92.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.5 \cdot 10^{-17}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\ \mathbf{elif}\;x \leq 9.2 \cdot 10^{+145}:\\ \;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(z \cdot z\right) \cdot \left(y - -0.0007936500793651\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\log x - 1\right) \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 4.5e-17)
   (/
    (fma
     (fma (- y -0.0007936500793651) z -0.0027777777777778)
     z
     0.083333333333333)
    x)
   (if (<= x 9.2e+145)
     (+
      (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
      (/ (* (* z z) (- y -0.0007936500793651)) x))
     (* (- (log x) 1.0) x))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 4.5e-17) {
		tmp = fma(fma((y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x;
	} else if (x <= 9.2e+145) {
		tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (((z * z) * (y - -0.0007936500793651)) / x);
	} else {
		tmp = (log(x) - 1.0) * x;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (x <= 4.5e-17)
		tmp = Float64(fma(fma(Float64(y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x);
	elseif (x <= 9.2e+145)
		tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(z * z) * Float64(y - -0.0007936500793651)) / x));
	else
		tmp = Float64(Float64(log(x) - 1.0) * x);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[x, 4.5e-17], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 9.2e+145], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(z * z), $MachinePrecision] * N[(y - -0.0007936500793651), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\

\mathbf{elif}\;x \leq 9.2 \cdot 10^{+145}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(z \cdot z\right) \cdot \left(y - -0.0007936500793651\right)}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 4.49999999999999978e-17

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(y + \frac{7936500793651}{10000000000000000}\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{\color{blue}{x}} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      7. sub-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      8. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      9. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \frac{-13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\frac{7936500793651}{10000000000000000} + y, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y + \frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      12. add-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \left(\mathsf{neg}\left(\frac{7936500793651}{10000000000000000}\right)\right), z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      13. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \frac{-7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      14. lower--.f6463.2

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x} \]
    4. Applied rewrites63.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}} \]

    if 4.49999999999999978e-17 < x < 9.2e145

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in z around inf

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

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{{z}^{2} \cdot \color{blue}{\left(\frac{7936500793651}{10000000000000000} + y\right)}}{x} \]
      2. unpow2N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(z \cdot z\right) \cdot \left(\color{blue}{\frac{7936500793651}{10000000000000000}} + y\right)}{x} \]
      3. lower-*.f64N/A

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

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

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(z \cdot z\right) \cdot \left(y - \color{blue}{\left(\mathsf{neg}\left(\frac{7936500793651}{10000000000000000}\right)\right)}\right)}{x} \]
      6. metadata-evalN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(z \cdot z\right) \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right)}{x} \]
      7. lower--.f6472.9

        \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(z \cdot z\right) \cdot \left(y - \color{blue}{-0.0007936500793651}\right)}{x} \]
    4. Applied rewrites72.9%

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\color{blue}{\left(z \cdot z\right) \cdot \left(y - -0.0007936500793651\right)}}{x} \]

    if 9.2e145 < x

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around inf

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

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

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

        \[\leadsto \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x \]
      4. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\log \left(\frac{1}{x}\right)\right)\right) - 1\right) \cdot x \]
      5. lower-neg.f64N/A

        \[\leadsto \left(\left(-\log \left(\frac{1}{x}\right)\right) - 1\right) \cdot x \]
      6. log-recN/A

        \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\log x\right)\right)\right) - 1\right) \cdot x \]
      7. lower-neg.f64N/A

        \[\leadsto \left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x \]
      8. lift-log.f6435.0

        \[\leadsto \left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x \]
    4. Applied rewrites35.0%

      \[\leadsto \color{blue}{\left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x} \]
    5. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(-\log x\right)\right)\right) - 1\right) \cdot x \]
      2. lift-log.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(-\log x\right)\right)\right) - 1\right) \cdot x \]
      3. lift-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log x\right)\right)\right)\right) - 1\right) \cdot x \]
      4. remove-double-negN/A

        \[\leadsto \left(\log x - 1\right) \cdot x \]
      5. lift-log.f6435.0

        \[\leadsto \left(\log x - 1\right) \cdot x \]
    6. Applied rewrites35.0%

      \[\leadsto \left(\log x - 1\right) \cdot x \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 84.3% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 85:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right) - -0.91893853320467\right) - x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 85.0)
   (/
    (fma
     (fma (- y -0.0007936500793651) z -0.0027777777777778)
     z
     0.083333333333333)
    x)
   (-
    (- (fma (log x) (- x 0.5) (/ 0.083333333333333 x)) -0.91893853320467)
    x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 85.0) {
		tmp = fma(fma((y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x;
	} else {
		tmp = (fma(log(x), (x - 0.5), (0.083333333333333 / x)) - -0.91893853320467) - x;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (x <= 85.0)
		tmp = Float64(fma(fma(Float64(y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x);
	else
		tmp = Float64(Float64(fma(log(x), Float64(x - 0.5), Float64(0.083333333333333 / x)) - -0.91893853320467) - x);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[x, 85.0], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision] - -0.91893853320467), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 85:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right) - -0.91893853320467\right) - x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 85

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(y + \frac{7936500793651}{10000000000000000}\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{\color{blue}{x}} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      7. sub-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      8. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      9. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \frac{-13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\frac{7936500793651}{10000000000000000} + y, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y + \frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      12. add-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \left(\mathsf{neg}\left(\frac{7936500793651}{10000000000000000}\right)\right), z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      13. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \frac{-7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      14. lower--.f6463.2

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x} \]
    4. Applied rewrites63.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}} \]

    if 85 < x

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in z around 0

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

        \[\leadsto \left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right) - \color{blue}{x} \]
      2. +-commutativeN/A

        \[\leadsto \left(\left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      3. lower-+.f64N/A

        \[\leadsto \left(\left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      4. +-commutativeN/A

        \[\leadsto \left(\left(\log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      5. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      6. lift-log.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      7. lift--.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      8. mult-flip-revN/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      9. lower-/.f6457.5

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right) + 0.91893853320467\right) - x \]
    4. Applied rewrites57.5%

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right) + 0.91893853320467\right) - x} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      2. lift--.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      3. lift-/.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      4. lift-fma.f64N/A

        \[\leadsto \left(\left(\log x \cdot \left(x - \frac{1}{2}\right) + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      5. lift-log.f64N/A

        \[\leadsto \left(\left(\log x \cdot \left(x - \frac{1}{2}\right) + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) + \frac{91893853320467}{100000000000000}\right) - x \]
      6. add-flipN/A

        \[\leadsto \left(\left(\log x \cdot \left(x - \frac{1}{2}\right) + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) - \left(\mathsf{neg}\left(\frac{91893853320467}{100000000000000}\right)\right)\right) - x \]
      7. mult-flip-revN/A

        \[\leadsto \left(\left(\log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) - \left(\mathsf{neg}\left(\frac{91893853320467}{100000000000000}\right)\right)\right) - x \]
      8. lower--.f64N/A

        \[\leadsto \left(\left(\log x \cdot \left(x - \frac{1}{2}\right) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) - \left(\mathsf{neg}\left(\frac{91893853320467}{100000000000000}\right)\right)\right) - x \]
      9. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) - \left(\mathsf{neg}\left(\frac{91893853320467}{100000000000000}\right)\right)\right) - x \]
      10. lift-log.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) - \left(\mathsf{neg}\left(\frac{91893853320467}{100000000000000}\right)\right)\right) - x \]
      11. lift--.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) - \left(\mathsf{neg}\left(\frac{91893853320467}{100000000000000}\right)\right)\right) - x \]
      12. mult-flip-revN/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) - \left(\mathsf{neg}\left(\frac{91893853320467}{100000000000000}\right)\right)\right) - x \]
      13. lift-/.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - \frac{1}{2}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) - \left(\mathsf{neg}\left(\frac{91893853320467}{100000000000000}\right)\right)\right) - x \]
      14. metadata-eval57.5

        \[\leadsto \left(\mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right) - -0.91893853320467\right) - x \]
    6. Applied rewrites57.5%

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x}\right) - -0.91893853320467\right) - x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 84.0% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.25 \cdot 10^{+20}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.25e20

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(z \cdot \left(y + \frac{7936500793651}{10000000000000000}\right) - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{\color{blue}{x}} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      7. sub-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      8. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \left(\mathsf{neg}\left(\frac{13888888888889}{5000000000000000}\right)\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      9. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{7936500793651}{10000000000000000} + y\right) \cdot z + \frac{-13888888888889}{5000000000000000}, z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\frac{7936500793651}{10000000000000000} + y, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y + \frac{7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      12. add-flipN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \left(\mathsf{neg}\left(\frac{7936500793651}{10000000000000000}\right)\right), z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      13. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - \frac{-7936500793651}{10000000000000000}, z, \frac{-13888888888889}{5000000000000000}\right), z, \frac{83333333333333}{1000000000000000}\right)}{x} \]
      14. lower--.f6463.2

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x} \]
    4. Applied rewrites63.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}} \]

    if 1.25e20 < x

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around inf

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

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

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

        \[\leadsto \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x \]
      4. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\log \left(\frac{1}{x}\right)\right)\right) - 1\right) \cdot x \]
      5. lower-neg.f64N/A

        \[\leadsto \left(\left(-\log \left(\frac{1}{x}\right)\right) - 1\right) \cdot x \]
      6. log-recN/A

        \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\log x\right)\right)\right) - 1\right) \cdot x \]
      7. lower-neg.f64N/A

        \[\leadsto \left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x \]
      8. lift-log.f6435.0

        \[\leadsto \left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x \]
    4. Applied rewrites35.0%

      \[\leadsto \color{blue}{\left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x} \]
    5. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(-\log x\right)\right)\right) - 1\right) \cdot x \]
      2. lift-log.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(-\log x\right)\right)\right) - 1\right) \cdot x \]
      3. lift-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log x\right)\right)\right)\right) - 1\right) \cdot x \]
      4. remove-double-negN/A

        \[\leadsto \left(\log x - 1\right) \cdot x \]
      5. lift-log.f6435.0

        \[\leadsto \left(\log x - 1\right) \cdot x \]
    6. Applied rewrites35.0%

      \[\leadsto \left(\log x - 1\right) \cdot x \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 64.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.65 \cdot 10^{-18}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{+19}:\\ \;\;\;\;\frac{y - -0.0007936500793651}{x} \cdot \left(z \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\log x - 1\right) \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 1.65e-18)
   (/ (fma -0.0027777777777778 z 0.083333333333333) x)
   (if (<= x 7.4e+19)
     (* (/ (- y -0.0007936500793651) x) (* z z))
     (* (- (log x) 1.0) x))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 1.65e-18) {
		tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
	} else if (x <= 7.4e+19) {
		tmp = ((y - -0.0007936500793651) / x) * (z * z);
	} else {
		tmp = (log(x) - 1.0) * x;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (x <= 1.65e-18)
		tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x);
	elseif (x <= 7.4e+19)
		tmp = Float64(Float64(Float64(y - -0.0007936500793651) / x) * Float64(z * z));
	else
		tmp = Float64(Float64(log(x) - 1.0) * x);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[x, 1.65e-18], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 7.4e+19], N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.65 \cdot 10^{-18}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\

\mathbf{elif}\;x \leq 7.4 \cdot 10^{+19}:\\
\;\;\;\;\frac{y - -0.0007936500793651}{x} \cdot \left(z \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 1.6500000000000001e-18

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in z around -inf

      \[\leadsto \color{blue}{{z}^{2} \cdot \left(-1 \cdot \frac{-1 \cdot \frac{\left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right) - x}{z} + \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}}{z} + \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right)\right)} \]
    3. Applied rewrites59.6%

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

      \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{\color{blue}{x}} \]
    5. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{x} \]
    6. Applied rewrites50.6%

      \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(0.0007936500793651 + \left(\left(y + \frac{0.083333333333333}{z \cdot z}\right) - \frac{0.0027777777777778}{z}\right)\right)}{\color{blue}{x}} \]
    7. Taylor expanded in z around 0

      \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \frac{-13888888888889}{5000000000000000} \cdot z}{x} \]
    8. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\frac{-13888888888889}{5000000000000000} \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      2. lower-fma.f6429.8

        \[\leadsto \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \]
    9. Applied rewrites29.8%

      \[\leadsto \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \]

    if 1.6500000000000001e-18 < x < 7.4e19

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x}} \]
      2. lift-+.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\color{blue}{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}}{x} \]
      3. lift-*.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\color{blue}{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z} + \frac{83333333333333}{1000000000000000}}{x} \]
      4. lift--.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\color{blue}{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right)} \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      5. lift-*.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(\color{blue}{\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z} - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      6. lift-+.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \frac{\left(\color{blue}{\left(y + \frac{7936500793651}{10000000000000000}\right)} \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      7. div-addN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\left(\frac{\left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right) \cdot z}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right)} \]
      8. *-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\frac{\color{blue}{z \cdot \left(\left(y + \frac{7936500793651}{10000000000000000}\right) \cdot z - \frac{13888888888889}{5000000000000000}\right)}}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\frac{z \cdot \left(\color{blue}{z \cdot \left(y + \frac{7936500793651}{10000000000000000}\right)} - \frac{13888888888889}{5000000000000000}\right)}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      10. +-commutativeN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\frac{z \cdot \left(z \cdot \color{blue}{\left(\frac{7936500793651}{10000000000000000} + y\right)} - \frac{13888888888889}{5000000000000000}\right)}{x} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      11. associate-/l*N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(\color{blue}{z \cdot \frac{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}}{x}} + \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      12. mult-flip-revN/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \left(z \cdot \frac{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}}{x} + \color{blue}{\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}}\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\mathsf{fma}\left(z, \frac{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}}{x}, \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right)} \]
    3. Applied rewrites97.6%

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

      \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, \color{blue}{\frac{y \cdot z}{x}}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
    5. Step-by-step derivation
      1. associate-/l*N/A

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

        \[\leadsto \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \mathsf{fma}\left(z, y \cdot \color{blue}{\frac{z}{x}}, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      3. lower-/.f6484.3

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

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

      \[\leadsto \color{blue}{{z}^{2} \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right)} \]
    8. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto {z}^{2} \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) \]
      2. metadata-evalN/A

        \[\leadsto {z}^{2} \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) \]
      3. add-flipN/A

        \[\leadsto {z}^{2} \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) \]
      4. metadata-evalN/A

        \[\leadsto {z}^{2} \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) \]
      5. sub-flipN/A

        \[\leadsto {z}^{2} \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) \]
      6. *-commutativeN/A

        \[\leadsto {z}^{2} \cdot \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) \]
      7. div-addN/A

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

        \[\leadsto \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) \cdot \color{blue}{{z}^{2}} \]
      9. lower-*.f64N/A

        \[\leadsto \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right) \cdot \color{blue}{{z}^{2}} \]
    9. Applied rewrites41.8%

      \[\leadsto \color{blue}{\frac{y - -0.0007936500793651}{x} \cdot \left(z \cdot z\right)} \]

    if 7.4e19 < x

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around inf

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

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

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

        \[\leadsto \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x \]
      4. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\log \left(\frac{1}{x}\right)\right)\right) - 1\right) \cdot x \]
      5. lower-neg.f64N/A

        \[\leadsto \left(\left(-\log \left(\frac{1}{x}\right)\right) - 1\right) \cdot x \]
      6. log-recN/A

        \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\log x\right)\right)\right) - 1\right) \cdot x \]
      7. lower-neg.f64N/A

        \[\leadsto \left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x \]
      8. lift-log.f6435.0

        \[\leadsto \left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x \]
    4. Applied rewrites35.0%

      \[\leadsto \color{blue}{\left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x} \]
    5. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(-\log x\right)\right)\right) - 1\right) \cdot x \]
      2. lift-log.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(-\log x\right)\right)\right) - 1\right) \cdot x \]
      3. lift-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log x\right)\right)\right)\right) - 1\right) \cdot x \]
      4. remove-double-negN/A

        \[\leadsto \left(\log x - 1\right) \cdot x \]
      5. lift-log.f6435.0

        \[\leadsto \left(\log x - 1\right) \cdot x \]
    6. Applied rewrites35.0%

      \[\leadsto \left(\log x - 1\right) \cdot x \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 64.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.65 \cdot 10^{-18}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{+19}:\\ \;\;\;\;\frac{\left(z \cdot z\right) \cdot \left(y - -0.0007936500793651\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\log x - 1\right) \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 1.65e-18)
   (/ (fma -0.0027777777777778 z 0.083333333333333) x)
   (if (<= x 7.4e+19)
     (/ (* (* z z) (- y -0.0007936500793651)) x)
     (* (- (log x) 1.0) x))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 1.65e-18) {
		tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
	} else if (x <= 7.4e+19) {
		tmp = ((z * z) * (y - -0.0007936500793651)) / x;
	} else {
		tmp = (log(x) - 1.0) * x;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (x <= 1.65e-18)
		tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x);
	elseif (x <= 7.4e+19)
		tmp = Float64(Float64(Float64(z * z) * Float64(y - -0.0007936500793651)) / x);
	else
		tmp = Float64(Float64(log(x) - 1.0) * x);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[x, 1.65e-18], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 7.4e+19], N[(N[(N[(z * z), $MachinePrecision] * N[(y - -0.0007936500793651), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.65 \cdot 10^{-18}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\

\mathbf{elif}\;x \leq 7.4 \cdot 10^{+19}:\\
\;\;\;\;\frac{\left(z \cdot z\right) \cdot \left(y - -0.0007936500793651\right)}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 1.6500000000000001e-18

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in z around -inf

      \[\leadsto \color{blue}{{z}^{2} \cdot \left(-1 \cdot \frac{-1 \cdot \frac{\left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right) - x}{z} + \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}}{z} + \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right)\right)} \]
    3. Applied rewrites59.6%

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

      \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{\color{blue}{x}} \]
    5. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{x} \]
    6. Applied rewrites50.6%

      \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(0.0007936500793651 + \left(\left(y + \frac{0.083333333333333}{z \cdot z}\right) - \frac{0.0027777777777778}{z}\right)\right)}{\color{blue}{x}} \]
    7. Taylor expanded in z around 0

      \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \frac{-13888888888889}{5000000000000000} \cdot z}{x} \]
    8. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\frac{-13888888888889}{5000000000000000} \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      2. lower-fma.f6429.8

        \[\leadsto \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \]
    9. Applied rewrites29.8%

      \[\leadsto \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \]

    if 1.6500000000000001e-18 < x < 7.4e19

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in z around -inf

      \[\leadsto \color{blue}{{z}^{2} \cdot \left(-1 \cdot \frac{-1 \cdot \frac{\left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right) - x}{z} + \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}}{z} + \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right)\right)} \]
    3. Applied rewrites59.6%

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

      \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{\color{blue}{x}} \]
    5. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{x} \]
    6. Applied rewrites50.6%

      \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(0.0007936500793651 + \left(\left(y + \frac{0.083333333333333}{z \cdot z}\right) - \frac{0.0027777777777778}{z}\right)\right)}{\color{blue}{x}} \]
    7. Taylor expanded in z around inf

      \[\leadsto \frac{{z}^{2} \cdot \left(\frac{7936500793651}{10000000000000000} + y\right)}{x} \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{{z}^{2} \cdot \left(\frac{7936500793651}{10000000000000000} + y\right)}{x} \]
      2. pow2N/A

        \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(\frac{7936500793651}{10000000000000000} + y\right)}{x} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(\frac{7936500793651}{10000000000000000} + y\right)}{x} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(y + \frac{7936500793651}{10000000000000000}\right)}{x} \]
      5. add-flipN/A

        \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(y - \left(\mathsf{neg}\left(\frac{7936500793651}{10000000000000000}\right)\right)\right)}{x} \]
      6. metadata-evalN/A

        \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right)}{x} \]
      7. lift--.f6441.8

        \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(y - -0.0007936500793651\right)}{x} \]
    9. Applied rewrites41.8%

      \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(y - -0.0007936500793651\right)}{x} \]

    if 7.4e19 < x

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around inf

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

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

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

        \[\leadsto \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x \]
      4. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\log \left(\frac{1}{x}\right)\right)\right) - 1\right) \cdot x \]
      5. lower-neg.f64N/A

        \[\leadsto \left(\left(-\log \left(\frac{1}{x}\right)\right) - 1\right) \cdot x \]
      6. log-recN/A

        \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\log x\right)\right)\right) - 1\right) \cdot x \]
      7. lower-neg.f64N/A

        \[\leadsto \left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x \]
      8. lift-log.f6435.0

        \[\leadsto \left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x \]
    4. Applied rewrites35.0%

      \[\leadsto \color{blue}{\left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x} \]
    5. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(-\log x\right)\right)\right) - 1\right) \cdot x \]
      2. lift-log.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(-\log x\right)\right)\right) - 1\right) \cdot x \]
      3. lift-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log x\right)\right)\right)\right) - 1\right) \cdot x \]
      4. remove-double-negN/A

        \[\leadsto \left(\log x - 1\right) \cdot x \]
      5. lift-log.f6435.0

        \[\leadsto \left(\log x - 1\right) \cdot x \]
    6. Applied rewrites35.0%

      \[\leadsto \left(\log x - 1\right) \cdot x \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 9: 62.3% accurate, 2.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.5e-10

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in z around -inf

      \[\leadsto \color{blue}{{z}^{2} \cdot \left(-1 \cdot \frac{-1 \cdot \frac{\left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right) - x}{z} + \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}}{z} + \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right)\right)} \]
    3. Applied rewrites59.6%

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

      \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{\color{blue}{x}} \]
    5. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{x} \]
    6. Applied rewrites50.6%

      \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(0.0007936500793651 + \left(\left(y + \frac{0.083333333333333}{z \cdot z}\right) - \frac{0.0027777777777778}{z}\right)\right)}{\color{blue}{x}} \]
    7. Taylor expanded in z around 0

      \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \frac{-13888888888889}{5000000000000000} \cdot z}{x} \]
    8. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\frac{-13888888888889}{5000000000000000} \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      2. lower-fma.f6429.8

        \[\leadsto \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \]
    9. Applied rewrites29.8%

      \[\leadsto \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \]

    if 1.5e-10 < x

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in x around inf

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

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

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

        \[\leadsto \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x \]
      4. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\log \left(\frac{1}{x}\right)\right)\right) - 1\right) \cdot x \]
      5. lower-neg.f64N/A

        \[\leadsto \left(\left(-\log \left(\frac{1}{x}\right)\right) - 1\right) \cdot x \]
      6. log-recN/A

        \[\leadsto \left(\left(-\left(\mathsf{neg}\left(\log x\right)\right)\right) - 1\right) \cdot x \]
      7. lower-neg.f64N/A

        \[\leadsto \left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x \]
      8. lift-log.f6435.0

        \[\leadsto \left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x \]
    4. Applied rewrites35.0%

      \[\leadsto \color{blue}{\left(\left(-\left(-\log x\right)\right) - 1\right) \cdot x} \]
    5. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(-\log x\right)\right)\right) - 1\right) \cdot x \]
      2. lift-log.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(-\log x\right)\right)\right) - 1\right) \cdot x \]
      3. lift-neg.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log x\right)\right)\right)\right) - 1\right) \cdot x \]
      4. remove-double-negN/A

        \[\leadsto \left(\log x - 1\right) \cdot x \]
      5. lift-log.f6435.0

        \[\leadsto \left(\log x - 1\right) \cdot x \]
    6. Applied rewrites35.0%

      \[\leadsto \left(\log x - 1\right) \cdot x \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 52.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z\\ t_1 := y \cdot \left(z \cdot \frac{z}{x}\right)\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+49}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 0.01:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z))
        (t_1 (* y (* z (/ z x)))))
   (if (<= t_0 -4e+49)
     t_1
     (if (<= t_0 0.01)
       (/ (fma -0.0027777777777778 z 0.083333333333333) x)
       t_1))))
double code(double x, double y, double z) {
	double t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z;
	double t_1 = y * (z * (z / x));
	double tmp;
	if (t_0 <= -4e+49) {
		tmp = t_1;
	} else if (t_0 <= 0.01) {
		tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z)
	t_1 = Float64(y * Float64(z * Float64(z / x)))
	tmp = 0.0
	if (t_0 <= -4e+49)
		tmp = t_1;
	elseif (t_0 <= 0.01)
		tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+49], t$95$1, If[LessEqual[t$95$0, 0.01], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z\\
t_1 := y \cdot \left(z \cdot \frac{z}{x}\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 0.01:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -3.99999999999999979e49 or 0.0100000000000000002 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z)

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in y around inf

      \[\leadsto \color{blue}{\frac{y \cdot {z}^{2}}{x}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{y \cdot {z}^{2}}{\color{blue}{x}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{{z}^{2} \cdot y}{x} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{{z}^{2} \cdot y}{x} \]
      4. unpow2N/A

        \[\leadsto \frac{\left(z \cdot z\right) \cdot y}{x} \]
      5. lower-*.f6429.9

        \[\leadsto \frac{\left(z \cdot z\right) \cdot y}{x} \]
    4. Applied rewrites29.9%

      \[\leadsto \color{blue}{\frac{\left(z \cdot z\right) \cdot y}{x}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \frac{\left(z \cdot z\right) \cdot y}{x} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left(z \cdot z\right) \cdot y}{x} \]
      4. pow2N/A

        \[\leadsto \frac{{z}^{2} \cdot y}{x} \]
      5. associate-/l*N/A

        \[\leadsto {z}^{2} \cdot \color{blue}{\frac{y}{x}} \]
      6. lower-*.f64N/A

        \[\leadsto {z}^{2} \cdot \color{blue}{\frac{y}{x}} \]
      7. pow2N/A

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

        \[\leadsto \left(z \cdot z\right) \cdot \frac{\color{blue}{y}}{x} \]
      9. lift-/.f6429.4

        \[\leadsto \left(z \cdot z\right) \cdot \frac{y}{\color{blue}{x}} \]
    6. Applied rewrites29.4%

      \[\leadsto \left(z \cdot z\right) \cdot \color{blue}{\frac{y}{x}} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \left(z \cdot z\right) \cdot \color{blue}{\frac{y}{x}} \]
      3. pow2N/A

        \[\leadsto {z}^{2} \cdot \frac{\color{blue}{y}}{x} \]
      4. lift-/.f64N/A

        \[\leadsto {z}^{2} \cdot \frac{y}{\color{blue}{x}} \]
      5. associate-*r/N/A

        \[\leadsto \frac{{z}^{2} \cdot y}{\color{blue}{x}} \]
      6. *-commutativeN/A

        \[\leadsto \frac{y \cdot {z}^{2}}{x} \]
      7. associate-/l*N/A

        \[\leadsto y \cdot \color{blue}{\frac{{z}^{2}}{x}} \]
      8. lower-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\frac{{z}^{2}}{x}} \]
      9. pow2N/A

        \[\leadsto y \cdot \frac{z \cdot z}{x} \]
      10. associate-/l*N/A

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

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\frac{z}{x}}\right) \]
      12. lift-/.f6432.1

        \[\leadsto y \cdot \left(z \cdot \frac{z}{\color{blue}{x}}\right) \]
    8. Applied rewrites32.1%

      \[\leadsto y \cdot \color{blue}{\left(z \cdot \frac{z}{x}\right)} \]

    if -3.99999999999999979e49 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 0.0100000000000000002

    1. Initial program 94.2%

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
    2. Taylor expanded in z around -inf

      \[\leadsto \color{blue}{{z}^{2} \cdot \left(-1 \cdot \frac{-1 \cdot \frac{\left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right) - x}{z} + \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}}{z} + \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right)\right)} \]
    3. Applied rewrites59.6%

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

      \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{\color{blue}{x}} \]
    5. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{x} \]
    6. Applied rewrites50.6%

      \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(0.0007936500793651 + \left(\left(y + \frac{0.083333333333333}{z \cdot z}\right) - \frac{0.0027777777777778}{z}\right)\right)}{\color{blue}{x}} \]
    7. Taylor expanded in z around 0

      \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \frac{-13888888888889}{5000000000000000} \cdot z}{x} \]
    8. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\frac{-13888888888889}{5000000000000000} \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      2. lower-fma.f6429.8

        \[\leadsto \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \]
    9. Applied rewrites29.8%

      \[\leadsto \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 29.8% accurate, 4.0× speedup?

\[\begin{array}{l} \\ \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (/ (fma -0.0027777777777778 z 0.083333333333333) x))
double code(double x, double y, double z) {
	return fma(-0.0027777777777778, z, 0.083333333333333) / x;
}
function code(x, y, z)
	return Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x)
end
code[x_, y_, z_] := N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}

\\
\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}
\end{array}
Derivation
  1. Initial program 94.2%

    \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
  2. Taylor expanded in z around -inf

    \[\leadsto \color{blue}{{z}^{2} \cdot \left(-1 \cdot \frac{-1 \cdot \frac{\left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right) - x}{z} + \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}}{z} + \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right)\right)} \]
  3. Applied rewrites59.6%

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

    \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{\color{blue}{x}} \]
  5. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{x} \]
  6. Applied rewrites50.6%

    \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(0.0007936500793651 + \left(\left(y + \frac{0.083333333333333}{z \cdot z}\right) - \frac{0.0027777777777778}{z}\right)\right)}{\color{blue}{x}} \]
  7. Taylor expanded in z around 0

    \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + \frac{-13888888888889}{5000000000000000} \cdot z}{x} \]
  8. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \frac{\frac{-13888888888889}{5000000000000000} \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
    2. lower-fma.f6429.8

      \[\leadsto \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \]
  9. Applied rewrites29.8%

    \[\leadsto \frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x} \]
  10. Add Preprocessing

Alternative 12: 23.8% accurate, 8.7× speedup?

\[\begin{array}{l} \\ \frac{0.083333333333333}{x} \end{array} \]
(FPCore (x y z) :precision binary64 (/ 0.083333333333333 x))
double code(double x, double y, double z) {
	return 0.083333333333333 / x;
}
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 = 0.083333333333333d0 / x
end function
public static double code(double x, double y, double z) {
	return 0.083333333333333 / x;
}
def code(x, y, z):
	return 0.083333333333333 / x
function code(x, y, z)
	return Float64(0.083333333333333 / x)
end
function tmp = code(x, y, z)
	tmp = 0.083333333333333 / x;
end
code[x_, y_, z_] := N[(0.083333333333333 / x), $MachinePrecision]
\begin{array}{l}

\\
\frac{0.083333333333333}{x}
\end{array}
Derivation
  1. Initial program 94.2%

    \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
  2. Taylor expanded in z around -inf

    \[\leadsto \color{blue}{{z}^{2} \cdot \left(-1 \cdot \frac{-1 \cdot \frac{\left(\frac{91893853320467}{100000000000000} + \left(\frac{83333333333333}{1000000000000000} \cdot \frac{1}{x} + \log x \cdot \left(x - \frac{1}{2}\right)\right)\right) - x}{z} + \frac{13888888888889}{5000000000000000} \cdot \frac{1}{x}}{z} + \left(\frac{7936500793651}{10000000000000000} \cdot \frac{1}{x} + \frac{y}{x}\right)\right)} \]
  3. Applied rewrites59.6%

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

    \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{\color{blue}{x}} \]
  5. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{{z}^{2} \cdot \left(\left(\frac{7936500793651}{10000000000000000} + \left(y + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{{z}^{2}}\right)\right) - \frac{13888888888889}{5000000000000000} \cdot \frac{1}{z}\right)}{x} \]
  6. Applied rewrites50.6%

    \[\leadsto \frac{\left(z \cdot z\right) \cdot \left(0.0007936500793651 + \left(\left(y + \frac{0.083333333333333}{z \cdot z}\right) - \frac{0.0027777777777778}{z}\right)\right)}{\color{blue}{x}} \]
  7. Taylor expanded in z around 0

    \[\leadsto \frac{\frac{83333333333333}{1000000000000000}}{x} \]
  8. Step-by-step derivation
    1. Applied rewrites23.8%

      \[\leadsto \frac{0.083333333333333}{x} \]
    2. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025134 
    (FPCore (x y z)
      :name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
      :precision binary64
      (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))