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

Percentage Accurate: 93.7% → 93.7%
Time: 3.5s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

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 13 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.7% accurate, 1.0× speedup?

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

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

Alternative 1: 93.7% accurate, 1.0× speedup?

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

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

    \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 31.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z\\ t_1 := \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{t\_0 + 0.083333333333333}{x}\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+122}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+306}:\\ \;\;\;\;\left(x - 0.5\right) + 0.91893853320467\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z))
        (t_1
         (+
          (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
          (/ (+ t_0 0.083333333333333) x))))
   (if (<= t_1 -1e+122)
     t_0
     (if (<= t_1 4e+306) (+ (- x 0.5) 0.91893853320467) t_0))))
double code(double x, double y, double z) {
	double t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z;
	double t_1 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((t_0 + 0.083333333333333) / x);
	double tmp;
	if (t_1 <= -1e+122) {
		tmp = t_0;
	} else if (t_1 <= 4e+306) {
		tmp = (x - 0.5) + 0.91893853320467;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z
    t_1 = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((t_0 + 0.083333333333333d0) / x)
    if (t_1 <= (-1d+122)) then
        tmp = t_0
    else if (t_1 <= 4d+306) then
        tmp = (x - 0.5d0) + 0.91893853320467d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z;
	double t_1 = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((t_0 + 0.083333333333333) / x);
	double tmp;
	if (t_1 <= -1e+122) {
		tmp = t_0;
	} else if (t_1 <= 4e+306) {
		tmp = (x - 0.5) + 0.91893853320467;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z
	t_1 = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((t_0 + 0.083333333333333) / x)
	tmp = 0
	if t_1 <= -1e+122:
		tmp = t_0
	elif t_1 <= 4e+306:
		tmp = (x - 0.5) + 0.91893853320467
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z)
	t_1 = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(t_0 + 0.083333333333333) / x))
	tmp = 0.0
	if (t_1 <= -1e+122)
		tmp = t_0;
	elseif (t_1 <= 4e+306)
		tmp = Float64(Float64(x - 0.5) + 0.91893853320467);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z;
	t_1 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((t_0 + 0.083333333333333) / x);
	tmp = 0.0;
	if (t_1 <= -1e+122)
		tmp = t_0;
	elseif (t_1 <= 4e+306)
		tmp = (x - 0.5) + 0.91893853320467;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(t$95$0 + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+122], t$95$0, If[LessEqual[t$95$1, 4e+306], N[(N[(x - 0.5), $MachinePrecision] + 0.91893853320467), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+306}:\\
\;\;\;\;\left(x - 0.5\right) + 0.91893853320467\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -1.00000000000000001e122 or 4.00000000000000007e306 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x))

    1. Initial program 81.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in x around 0

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around inf

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

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

    if -1.00000000000000001e122 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 4.00000000000000007e306

    1. Initial program 99.4%

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

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{-1}{2} \cdot \log x + \frac{91893853320467}{100000000000000} \]
    6. Applied rewrites9.9%

      \[\leadsto \left(x - 0.5\right) + 0.91893853320467 \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 84.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - 0.5\right) \cdot \log x\\ \mathbf{if}\;x \leq 1.1 \cdot 10^{+130}:\\ \;\;\;\;\left(t\_0 + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\right) + 0.91893853320467\\ \mathbf{else}:\\ \;\;\;\;t\_0 - x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (- x 0.5) (log x))))
   (if (<= x 1.1e+130)
     (+
      (+
       t_0
       (/
        (+
         (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
         0.083333333333333)
        x))
      0.91893853320467)
     (- t_0 x))))
double code(double x, double y, double z) {
	double t_0 = (x - 0.5) * log(x);
	double tmp;
	if (x <= 1.1e+130) {
		tmp = (t_0 + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) + 0.91893853320467;
	} else {
		tmp = t_0 - x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x - 0.5d0) * log(x)
    if (x <= 1.1d+130) then
        tmp = (t_0 + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)) + 0.91893853320467d0
    else
        tmp = t_0 - x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x - 0.5) * Math.log(x);
	double tmp;
	if (x <= 1.1e+130) {
		tmp = (t_0 + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) + 0.91893853320467;
	} else {
		tmp = t_0 - x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x - 0.5) * math.log(x)
	tmp = 0
	if x <= 1.1e+130:
		tmp = (t_0 + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) + 0.91893853320467
	else:
		tmp = t_0 - x
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x - 0.5) * log(x))
	tmp = 0.0
	if (x <= 1.1e+130)
		tmp = Float64(Float64(t_0 + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) + 0.91893853320467);
	else
		tmp = Float64(t_0 - x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x - 0.5) * log(x);
	tmp = 0.0;
	if (x <= 1.1e+130)
		tmp = (t_0 + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) + 0.91893853320467;
	else
		tmp = t_0 - x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.1e+130], N[(N[(t$95$0 + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + 0.91893853320467), $MachinePrecision], N[(t$95$0 - x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(x - 0.5\right) \cdot \log x\\
\mathbf{if}\;x \leq 1.1 \cdot 10^{+130}:\\
\;\;\;\;\left(t\_0 + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\right) + 0.91893853320467\\

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


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

    1. Initial program 98.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in x around 0

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \left(\frac{-1}{2} \cdot \log x + x \cdot \left(\log x - 1\right)\right) + \frac{91893853320467}{100000000000000} \]
    6. Applied rewrites88.6%

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

    if 1.09999999999999997e130 < x

    1. Initial program 78.6%

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

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

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

Alternative 4: 84.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - 0.5\right) \cdot \log x\\ \mathbf{if}\;x \leq 1.1 \cdot 10^{+130}:\\ \;\;\;\;t\_0 + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;t\_0 - x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (- x 0.5) (log x))))
   (if (<= x 1.1e+130)
     (+
      t_0
      (/
       (+
        (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
        0.083333333333333)
       x))
     (- t_0 x))))
double code(double x, double y, double z) {
	double t_0 = (x - 0.5) * log(x);
	double tmp;
	if (x <= 1.1e+130) {
		tmp = t_0 + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
	} else {
		tmp = t_0 - x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x - 0.5d0) * log(x)
    if (x <= 1.1d+130) then
        tmp = t_0 + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
    else
        tmp = t_0 - x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x - 0.5) * Math.log(x);
	double tmp;
	if (x <= 1.1e+130) {
		tmp = t_0 + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
	} else {
		tmp = t_0 - x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x - 0.5) * math.log(x)
	tmp = 0
	if x <= 1.1e+130:
		tmp = t_0 + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
	else:
		tmp = t_0 - x
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x - 0.5) * log(x))
	tmp = 0.0
	if (x <= 1.1e+130)
		tmp = Float64(t_0 + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x));
	else
		tmp = Float64(t_0 - x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x - 0.5) * log(x);
	tmp = 0.0;
	if (x <= 1.1e+130)
		tmp = t_0 + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
	else
		tmp = t_0 - x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.1e+130], N[(t$95$0 + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(x - 0.5\right) \cdot \log x\\
\mathbf{if}\;x \leq 1.1 \cdot 10^{+130}:\\
\;\;\;\;t\_0 + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\

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


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

    1. Initial program 98.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in x around 0

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

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

    if 1.09999999999999997e130 < x

    1. Initial program 78.6%

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

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

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

Alternative 5: 84.6% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.6 \cdot 10^{+40}:\\
\;\;\;\;\frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\

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


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

    1. Initial program 99.7%

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

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{91893853320467}{100000000000000} + \color{blue}{\frac{-1}{2} \cdot \log x} \]
    6. Applied rewrites4.5%

      \[\leadsto \left(x - 0.5\right) \cdot \color{blue}{\log x} \]
    7. Taylor expanded in x around inf

      \[\leadsto -1 \cdot \left(x \cdot \color{blue}{\log \left(\frac{1}{x}\right)}\right) \]
    8. Applied rewrites94.0%

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

    if 6.5999999999999997e40 < x

    1. Initial program 81.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. Add Preprocessing
    3. Taylor expanded in x around 0

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

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

Alternative 6: 66.6% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5 \cdot 10^{+131}:\\
\;\;\;\;\frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\

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


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

    1. Initial program 98.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in x around 0

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{91893853320467}{100000000000000} + \color{blue}{\frac{-1}{2} \cdot \log x} \]
    6. Applied rewrites6.8%

      \[\leadsto \left(x - 0.5\right) \cdot \color{blue}{\log x} \]
    7. Taylor expanded in x around inf

      \[\leadsto -1 \cdot \left(x \cdot \color{blue}{\log \left(\frac{1}{x}\right)}\right) \]
    8. Applied rewrites84.5%

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

    if 1.5000000000000001e131 < x

    1. Initial program 78.6%

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

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{91893853320467}{100000000000000} + \color{blue}{\frac{-1}{2} \cdot \log x} \]
    6. Applied rewrites26.6%

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

Alternative 7: 63.4% accurate, 4.8× speedup?

\[\begin{array}{l} \\ \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (/
  (+
   (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
   0.083333333333333)
  x))
double code(double x, double y, double z) {
	return (((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x
end function
public static double code(double x, double y, double z) {
	return (((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x;
}
def code(x, y, z):
	return (((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x
function code(x, y, z)
	return Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
end
function tmp = code(x, y, z)
	tmp = (((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x;
end
code[x_, y_, z_] := N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
\end{array}
Derivation
  1. Initial program 91.6%

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

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

    \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
  5. Taylor expanded in x around 0

    \[\leadsto \frac{91893853320467}{100000000000000} + \color{blue}{\frac{-1}{2} \cdot \log x} \]
  6. Applied rewrites13.4%

    \[\leadsto \left(x - 0.5\right) \cdot \color{blue}{\log x} \]
  7. Taylor expanded in x around inf

    \[\leadsto -1 \cdot \left(x \cdot \color{blue}{\log \left(\frac{1}{x}\right)}\right) \]
  8. Applied rewrites61.4%

    \[\leadsto \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
  9. Add Preprocessing

Alternative 8: 13.9% accurate, 7.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -8 \cdot 10^{+97}:\\ \;\;\;\;\left(x - 0.5\right) \cdot \left(y + 0.0007936500793651\right)\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{+29}:\\ \;\;\;\;\left(x - 0.5\right) + 0.91893853320467\\ \mathbf{else}:\\ \;\;\;\;\left(y + 0.0007936500793651\right) \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -8e+97)
   (* (- x 0.5) (+ y 0.0007936500793651))
   (if (<= z 2.35e+29)
     (+ (- x 0.5) 0.91893853320467)
     (* (+ y 0.0007936500793651) z))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -8e+97) {
		tmp = (x - 0.5) * (y + 0.0007936500793651);
	} else if (z <= 2.35e+29) {
		tmp = (x - 0.5) + 0.91893853320467;
	} else {
		tmp = (y + 0.0007936500793651) * z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-8d+97)) then
        tmp = (x - 0.5d0) * (y + 0.0007936500793651d0)
    else if (z <= 2.35d+29) then
        tmp = (x - 0.5d0) + 0.91893853320467d0
    else
        tmp = (y + 0.0007936500793651d0) * z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -8e+97) {
		tmp = (x - 0.5) * (y + 0.0007936500793651);
	} else if (z <= 2.35e+29) {
		tmp = (x - 0.5) + 0.91893853320467;
	} else {
		tmp = (y + 0.0007936500793651) * z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -8e+97:
		tmp = (x - 0.5) * (y + 0.0007936500793651)
	elif z <= 2.35e+29:
		tmp = (x - 0.5) + 0.91893853320467
	else:
		tmp = (y + 0.0007936500793651) * z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -8e+97)
		tmp = Float64(Float64(x - 0.5) * Float64(y + 0.0007936500793651));
	elseif (z <= 2.35e+29)
		tmp = Float64(Float64(x - 0.5) + 0.91893853320467);
	else
		tmp = Float64(Float64(y + 0.0007936500793651) * z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -8e+97)
		tmp = (x - 0.5) * (y + 0.0007936500793651);
	elseif (z <= 2.35e+29)
		tmp = (x - 0.5) + 0.91893853320467;
	else
		tmp = (y + 0.0007936500793651) * z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -8e+97], N[(N[(x - 0.5), $MachinePrecision] * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.35e+29], N[(N[(x - 0.5), $MachinePrecision] + 0.91893853320467), $MachinePrecision], N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+97}:\\
\;\;\;\;\left(x - 0.5\right) \cdot \left(y + 0.0007936500793651\right)\\

\mathbf{elif}\;z \leq 2.35 \cdot 10^{+29}:\\
\;\;\;\;\left(x - 0.5\right) + 0.91893853320467\\

\mathbf{else}:\\
\;\;\;\;\left(y + 0.0007936500793651\right) \cdot z\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.0000000000000006e97

    1. Initial program 77.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. Add Preprocessing
    3. Taylor expanded in x around 0

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{91893853320467}{100000000000000} + \color{blue}{\frac{-1}{2} \cdot \log x} \]
    6. Applied rewrites6.2%

      \[\leadsto \left(x - 0.5\right) \cdot \color{blue}{\log x} \]
    7. Taylor expanded in x around 0

      \[\leadsto \left(x - \frac{1}{2}\right) \cdot \log x \]
    8. Applied rewrites17.9%

      \[\leadsto \left(x - 0.5\right) \cdot \left(y + 0.0007936500793651\right) \]

    if -8.0000000000000006e97 < z < 2.3500000000000001e29

    1. Initial program 98.2%

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

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{-1}{2} \cdot \log x + \frac{91893853320467}{100000000000000} \]
    6. Applied rewrites9.1%

      \[\leadsto \left(x - 0.5\right) + 0.91893853320467 \]

    if 2.3500000000000001e29 < z

    1. Initial program 83.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. Add Preprocessing
    3. Taylor expanded in x around 0

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

      \[\leadsto \color{blue}{\left(x - 0.5\right) \cdot \log x - x} \]
    5. Taylor expanded in x around inf

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

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

Alternative 9: 11.7% accurate, 7.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.8 \cdot 10^{+37}:\\ \;\;\;\;\left(\left(y + 0.0007936500793651\right) \cdot z + 0.91893853320467\right) + 0.91893853320467\\ \mathbf{else}:\\ \;\;\;\;\left(x - 0.5\right) \cdot \left(y + 0.0007936500793651\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 4.8e+37)
   (+ (+ (* (+ y 0.0007936500793651) z) 0.91893853320467) 0.91893853320467)
   (* (- x 0.5) (+ y 0.0007936500793651))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 4.8e+37) {
		tmp = (((y + 0.0007936500793651) * z) + 0.91893853320467) + 0.91893853320467;
	} else {
		tmp = (x - 0.5) * (y + 0.0007936500793651);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= 4.8d+37) then
        tmp = (((y + 0.0007936500793651d0) * z) + 0.91893853320467d0) + 0.91893853320467d0
    else
        tmp = (x - 0.5d0) * (y + 0.0007936500793651d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= 4.8e+37) {
		tmp = (((y + 0.0007936500793651) * z) + 0.91893853320467) + 0.91893853320467;
	} else {
		tmp = (x - 0.5) * (y + 0.0007936500793651);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= 4.8e+37:
		tmp = (((y + 0.0007936500793651) * z) + 0.91893853320467) + 0.91893853320467
	else:
		tmp = (x - 0.5) * (y + 0.0007936500793651)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= 4.8e+37)
		tmp = Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) + 0.91893853320467) + 0.91893853320467);
	else
		tmp = Float64(Float64(x - 0.5) * Float64(y + 0.0007936500793651));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= 4.8e+37)
		tmp = (((y + 0.0007936500793651) * z) + 0.91893853320467) + 0.91893853320467;
	else
		tmp = (x - 0.5) * (y + 0.0007936500793651);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, 4.8e+37], N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + 0.91893853320467), $MachinePrecision], N[(N[(x - 0.5), $MachinePrecision] * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.8 \cdot 10^{+37}:\\
\;\;\;\;\left(\left(y + 0.0007936500793651\right) \cdot z + 0.91893853320467\right) + 0.91893853320467\\

\mathbf{else}:\\
\;\;\;\;\left(x - 0.5\right) \cdot \left(y + 0.0007936500793651\right)\\


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

    1. Initial program 99.7%

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

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{-1}{2} \cdot \log x + \frac{91893853320467}{100000000000000} \]
    6. Applied rewrites4.2%

      \[\leadsto \left(x - 0.5\right) + 0.91893853320467 \]
    7. Taylor expanded in x around 0

      \[\leadsto \left(x - \frac{1}{2}\right) + \frac{91893853320467}{100000000000000} \]
    8. Applied rewrites10.6%

      \[\leadsto \left(\left(y + 0.0007936500793651\right) \cdot z + 0.91893853320467\right) + 0.91893853320467 \]

    if 4.8e37 < x

    1. Initial program 82.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in x around 0

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{91893853320467}{100000000000000} + \color{blue}{\frac{-1}{2} \cdot \log x} \]
    6. Applied rewrites23.9%

      \[\leadsto \left(x - 0.5\right) \cdot \color{blue}{\log x} \]
    7. Taylor expanded in x around 0

      \[\leadsto \left(x - \frac{1}{2}\right) \cdot \log x \]
    8. Applied rewrites16.9%

      \[\leadsto \left(x - 0.5\right) \cdot \left(y + 0.0007936500793651\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 11.7% accurate, 8.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.8 \cdot 10^{+37}:\\ \;\;\;\;\left(y + 0.0007936500793651\right) \cdot z + 0.91893853320467\\ \mathbf{else}:\\ \;\;\;\;\left(x - 0.5\right) \cdot \left(y + 0.0007936500793651\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 4.8e+37)
   (+ (* (+ y 0.0007936500793651) z) 0.91893853320467)
   (* (- x 0.5) (+ y 0.0007936500793651))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 4.8e+37) {
		tmp = ((y + 0.0007936500793651) * z) + 0.91893853320467;
	} else {
		tmp = (x - 0.5) * (y + 0.0007936500793651);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= 4.8d+37) then
        tmp = ((y + 0.0007936500793651d0) * z) + 0.91893853320467d0
    else
        tmp = (x - 0.5d0) * (y + 0.0007936500793651d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= 4.8e+37) {
		tmp = ((y + 0.0007936500793651) * z) + 0.91893853320467;
	} else {
		tmp = (x - 0.5) * (y + 0.0007936500793651);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= 4.8e+37:
		tmp = ((y + 0.0007936500793651) * z) + 0.91893853320467
	else:
		tmp = (x - 0.5) * (y + 0.0007936500793651)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= 4.8e+37)
		tmp = Float64(Float64(Float64(y + 0.0007936500793651) * z) + 0.91893853320467);
	else
		tmp = Float64(Float64(x - 0.5) * Float64(y + 0.0007936500793651));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= 4.8e+37)
		tmp = ((y + 0.0007936500793651) * z) + 0.91893853320467;
	else
		tmp = (x - 0.5) * (y + 0.0007936500793651);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, 4.8e+37], N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] + 0.91893853320467), $MachinePrecision], N[(N[(x - 0.5), $MachinePrecision] * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.8 \cdot 10^{+37}:\\
\;\;\;\;\left(y + 0.0007936500793651\right) \cdot z + 0.91893853320467\\

\mathbf{else}:\\
\;\;\;\;\left(x - 0.5\right) \cdot \left(y + 0.0007936500793651\right)\\


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

    1. Initial program 99.7%

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

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around inf

      \[\leadsto x \cdot \left(\left(-1 \cdot \log \left(\frac{1}{x}\right) + \frac{1}{2} \cdot \frac{\log \left(\frac{1}{x}\right)}{x}\right) - 1\right) + \frac{91893853320467}{100000000000000} \]
    6. Applied rewrites10.5%

      \[\leadsto \left(y + 0.0007936500793651\right) \cdot z + 0.91893853320467 \]

    if 4.8e37 < x

    1. Initial program 82.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in x around 0

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{91893853320467}{100000000000000} + \color{blue}{\frac{-1}{2} \cdot \log x} \]
    6. Applied rewrites23.9%

      \[\leadsto \left(x - 0.5\right) \cdot \color{blue}{\log x} \]
    7. Taylor expanded in x around 0

      \[\leadsto \left(x - \frac{1}{2}\right) \cdot \log x \]
    8. Applied rewrites16.9%

      \[\leadsto \left(x - 0.5\right) \cdot \left(y + 0.0007936500793651\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 12.6% accurate, 9.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 2.35 \cdot 10^{+29}:\\ \;\;\;\;\left(x - 0.5\right) + 0.91893853320467\\ \mathbf{else}:\\ \;\;\;\;\left(y + 0.0007936500793651\right) \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z 2.35e+29)
   (+ (- x 0.5) 0.91893853320467)
   (* (+ y 0.0007936500793651) z)))
double code(double x, double y, double z) {
	double tmp;
	if (z <= 2.35e+29) {
		tmp = (x - 0.5) + 0.91893853320467;
	} else {
		tmp = (y + 0.0007936500793651) * z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= 2.35d+29) then
        tmp = (x - 0.5d0) + 0.91893853320467d0
    else
        tmp = (y + 0.0007936500793651d0) * z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= 2.35e+29) {
		tmp = (x - 0.5) + 0.91893853320467;
	} else {
		tmp = (y + 0.0007936500793651) * z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= 2.35e+29:
		tmp = (x - 0.5) + 0.91893853320467
	else:
		tmp = (y + 0.0007936500793651) * z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= 2.35e+29)
		tmp = Float64(Float64(x - 0.5) + 0.91893853320467);
	else
		tmp = Float64(Float64(y + 0.0007936500793651) * z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= 2.35e+29)
		tmp = (x - 0.5) + 0.91893853320467;
	else
		tmp = (y + 0.0007936500793651) * z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, 2.35e+29], N[(N[(x - 0.5), $MachinePrecision] + 0.91893853320467), $MachinePrecision], N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.35 \cdot 10^{+29}:\\
\;\;\;\;\left(x - 0.5\right) + 0.91893853320467\\

\mathbf{else}:\\
\;\;\;\;\left(y + 0.0007936500793651\right) \cdot z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.3500000000000001e29

    1. Initial program 93.6%

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

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

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{-1}{2} \cdot \log x + \frac{91893853320467}{100000000000000} \]
    6. Applied rewrites7.9%

      \[\leadsto \left(x - 0.5\right) + 0.91893853320467 \]

    if 2.3500000000000001e29 < z

    1. Initial program 83.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. Add Preprocessing
    3. Taylor expanded in x around 0

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

      \[\leadsto \color{blue}{\left(x - 0.5\right) \cdot \log x - x} \]
    5. Taylor expanded in x around inf

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

      \[\leadsto \left(y + 0.0007936500793651\right) \cdot \color{blue}{z} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 7.4% accurate, 21.1× speedup?

\[\begin{array}{l} \\ \left(x - 0.5\right) + 0.91893853320467 \end{array} \]
(FPCore (x y z) :precision binary64 (+ (- x 0.5) 0.91893853320467))
double code(double x, double y, double z) {
	return (x - 0.5) + 0.91893853320467;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x - 0.5d0) + 0.91893853320467d0
end function
public static double code(double x, double y, double z) {
	return (x - 0.5) + 0.91893853320467;
}
def code(x, y, z):
	return (x - 0.5) + 0.91893853320467
function code(x, y, z)
	return Float64(Float64(x - 0.5) + 0.91893853320467)
end
function tmp = code(x, y, z)
	tmp = (x - 0.5) + 0.91893853320467;
end
code[x_, y_, z_] := N[(N[(x - 0.5), $MachinePrecision] + 0.91893853320467), $MachinePrecision]
\begin{array}{l}

\\
\left(x - 0.5\right) + 0.91893853320467
\end{array}
Derivation
  1. Initial program 91.6%

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

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

    \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467} \]
  5. Taylor expanded in x around 0

    \[\leadsto \frac{-1}{2} \cdot \log x + \frac{91893853320467}{100000000000000} \]
  6. Applied rewrites7.3%

    \[\leadsto \left(x - 0.5\right) + 0.91893853320467 \]
  7. Add Preprocessing

Alternative 13: 6.1% accurate, 37.0× speedup?

\[\begin{array}{l} \\ x - 0.5 \end{array} \]
(FPCore (x y z) :precision binary64 (- x 0.5))
double code(double x, double y, double z) {
	return x - 0.5;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x - 0.5d0
end function
public static double code(double x, double y, double z) {
	return x - 0.5;
}
def code(x, y, z):
	return x - 0.5
function code(x, y, z)
	return Float64(x - 0.5)
end
function tmp = code(x, y, z)
	tmp = x - 0.5;
end
code[x_, y_, z_] := N[(x - 0.5), $MachinePrecision]
\begin{array}{l}

\\
x - 0.5
\end{array}
Derivation
  1. Initial program 91.6%

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

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

    \[\leadsto \color{blue}{\left(x - 0.5\right) \cdot \log x - x} \]
  5. Taylor expanded in x around 0

    \[\leadsto \frac{-1}{2} \cdot \color{blue}{\log x} \]
  6. Applied rewrites6.1%

    \[\leadsto x - \color{blue}{0.5} \]
  7. Add Preprocessing

Developer Target 1: 98.8% accurate, 0.9× speedup?

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

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

Reproduce

?
herbie shell --seed 2024313 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
  :precision binary64

  :alt
  (! :herbie-platform default (+ (+ (+ (* (- x 1/2) (log x)) (- 91893853320467/100000000000000 x)) (/ 83333333333333/1000000000000000 x)) (* (/ z x) (- (* z (+ y 7936500793651/10000000000000000)) 13888888888889/5000000000000000))))

  (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))