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

Percentage Accurate: 93.8% → 98.6%
Time: 5.0s
Alternatives: 12
Speedup: 1.0×

Specification

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

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: 93.8% accurate, 1.0× speedup?

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

Alternative 1: 98.6% accurate, 1.0× speedup?

\[\mathsf{fma}\left(\frac{z}{x}, \mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), \mathsf{fma}\left(\log x, x - 0.5, 0.91893853320467 - x\right)\right) - \frac{-0.083333333333333}{x} \]
(FPCore (x y z)
 :precision binary64
 (-
  (fma
   (/ z x)
   (fma z (- y -0.0007936500793651) -0.0027777777777778)
   (fma (log x) (- x 0.5) (- 0.91893853320467 x)))
  (/ -0.083333333333333 x)))
double code(double x, double y, double z) {
	return fma((z / x), fma(z, (y - -0.0007936500793651), -0.0027777777777778), fma(log(x), (x - 0.5), (0.91893853320467 - x))) - (-0.083333333333333 / x);
}
function code(x, y, z)
	return Float64(fma(Float64(z / x), fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), fma(log(x), Float64(x - 0.5), Float64(0.91893853320467 - x))) - Float64(-0.083333333333333 / x))
end
code[x_, y_, z_] := N[(N[(N[(z / x), $MachinePrecision] * N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(\frac{z}{x}, \mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), \mathsf{fma}\left(\log x, x - 0.5, 0.91893853320467 - x\right)\right) - \frac{-0.083333333333333}{x}
Derivation
  1. Initial program 93.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. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \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) + \color{blue}{\frac{\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. add-flipN/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 - \left(\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)\right)}}{x} \]
    5. div-subN/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{\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)}{x}\right)} \]
    6. associate-+r-N/A

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

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

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

Alternative 2: 95.5% accurate, 0.7× speedup?

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, \frac{y - -0.0007936500793651}{x}, \frac{-0.0027777777777778}{x}\right), z, \frac{0.083333333333333}{x}\right)\\


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

    1. Initial program 93.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. Applied rewrites93.9%

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

    if 3.9999999999999999e295 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64))

    1. Initial program 93.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. Applied rewrites97.6%

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

      \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \color{blue}{\frac{\frac{83333333333333}{1000000000000000}}{x}}\right) \]
    4. Step-by-step derivation
      1. lower-/.f6464.1%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \frac{0.083333333333333}{\color{blue}{x}}\right) \]
    5. Applied rewrites64.1%

      \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \color{blue}{\frac{0.083333333333333}{x}}\right) \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{fma}\left(z, y - \frac{-7936500793651}{10000000000000000}, \frac{-13888888888889}{5000000000000000}\right)}{x}}, z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      2. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{z \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right) + \frac{-13888888888889}{5000000000000000}}}{x}, z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      3. div-addN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{z \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right)}{x} + \frac{\frac{-13888888888889}{5000000000000000}}{x}}, z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      4. associate-/l*N/A

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, \color{blue}{\frac{y - \frac{-7936500793651}{10000000000000000}}{x}}, \frac{\frac{-13888888888889}{5000000000000000}}{x}\right), z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      7. lower-/.f6460.6%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, \frac{y - -0.0007936500793651}{x}, \color{blue}{\frac{-0.0027777777777778}{x}}\right), z, \frac{0.083333333333333}{x}\right) \]
    7. Applied rewrites60.6%

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

Alternative 3: 85.3% accurate, 0.6× speedup?

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

\mathbf{elif}\;t\_0 \leq 10^{+124}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \left(0.91893853320467 - x\right) - \frac{-0.083333333333333}{x}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, \frac{y - -0.0007936500793651}{x}, \frac{-0.0027777777777778}{x}\right), z, \frac{0.083333333333333}{x}\right)\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -2.0000000000000001e207

    1. Initial program 93.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 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. lower-/.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x} \]
      6. lower-+.f6463.0%

        \[\leadsto \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x} \]
    4. Applied rewrites63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e207 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 9.99999999999999948e123

    1. Initial program 93.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. Applied rewrites97.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{91893853320467}{100000000000000} + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) - \left(x + \log x \cdot \left(\color{blue}{\frac{1}{2}} - x\right)\right) \]
      8. lower--.f6456.7%

        \[\leadsto \left(0.91893853320467 + 0.083333333333333 \cdot \frac{1}{x}\right) - \left(x + \log x \cdot \left(0.5 - \color{blue}{x}\right)\right) \]
    5. Applied rewrites56.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \left(\frac{91893853320467}{100000000000000} + \frac{83333333333333}{1000000000000000} \cdot \color{blue}{\frac{1}{x}}\right) \]
      15. fp-cancel-sign-sub-invN/A

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

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

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

        \[\leadsto \left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \left(\frac{91893853320467}{100000000000000} - \frac{\frac{-83333333333333}{1000000000000000}}{\color{blue}{x}}\right) \]
    7. Applied rewrites56.7%

      \[\leadsto \mathsf{fma}\left(x - 0.5, \color{blue}{\log x}, \left(0.91893853320467 - x\right) - \frac{-0.083333333333333}{x}\right) \]

    if 9.99999999999999948e123 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64))

    1. Initial program 93.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. Applied rewrites97.6%

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

      \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \color{blue}{\frac{\frac{83333333333333}{1000000000000000}}{x}}\right) \]
    4. Step-by-step derivation
      1. lower-/.f6464.1%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \frac{0.083333333333333}{\color{blue}{x}}\right) \]
    5. Applied rewrites64.1%

      \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \color{blue}{\frac{0.083333333333333}{x}}\right) \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{fma}\left(z, y - \frac{-7936500793651}{10000000000000000}, \frac{-13888888888889}{5000000000000000}\right)}{x}}, z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      2. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{z \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right) + \frac{-13888888888889}{5000000000000000}}}{x}, z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      3. div-addN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{z \cdot \left(y - \frac{-7936500793651}{10000000000000000}\right)}{x} + \frac{\frac{-13888888888889}{5000000000000000}}{x}}, z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      4. associate-/l*N/A

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, \color{blue}{\frac{y - \frac{-7936500793651}{10000000000000000}}{x}}, \frac{\frac{-13888888888889}{5000000000000000}}{x}\right), z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      7. lower-/.f6460.6%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, \frac{y - -0.0007936500793651}{x}, \color{blue}{\frac{-0.0027777777777778}{x}}\right), z, \frac{0.083333333333333}{x}\right) \]
    7. Applied rewrites60.6%

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

Alternative 4: 85.1% accurate, 0.6× speedup?

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

\mathbf{elif}\;t\_0 \leq 10^{+124}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \left(0.91893853320467 - x\right) - \frac{-0.083333333333333}{x}\right)\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -2.0000000000000001e207

    1. Initial program 93.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 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. lower-/.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x} \]
      6. lower-+.f6463.0%

        \[\leadsto \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x} \]
    4. Applied rewrites63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e207 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 9.99999999999999948e123

    1. Initial program 93.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. Applied rewrites97.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{91893853320467}{100000000000000} + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) - \left(x + \log x \cdot \left(\color{blue}{\frac{1}{2}} - x\right)\right) \]
      8. lower--.f6456.7%

        \[\leadsto \left(0.91893853320467 + 0.083333333333333 \cdot \frac{1}{x}\right) - \left(x + \log x \cdot \left(0.5 - \color{blue}{x}\right)\right) \]
    5. Applied rewrites56.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \left(\frac{91893853320467}{100000000000000} + \frac{83333333333333}{1000000000000000} \cdot \color{blue}{\frac{1}{x}}\right) \]
      15. fp-cancel-sign-sub-invN/A

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

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

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

        \[\leadsto \left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \left(\frac{91893853320467}{100000000000000} - \frac{\frac{-83333333333333}{1000000000000000}}{\color{blue}{x}}\right) \]
    7. Applied rewrites56.7%

      \[\leadsto \mathsf{fma}\left(x - 0.5, \color{blue}{\log x}, \left(0.91893853320467 - x\right) - \frac{-0.083333333333333}{x}\right) \]

    if 9.99999999999999948e123 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64))

    1. Initial program 93.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. Applied rewrites97.6%

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

      \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \color{blue}{\frac{\frac{83333333333333}{1000000000000000}}{x}}\right) \]
    4. Step-by-step derivation
      1. lower-/.f6464.1%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \frac{0.083333333333333}{\color{blue}{x}}\right) \]
    5. Applied rewrites64.1%

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

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right)}}{x}, z, \frac{0.083333333333333}{x}\right) \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{z \cdot \color{blue}{\left(\frac{7936500793651}{10000000000000000} + y\right)}}{x}, z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      2. lower-+.f6463.8%

        \[\leadsto \mathsf{fma}\left(\frac{z \cdot \left(0.0007936500793651 + \color{blue}{y}\right)}{x}, z, \frac{0.083333333333333}{x}\right) \]
    8. Applied rewrites63.8%

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

Alternative 5: 85.1% accurate, 0.6× speedup?

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

\mathbf{elif}\;t\_1 \leq 10^{+124}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \left(0.91893853320467 - x\right) - \frac{-0.083333333333333}{x}\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -2.0000000000000001e207 or 9.99999999999999948e123 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64))

    1. Initial program 93.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. Applied rewrites97.6%

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

      \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \color{blue}{\frac{\frac{83333333333333}{1000000000000000}}{x}}\right) \]
    4. Step-by-step derivation
      1. lower-/.f6464.1%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \frac{0.083333333333333}{\color{blue}{x}}\right) \]
    5. Applied rewrites64.1%

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

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right)}}{x}, z, \frac{0.083333333333333}{x}\right) \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{z \cdot \color{blue}{\left(\frac{7936500793651}{10000000000000000} + y\right)}}{x}, z, \frac{\frac{83333333333333}{1000000000000000}}{x}\right) \]
      2. lower-+.f6463.8%

        \[\leadsto \mathsf{fma}\left(\frac{z \cdot \left(0.0007936500793651 + \color{blue}{y}\right)}{x}, z, \frac{0.083333333333333}{x}\right) \]
    8. Applied rewrites63.8%

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

    if -2.0000000000000001e207 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 9.99999999999999948e123

    1. Initial program 93.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. Applied rewrites97.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{91893853320467}{100000000000000} + \frac{83333333333333}{1000000000000000} \cdot \frac{1}{x}\right) - \left(x + \log x \cdot \left(\color{blue}{\frac{1}{2}} - x\right)\right) \]
      8. lower--.f6456.7%

        \[\leadsto \left(0.91893853320467 + 0.083333333333333 \cdot \frac{1}{x}\right) - \left(x + \log x \cdot \left(0.5 - \color{blue}{x}\right)\right) \]
    5. Applied rewrites56.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \left(\frac{91893853320467}{100000000000000} + \frac{83333333333333}{1000000000000000} \cdot \color{blue}{\frac{1}{x}}\right) \]
      15. fp-cancel-sign-sub-invN/A

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

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

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

        \[\leadsto \left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \left(\frac{91893853320467}{100000000000000} - \frac{\frac{-83333333333333}{1000000000000000}}{\color{blue}{x}}\right) \]
    7. Applied rewrites56.7%

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

Alternative 6: 83.7% accurate, 1.8× speedup?

\[\begin{array}{l} \mathbf{if}\;x \leq 7.2 \cdot 10^{+70}:\\ \;\;\;\;\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} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 7.2e+70)
   (/
    (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 <= 7.2e+70) {
		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 <= 7.2e+70)
		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, 7.2e+70], 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}
\mathbf{if}\;x \leq 7.2 \cdot 10^{+70}:\\
\;\;\;\;\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}
Derivation
  1. Split input into 2 regimes
  2. if x < 7.1999999999999999e70

    1. Initial program 93.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 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. lower-/.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x} \]
      6. lower-+.f6463.0%

        \[\leadsto \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x} \]
    4. Applied rewrites63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(z, y - \frac{-7936500793651}{10000000000000000}, \frac{-13888888888889}{5000000000000000}\right) \cdot z + \frac{83333333333333}{1000000000000000}}{x} \]
      15. lift-fma.f6463.0%

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

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

    if 7.1999999999999999e70 < x

    1. Initial program 93.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. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \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) + \color{blue}{\frac{\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. add-flipN/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 - \left(\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)\right)}}{x} \]
      5. div-subN/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{\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)}{x}\right)} \]
      6. associate-+r-N/A

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \]
      5. lower-/.f6435.3%

        \[\leadsto x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \]
    6. Applied rewrites35.3%

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

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

        \[\leadsto \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot \color{blue}{x} \]
      3. lower-*.f6435.3%

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

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

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

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

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

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

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log x\right)\right)\right)\right) - 1\right) \cdot x \]
      10. remove-double-neg35.3%

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

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

Alternative 7: 73.0% accurate, 1.9× speedup?

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

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


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

    1. Initial program 93.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. Applied rewrites97.6%

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

      \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \color{blue}{\frac{\frac{83333333333333}{1000000000000000}}{x}}\right) \]
    4. Step-by-step derivation
      1. lower-/.f6464.1%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \frac{0.083333333333333}{\color{blue}{x}}\right) \]
    5. Applied rewrites64.1%

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

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{y \cdot z}}{x}, z, \frac{0.083333333333333}{x}\right) \]
    7. Step-by-step derivation
      1. lower-*.f6449.5%

        \[\leadsto \mathsf{fma}\left(\frac{y \cdot \color{blue}{z}}{x}, z, \frac{0.083333333333333}{x}\right) \]
    8. Applied rewrites49.5%

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

    if 1.54999999999999998e44 < x

    1. Initial program 93.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. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \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) + \color{blue}{\frac{\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. add-flipN/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 - \left(\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)\right)}}{x} \]
      5. div-subN/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{\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)}{x}\right)} \]
      6. associate-+r-N/A

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \]
      5. lower-/.f6435.3%

        \[\leadsto x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \]
    6. Applied rewrites35.3%

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

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

        \[\leadsto \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot \color{blue}{x} \]
      3. lower-*.f6435.3%

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

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

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

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

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

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

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log x\right)\right)\right)\right) - 1\right) \cdot x \]
      10. remove-double-neg35.3%

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

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

Alternative 8: 72.6% accurate, 1.9× speedup?

\[\begin{array}{l} \mathbf{if}\;x \leq 4.7 \cdot 10^{+20}:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\log x - 1\right) \cdot x\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 4.7e+20)
   (/
    (+ 0.083333333333333 (* z (- (* 0.0007936500793651 z) 0.0027777777777778)))
    x)
   (* (- (log x) 1.0) x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 4.7e+20) {
		tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x;
	} else {
		tmp = (log(x) - 1.0) * x;
	}
	return tmp;
}
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
    real(8) :: tmp
    if (x <= 4.7d+20) then
        tmp = (0.083333333333333d0 + (z * ((0.0007936500793651d0 * z) - 0.0027777777777778d0))) / x
    else
        tmp = (log(x) - 1.0d0) * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= 4.7e+20) {
		tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x;
	} else {
		tmp = (Math.log(x) - 1.0) * x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= 4.7e+20:
		tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x
	else:
		tmp = (math.log(x) - 1.0) * x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= 4.7e+20)
		tmp = Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(0.0007936500793651 * z) - 0.0027777777777778))) / x);
	else
		tmp = Float64(Float64(log(x) - 1.0) * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= 4.7e+20)
		tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x;
	else
		tmp = (log(x) - 1.0) * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, 4.7e+20], N[(N[(0.083333333333333 + N[(z * N[(N[(0.0007936500793651 * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 4.7 \cdot 10^{+20}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{x}\\

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


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

    1. Initial program 93.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 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. lower-/.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x} \]
      6. lower-+.f6463.0%

        \[\leadsto \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x} \]
    4. Applied rewrites63.0%

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

      \[\leadsto \frac{0.083333333333333 + z \cdot \left(\frac{7936500793651}{10000000000000000} \cdot z - 0.0027777777777778\right)}{x} \]
    6. Step-by-step derivation
      1. lower-*.f6446.8%

        \[\leadsto \frac{0.083333333333333 + z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{x} \]
    7. Applied rewrites46.8%

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

    if 4.7e20 < x

    1. Initial program 93.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. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \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) + \color{blue}{\frac{\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. add-flipN/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 - \left(\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)\right)}}{x} \]
      5. div-subN/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{\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)}{x}\right)} \]
      6. associate-+r-N/A

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \]
      5. lower-/.f6435.3%

        \[\leadsto x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \]
    6. Applied rewrites35.3%

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

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

        \[\leadsto \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot \color{blue}{x} \]
      3. lower-*.f6435.3%

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

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

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

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

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

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

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log x\right)\right)\right)\right) - 1\right) \cdot x \]
      10. remove-double-neg35.3%

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

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

Alternative 9: 61.3% accurate, 2.3× speedup?

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

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


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

    1. Initial program 93.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. Applied rewrites97.6%

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

      \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \color{blue}{\frac{\frac{83333333333333}{1000000000000000}}{x}}\right) \]
    4. Step-by-step derivation
      1. lower-/.f6464.1%

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \frac{0.083333333333333}{\color{blue}{x}}\right) \]
    5. Applied rewrites64.1%

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

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\frac{-13888888888889}{5000000000000000}}}{x}, z, \frac{0.083333333333333}{x}\right) \]
    7. Step-by-step derivation
      1. Applied rewrites28.2%

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

      if 2.7000000000000002 < x

      1. Initial program 93.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. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \color{blue}{\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \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) + \color{blue}{\frac{\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. add-flipN/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 - \left(\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)\right)}}{x} \]
        5. div-subN/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{\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)}{x}\right)} \]
        6. associate-+r-N/A

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

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

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

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

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

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

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

          \[\leadsto x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \]
        5. lower-/.f6435.3%

          \[\leadsto x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \]
      6. Applied rewrites35.3%

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

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

          \[\leadsto \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot \color{blue}{x} \]
        3. lower-*.f6435.3%

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

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

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

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

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

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

          \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log x\right)\right)\right)\right) - 1\right) \cdot x \]
        10. remove-double-neg35.3%

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

        \[\leadsto \left(\log x - 1\right) \cdot \color{blue}{x} \]
    8. Recombined 2 regimes into one program.
    9. Add Preprocessing

    Alternative 10: 61.3% accurate, 2.3× speedup?

    \[\begin{array}{l} \mathbf{if}\;x \leq 2.7:\\ \;\;\;\;\frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\log x - 1\right) \cdot x\\ \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= x 2.7)
       (/ (+ 0.083333333333333 (* -0.0027777777777778 z)) x)
       (* (- (log x) 1.0) x)))
    double code(double x, double y, double z) {
    	double tmp;
    	if (x <= 2.7) {
    		tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x;
    	} else {
    		tmp = (log(x) - 1.0) * x;
    	}
    	return tmp;
    }
    
    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
        real(8) :: tmp
        if (x <= 2.7d0) then
            tmp = (0.083333333333333d0 + ((-0.0027777777777778d0) * z)) / x
        else
            tmp = (log(x) - 1.0d0) * x
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double tmp;
    	if (x <= 2.7) {
    		tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x;
    	} else {
    		tmp = (Math.log(x) - 1.0) * x;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	tmp = 0
    	if x <= 2.7:
    		tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x
    	else:
    		tmp = (math.log(x) - 1.0) * x
    	return tmp
    
    function code(x, y, z)
    	tmp = 0.0
    	if (x <= 2.7)
    		tmp = Float64(Float64(0.083333333333333 + Float64(-0.0027777777777778 * z)) / x);
    	else
    		tmp = Float64(Float64(log(x) - 1.0) * x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	tmp = 0.0;
    	if (x <= 2.7)
    		tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x;
    	else
    		tmp = (log(x) - 1.0) * x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := If[LessEqual[x, 2.7], N[(N[(0.083333333333333 + N[(-0.0027777777777778 * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]]
    
    \begin{array}{l}
    \mathbf{if}\;x \leq 2.7:\\
    \;\;\;\;\frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x}\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(\log x - 1\right) \cdot x\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 2.7000000000000002

      1. Initial program 93.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 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. lower-/.f64N/A

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

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

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

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

          \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x} \]
        6. lower-+.f6463.0%

          \[\leadsto \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x} \]
      4. Applied rewrites63.0%

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

        \[\leadsto \frac{0.083333333333333 + \frac{-13888888888889}{5000000000000000} \cdot z}{x} \]
      6. Step-by-step derivation
        1. lower-*.f6428.2%

          \[\leadsto \frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x} \]
      7. Applied rewrites28.2%

        \[\leadsto \frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x} \]

      if 2.7000000000000002 < x

      1. Initial program 93.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. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \color{blue}{\left(\left(\left(x - \frac{1}{2}\right) \cdot \log x - x\right) + \frac{91893853320467}{100000000000000}\right) + \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) + \color{blue}{\frac{\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. add-flipN/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 - \left(\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)\right)}}{x} \]
        5. div-subN/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{\mathsf{neg}\left(\frac{83333333333333}{1000000000000000}\right)}{x}\right)} \]
        6. associate-+r-N/A

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

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

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

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

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

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

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

          \[\leadsto x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \]
        5. lower-/.f6435.3%

          \[\leadsto x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \]
      6. Applied rewrites35.3%

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

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

          \[\leadsto \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot \color{blue}{x} \]
        3. lower-*.f6435.3%

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

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

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

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

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

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

          \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\log x\right)\right)\right)\right) - 1\right) \cdot x \]
        10. remove-double-neg35.3%

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

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

    Alternative 11: 28.2% accurate, 3.8× speedup?

    \[\frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x} \]
    (FPCore (x y z)
     :precision binary64
     (/ (+ 0.083333333333333 (* -0.0027777777777778 z)) x))
    double code(double x, double y, double z) {
    	return (0.083333333333333 + (-0.0027777777777778 * z)) / 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 + ((-0.0027777777777778d0) * z)) / x
    end function
    
    public static double code(double x, double y, double z) {
    	return (0.083333333333333 + (-0.0027777777777778 * z)) / x;
    }
    
    def code(x, y, z):
    	return (0.083333333333333 + (-0.0027777777777778 * z)) / x
    
    function code(x, y, z)
    	return Float64(Float64(0.083333333333333 + Float64(-0.0027777777777778 * z)) / x)
    end
    
    function tmp = code(x, y, z)
    	tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x;
    end
    
    code[x_, y_, z_] := N[(N[(0.083333333333333 + N[(-0.0027777777777778 * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
    
    \frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x}
    
    Derivation
    1. Initial program 93.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 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. lower-/.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x} \]
      6. lower-+.f6463.0%

        \[\leadsto \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x} \]
    4. Applied rewrites63.0%

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

      \[\leadsto \frac{0.083333333333333 + \frac{-13888888888889}{5000000000000000} \cdot z}{x} \]
    6. Step-by-step derivation
      1. lower-*.f6428.2%

        \[\leadsto \frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x} \]
    7. Applied rewrites28.2%

      \[\leadsto \frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x} \]
    8. Add Preprocessing

    Alternative 12: 22.7% accurate, 8.7× speedup?

    \[\frac{0.083333333333333}{x} \]
    (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]
    
    \frac{0.083333333333333}{x}
    
    Derivation
    1. Initial program 93.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 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. lower-/.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{83333333333333}{1000000000000000} + z \cdot \left(z \cdot \left(\frac{7936500793651}{10000000000000000} + y\right) - \frac{13888888888889}{5000000000000000}\right)}{x} \]
      6. lower-+.f6463.0%

        \[\leadsto \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x} \]
    4. Applied rewrites63.0%

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

      \[\leadsto \frac{\frac{83333333333333}{1000000000000000}}{x} \]
    6. Step-by-step derivation
      1. Applied rewrites22.7%

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

      Reproduce

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