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

Percentage Accurate: 94.4% → 99.5%
Time: 14.2s
Alternatives: 6
Speedup: N/A×

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 6 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.4% 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.5% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0 - \log x\\ \mathbf{if}\;x \leq 2 \cdot 10^{-30}:\\ \;\;\;\;\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}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\mathsf{fma}\left(-1, t\_0, \mathsf{fma}\left(0.5, \frac{t\_0}{x}, 0.91893853320467 \cdot {x}^{-1}\right)\right) - 1\right) + \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left({x}^{-1}, 0.0007936500793651, \frac{y}{x}\right), z, -0.0027777777777778 \cdot {x}^{-1}\right), z, {x}^{-1} \cdot 0.083333333333333\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 0.0 (log x))))
   (if (<= x 2e-30)
     (+
      (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
      (/
       (+
        (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
        0.083333333333333)
       x))
     (+
      (*
       x
       (-
        (fma -1.0 t_0 (fma 0.5 (/ t_0 x) (* 0.91893853320467 (pow x -1.0))))
        1.0))
      (fma
       (fma
        (fma (pow x -1.0) 0.0007936500793651 (/ y x))
        z
        (* -0.0027777777777778 (pow x -1.0)))
       z
       (* (pow x -1.0) 0.083333333333333))))))
double code(double x, double y, double z) {
	double t_0 = 0.0 - log(x);
	double tmp;
	if (x <= 2e-30) {
		tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
	} else {
		tmp = (x * (fma(-1.0, t_0, fma(0.5, (t_0 / x), (0.91893853320467 * pow(x, -1.0)))) - 1.0)) + fma(fma(fma(pow(x, -1.0), 0.0007936500793651, (y / x)), z, (-0.0027777777777778 * pow(x, -1.0))), z, (pow(x, -1.0) * 0.083333333333333));
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(0.0 - log(x))
	tmp = 0.0
	if (x <= 2e-30)
		tmp = 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));
	else
		tmp = Float64(Float64(x * Float64(fma(-1.0, t_0, fma(0.5, Float64(t_0 / x), Float64(0.91893853320467 * (x ^ -1.0)))) - 1.0)) + fma(fma(fma((x ^ -1.0), 0.0007936500793651, Float64(y / x)), z, Float64(-0.0027777777777778 * (x ^ -1.0))), z, Float64((x ^ -1.0) * 0.083333333333333)));
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.0 - N[Log[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2e-30], 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], N[(N[(x * N[(N[(-1.0 * t$95$0 + N[(0.5 * N[(t$95$0 / x), $MachinePrecision] + N[(0.91893853320467 * N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[Power[x, -1.0], $MachinePrecision] * 0.0007936500793651 + N[(y / x), $MachinePrecision]), $MachinePrecision] * z + N[(-0.0027777777777778 * N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + N[(N[Power[x, -1.0], $MachinePrecision] * 0.083333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0 - \log x\\
\mathbf{if}\;x \leq 2 \cdot 10^{-30}:\\
\;\;\;\;\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}\\

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


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

    1. Initial program 99.7%

      \[\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} \]

    if 2e-30 < x

    1. Initial program 90.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 \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\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) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

Alternative 2: 94.5% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0 - \log x\\ x \cdot \left(\mathsf{fma}\left(-1, t\_0, \mathsf{fma}\left(0.5, \frac{t\_0}{x}, 0.91893853320467 \cdot {x}^{-1}\right)\right) - 1\right) + \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left({x}^{-1}, 0.0007936500793651, \frac{y}{x}\right), z, -0.0027777777777778 \cdot {x}^{-1}\right), z, {x}^{-1} \cdot 0.083333333333333\right) \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 0.0 (log x))))
   (+
    (*
     x
     (-
      (fma -1.0 t_0 (fma 0.5 (/ t_0 x) (* 0.91893853320467 (pow x -1.0))))
      1.0))
    (fma
     (fma
      (fma (pow x -1.0) 0.0007936500793651 (/ y x))
      z
      (* -0.0027777777777778 (pow x -1.0)))
     z
     (* (pow x -1.0) 0.083333333333333)))))
double code(double x, double y, double z) {
	double t_0 = 0.0 - log(x);
	return (x * (fma(-1.0, t_0, fma(0.5, (t_0 / x), (0.91893853320467 * pow(x, -1.0)))) - 1.0)) + fma(fma(fma(pow(x, -1.0), 0.0007936500793651, (y / x)), z, (-0.0027777777777778 * pow(x, -1.0))), z, (pow(x, -1.0) * 0.083333333333333));
}
function code(x, y, z)
	t_0 = Float64(0.0 - log(x))
	return Float64(Float64(x * Float64(fma(-1.0, t_0, fma(0.5, Float64(t_0 / x), Float64(0.91893853320467 * (x ^ -1.0)))) - 1.0)) + fma(fma(fma((x ^ -1.0), 0.0007936500793651, Float64(y / x)), z, Float64(-0.0027777777777778 * (x ^ -1.0))), z, Float64((x ^ -1.0) * 0.083333333333333)))
end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.0 - N[Log[x], $MachinePrecision]), $MachinePrecision]}, N[(N[(x * N[(N[(-1.0 * t$95$0 + N[(0.5 * N[(t$95$0 / x), $MachinePrecision] + N[(0.91893853320467 * N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[Power[x, -1.0], $MachinePrecision] * 0.0007936500793651 + N[(y / x), $MachinePrecision]), $MachinePrecision] * z + N[(-0.0027777777777778 * N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + N[(N[Power[x, -1.0], $MachinePrecision] * 0.083333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0 - \log x\\
x \cdot \left(\mathsf{fma}\left(-1, t\_0, \mathsf{fma}\left(0.5, \frac{t\_0}{x}, 0.91893853320467 \cdot {x}^{-1}\right)\right) - 1\right) + \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left({x}^{-1}, 0.0007936500793651, \frac{y}{x}\right), z, -0.0027777777777778 \cdot {x}^{-1}\right), z, {x}^{-1} \cdot 0.083333333333333\right)
\end{array}
\end{array}
Derivation
  1. Initial program 94.4%

    \[\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 \left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \color{blue}{\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) + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot \left(\mathsf{fma}\left(-1, 0 - \log x, \mathsf{fma}\left(0.5, \frac{0 - \log x}{x}, 0.91893853320467 \cdot {x}^{-1}\right)\right) - 1\right)} + \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left({x}^{-1}, 0.0007936500793651, \frac{y}{x}\right), z, -0.0027777777777778 \cdot {x}^{-1}\right), z, {x}^{-1} \cdot 0.083333333333333\right) \]
  8. Add Preprocessing

Alternative 3: 74.6% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_0 := -1 \cdot \log x\\
\mathbf{if}\;x \leq 1.52 \cdot 10^{+78}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.083333333333333, {y}^{-1}, \mathsf{fma}\left(x, \mathsf{fma}\left(-0.5, \frac{\log x}{y}, \mathsf{fma}\left(0.91893853320467, {y}^{-1}, x \cdot \frac{\log x - 1}{y}\right)\right), \frac{z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{y} + z \cdot z\right)\right)}{x} \cdot y\\

\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(t\_0, -1, \mathsf{fma}\left(\frac{t\_0}{x}, 0.5, {x}^{-1} \cdot 0.91893853320467\right)\right) - 1\right) \cdot x\\


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

    1. Initial program 99.1%

      \[\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}{y \cdot \left(\left(\frac{\frac{83333333333333}{1000000000000000}}{x \cdot y} + \left(\frac{91893853320467}{100000000000000} \cdot \frac{1}{y} + \left(\frac{z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot z - \frac{13888888888889}{5000000000000000}\right)}{x \cdot y} + \left(\frac{\log x \cdot \left(x - \frac{1}{2}\right)}{y} + \frac{{z}^{2}}{x}\right)\right)\right)\right) - \frac{x}{y}\right)} \]
    3. Applied rewrites73.0%

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(0.083333333333333, {y}^{-1}, \mathsf{fma}\left(x, \mathsf{fma}\left(-0.5, \frac{\log x}{y}, \mathsf{fma}\left(0.91893853320467, {y}^{-1}, x \cdot \frac{\log x - 1}{y}\right)\right), \frac{z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{y} + z \cdot z\right)\right)}{x} \cdot y \]

    if 1.52e78 < x

    1. Initial program 86.6%

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

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

        \[\leadsto \left(\left(-1 \cdot \log \left(\frac{1}{x}\right) + \left(\frac{1}{2} \cdot \frac{\log \left(\frac{1}{x}\right)}{x} + \frac{91893853320467}{100000000000000} \cdot \frac{1}{x}\right)\right) - 1\right) \cdot \color{blue}{x} \]
    4. Applied rewrites76.0%

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

Alternative 4: 74.5% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{{x}^{-1} \cdot 0.083333333333333}{y}\\
t_1 := {\left(x \cdot y\right)}^{-1}\\
t_2 := \left(\left(\left(z \cdot z\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(0.91893853320467, {y}^{-1}, \frac{\log x \cdot \left(x - 0.5\right)}{y}\right)}{z}, 0.0027777777777778 \cdot t\_1\right)}{z}, \mathsf{fma}\left(0.0007936500793651, t\_1, {x}^{-1}\right)\right) + t\_0\right) - \frac{x}{y}\right) \cdot y\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{-52}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq 7.4 \cdot 10^{+151}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left({y}^{-1}, 0.91893853320467, \mathsf{fma}\left(\frac{z}{x}, \frac{z \cdot 0.0007936500793651 - 0.0027777777777778}{y}, \mathsf{fma}\left(\log x, \frac{x - 0.5}{y}, \frac{z \cdot z}{x}\right)\right)\right) + t\_0\right) - \frac{x}{y}\right) \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.1999999999999997e-52 or 7.3999999999999995e151 < z

    1. Initial program 89.8%

      \[\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}{y \cdot \left(\left(\frac{\frac{83333333333333}{1000000000000000}}{x \cdot y} + \left(\frac{91893853320467}{100000000000000} \cdot \frac{1}{y} + \left(\frac{z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot z - \frac{13888888888889}{5000000000000000}\right)}{x \cdot y} + \left(\frac{\log x \cdot \left(x - \frac{1}{2}\right)}{y} + \frac{{z}^{2}}{x}\right)\right)\right)\right) - \frac{x}{y}\right)} \]
    3. Applied rewrites61.0%

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

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

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

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

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

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

      \[\leadsto \left(\left(\left(z \cdot z\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(0.91893853320467, {y}^{-1}, \frac{\log x \cdot \left(x - 0.5\right)}{y}\right)}{z}, 0.0027777777777778 \cdot {\left(x \cdot y\right)}^{-1}\right)}{z}, \mathsf{fma}\left(0.0007936500793651, {\left(x \cdot y\right)}^{-1}, {x}^{-1}\right)\right) + \frac{{x}^{-1} \cdot 0.083333333333333}{y}\right) - \frac{x}{y}\right) \cdot y \]

    if -4.1999999999999997e-52 < z < 7.3999999999999995e151

    1. Initial program 97.6%

      \[\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}{y \cdot \left(\left(\frac{\frac{83333333333333}{1000000000000000}}{x \cdot y} + \left(\frac{91893853320467}{100000000000000} \cdot \frac{1}{y} + \left(\frac{z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot z - \frac{13888888888889}{5000000000000000}\right)}{x \cdot y} + \left(\frac{\log x \cdot \left(x - \frac{1}{2}\right)}{y} + \frac{{z}^{2}}{x}\right)\right)\right)\right) - \frac{x}{y}\right)} \]
    3. Applied rewrites74.3%

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

Alternative 5: 68.9% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(x \cdot y\right)}^{-1}\\
t_1 := \left(\left(\left(z \cdot z\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(0.91893853320467, {y}^{-1}, \frac{\log x \cdot \left(x - 0.5\right)}{y}\right)}{z}, 0.0027777777777778 \cdot t\_0\right)}{z}, \mathsf{fma}\left(0.0007936500793651, t\_0, {x}^{-1}\right)\right) + \frac{{x}^{-1} \cdot 0.083333333333333}{y}\right) - \frac{x}{y}\right) \cdot y\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{-93}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 7.1 \cdot 10^{+162}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.083333333333333, {y}^{-1}, \mathsf{fma}\left(x, \mathsf{fma}\left(-0.5, \frac{\log x}{y}, \mathsf{fma}\left(0.91893853320467, {y}^{-1}, x \cdot \frac{\log x - 1}{y}\right)\right), \frac{z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{y} + z \cdot z\right)\right)}{x} \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.6000000000000002e-93 or 7.0999999999999997e162 < z

    1. Initial program 90.9%

      \[\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}{y \cdot \left(\left(\frac{\frac{83333333333333}{1000000000000000}}{x \cdot y} + \left(\frac{91893853320467}{100000000000000} \cdot \frac{1}{y} + \left(\frac{z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot z - \frac{13888888888889}{5000000000000000}\right)}{x \cdot y} + \left(\frac{\log x \cdot \left(x - \frac{1}{2}\right)}{y} + \frac{{z}^{2}}{x}\right)\right)\right)\right) - \frac{x}{y}\right)} \]
    3. Applied rewrites62.5%

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

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

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

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

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

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

      \[\leadsto \left(\left(\left(z \cdot z\right) \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(0.91893853320467, {y}^{-1}, \frac{\log x \cdot \left(x - 0.5\right)}{y}\right)}{z}, 0.0027777777777778 \cdot {\left(x \cdot y\right)}^{-1}\right)}{z}, \mathsf{fma}\left(0.0007936500793651, {\left(x \cdot y\right)}^{-1}, {x}^{-1}\right)\right) + \frac{{x}^{-1} \cdot 0.083333333333333}{y}\right) - \frac{x}{y}\right) \cdot y \]

    if -3.6000000000000002e-93 < z < 7.0999999999999997e162

    1. Initial program 97.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}{y \cdot \left(\left(\frac{\frac{83333333333333}{1000000000000000}}{x \cdot y} + \left(\frac{91893853320467}{100000000000000} \cdot \frac{1}{y} + \left(\frac{z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot z - \frac{13888888888889}{5000000000000000}\right)}{x \cdot y} + \left(\frac{\log x \cdot \left(x - \frac{1}{2}\right)}{y} + \frac{{z}^{2}}{x}\right)\right)\right)\right) - \frac{x}{y}\right)} \]
    3. Applied rewrites73.8%

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

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

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

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

Alternative 6: 60.7% accurate, N/A× speedup?

\[\begin{array}{l} \\ \frac{\mathsf{fma}\left(0.083333333333333, {y}^{-1}, \mathsf{fma}\left(x, \mathsf{fma}\left(-0.5, \frac{\log x}{y}, \mathsf{fma}\left(0.91893853320467, {y}^{-1}, x \cdot \frac{\log x - 1}{y}\right)\right), \frac{z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{y} + z \cdot z\right)\right)}{x} \cdot y \end{array} \]
(FPCore (x y z)
 :precision binary64
 (*
  (/
   (fma
    0.083333333333333
    (pow y -1.0)
    (fma
     x
     (fma
      -0.5
      (/ (log x) y)
      (fma 0.91893853320467 (pow y -1.0) (* x (/ (- (log x) 1.0) y))))
     (+ (/ (* z (- (* 0.0007936500793651 z) 0.0027777777777778)) y) (* z z))))
   x)
  y))
double code(double x, double y, double z) {
	return (fma(0.083333333333333, pow(y, -1.0), fma(x, fma(-0.5, (log(x) / y), fma(0.91893853320467, pow(y, -1.0), (x * ((log(x) - 1.0) / y)))), (((z * ((0.0007936500793651 * z) - 0.0027777777777778)) / y) + (z * z)))) / x) * y;
}
function code(x, y, z)
	return Float64(Float64(fma(0.083333333333333, (y ^ -1.0), fma(x, fma(-0.5, Float64(log(x) / y), fma(0.91893853320467, (y ^ -1.0), Float64(x * Float64(Float64(log(x) - 1.0) / y)))), Float64(Float64(Float64(z * Float64(Float64(0.0007936500793651 * z) - 0.0027777777777778)) / y) + Float64(z * z)))) / x) * y)
end
code[x_, y_, z_] := N[(N[(N[(0.083333333333333 * N[Power[y, -1.0], $MachinePrecision] + N[(x * N[(-0.5 * N[(N[Log[x], $MachinePrecision] / y), $MachinePrecision] + N[(0.91893853320467 * N[Power[y, -1.0], $MachinePrecision] + N[(x * N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(z * N[(N[(0.0007936500793651 * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}

\\
\frac{\mathsf{fma}\left(0.083333333333333, {y}^{-1}, \mathsf{fma}\left(x, \mathsf{fma}\left(-0.5, \frac{\log x}{y}, \mathsf{fma}\left(0.91893853320467, {y}^{-1}, x \cdot \frac{\log x - 1}{y}\right)\right), \frac{z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{y} + z \cdot z\right)\right)}{x} \cdot y
\end{array}
Derivation
  1. Initial program 94.4%

    \[\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}{y \cdot \left(\left(\frac{\frac{83333333333333}{1000000000000000}}{x \cdot y} + \left(\frac{91893853320467}{100000000000000} \cdot \frac{1}{y} + \left(\frac{z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot z - \frac{13888888888889}{5000000000000000}\right)}{x \cdot y} + \left(\frac{\log x \cdot \left(x - \frac{1}{2}\right)}{y} + \frac{{z}^{2}}{x}\right)\right)\right)\right) - \frac{x}{y}\right)} \]
  3. Applied rewrites68.8%

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

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

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

    \[\leadsto \frac{\mathsf{fma}\left(0.083333333333333, {y}^{-1}, \mathsf{fma}\left(x, \mathsf{fma}\left(-0.5, \frac{\log x}{y}, \mathsf{fma}\left(0.91893853320467, {y}^{-1}, x \cdot \frac{\log x - 1}{y}\right)\right), \frac{z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{y} + z \cdot z\right)\right)}{x} \cdot y \]
  7. Add Preprocessing

Reproduce

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