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

Percentage Accurate: 69.4% → 99.5%
Time: 9.2s
Alternatives: 12
Speedup: 1.4×

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 12 alternatives:

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

Initial Program: 69.4% 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: 99.5% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) + 0.279195317918525\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} \leq 4 \cdot 10^{+305}:\\
\;\;\;\;x + y \cdot \frac{\mathsf{fma}\left(\frac{0.24180012482592123 - {z}^{2} \cdot 0.004801250986110448}{0.4917317610505968 - z \cdot 0.0692910599291889}, z, 0.279195317918525\right)}{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot 0.0692910599291889\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 692910599291889/10000000000000000 binary64)) #s(literal 307332350656623/625000000000000 binary64)) z) #s(literal 11167812716741/40000000000000 binary64))) (+.f64 (*.f64 (+.f64 z #s(literal 6012459259764103/1000000000000000 binary64)) z) #s(literal 104698244219447/31250000000000 binary64))) < 3.9999999999999998e305

    1. Initial program 96.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. Step-by-step derivation
      1. remove-double-neg96.1%

        \[\leadsto x + \color{blue}{\left(-\left(-\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}\right)\right)} \]
      2. associate-/l*99.8%

        \[\leadsto x + \left(-\left(-\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}}\right)\right) \]
      3. distribute-rgt-neg-in99.8%

        \[\leadsto x + \left(-\color{blue}{y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}\right) \]
      4. distribute-lft-neg-in99.8%

        \[\leadsto x + \color{blue}{\left(-y\right) \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)} \]
      5. distribute-lft-neg-in99.8%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)\right)} \]
      6. distribute-rgt-neg-in99.8%

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

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

        \[\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} \]
      9. fma-define99.8%

        \[\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} \]
      10. fma-define99.8%

        \[\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. Simplified99.8%

      \[\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. fma-define99.8%

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

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

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

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

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

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

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

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

    if 3.9999999999999998e305 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 692910599291889/10000000000000000 binary64)) #s(literal 307332350656623/625000000000000 binary64)) z) #s(literal 11167812716741/40000000000000 binary64))) (+.f64 (*.f64 (+.f64 z #s(literal 6012459259764103/1000000000000000 binary64)) z) #s(literal 104698244219447/31250000000000 binary64)))

    1. Initial program 1.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. Step-by-step derivation
      1. +-commutative1.1%

        \[\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. *-commutative1.1%

        \[\leadsto \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} + x \]
      3. associate-/l*16.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right), \frac{y}{\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} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.7%

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

Alternative 2: 99.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) + 0.279195317918525\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} \leq 4 \cdot 10^{+305}:\\ \;\;\;\;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)}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<=
      (/
       (*
        y
        (+
         (* z (+ (* z 0.0692910599291889) 0.4917317610505968))
         0.279195317918525))
       (+ (* z (+ z 6.012459259764103)) 3.350343815022304))
      4e+305)
   (+
    x
    (*
     y
     (/
      (fma (fma z 0.0692910599291889 0.4917317610505968) z 0.279195317918525)
      (fma (+ z 6.012459259764103) z 3.350343815022304))))
   (+ x (* y 0.0692910599291889))))
double code(double x, double y, double z) {
	double tmp;
	if (((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) <= 4e+305) {
		tmp = x + (y * (fma(fma(z, 0.0692910599291889, 0.4917317610505968), z, 0.279195317918525) / fma((z + 6.012459259764103), z, 3.350343815022304)));
	} else {
		tmp = x + (y * 0.0692910599291889);
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (Float64(Float64(y * Float64(Float64(z * Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / Float64(Float64(z * Float64(z + 6.012459259764103)) + 3.350343815022304)) <= 4e+305)
		tmp = Float64(x + Float64(y * Float64(fma(fma(z, 0.0692910599291889, 0.4917317610505968), z, 0.279195317918525) / fma(Float64(z + 6.012459259764103), z, 3.350343815022304))));
	else
		tmp = Float64(x + Float64(y * 0.0692910599291889));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[N[(N[(y * N[(N[(z * N[(N[(z * 0.0692910599291889), $MachinePrecision] + 0.4917317610505968), $MachinePrecision]), $MachinePrecision] + 0.279195317918525), $MachinePrecision]), $MachinePrecision] / N[(N[(z * N[(z + 6.012459259764103), $MachinePrecision]), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision], 4e+305], N[(x + N[(y * N[(N[(N[(z * 0.0692910599291889 + 0.4917317610505968), $MachinePrecision] * z + 0.279195317918525), $MachinePrecision] / N[(N[(z + 6.012459259764103), $MachinePrecision] * z + 3.350343815022304), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) + 0.279195317918525\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} \leq 4 \cdot 10^{+305}:\\
\;\;\;\;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)}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot 0.0692910599291889\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 692910599291889/10000000000000000 binary64)) #s(literal 307332350656623/625000000000000 binary64)) z) #s(literal 11167812716741/40000000000000 binary64))) (+.f64 (*.f64 (+.f64 z #s(literal 6012459259764103/1000000000000000 binary64)) z) #s(literal 104698244219447/31250000000000 binary64))) < 3.9999999999999998e305

    1. Initial program 96.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. Step-by-step derivation
      1. remove-double-neg96.1%

        \[\leadsto x + \color{blue}{\left(-\left(-\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}\right)\right)} \]
      2. associate-/l*99.8%

        \[\leadsto x + \left(-\left(-\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}}\right)\right) \]
      3. distribute-rgt-neg-in99.8%

        \[\leadsto x + \left(-\color{blue}{y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}\right) \]
      4. distribute-lft-neg-in99.8%

        \[\leadsto x + \color{blue}{\left(-y\right) \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)} \]
      5. distribute-lft-neg-in99.8%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)\right)} \]
      6. distribute-rgt-neg-in99.8%

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

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

        \[\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} \]
      9. fma-define99.8%

        \[\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} \]
      10. fma-define99.8%

        \[\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. Simplified99.8%

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

    if 3.9999999999999998e305 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 692910599291889/10000000000000000 binary64)) #s(literal 307332350656623/625000000000000 binary64)) z) #s(literal 11167812716741/40000000000000 binary64))) (+.f64 (*.f64 (+.f64 z #s(literal 6012459259764103/1000000000000000 binary64)) z) #s(literal 104698244219447/31250000000000 binary64)))

    1. Initial program 1.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. Step-by-step derivation
      1. +-commutative1.1%

        \[\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. *-commutative1.1%

        \[\leadsto \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} + x \]
      3. associate-/l*16.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right), \frac{y}{\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} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) + 0.279195317918525\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} \leq 4 \cdot 10^{+305}:\\ \;\;\;\;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)}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -14000000000000 \lor \neg \left(z \leq 8.5 \cdot 10^{+37}\right):\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) + 0.279195317918525\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} + x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -14000000000000.0) (not (<= z 8.5e+37)))
   (+ x (* y 0.0692910599291889))
   (+
    (/
     (*
      y
      (+
       (* z (+ (* z 0.0692910599291889) 0.4917317610505968))
       0.279195317918525))
     (+ (* z (+ z 6.012459259764103)) 3.350343815022304))
    x)))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -14000000000000.0) || !(z <= 8.5e+37)) {
		tmp = x + (y * 0.0692910599291889);
	} else {
		tmp = ((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) + 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 ((z <= (-14000000000000.0d0)) .or. (.not. (z <= 8.5d+37))) then
        tmp = x + (y * 0.0692910599291889d0)
    else
        tmp = ((y * ((z * ((z * 0.0692910599291889d0) + 0.4917317610505968d0)) + 0.279195317918525d0)) / ((z * (z + 6.012459259764103d0)) + 3.350343815022304d0)) + x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -14000000000000.0) || !(z <= 8.5e+37)) {
		tmp = x + (y * 0.0692910599291889);
	} else {
		tmp = ((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) + x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -14000000000000.0) or not (z <= 8.5e+37):
		tmp = x + (y * 0.0692910599291889)
	else:
		tmp = ((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) + x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -14000000000000.0) || !(z <= 8.5e+37))
		tmp = Float64(x + Float64(y * 0.0692910599291889));
	else
		tmp = Float64(Float64(Float64(y * Float64(Float64(z * Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / Float64(Float64(z * Float64(z + 6.012459259764103)) + 3.350343815022304)) + x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -14000000000000.0) || ~((z <= 8.5e+37)))
		tmp = x + (y * 0.0692910599291889);
	else
		tmp = ((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) + x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -14000000000000.0], N[Not[LessEqual[z, 8.5e+37]], $MachinePrecision]], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * N[(N[(z * N[(N[(z * 0.0692910599291889), $MachinePrecision] + 0.4917317610505968), $MachinePrecision]), $MachinePrecision] + 0.279195317918525), $MachinePrecision]), $MachinePrecision] / N[(N[(z * N[(z + 6.012459259764103), $MachinePrecision]), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -14000000000000 \lor \neg \left(z \leq 8.5 \cdot 10^{+37}\right):\\
\;\;\;\;x + y \cdot 0.0692910599291889\\

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) + 0.279195317918525\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} + x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.4e13 or 8.4999999999999999e37 < z

    1. Initial program 35.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. +-commutative35.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. *-commutative35.2%

        \[\leadsto \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} + x \]
      3. associate-/l*48.8%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right), \frac{y}{\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 -1.4e13 < z < 8.4999999999999999e37

    1. Initial program 99.7%

      \[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. Recombined 2 regimes into one program.
  4. Final simplification99.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -14000000000000 \lor \neg \left(z \leq 8.5 \cdot 10^{+37}\right):\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) + 0.279195317918525\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} + x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -14000 \lor \neg \left(z \leq 1.2\right):\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot \left(z \cdot \left(0.0007936505811533442 + z \cdot -0.0005951669793454025\right) - 0.00277777777751721\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -14000.0) (not (<= z 1.2)))
   (+ x (* y 0.0692910599291889))
   (+
    x
    (*
     y
     (+
      0.08333333333333323
      (*
       z
       (-
        (* z (+ 0.0007936505811533442 (* z -0.0005951669793454025)))
        0.00277777777751721)))))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -14000.0) || !(z <= 1.2)) {
		tmp = x + (y * 0.0692910599291889);
	} else {
		tmp = x + (y * (0.08333333333333323 + (z * ((z * (0.0007936505811533442 + (z * -0.0005951669793454025))) - 0.00277777777751721))));
	}
	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 <= (-14000.0d0)) .or. (.not. (z <= 1.2d0))) then
        tmp = x + (y * 0.0692910599291889d0)
    else
        tmp = x + (y * (0.08333333333333323d0 + (z * ((z * (0.0007936505811533442d0 + (z * (-0.0005951669793454025d0)))) - 0.00277777777751721d0))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -14000.0) || !(z <= 1.2)) {
		tmp = x + (y * 0.0692910599291889);
	} else {
		tmp = x + (y * (0.08333333333333323 + (z * ((z * (0.0007936505811533442 + (z * -0.0005951669793454025))) - 0.00277777777751721))));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -14000.0) or not (z <= 1.2):
		tmp = x + (y * 0.0692910599291889)
	else:
		tmp = x + (y * (0.08333333333333323 + (z * ((z * (0.0007936505811533442 + (z * -0.0005951669793454025))) - 0.00277777777751721))))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -14000.0) || !(z <= 1.2))
		tmp = Float64(x + Float64(y * 0.0692910599291889));
	else
		tmp = Float64(x + Float64(y * Float64(0.08333333333333323 + Float64(z * Float64(Float64(z * Float64(0.0007936505811533442 + Float64(z * -0.0005951669793454025))) - 0.00277777777751721)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -14000.0) || ~((z <= 1.2)))
		tmp = x + (y * 0.0692910599291889);
	else
		tmp = x + (y * (0.08333333333333323 + (z * ((z * (0.0007936505811533442 + (z * -0.0005951669793454025))) - 0.00277777777751721))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -14000.0], N[Not[LessEqual[z, 1.2]], $MachinePrecision]], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(0.08333333333333323 + N[(z * N[(N[(z * N[(0.0007936505811533442 + N[(z * -0.0005951669793454025), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.00277777777751721), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -14000 \lor \neg \left(z \leq 1.2\right):\\
\;\;\;\;x + y \cdot 0.0692910599291889\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot \left(z \cdot \left(0.0007936505811533442 + z \cdot -0.0005951669793454025\right) - 0.00277777777751721\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -14000 or 1.19999999999999996 < z

    1. Initial program 39.7%

      \[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. +-commutative39.7%

        \[\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. *-commutative39.7%

        \[\leadsto \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} + x \]
      3. associate-/l*52.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right), \frac{y}{\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 -14000 < z < 1.19999999999999996

    1. Initial program 99.7%

      \[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. remove-double-neg99.7%

        \[\leadsto x + \color{blue}{\left(-\left(-\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}\right)\right)} \]
      2. associate-/l*99.9%

        \[\leadsto x + \left(-\left(-\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}}\right)\right) \]
      3. distribute-rgt-neg-in99.9%

        \[\leadsto x + \left(-\color{blue}{y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}\right) \]
      4. distribute-lft-neg-in99.9%

        \[\leadsto x + \color{blue}{\left(-y\right) \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)} \]
      5. distribute-lft-neg-in99.9%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)\right)} \]
      6. distribute-rgt-neg-in99.9%

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

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

        \[\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} \]
      9. fma-define99.9%

        \[\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} \]
      10. fma-define99.9%

        \[\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. Simplified99.9%

      \[\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 0 99.1%

      \[\leadsto x + y \cdot \color{blue}{\left(0.08333333333333323 + z \cdot \left(z \cdot \left(0.0007936505811533442 + -0.0005951669793454025 \cdot z\right) - 0.00277777777751721\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -14000 \lor \neg \left(z \leq 1.2\right):\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot \left(z \cdot \left(0.0007936505811533442 + z \cdot -0.0005951669793454025\right) - 0.00277777777751721\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.4:\\ \;\;\;\;x + \left(y \cdot 0.0692910599291889 + -0.4166096748901212 \cdot \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq 1.2:\\ \;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot \left(z \cdot 0.0007936505811533442 - 0.00277777777751721\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -4.4)
   (+ x (+ (* y 0.0692910599291889) (* -0.4166096748901212 (/ y z))))
   (if (<= z 1.2)
     (+
      x
      (*
       y
       (+
        0.08333333333333323
        (* z (- (* z 0.0007936505811533442) 0.00277777777751721)))))
     (+ x (* y 0.0692910599291889)))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.4) {
		tmp = x + ((y * 0.0692910599291889) + (-0.4166096748901212 * (y / z)));
	} else if (z <= 1.2) {
		tmp = x + (y * (0.08333333333333323 + (z * ((z * 0.0007936505811533442) - 0.00277777777751721))));
	} else {
		tmp = x + (y * 0.0692910599291889);
	}
	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 <= (-4.4d0)) then
        tmp = x + ((y * 0.0692910599291889d0) + ((-0.4166096748901212d0) * (y / z)))
    else if (z <= 1.2d0) then
        tmp = x + (y * (0.08333333333333323d0 + (z * ((z * 0.0007936505811533442d0) - 0.00277777777751721d0))))
    else
        tmp = x + (y * 0.0692910599291889d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.4) {
		tmp = x + ((y * 0.0692910599291889) + (-0.4166096748901212 * (y / z)));
	} else if (z <= 1.2) {
		tmp = x + (y * (0.08333333333333323 + (z * ((z * 0.0007936505811533442) - 0.00277777777751721))));
	} else {
		tmp = x + (y * 0.0692910599291889);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -4.4:
		tmp = x + ((y * 0.0692910599291889) + (-0.4166096748901212 * (y / z)))
	elif z <= 1.2:
		tmp = x + (y * (0.08333333333333323 + (z * ((z * 0.0007936505811533442) - 0.00277777777751721))))
	else:
		tmp = x + (y * 0.0692910599291889)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -4.4)
		tmp = Float64(x + Float64(Float64(y * 0.0692910599291889) + Float64(-0.4166096748901212 * Float64(y / z))));
	elseif (z <= 1.2)
		tmp = Float64(x + Float64(y * Float64(0.08333333333333323 + Float64(z * Float64(Float64(z * 0.0007936505811533442) - 0.00277777777751721)))));
	else
		tmp = Float64(x + Float64(y * 0.0692910599291889));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -4.4)
		tmp = x + ((y * 0.0692910599291889) + (-0.4166096748901212 * (y / z)));
	elseif (z <= 1.2)
		tmp = x + (y * (0.08333333333333323 + (z * ((z * 0.0007936505811533442) - 0.00277777777751721))));
	else
		tmp = x + (y * 0.0692910599291889);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -4.4], N[(x + N[(N[(y * 0.0692910599291889), $MachinePrecision] + N[(-0.4166096748901212 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2], N[(x + N[(y * N[(0.08333333333333323 + N[(z * N[(N[(z * 0.0007936505811533442), $MachinePrecision] - 0.00277777777751721), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 1.2:\\
\;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot \left(z \cdot 0.0007936505811533442 - 0.00277777777751721\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot 0.0692910599291889\\


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

    1. Initial program 44.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. +-commutative44.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. *-commutative44.0%

        \[\leadsto \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} + x \]
      3. associate-/l*55.9%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, \color{blue}{0.0692910599291889 \cdot z}, 0.279195317918525\right), \frac{y}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right) \]
    6. Step-by-step derivation
      1. *-commutative54.5%

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, \color{blue}{z \cdot 0.0692910599291889}, 0.279195317918525\right), \frac{y}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right) \]
    8. Taylor expanded in z around inf 98.6%

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

    if -4.4000000000000004 < z < 1.19999999999999996

    1. Initial program 99.7%

      \[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. remove-double-neg99.7%

        \[\leadsto x + \color{blue}{\left(-\left(-\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}\right)\right)} \]
      2. associate-/l*99.9%

        \[\leadsto x + \left(-\left(-\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}}\right)\right) \]
      3. distribute-rgt-neg-in99.9%

        \[\leadsto x + \left(-\color{blue}{y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}\right) \]
      4. distribute-lft-neg-in99.9%

        \[\leadsto x + \color{blue}{\left(-y\right) \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)} \]
      5. distribute-lft-neg-in99.9%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)\right)} \]
      6. distribute-rgt-neg-in99.9%

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

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

        \[\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} \]
      9. fma-define99.9%

        \[\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} \]
      10. fma-define99.9%

        \[\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. Simplified99.9%

      \[\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 0 99.5%

      \[\leadsto x + y \cdot \color{blue}{\left(0.08333333333333323 + z \cdot \left(0.0007936505811533442 \cdot z - 0.00277777777751721\right)\right)} \]

    if 1.19999999999999996 < z

    1. Initial program 36.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. +-commutative36.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. *-commutative36.9%

        \[\leadsto \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} + x \]
      3. associate-/l*49.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.0692910599291889 \cdot y + x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.4:\\ \;\;\;\;x + \left(y \cdot 0.0692910599291889 + -0.4166096748901212 \cdot \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq 1.2:\\ \;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot \left(z \cdot 0.0007936505811533442 - 0.00277777777751721\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -14000 \lor \neg \left(z \leq 1.2\right):\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot -0.00277777777751721\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -14000.0) (not (<= z 1.2)))
   (+ x (* y 0.0692910599291889))
   (+ x (* y (+ 0.08333333333333323 (* z -0.00277777777751721))))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -14000.0) || !(z <= 1.2)) {
		tmp = x + (y * 0.0692910599291889);
	} else {
		tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
	}
	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 <= (-14000.0d0)) .or. (.not. (z <= 1.2d0))) then
        tmp = x + (y * 0.0692910599291889d0)
    else
        tmp = x + (y * (0.08333333333333323d0 + (z * (-0.00277777777751721d0))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -14000.0) || !(z <= 1.2)) {
		tmp = x + (y * 0.0692910599291889);
	} else {
		tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -14000.0) or not (z <= 1.2):
		tmp = x + (y * 0.0692910599291889)
	else:
		tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -14000.0) || !(z <= 1.2))
		tmp = Float64(x + Float64(y * 0.0692910599291889));
	else
		tmp = Float64(x + Float64(y * Float64(0.08333333333333323 + Float64(z * -0.00277777777751721))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -14000.0) || ~((z <= 1.2)))
		tmp = x + (y * 0.0692910599291889);
	else
		tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -14000.0], N[Not[LessEqual[z, 1.2]], $MachinePrecision]], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(0.08333333333333323 + N[(z * -0.00277777777751721), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -14000 \lor \neg \left(z \leq 1.2\right):\\
\;\;\;\;x + y \cdot 0.0692910599291889\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot -0.00277777777751721\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -14000 or 1.19999999999999996 < z

    1. Initial program 39.7%

      \[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. +-commutative39.7%

        \[\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. *-commutative39.7%

        \[\leadsto \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} + x \]
      3. associate-/l*52.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right), \frac{y}{\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 -14000 < z < 1.19999999999999996

    1. Initial program 99.7%

      \[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. remove-double-neg99.7%

        \[\leadsto x + \color{blue}{\left(-\left(-\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}\right)\right)} \]
      2. associate-/l*99.9%

        \[\leadsto x + \left(-\left(-\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}}\right)\right) \]
      3. distribute-rgt-neg-in99.9%

        \[\leadsto x + \left(-\color{blue}{y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}\right) \]
      4. distribute-lft-neg-in99.9%

        \[\leadsto x + \color{blue}{\left(-y\right) \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)} \]
      5. distribute-lft-neg-in99.9%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)\right)} \]
      6. distribute-rgt-neg-in99.9%

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

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

        \[\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} \]
      9. fma-define99.9%

        \[\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} \]
      10. fma-define99.9%

        \[\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. Simplified99.9%

      \[\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 0 98.6%

      \[\leadsto x + y \cdot \color{blue}{\left(0.08333333333333323 + -0.00277777777751721 \cdot z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -14000 \lor \neg \left(z \leq 1.2\right):\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot -0.00277777777751721\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 99.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.2:\\ \;\;\;\;x + \left(y \cdot 0.0692910599291889 + -0.4166096748901212 \cdot \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq 1.2:\\ \;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot -0.00277777777751721\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -4.2)
   (+ x (+ (* y 0.0692910599291889) (* -0.4166096748901212 (/ y z))))
   (if (<= z 1.2)
     (+ x (* y (+ 0.08333333333333323 (* z -0.00277777777751721))))
     (+ x (* y 0.0692910599291889)))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.2) {
		tmp = x + ((y * 0.0692910599291889) + (-0.4166096748901212 * (y / z)));
	} else if (z <= 1.2) {
		tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
	} else {
		tmp = x + (y * 0.0692910599291889);
	}
	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 <= (-4.2d0)) then
        tmp = x + ((y * 0.0692910599291889d0) + ((-0.4166096748901212d0) * (y / z)))
    else if (z <= 1.2d0) then
        tmp = x + (y * (0.08333333333333323d0 + (z * (-0.00277777777751721d0))))
    else
        tmp = x + (y * 0.0692910599291889d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.2) {
		tmp = x + ((y * 0.0692910599291889) + (-0.4166096748901212 * (y / z)));
	} else if (z <= 1.2) {
		tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
	} else {
		tmp = x + (y * 0.0692910599291889);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -4.2:
		tmp = x + ((y * 0.0692910599291889) + (-0.4166096748901212 * (y / z)))
	elif z <= 1.2:
		tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)))
	else:
		tmp = x + (y * 0.0692910599291889)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -4.2)
		tmp = Float64(x + Float64(Float64(y * 0.0692910599291889) + Float64(-0.4166096748901212 * Float64(y / z))));
	elseif (z <= 1.2)
		tmp = Float64(x + Float64(y * Float64(0.08333333333333323 + Float64(z * -0.00277777777751721))));
	else
		tmp = Float64(x + Float64(y * 0.0692910599291889));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -4.2)
		tmp = x + ((y * 0.0692910599291889) + (-0.4166096748901212 * (y / z)));
	elseif (z <= 1.2)
		tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
	else
		tmp = x + (y * 0.0692910599291889);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -4.2], N[(x + N[(N[(y * 0.0692910599291889), $MachinePrecision] + N[(-0.4166096748901212 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2], N[(x + N[(y * N[(0.08333333333333323 + N[(z * -0.00277777777751721), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 1.2:\\
\;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot -0.00277777777751721\right)\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot 0.0692910599291889\\


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

    1. Initial program 44.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. +-commutative44.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. *-commutative44.0%

        \[\leadsto \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} + x \]
      3. associate-/l*55.9%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, \color{blue}{0.0692910599291889 \cdot z}, 0.279195317918525\right), \frac{y}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right) \]
    6. Step-by-step derivation
      1. *-commutative54.5%

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, \color{blue}{z \cdot 0.0692910599291889}, 0.279195317918525\right), \frac{y}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right) \]
    8. Taylor expanded in z around inf 98.6%

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

    if -4.20000000000000018 < z < 1.19999999999999996

    1. Initial program 99.7%

      \[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. remove-double-neg99.7%

        \[\leadsto x + \color{blue}{\left(-\left(-\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}\right)\right)} \]
      2. associate-/l*99.9%

        \[\leadsto x + \left(-\left(-\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}}\right)\right) \]
      3. distribute-rgt-neg-in99.9%

        \[\leadsto x + \left(-\color{blue}{y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)}\right) \]
      4. distribute-lft-neg-in99.9%

        \[\leadsto x + \color{blue}{\left(-y\right) \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)} \]
      5. distribute-lft-neg-in99.9%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(-\frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\right)\right)} \]
      6. distribute-rgt-neg-in99.9%

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

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

        \[\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} \]
      9. fma-define99.9%

        \[\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} \]
      10. fma-define99.9%

        \[\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. Simplified99.9%

      \[\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 0 99.2%

      \[\leadsto x + y \cdot \color{blue}{\left(0.08333333333333323 + -0.00277777777751721 \cdot z\right)} \]

    if 1.19999999999999996 < z

    1. Initial program 36.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. +-commutative36.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. *-commutative36.9%

        \[\leadsto \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} + x \]
      3. associate-/l*49.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.0692910599291889 \cdot y + x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.2:\\ \;\;\;\;x + \left(y \cdot 0.0692910599291889 + -0.4166096748901212 \cdot \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq 1.2:\\ \;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot -0.00277777777751721\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 98.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -14000 \lor \neg \left(z \leq 1.2\right):\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot 0.08333333333333323\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -14000.0) (not (<= z 1.2)))
   (+ x (* y 0.0692910599291889))
   (+ x (* y 0.08333333333333323))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -14000.0) || !(z <= 1.2)) {
		tmp = x + (y * 0.0692910599291889);
	} else {
		tmp = x + (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 ((z <= (-14000.0d0)) .or. (.not. (z <= 1.2d0))) then
        tmp = x + (y * 0.0692910599291889d0)
    else
        tmp = x + (y * 0.08333333333333323d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -14000.0) || !(z <= 1.2)) {
		tmp = x + (y * 0.0692910599291889);
	} else {
		tmp = x + (y * 0.08333333333333323);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -14000.0) or not (z <= 1.2):
		tmp = x + (y * 0.0692910599291889)
	else:
		tmp = x + (y * 0.08333333333333323)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -14000.0) || !(z <= 1.2))
		tmp = Float64(x + Float64(y * 0.0692910599291889));
	else
		tmp = Float64(x + Float64(y * 0.08333333333333323));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -14000.0) || ~((z <= 1.2)))
		tmp = x + (y * 0.0692910599291889);
	else
		tmp = x + (y * 0.08333333333333323);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -14000.0], N[Not[LessEqual[z, 1.2]], $MachinePrecision]], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * 0.08333333333333323), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -14000 \lor \neg \left(z \leq 1.2\right):\\
\;\;\;\;x + y \cdot 0.0692910599291889\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -14000 or 1.19999999999999996 < z

    1. Initial program 39.7%

      \[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. +-commutative39.7%

        \[\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. *-commutative39.7%

        \[\leadsto \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} + x \]
      3. associate-/l*52.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right), \frac{y}{\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 -14000 < z < 1.19999999999999996

    1. Initial program 99.7%

      \[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. +-commutative99.7%

        \[\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. *-commutative99.7%

        \[\leadsto \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} + x \]
      3. associate-/l*99.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -14000 \lor \neg \left(z \leq 1.2\right):\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot 0.08333333333333323\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 79.4% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 2.5 \cdot 10^{-280} \lor \neg \left(z \leq 2.3 \cdot 10^{-210}\right):\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.08333333333333323\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z 2.5e-280) (not (<= z 2.3e-210)))
   (+ x (* y 0.0692910599291889))
   (* y 0.08333333333333323)))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= 2.5e-280) || !(z <= 2.3e-210)) {
		tmp = x + (y * 0.0692910599291889);
	} 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 ((z <= 2.5d-280) .or. (.not. (z <= 2.3d-210))) then
        tmp = x + (y * 0.0692910599291889d0)
    else
        tmp = y * 0.08333333333333323d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= 2.5e-280) || !(z <= 2.3e-210)) {
		tmp = x + (y * 0.0692910599291889);
	} else {
		tmp = y * 0.08333333333333323;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= 2.5e-280) or not (z <= 2.3e-210):
		tmp = x + (y * 0.0692910599291889)
	else:
		tmp = y * 0.08333333333333323
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= 2.5e-280) || !(z <= 2.3e-210))
		tmp = Float64(x + Float64(y * 0.0692910599291889));
	else
		tmp = Float64(y * 0.08333333333333323);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= 2.5e-280) || ~((z <= 2.3e-210)))
		tmp = x + (y * 0.0692910599291889);
	else
		tmp = y * 0.08333333333333323;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, 2.5e-280], N[Not[LessEqual[z, 2.3e-210]], $MachinePrecision]], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision], N[(y * 0.08333333333333323), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.5 \cdot 10^{-280} \lor \neg \left(z \leq 2.3 \cdot 10^{-210}\right):\\
\;\;\;\;x + y \cdot 0.0692910599291889\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.50000000000000014e-280 or 2.3e-210 < z

    1. Initial program 67.3%

      \[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. +-commutative67.3%

        \[\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. *-commutative67.3%

        \[\leadsto \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} + x \]
      3. associate-/l*74.1%

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

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

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

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

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

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

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

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

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

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

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

    if 2.50000000000000014e-280 < z < 2.3e-210

    1. Initial program 99.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. +-commutative99.6%

        \[\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. *-commutative99.6%

        \[\leadsto \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} + x \]
      3. associate-/l*99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 2.5 \cdot 10^{-280} \lor \neg \left(z \leq 2.3 \cdot 10^{-210}\right):\\ \;\;\;\;x + y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.08333333333333323\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 60.8% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{+183} \lor \neg \left(y \leq 1.06 \cdot 10^{+129}\right):\\ \;\;\;\;y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -8.5e+183) (not (<= y 1.06e+129))) (* y 0.0692910599291889) x))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -8.5e+183) || !(y <= 1.06e+129)) {
		tmp = y * 0.0692910599291889;
	} else {
		tmp = 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 ((y <= (-8.5d+183)) .or. (.not. (y <= 1.06d+129))) then
        tmp = y * 0.0692910599291889d0
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -8.5e+183) || !(y <= 1.06e+129)) {
		tmp = y * 0.0692910599291889;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -8.5e+183) or not (y <= 1.06e+129):
		tmp = y * 0.0692910599291889
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -8.5e+183) || !(y <= 1.06e+129))
		tmp = Float64(y * 0.0692910599291889);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -8.5e+183) || ~((y <= 1.06e+129)))
		tmp = y * 0.0692910599291889;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -8.5e+183], N[Not[LessEqual[y, 1.06e+129]], $MachinePrecision]], N[(y * 0.0692910599291889), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+183} \lor \neg \left(y \leq 1.06 \cdot 10^{+129}\right):\\
\;\;\;\;y \cdot 0.0692910599291889\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.5000000000000004e183 or 1.06e129 < y

    1. Initial program 50.7%

      \[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. +-commutative50.7%

        \[\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. *-commutative50.7%

        \[\leadsto \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} + x \]
      3. associate-/l*71.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.5000000000000004e183 < y < 1.06e129

    1. Initial program 75.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. +-commutative75.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. *-commutative75.2%

        \[\leadsto \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} + x \]
      3. associate-/l*76.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{+183} \lor \neg \left(y \leq 1.06 \cdot 10^{+129}\right):\\ \;\;\;\;y \cdot 0.0692910599291889\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 62.7% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-103}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 2.3 \cdot 10^{-57}:\\
\;\;\;\;y \cdot 0.08333333333333323\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.40000000000000003e-103 or 2.3e-57 < x

    1. Initial program 67.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. +-commutative67.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. *-commutative67.2%

        \[\leadsto \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} + x \]
      3. associate-/l*73.4%

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

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

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

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

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

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

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

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

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

    if -3.40000000000000003e-103 < x < 2.3e-57

    1. Initial program 73.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. Step-by-step derivation
      1. +-commutative73.1%

        \[\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. *-commutative73.1%

        \[\leadsto \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} + x \]
      3. associate-/l*80.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.4 \cdot 10^{-103}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-57}:\\ \;\;\;\;y \cdot 0.08333333333333323\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 52.0% 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 69.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. +-commutative69.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. *-commutative69.0%

      \[\leadsto \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} + x \]
    3. associate-/l*75.4%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  6. Add Preprocessing

Developer Target 1: 99.4% 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 2024135 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, B"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< z -324806146098267/40000000) (- (* (+ (/ 7512208616047561/100000000000000000 z) 692910599291889/10000000000000000) y) (- (/ (* 323697630959937/800000000000000 y) (* z z)) x)) (if (< z 657611897278737700000) (+ x (* (* y (+ (* (+ (* z 692910599291889/10000000000000000) 307332350656623/625000000000000) z) 11167812716741/40000000000000)) (/ 1 (+ (* (+ z 6012459259764103/1000000000000000) z) 104698244219447/31250000000000)))) (- (* (+ (/ 7512208616047561/100000000000000000 z) 692910599291889/10000000000000000) y) (- (/ (* 323697630959937/800000000000000 y) (* z z)) x)))))

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