Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, B

Percentage Accurate: 68.7% → 86.3%
Time: 13.1s
Alternatives: 6
Speedup: 4.2×

Specification

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

\\
x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}
\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 6 alternatives:

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

Initial Program: 68.7% accurate, 1.0× speedup?

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

\\
x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}
\end{array}

Alternative 1: 86.3% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -132000000:\\ \;\;\;\;x + \left(0.0692910599291889 \cdot y - \frac{y \cdot -0.07512208616047561}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + {\left(\sqrt[3]{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right) \cdot \frac{y}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}}\right)}^{3}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -132000000.0)
   (+ x (- (* 0.0692910599291889 y) (/ (* y -0.07512208616047561) z)))
   (+
    x
    (pow
     (cbrt
      (*
       (fma z (fma z 0.0692910599291889 0.4917317610505968) 0.279195317918525)
       (/ y (fma z (+ z 6.012459259764103) 3.350343815022304))))
     3.0))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -132000000.0) {
		tmp = x + ((0.0692910599291889 * y) - ((y * -0.07512208616047561) / z));
	} else {
		tmp = x + pow(cbrt((fma(z, fma(z, 0.0692910599291889, 0.4917317610505968), 0.279195317918525) * (y / fma(z, (z + 6.012459259764103), 3.350343815022304)))), 3.0);
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (z <= -132000000.0)
		tmp = Float64(x + Float64(Float64(0.0692910599291889 * y) - Float64(Float64(y * -0.07512208616047561) / z)));
	else
		tmp = Float64(x + (cbrt(Float64(fma(z, fma(z, 0.0692910599291889, 0.4917317610505968), 0.279195317918525) * Float64(y / fma(z, Float64(z + 6.012459259764103), 3.350343815022304)))) ^ 3.0));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[z, -132000000.0], N[(x + N[(N[(0.0692910599291889 * y), $MachinePrecision] - N[(N[(y * -0.07512208616047561), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Power[N[Power[N[(N[(z * N[(z * 0.0692910599291889 + 0.4917317610505968), $MachinePrecision] + 0.279195317918525), $MachinePrecision] * N[(y / N[(z * N[(z + 6.012459259764103), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -132000000:\\
\;\;\;\;x + \left(0.0692910599291889 \cdot y - \frac{y \cdot -0.07512208616047561}{z}\right)\\

\mathbf{else}:\\
\;\;\;\;x + {\left(\sqrt[3]{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right) \cdot \frac{y}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}}\right)}^{3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.32e8

    1. Initial program 32.9%

      \[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
    2. Step-by-step derivation
      1. associate-/l*56.3%

        \[\leadsto x + \color{blue}{y \cdot \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}} \]
      2. fma-define56.3%

        \[\leadsto x + y \cdot \frac{\color{blue}{\mathsf{fma}\left(z \cdot 0.0692910599291889 + 0.4917317610505968, z, 0.279195317918525\right)}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      3. fma-define56.3%

        \[\leadsto x + y \cdot \frac{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)}, z, 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      4. fma-define56.3%

        \[\leadsto x + y \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), z, 0.279195317918525\right)}{\color{blue}{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}} \]
    3. Simplified56.3%

      \[\leadsto \color{blue}{x + y \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), z, 0.279195317918525\right)}{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around -inf 99.6%

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{-0.4917317610505968 \cdot y - -0.4166096748901212 \cdot y}{z} + 0.0692910599291889 \cdot y\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.6%

        \[\leadsto x + \color{blue}{\left(0.0692910599291889 \cdot y + -1 \cdot \frac{-0.4917317610505968 \cdot y - -0.4166096748901212 \cdot y}{z}\right)} \]
      2. mul-1-neg99.6%

        \[\leadsto x + \left(0.0692910599291889 \cdot y + \color{blue}{\left(-\frac{-0.4917317610505968 \cdot y - -0.4166096748901212 \cdot y}{z}\right)}\right) \]
      3. unsub-neg99.6%

        \[\leadsto x + \color{blue}{\left(0.0692910599291889 \cdot y - \frac{-0.4917317610505968 \cdot y - -0.4166096748901212 \cdot y}{z}\right)} \]
      4. distribute-rgt-out--99.6%

        \[\leadsto x + \left(0.0692910599291889 \cdot y - \frac{\color{blue}{y \cdot \left(-0.4917317610505968 - -0.4166096748901212\right)}}{z}\right) \]
      5. metadata-eval99.6%

        \[\leadsto x + \left(0.0692910599291889 \cdot y - \frac{y \cdot \color{blue}{-0.07512208616047561}}{z}\right) \]
    7. Simplified99.6%

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

    if -1.32e8 < z

    1. Initial program 82.6%

      \[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
    2. Step-by-step derivation
      1. associate-/l*85.5%

        \[\leadsto x + \color{blue}{y \cdot \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}} \]
      2. fma-define85.5%

        \[\leadsto x + y \cdot \frac{\color{blue}{\mathsf{fma}\left(z \cdot 0.0692910599291889 + 0.4917317610505968, z, 0.279195317918525\right)}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      3. fma-define85.5%

        \[\leadsto x + y \cdot \frac{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)}, z, 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      4. fma-define85.5%

        \[\leadsto x + y \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), z, 0.279195317918525\right)}{\color{blue}{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}} \]
    3. Simplified85.5%

      \[\leadsto \color{blue}{x + y \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), z, 0.279195317918525\right)}{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt84.8%

        \[\leadsto x + \color{blue}{\left(\sqrt[3]{y \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), z, 0.279195317918525\right)}{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}} \cdot \sqrt[3]{y \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), z, 0.279195317918525\right)}{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}}\right) \cdot \sqrt[3]{y \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), z, 0.279195317918525\right)}{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}}} \]
      2. pow384.8%

        \[\leadsto x + \color{blue}{{\left(\sqrt[3]{y \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), z, 0.279195317918525\right)}{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}}\right)}^{3}} \]
    6. Applied egg-rr84.3%

      \[\leadsto x + \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right) \cdot \frac{y}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}}\right)}^{3}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -132000000:\\ \;\;\;\;x + \left(0.0692910599291889 \cdot y - \frac{y \cdot -0.07512208616047561}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + {\left(\sqrt[3]{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right) \cdot \frac{y}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}}\right)}^{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 79.8% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -7.2 \cdot 10^{+33}:\\ \;\;\;\;x + 0.0692910599291889 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + -0.07795002554762624\right) \cdot \frac{y}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), -0.279195317918525\right)}}{3.350343815022304 + z \cdot \left(z + 6.012459259764103\right)}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -7.2e+33)
   (+ x (* 0.0692910599291889 y))
   (+
    x
    (/
     (*
      (+
       (pow (* z (fma z 0.0692910599291889 0.4917317610505968)) 2.0)
       -0.07795002554762624)
      (/
       y
       (fma
        z
        (fma z 0.0692910599291889 0.4917317610505968)
        -0.279195317918525)))
     (+ 3.350343815022304 (* z (+ z 6.012459259764103)))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -7.2e+33) {
		tmp = x + (0.0692910599291889 * y);
	} else {
		tmp = x + (((pow((z * fma(z, 0.0692910599291889, 0.4917317610505968)), 2.0) + -0.07795002554762624) * (y / fma(z, fma(z, 0.0692910599291889, 0.4917317610505968), -0.279195317918525))) / (3.350343815022304 + (z * (z + 6.012459259764103))));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (z <= -7.2e+33)
		tmp = Float64(x + Float64(0.0692910599291889 * y));
	else
		tmp = Float64(x + Float64(Float64(Float64((Float64(z * fma(z, 0.0692910599291889, 0.4917317610505968)) ^ 2.0) + -0.07795002554762624) * Float64(y / fma(z, fma(z, 0.0692910599291889, 0.4917317610505968), -0.279195317918525))) / Float64(3.350343815022304 + Float64(z * Float64(z + 6.012459259764103)))));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[z, -7.2e+33], N[(x + N[(0.0692910599291889 * y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(N[Power[N[(z * N[(z * 0.0692910599291889 + 0.4917317610505968), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + -0.07795002554762624), $MachinePrecision] * N[(y / N[(z * N[(z * 0.0692910599291889 + 0.4917317610505968), $MachinePrecision] + -0.279195317918525), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(3.350343815022304 + N[(z * N[(z + 6.012459259764103), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+33}:\\
\;\;\;\;x + 0.0692910599291889 \cdot y\\

\mathbf{else}:\\
\;\;\;\;x + \frac{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + -0.07795002554762624\right) \cdot \frac{y}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), -0.279195317918525\right)}}{3.350343815022304 + z \cdot \left(z + 6.012459259764103\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.2000000000000005e33

    1. Initial program 25.5%

      \[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
    2. Step-by-step derivation
      1. +-commutative25.5%

        \[\leadsto \color{blue}{\frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} + x} \]
      2. associate-/l*51.6%

        \[\leadsto \color{blue}{y \cdot \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}} + x \]
      3. fma-define51.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right)} \]
      4. remove-double-neg51.6%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-\left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}, x\right) \]
      5. remove-double-neg51.6%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}}, x\right) \]
      6. *-commutative51.6%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right)} + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
      7. fma-define51.6%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\mathsf{fma}\left(z, z \cdot 0.0692910599291889 + 0.4917317610505968, 0.279195317918525\right)}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
      8. fma-define51.6%

        \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)}, 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
      9. *-commutative51.6%

        \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{z \cdot \left(z + 6.012459259764103\right)} + 3.350343815022304}, x\right) \]
      10. fma-define51.6%

        \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}}, x\right) \]
    3. Simplified51.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.6%

      \[\leadsto \color{blue}{x + 0.0692910599291889 \cdot y} \]
    6. Step-by-step derivation
      1. +-commutative99.6%

        \[\leadsto \color{blue}{0.0692910599291889 \cdot y + x} \]
    7. Simplified99.6%

      \[\leadsto \color{blue}{0.0692910599291889 \cdot y + x} \]

    if -7.2000000000000005e33 < z

    1. Initial program 83.1%

      \[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative83.1%

        \[\leadsto x + \frac{\color{blue}{\left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right) \cdot y}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      2. flip-+79.2%

        \[\leadsto x + \frac{\color{blue}{\frac{\left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z\right) \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z\right) - 0.279195317918525 \cdot 0.279195317918525}{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z - 0.279195317918525}} \cdot y}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      3. associate-*l/77.5%

        \[\leadsto x + \frac{\color{blue}{\frac{\left(\left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z\right) \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z\right) - 0.279195317918525 \cdot 0.279195317918525\right) \cdot y}{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z - 0.279195317918525}}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      4. sub-neg77.5%

        \[\leadsto x + \frac{\frac{\color{blue}{\left(\left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z\right) \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z\right) + \left(-0.279195317918525 \cdot 0.279195317918525\right)\right)} \cdot y}{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z - 0.279195317918525}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      5. fma-define77.5%

        \[\leadsto x + \frac{\frac{\left(\left(\color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)} \cdot z\right) \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z\right) + \left(-0.279195317918525 \cdot 0.279195317918525\right)\right) \cdot y}{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z - 0.279195317918525}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      6. fma-define77.5%

        \[\leadsto x + \frac{\frac{\left(\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right) \cdot z\right) \cdot \left(\color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)} \cdot z\right) + \left(-0.279195317918525 \cdot 0.279195317918525\right)\right) \cdot y}{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z - 0.279195317918525}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      7. pow277.5%

        \[\leadsto x + \frac{\frac{\left(\color{blue}{{\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right) \cdot z\right)}^{2}} + \left(-0.279195317918525 \cdot 0.279195317918525\right)\right) \cdot y}{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z - 0.279195317918525}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      8. *-commutative77.5%

        \[\leadsto x + \frac{\frac{\left({\color{blue}{\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}}^{2} + \left(-0.279195317918525 \cdot 0.279195317918525\right)\right) \cdot y}{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z - 0.279195317918525}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      9. metadata-eval77.8%

        \[\leadsto x + \frac{\frac{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + \left(-\color{blue}{0.07795002554762624}\right)\right) \cdot y}{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z - 0.279195317918525}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      10. metadata-eval77.8%

        \[\leadsto x + \frac{\frac{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + \color{blue}{-0.07795002554762624}\right) \cdot y}{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z - 0.279195317918525}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      11. fma-define77.8%

        \[\leadsto x + \frac{\frac{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + -0.07795002554762624\right) \cdot y}{\color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)} \cdot z - 0.279195317918525}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      12. *-commutative77.8%

        \[\leadsto x + \frac{\frac{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + -0.07795002554762624\right) \cdot y}{\color{blue}{z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)} - 0.279195317918525}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      13. fma-neg77.8%

        \[\leadsto x + \frac{\frac{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + -0.07795002554762624\right) \cdot y}{\color{blue}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), -0.279195317918525\right)}}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
      14. metadata-eval77.8%

        \[\leadsto x + \frac{\frac{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + -0.07795002554762624\right) \cdot y}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), \color{blue}{-0.279195317918525}\right)}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
    4. Applied egg-rr77.8%

      \[\leadsto x + \frac{\color{blue}{\frac{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + -0.07795002554762624\right) \cdot y}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), -0.279195317918525\right)}}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
    5. Step-by-step derivation
      1. associate-/l*79.2%

        \[\leadsto x + \frac{\color{blue}{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + -0.07795002554762624\right) \cdot \frac{y}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), -0.279195317918525\right)}}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
    6. Simplified79.2%

      \[\leadsto x + \frac{\color{blue}{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + -0.07795002554762624\right) \cdot \frac{y}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), -0.279195317918525\right)}}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.2 \cdot 10^{+33}:\\ \;\;\;\;x + 0.0692910599291889 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left({\left(z \cdot \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)\right)}^{2} + -0.07795002554762624\right) \cdot \frac{y}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), -0.279195317918525\right)}}{3.350343815022304 + z \cdot \left(z + 6.012459259764103\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 55.6% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 5.6 \cdot 10^{+60}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.08333333333333323\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 5.6e+60) x (* y 0.08333333333333323)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 5.6e+60) {
		tmp = x;
	} else {
		tmp = y * 0.08333333333333323;
	}
	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 (y <= 5.6d+60) then
        tmp = x
    else
        tmp = y * 0.08333333333333323d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 5.6e+60) {
		tmp = x;
	} else {
		tmp = y * 0.08333333333333323;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 5.6e+60:
		tmp = x
	else:
		tmp = y * 0.08333333333333323
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 5.6e+60)
		tmp = x;
	else
		tmp = Float64(y * 0.08333333333333323);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 5.6e+60)
		tmp = x;
	else
		tmp = y * 0.08333333333333323;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 5.6e+60], x, N[(y * 0.08333333333333323), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.6 \cdot 10^{+60}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;y \cdot 0.08333333333333323\\


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

    1. Initial program 72.9%

      \[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
    2. Step-by-step derivation
      1. +-commutative72.9%

        \[\leadsto \color{blue}{\frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} + x} \]
      2. associate-/l*79.3%

        \[\leadsto \color{blue}{y \cdot \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}} + x \]
      3. fma-define79.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right)} \]
      4. remove-double-neg79.3%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-\left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}, x\right) \]
      5. remove-double-neg79.3%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}}, x\right) \]
      6. *-commutative79.3%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right)} + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
      7. fma-define79.3%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\mathsf{fma}\left(z, z \cdot 0.0692910599291889 + 0.4917317610505968, 0.279195317918525\right)}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
      8. fma-define79.3%

        \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)}, 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
      9. *-commutative79.3%

        \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{z \cdot \left(z + 6.012459259764103\right)} + 3.350343815022304}, x\right) \]
      10. fma-define79.3%

        \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}}, x\right) \]
    3. Simplified79.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 54.2%

      \[\leadsto \color{blue}{x} \]

    if 5.6e60 < y

    1. Initial program 63.2%

      \[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
    2. Step-by-step derivation
      1. +-commutative63.2%

        \[\leadsto \color{blue}{\frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} + x} \]
      2. associate-/l*76.2%

        \[\leadsto \color{blue}{y \cdot \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}} + x \]
      3. fma-define76.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right)} \]
      4. remove-double-neg76.2%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-\left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}, x\right) \]
      5. remove-double-neg76.2%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}}, x\right) \]
      6. *-commutative76.2%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right)} + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
      7. fma-define76.2%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\mathsf{fma}\left(z, z \cdot 0.0692910599291889 + 0.4917317610505968, 0.279195317918525\right)}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
      8. fma-define76.2%

        \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)}, 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
      9. *-commutative76.2%

        \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{z \cdot \left(z + 6.012459259764103\right)} + 3.350343815022304}, x\right) \]
      10. fma-define76.2%

        \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}}, x\right) \]
    3. Simplified76.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 70.1%

      \[\leadsto \color{blue}{x + 0.08333333333333323 \cdot y} \]
    6. Step-by-step derivation
      1. +-commutative70.1%

        \[\leadsto \color{blue}{0.08333333333333323 \cdot y + x} \]
    7. Simplified70.1%

      \[\leadsto \color{blue}{0.08333333333333323 \cdot y + x} \]
    8. Taylor expanded in y around inf 51.8%

      \[\leadsto \color{blue}{0.08333333333333323 \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.6 \cdot 10^{+60}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.08333333333333323\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 79.5% accurate, 4.2× speedup?

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

\\
x + 0.0692910599291889 \cdot y
\end{array}
Derivation
  1. Initial program 71.0%

    \[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
  2. Step-by-step derivation
    1. +-commutative71.0%

      \[\leadsto \color{blue}{\frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} + x} \]
    2. associate-/l*78.7%

      \[\leadsto \color{blue}{y \cdot \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}} + x \]
    3. fma-define78.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right)} \]
    4. remove-double-neg78.7%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{-\left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}, x\right) \]
    5. remove-double-neg78.7%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}}, x\right) \]
    6. *-commutative78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right)} + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
    7. fma-define78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\mathsf{fma}\left(z, z \cdot 0.0692910599291889 + 0.4917317610505968, 0.279195317918525\right)}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
    8. fma-define78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)}, 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
    9. *-commutative78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{z \cdot \left(z + 6.012459259764103\right)} + 3.350343815022304}, x\right) \]
    10. fma-define78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}}, x\right) \]
  3. Simplified78.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in z around inf 76.3%

    \[\leadsto \color{blue}{x + 0.0692910599291889 \cdot y} \]
  6. Step-by-step derivation
    1. +-commutative76.3%

      \[\leadsto \color{blue}{0.0692910599291889 \cdot y + x} \]
  7. Simplified76.3%

    \[\leadsto \color{blue}{0.0692910599291889 \cdot y + x} \]
  8. Final simplification76.3%

    \[\leadsto x + 0.0692910599291889 \cdot y \]
  9. Add Preprocessing

Alternative 5: 79.2% accurate, 4.2× speedup?

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

\\
x + y \cdot 0.08333333333333323
\end{array}
Derivation
  1. Initial program 71.0%

    \[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
  2. Step-by-step derivation
    1. +-commutative71.0%

      \[\leadsto \color{blue}{\frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} + x} \]
    2. associate-/l*78.7%

      \[\leadsto \color{blue}{y \cdot \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}} + x \]
    3. fma-define78.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right)} \]
    4. remove-double-neg78.7%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{-\left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}, x\right) \]
    5. remove-double-neg78.7%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}}, x\right) \]
    6. *-commutative78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right)} + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
    7. fma-define78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\mathsf{fma}\left(z, z \cdot 0.0692910599291889 + 0.4917317610505968, 0.279195317918525\right)}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
    8. fma-define78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)}, 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
    9. *-commutative78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{z \cdot \left(z + 6.012459259764103\right)} + 3.350343815022304}, x\right) \]
    10. fma-define78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}}, x\right) \]
  3. Simplified78.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in z around 0 79.6%

    \[\leadsto \color{blue}{x + 0.08333333333333323 \cdot y} \]
  6. Step-by-step derivation
    1. +-commutative79.6%

      \[\leadsto \color{blue}{0.08333333333333323 \cdot y + x} \]
  7. Simplified79.6%

    \[\leadsto \color{blue}{0.08333333333333323 \cdot y + x} \]
  8. Final simplification79.6%

    \[\leadsto x + y \cdot 0.08333333333333323 \]
  9. Add Preprocessing

Alternative 6: 50.8% accurate, 21.0× speedup?

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

\\
x
\end{array}
Derivation
  1. Initial program 71.0%

    \[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \]
  2. Step-by-step derivation
    1. +-commutative71.0%

      \[\leadsto \color{blue}{\frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} + x} \]
    2. associate-/l*78.7%

      \[\leadsto \color{blue}{y \cdot \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}} + x \]
    3. fma-define78.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right)} \]
    4. remove-double-neg78.7%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{-\left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}, x\right) \]
    5. remove-double-neg78.7%

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}}, x\right) \]
    6. *-commutative78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right)} + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
    7. fma-define78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\mathsf{fma}\left(z, z \cdot 0.0692910599291889 + 0.4917317610505968, 0.279195317918525\right)}}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
    8. fma-define78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right)}, 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}, x\right) \]
    9. *-commutative78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{z \cdot \left(z + 6.012459259764103\right)} + 3.350343815022304}, x\right) \]
    10. fma-define78.7%

      \[\leadsto \mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\color{blue}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}}, x\right) \]
  3. Simplified78.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in y around 0 47.7%

    \[\leadsto \color{blue}{x} \]
  6. Final simplification47.7%

    \[\leadsto x \]
  7. Add Preprocessing

Developer target: 99.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\frac{0.07512208616047561}{z} + 0.0692910599291889\right) \cdot y - \left(\frac{0.40462203869992125 \cdot y}{z \cdot z} - x\right)\\ \mathbf{if}\;z < -8120153.652456675:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z < 6.576118972787377 \cdot 10^{+20}:\\ \;\;\;\;x + \left(y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)\right) \cdot \frac{1}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0
         (-
          (* (+ (/ 0.07512208616047561 z) 0.0692910599291889) y)
          (- (/ (* 0.40462203869992125 y) (* z z)) x))))
   (if (< z -8120153.652456675)
     t_0
     (if (< z 6.576118972787377e+20)
       (+
        x
        (*
         (*
          y
          (+
           (* (+ (* z 0.0692910599291889) 0.4917317610505968) z)
           0.279195317918525))
         (/ 1.0 (+ (* (+ z 6.012459259764103) z) 3.350343815022304))))
       t_0))))
double code(double x, double y, double z) {
	double t_0 = (((0.07512208616047561 / z) + 0.0692910599291889) * y) - (((0.40462203869992125 * y) / (z * z)) - x);
	double tmp;
	if (z < -8120153.652456675) {
		tmp = t_0;
	} else if (z < 6.576118972787377e+20) {
		tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) * (1.0 / (((z + 6.012459259764103) * z) + 3.350343815022304)));
	} 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) :: tmp
    t_0 = (((0.07512208616047561d0 / z) + 0.0692910599291889d0) * y) - (((0.40462203869992125d0 * y) / (z * z)) - x)
    if (z < (-8120153.652456675d0)) then
        tmp = t_0
    else if (z < 6.576118972787377d+20) then
        tmp = x + ((y * ((((z * 0.0692910599291889d0) + 0.4917317610505968d0) * z) + 0.279195317918525d0)) * (1.0d0 / (((z + 6.012459259764103d0) * z) + 3.350343815022304d0)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (((0.07512208616047561 / z) + 0.0692910599291889) * y) - (((0.40462203869992125 * y) / (z * z)) - x);
	double tmp;
	if (z < -8120153.652456675) {
		tmp = t_0;
	} else if (z < 6.576118972787377e+20) {
		tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) * (1.0 / (((z + 6.012459259764103) * z) + 3.350343815022304)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (((0.07512208616047561 / z) + 0.0692910599291889) * y) - (((0.40462203869992125 * y) / (z * z)) - x)
	tmp = 0
	if z < -8120153.652456675:
		tmp = t_0
	elif z < 6.576118972787377e+20:
		tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) * (1.0 / (((z + 6.012459259764103) * z) + 3.350343815022304)))
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(Float64(Float64(0.07512208616047561 / z) + 0.0692910599291889) * y) - Float64(Float64(Float64(0.40462203869992125 * y) / Float64(z * z)) - x))
	tmp = 0.0
	if (z < -8120153.652456675)
		tmp = t_0;
	elseif (z < 6.576118972787377e+20)
		tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) * Float64(1.0 / Float64(Float64(Float64(z + 6.012459259764103) * z) + 3.350343815022304))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (((0.07512208616047561 / z) + 0.0692910599291889) * y) - (((0.40462203869992125 * y) / (z * z)) - x);
	tmp = 0.0;
	if (z < -8120153.652456675)
		tmp = t_0;
	elseif (z < 6.576118972787377e+20)
		tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) * (1.0 / (((z + 6.012459259764103) * z) + 3.350343815022304)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(0.07512208616047561 / z), $MachinePrecision] + 0.0692910599291889), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(0.40462203869992125 * y), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -8120153.652456675], t$95$0, If[Less[z, 6.576118972787377e+20], N[(x + N[(N[(y * N[(N[(N[(N[(z * 0.0692910599291889), $MachinePrecision] + 0.4917317610505968), $MachinePrecision] * z), $MachinePrecision] + 0.279195317918525), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(N[(z + 6.012459259764103), $MachinePrecision] * z), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\frac{0.07512208616047561}{z} + 0.0692910599291889\right) \cdot y - \left(\frac{0.40462203869992125 \cdot y}{z \cdot z} - x\right)\\
\mathbf{if}\;z < -8120153.652456675:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z < 6.576118972787377 \cdot 10^{+20}:\\
\;\;\;\;x + \left(y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)\right) \cdot \frac{1}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\\

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


\end{array}
\end{array}

Reproduce

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

  :alt
  (if (< z -8120153.652456675) (- (* (+ (/ 0.07512208616047561 z) 0.0692910599291889) y) (- (/ (* 0.40462203869992125 y) (* z z)) x)) (if (< z 6.576118972787377e+20) (+ x (* (* y (+ (* (+ (* z 0.0692910599291889) 0.4917317610505968) z) 0.279195317918525)) (/ 1.0 (+ (* (+ z 6.012459259764103) z) 3.350343815022304)))) (- (* (+ (/ 0.07512208616047561 z) 0.0692910599291889) y) (- (/ (* 0.40462203869992125 y) (* z z)) x))))

  (+ x (/ (* y (+ (* (+ (* z 0.0692910599291889) 0.4917317610505968) z) 0.279195317918525)) (+ (* (+ z 6.012459259764103) z) 3.350343815022304))))