Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A

Percentage Accurate: 67.9% → 99.9%
Time: 11.0s
Alternatives: 12
Speedup: 1.2×

Specification

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

\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\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: 67.9% accurate, 1.0× speedup?

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

\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}

Alternative 1: 99.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ 0.5 \cdot \mathsf{fma}\left(x + z, \frac{x - z}{y}, y\right) \end{array} \]
(FPCore (x y z) :precision binary64 (* 0.5 (fma (+ x z) (/ (- x z) y) y)))
double code(double x, double y, double z) {
	return 0.5 * fma((x + z), ((x - z) / y), y);
}
function code(x, y, z)
	return Float64(0.5 * fma(Float64(x + z), Float64(Float64(x - z) / y), y))
end
code[x_, y_, z_] := N[(0.5 * N[(N[(x + z), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
0.5 \cdot \mathsf{fma}\left(x + z, \frac{x - z}{y}, y\right)
\end{array}
Derivation
  1. Initial program 69.8%

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
  2. Step-by-step derivation
    1. remove-double-neg69.8%

      \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
    2. distribute-lft-neg-out69.8%

      \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
    3. distribute-frac-neg269.8%

      \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
    4. distribute-frac-neg69.8%

      \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
    5. neg-mul-169.8%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
    6. distribute-lft-neg-out69.8%

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
    7. *-commutative69.8%

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
    8. distribute-lft-neg-in69.8%

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
    9. times-frac69.8%

      \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
    10. metadata-eval69.8%

      \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
    11. metadata-eval69.8%

      \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
    12. associate--l+69.8%

      \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
    13. fma-define72.1%

      \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
  3. Simplified72.1%

    \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 81.2%

    \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
  6. Step-by-step derivation
    1. associate--l+81.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
    2. div-sub86.3%

      \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
  7. Simplified86.3%

    \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
  8. Step-by-step derivation
    1. pow286.3%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
    2. unpow286.3%

      \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
    3. difference-of-squares90.7%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
  9. Applied egg-rr90.7%

    \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
  10. Step-by-step derivation
    1. +-commutative90.7%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\left(x + z\right) \cdot \left(x - z\right)}{y} + y\right)} \]
    2. associate-/l*99.9%

      \[\leadsto 0.5 \cdot \left(\color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}} + y\right) \]
    3. fma-define99.9%

      \[\leadsto 0.5 \cdot \color{blue}{\mathsf{fma}\left(x + z, \frac{x - z}{y}, y\right)} \]
  11. Applied egg-rr99.9%

    \[\leadsto 0.5 \cdot \color{blue}{\mathsf{fma}\left(x + z, \frac{x - z}{y}, y\right)} \]
  12. Add Preprocessing

Alternative 2: 53.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-282}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{-75}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{x - z}{y}\right)\\ \mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{-47}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot \left(x - z\right)\right) \cdot \frac{0.5}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= (* z z) 5e-282)
   (* 0.5 y)
   (if (<= (* z z) 4e-75)
     (* 0.5 (* x (/ (- x z) y)))
     (if (<= (* z z) 2e-47) (* 0.5 y) (* (* z (- x z)) (/ 0.5 y))))))
double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 5e-282) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 4e-75) {
		tmp = 0.5 * (x * ((x - z) / y));
	} else if ((z * z) <= 2e-47) {
		tmp = 0.5 * y;
	} else {
		tmp = (z * (x - z)) * (0.5 / y);
	}
	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 * z) <= 5d-282) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 4d-75) then
        tmp = 0.5d0 * (x * ((x - z) / y))
    else if ((z * z) <= 2d-47) then
        tmp = 0.5d0 * y
    else
        tmp = (z * (x - z)) * (0.5d0 / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 5e-282) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 4e-75) {
		tmp = 0.5 * (x * ((x - z) / y));
	} else if ((z * z) <= 2e-47) {
		tmp = 0.5 * y;
	} else {
		tmp = (z * (x - z)) * (0.5 / y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z * z) <= 5e-282:
		tmp = 0.5 * y
	elif (z * z) <= 4e-75:
		tmp = 0.5 * (x * ((x - z) / y))
	elif (z * z) <= 2e-47:
		tmp = 0.5 * y
	else:
		tmp = (z * (x - z)) * (0.5 / y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (Float64(z * z) <= 5e-282)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 4e-75)
		tmp = Float64(0.5 * Float64(x * Float64(Float64(x - z) / y)));
	elseif (Float64(z * z) <= 2e-47)
		tmp = Float64(0.5 * y);
	else
		tmp = Float64(Float64(z * Float64(x - z)) * Float64(0.5 / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z * z) <= 5e-282)
		tmp = 0.5 * y;
	elseif ((z * z) <= 4e-75)
		tmp = 0.5 * (x * ((x - z) / y));
	elseif ((z * z) <= 2e-47)
		tmp = 0.5 * y;
	else
		tmp = (z * (x - z)) * (0.5 / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-282], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 4e-75], N[(0.5 * N[(x * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e-47], N[(0.5 * y), $MachinePrecision], N[(N[(z * N[(x - z), $MachinePrecision]), $MachinePrecision] * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-282}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{-75}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x - z}{y}\right)\\

\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{-47}:\\
\;\;\;\;0.5 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z z) < 5.0000000000000001e-282 or 3.9999999999999998e-75 < (*.f64 z z) < 1.9999999999999999e-47

    1. Initial program 66.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg66.3%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out66.3%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg266.3%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg66.3%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-166.3%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out66.3%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative66.3%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in66.3%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac66.3%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval66.3%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval66.3%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+66.3%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define66.3%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified66.3%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 62.6%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative62.6%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    7. Simplified62.6%

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

    if 5.0000000000000001e-282 < (*.f64 z z) < 3.9999999999999998e-75

    1. Initial program 86.5%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg86.5%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out86.5%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg286.5%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg86.5%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-186.5%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out86.5%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative86.5%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in86.5%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac86.5%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval86.5%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval86.5%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+86.5%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define86.5%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified86.5%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 93.1%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. associate--l+93.1%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
      2. div-sub93.1%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
    7. Simplified93.1%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
    8. Step-by-step derivation
      1. pow293.1%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
      2. unpow293.1%

        \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
      3. difference-of-squares93.1%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    9. Applied egg-rr93.1%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    10. Taylor expanded in y around 0 71.0%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(x + z\right) \cdot \left(x - z\right)}{y}} \]
    11. Step-by-step derivation
      1. associate-*r/74.2%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x + z\right) \cdot \frac{x - z}{y}\right)} \]
      2. +-commutative74.2%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(z + x\right)} \cdot \frac{x - z}{y}\right) \]
    12. Simplified74.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(z + x\right) \cdot \frac{x - z}{y}\right)} \]
    13. Taylor expanded in z around 0 64.8%

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

    if 1.9999999999999999e-47 < (*.f64 z z)

    1. Initial program 68.5%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg68.5%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out68.5%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg268.5%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg68.5%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-168.5%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out68.5%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative68.5%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in68.5%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac68.5%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval68.5%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval68.5%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+68.5%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define72.5%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified72.5%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 65.9%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{2} - {z}^{2}}{y}} \]
    6. Step-by-step derivation
      1. associate-*r/65.9%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left({x}^{2} - {z}^{2}\right)}{y}} \]
      2. *-commutative65.9%

        \[\leadsto \frac{\color{blue}{\left({x}^{2} - {z}^{2}\right) \cdot 0.5}}{y} \]
      3. associate-/l*65.9%

        \[\leadsto \color{blue}{\left({x}^{2} - {z}^{2}\right) \cdot \frac{0.5}{y}} \]
    7. Simplified65.9%

      \[\leadsto \color{blue}{\left({x}^{2} - {z}^{2}\right) \cdot \frac{0.5}{y}} \]
    8. Step-by-step derivation
      1. pow281.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
      2. unpow281.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
      3. difference-of-squares88.7%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    9. Applied egg-rr73.4%

      \[\leadsto \color{blue}{\left(\left(x + z\right) \cdot \left(x - z\right)\right)} \cdot \frac{0.5}{y} \]
    10. Taylor expanded in x around 0 67.3%

      \[\leadsto \left(\color{blue}{z} \cdot \left(x - z\right)\right) \cdot \frac{0.5}{y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification65.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-282}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{-75}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{x - z}{y}\right)\\ \mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{-47}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot \left(x - z\right)\right) \cdot \frac{0.5}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 78.2% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 71.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg71.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out71.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg271.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg71.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-171.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out71.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative71.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in71.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac71.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval71.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval71.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+71.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define72.0%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified72.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 84.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. associate--l+84.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
      2. div-sub89.2%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
    7. Simplified89.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
    8. Step-by-step derivation
      1. pow289.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
      2. unpow289.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
      3. difference-of-squares91.8%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    9. Applied egg-rr91.8%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    10. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}}\right) \]
    11. Applied egg-rr99.9%

      \[\leadsto 0.5 \cdot \left(y + \color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}}\right) \]
    12. Taylor expanded in x around 0 82.9%

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

    if 1.7e151 < x

    1. Initial program 54.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg54.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out54.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg254.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg54.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-154.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out54.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative54.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in54.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac54.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval54.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval54.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+54.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define73.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified73.2%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 49.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. associate--l+49.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
      2. div-sub54.2%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
    7. Simplified54.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
    8. Step-by-step derivation
      1. pow254.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
      2. unpow254.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
      3. difference-of-squares78.3%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    9. Applied egg-rr78.3%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    10. Taylor expanded in y around 0 78.3%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(x + z\right) \cdot \left(x - z\right)}{y}} \]
    11. Step-by-step derivation
      1. associate-*r/90.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x + z\right) \cdot \frac{x - z}{y}\right)} \]
      2. +-commutative90.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(z + x\right)} \cdot \frac{x - z}{y}\right) \]
    12. Simplified90.7%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(z + x\right) \cdot \frac{x - z}{y}\right)} \]
    13. Step-by-step derivation
      1. clear-num90.7%

        \[\leadsto 0.5 \cdot \left(\left(z + x\right) \cdot \color{blue}{\frac{1}{\frac{y}{x - z}}}\right) \]
      2. associate-/r/90.8%

        \[\leadsto 0.5 \cdot \left(\left(z + x\right) \cdot \color{blue}{\left(\frac{1}{y} \cdot \left(x - z\right)\right)}\right) \]
    14. Applied egg-rr90.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.7 \cdot 10^{+151}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x - z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(x + z\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 49.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.9 \cdot 10^{-123}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x - z}{y}\right)\\

\mathbf{elif}\;y \leq 1.65 \cdot 10^{+61}:\\
\;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 2.90000000000000004e-123

    1. Initial program 74.6%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg74.6%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out74.6%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg274.6%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg74.6%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-174.6%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out74.6%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative74.6%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in74.6%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac74.6%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval74.6%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval74.6%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+74.6%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define77.1%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified77.1%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 79.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. associate--l+79.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
      2. div-sub87.3%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
    7. Simplified87.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
    8. Step-by-step derivation
      1. pow287.3%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
      2. unpow287.3%

        \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
      3. difference-of-squares91.1%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    9. Applied egg-rr91.1%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    10. Taylor expanded in y around 0 68.2%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(x + z\right) \cdot \left(x - z\right)}{y}} \]
    11. Step-by-step derivation
      1. associate-*r/73.5%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x + z\right) \cdot \frac{x - z}{y}\right)} \]
      2. +-commutative73.5%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(z + x\right)} \cdot \frac{x - z}{y}\right) \]
    12. Simplified73.5%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(z + x\right) \cdot \frac{x - z}{y}\right)} \]
    13. Taylor expanded in z around 0 43.5%

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

    if 2.90000000000000004e-123 < y < 1.6499999999999999e61

    1. Initial program 89.8%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg89.8%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out89.8%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg289.8%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg89.8%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-189.8%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out89.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative89.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in89.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac89.8%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval89.8%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval89.8%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+89.8%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define95.0%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified95.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 59.3%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{z}^{2}}{y}} \]
    6. Step-by-step derivation
      1. *-commutative59.3%

        \[\leadsto \color{blue}{\frac{{z}^{2}}{y} \cdot -0.5} \]
      2. associate-*l/59.3%

        \[\leadsto \color{blue}{\frac{{z}^{2} \cdot -0.5}{y}} \]
    7. Simplified59.3%

      \[\leadsto \color{blue}{\frac{{z}^{2} \cdot -0.5}{y}} \]
    8. Step-by-step derivation
      1. associate-/l*59.2%

        \[\leadsto \color{blue}{{z}^{2} \cdot \frac{-0.5}{y}} \]
      2. unpow259.2%

        \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \frac{-0.5}{y} \]
      3. associate-*l*64.1%

        \[\leadsto \color{blue}{z \cdot \left(z \cdot \frac{-0.5}{y}\right)} \]
    9. Applied egg-rr64.1%

      \[\leadsto \color{blue}{z \cdot \left(z \cdot \frac{-0.5}{y}\right)} \]

    if 1.6499999999999999e61 < y

    1. Initial program 42.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg42.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out42.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg242.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg42.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-142.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out42.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative42.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in42.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac42.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval42.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval42.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+42.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define42.3%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified42.3%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 58.2%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative58.2%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    7. Simplified58.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.9 \cdot 10^{-123}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{x - z}{y}\right)\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{+61}:\\ \;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 78.2% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 71.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg71.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out71.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg271.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg71.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-171.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out71.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative71.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in71.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac71.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval71.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval71.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+71.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define72.0%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified72.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 84.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. associate--l+84.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
      2. div-sub89.2%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
    7. Simplified89.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
    8. Step-by-step derivation
      1. pow289.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
      2. unpow289.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
      3. difference-of-squares91.8%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    9. Applied egg-rr91.8%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    10. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}}\right) \]
    11. Applied egg-rr99.9%

      \[\leadsto 0.5 \cdot \left(y + \color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}}\right) \]
    12. Taylor expanded in x around 0 82.9%

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

    if 1.02000000000000002e151 < x

    1. Initial program 54.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg54.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out54.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg254.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg54.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-154.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out54.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative54.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in54.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac54.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval54.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval54.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+54.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define73.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified73.2%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 49.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. associate--l+49.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
      2. div-sub54.2%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
    7. Simplified54.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
    8. Step-by-step derivation
      1. pow254.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
      2. unpow254.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
      3. difference-of-squares78.3%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    9. Applied egg-rr78.3%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    10. Taylor expanded in y around 0 78.3%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(x + z\right) \cdot \left(x - z\right)}{y}} \]
    11. Step-by-step derivation
      1. associate-*r/90.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x + z\right) \cdot \frac{x - z}{y}\right)} \]
      2. +-commutative90.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(z + x\right)} \cdot \frac{x - z}{y}\right) \]
    12. Simplified90.7%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(z + x\right) \cdot \frac{x - z}{y}\right)} \]
    13. Step-by-step derivation
      1. associate-*r*90.7%

        \[\leadsto \color{blue}{\left(0.5 \cdot \left(z + x\right)\right) \cdot \frac{x - z}{y}} \]
      2. clear-num90.7%

        \[\leadsto \left(0.5 \cdot \left(z + x\right)\right) \cdot \color{blue}{\frac{1}{\frac{y}{x - z}}} \]
      3. un-div-inv90.7%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(z + x\right)}{\frac{y}{x - z}}} \]
      4. +-commutative90.7%

        \[\leadsto \frac{0.5 \cdot \color{blue}{\left(x + z\right)}}{\frac{y}{x - z}} \]
      5. *-commutative90.7%

        \[\leadsto \frac{\color{blue}{\left(x + z\right) \cdot 0.5}}{\frac{y}{x - z}} \]
    14. Applied egg-rr90.7%

      \[\leadsto \color{blue}{\frac{\left(x + z\right) \cdot 0.5}{\frac{y}{x - z}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.02 \cdot 10^{+151}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x - z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot \left(x + z\right)}{\frac{y}{x - z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 78.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x - z}{y}\\ \mathbf{if}\;x \leq 2.56 \cdot 10^{+151}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(x + z\right) \cdot t\_0\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (- x z) y)))
   (if (<= x 2.56e+151) (* 0.5 (+ y (* z t_0))) (* 0.5 (* (+ x z) t_0)))))
double code(double x, double y, double z) {
	double t_0 = (x - z) / y;
	double tmp;
	if (x <= 2.56e+151) {
		tmp = 0.5 * (y + (z * t_0));
	} else {
		tmp = 0.5 * ((x + z) * 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 = (x - z) / y
    if (x <= 2.56d+151) then
        tmp = 0.5d0 * (y + (z * t_0))
    else
        tmp = 0.5d0 * ((x + z) * t_0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x - z) / y;
	double tmp;
	if (x <= 2.56e+151) {
		tmp = 0.5 * (y + (z * t_0));
	} else {
		tmp = 0.5 * ((x + z) * t_0);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x - z) / y
	tmp = 0
	if x <= 2.56e+151:
		tmp = 0.5 * (y + (z * t_0))
	else:
		tmp = 0.5 * ((x + z) * t_0)
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x - z) / y)
	tmp = 0.0
	if (x <= 2.56e+151)
		tmp = Float64(0.5 * Float64(y + Float64(z * t_0)));
	else
		tmp = Float64(0.5 * Float64(Float64(x + z) * t_0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x - z) / y;
	tmp = 0.0;
	if (x <= 2.56e+151)
		tmp = 0.5 * (y + (z * t_0));
	else
		tmp = 0.5 * ((x + z) * t_0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, 2.56e+151], N[(0.5 * N[(y + N[(z * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + z), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x - z}{y}\\
\mathbf{if}\;x \leq 2.56 \cdot 10^{+151}:\\
\;\;\;\;0.5 \cdot \left(y + z \cdot t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\right) \cdot t\_0\right)\\


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

    1. Initial program 71.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg71.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out71.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg271.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg71.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-171.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out71.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative71.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in71.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac71.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval71.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval71.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+71.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define72.0%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified72.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 84.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. associate--l+84.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
      2. div-sub89.2%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
    7. Simplified89.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
    8. Step-by-step derivation
      1. pow289.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
      2. unpow289.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
      3. difference-of-squares91.8%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    9. Applied egg-rr91.8%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    10. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}}\right) \]
    11. Applied egg-rr99.9%

      \[\leadsto 0.5 \cdot \left(y + \color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}}\right) \]
    12. Taylor expanded in x around 0 82.9%

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

    if 2.56000000000000013e151 < x

    1. Initial program 54.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg54.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out54.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg254.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg54.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-154.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out54.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative54.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in54.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac54.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval54.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval54.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+54.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define73.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified73.2%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 49.4%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. associate--l+49.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
      2. div-sub54.2%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
    7. Simplified54.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
    8. Step-by-step derivation
      1. pow254.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
      2. unpow254.2%

        \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
      3. difference-of-squares78.3%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    9. Applied egg-rr78.3%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    10. Taylor expanded in y around 0 78.3%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(x + z\right) \cdot \left(x - z\right)}{y}} \]
    11. Step-by-step derivation
      1. associate-*r/90.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x + z\right) \cdot \frac{x - z}{y}\right)} \]
      2. +-commutative90.7%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(z + x\right)} \cdot \frac{x - z}{y}\right) \]
    12. Simplified90.7%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(z + x\right) \cdot \frac{x - z}{y}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.56 \cdot 10^{+151}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x - z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(x + z\right) \cdot \frac{x - z}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.9% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 77.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg77.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out77.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg277.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg77.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-177.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out77.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative77.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in77.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac77.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval77.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval77.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+77.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define79.9%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified79.9%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 81.9%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
    6. Step-by-step derivation
      1. associate--l+81.9%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
      2. div-sub87.6%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
    7. Simplified87.6%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
    8. Step-by-step derivation
      1. pow287.6%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
      2. unpow287.6%

        \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
      3. difference-of-squares92.0%

        \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    9. Applied egg-rr92.0%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
    10. Taylor expanded in y around 0 66.7%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(x + z\right) \cdot \left(x - z\right)}{y}} \]
    11. Step-by-step derivation
      1. associate-*r/72.1%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x + z\right) \cdot \frac{x - z}{y}\right)} \]
      2. +-commutative72.1%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(z + x\right)} \cdot \frac{x - z}{y}\right) \]
    12. Simplified72.1%

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

    if 3.9999999999999997e168 < y

    1. Initial program 9.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg9.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out9.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg29.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg9.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-19.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out9.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative9.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in9.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac9.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval9.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval9.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+9.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define9.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified9.2%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 79.3%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative79.3%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    7. Simplified79.3%

      \[\leadsto \color{blue}{y \cdot 0.5} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification72.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4 \cdot 10^{+168}:\\ \;\;\;\;0.5 \cdot \left(\left(x + z\right) \cdot \frac{x - z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 43.3% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 9.4 \cdot 10^{+79}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{y}{0.5 \cdot \left(-z\right)}}\\


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

    1. Initial program 72.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg72.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out72.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg272.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg72.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-172.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out72.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative72.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in72.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac72.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval72.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval72.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+72.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define73.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified73.2%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 38.4%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative38.4%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    7. Simplified38.4%

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

    if 9.40000000000000045e79 < z

    1. Initial program 59.8%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg59.8%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out59.8%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg259.8%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg59.8%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-159.8%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out59.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative59.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in59.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac59.8%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval59.8%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval59.8%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+59.8%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define67.8%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified67.8%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 71.4%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{z}^{2}}{y}} \]
    6. Step-by-step derivation
      1. *-commutative71.4%

        \[\leadsto \color{blue}{\frac{{z}^{2}}{y} \cdot -0.5} \]
      2. associate-*l/71.4%

        \[\leadsto \color{blue}{\frac{{z}^{2} \cdot -0.5}{y}} \]
    7. Simplified71.4%

      \[\leadsto \color{blue}{\frac{{z}^{2} \cdot -0.5}{y}} \]
    8. Step-by-step derivation
      1. associate-/l*71.4%

        \[\leadsto \color{blue}{{z}^{2} \cdot \frac{-0.5}{y}} \]
      2. unpow271.4%

        \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \frac{-0.5}{y} \]
      3. associate-*l*77.1%

        \[\leadsto \color{blue}{z \cdot \left(z \cdot \frac{-0.5}{y}\right)} \]
    9. Applied egg-rr77.1%

      \[\leadsto \color{blue}{z \cdot \left(z \cdot \frac{-0.5}{y}\right)} \]
    10. Step-by-step derivation
      1. associate-*r/77.1%

        \[\leadsto z \cdot \color{blue}{\frac{z \cdot -0.5}{y}} \]
      2. clear-num77.1%

        \[\leadsto z \cdot \color{blue}{\frac{1}{\frac{y}{z \cdot -0.5}}} \]
    11. Applied egg-rr77.1%

      \[\leadsto z \cdot \color{blue}{\frac{1}{\frac{y}{z \cdot -0.5}}} \]
    12. Step-by-step derivation
      1. un-div-inv77.1%

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{z \cdot -0.5}}} \]
      2. frac-2neg77.1%

        \[\leadsto \color{blue}{\frac{-z}{-\frac{y}{z \cdot -0.5}}} \]
      3. distribute-neg-frac277.1%

        \[\leadsto \frac{-z}{\color{blue}{\frac{y}{-z \cdot -0.5}}} \]
      4. distribute-rgt-neg-in77.1%

        \[\leadsto \frac{-z}{\frac{y}{\color{blue}{z \cdot \left(--0.5\right)}}} \]
      5. metadata-eval77.1%

        \[\leadsto \frac{-z}{\frac{y}{z \cdot \color{blue}{0.5}}} \]
    13. Applied egg-rr77.1%

      \[\leadsto \color{blue}{\frac{-z}{\frac{y}{z \cdot 0.5}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 9.4 \cdot 10^{+79}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{y}{0.5 \cdot \left(-z\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 99.9% accurate, 1.2× speedup?

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

\\
0.5 \cdot \left(y + \left(x + z\right) \cdot \frac{x - z}{y}\right)
\end{array}
Derivation
  1. Initial program 69.8%

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
  2. Step-by-step derivation
    1. remove-double-neg69.8%

      \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
    2. distribute-lft-neg-out69.8%

      \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
    3. distribute-frac-neg269.8%

      \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
    4. distribute-frac-neg69.8%

      \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
    5. neg-mul-169.8%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
    6. distribute-lft-neg-out69.8%

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
    7. *-commutative69.8%

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
    8. distribute-lft-neg-in69.8%

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
    9. times-frac69.8%

      \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
    10. metadata-eval69.8%

      \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
    11. metadata-eval69.8%

      \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
    12. associate--l+69.8%

      \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
    13. fma-define72.1%

      \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
  3. Simplified72.1%

    \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 81.2%

    \[\leadsto 0.5 \cdot \color{blue}{\left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)} \]
  6. Step-by-step derivation
    1. associate--l+81.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + \left(\frac{{x}^{2}}{y} - \frac{{z}^{2}}{y}\right)\right)} \]
    2. div-sub86.3%

      \[\leadsto 0.5 \cdot \left(y + \color{blue}{\frac{{x}^{2} - {z}^{2}}{y}}\right) \]
  7. Simplified86.3%

    \[\leadsto 0.5 \cdot \color{blue}{\left(y + \frac{{x}^{2} - {z}^{2}}{y}\right)} \]
  8. Step-by-step derivation
    1. pow286.3%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{x \cdot x} - {z}^{2}}{y}\right) \]
    2. unpow286.3%

      \[\leadsto 0.5 \cdot \left(y + \frac{x \cdot x - \color{blue}{z \cdot z}}{y}\right) \]
    3. difference-of-squares90.7%

      \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
  9. Applied egg-rr90.7%

    \[\leadsto 0.5 \cdot \left(y + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{y}\right) \]
  10. Step-by-step derivation
    1. associate-/l*99.9%

      \[\leadsto 0.5 \cdot \left(y + \color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}}\right) \]
  11. Applied egg-rr99.9%

    \[\leadsto 0.5 \cdot \left(y + \color{blue}{\left(x + z\right) \cdot \frac{x - z}{y}}\right) \]
  12. Add Preprocessing

Alternative 10: 43.3% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.35 \cdot 10^{+79}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{else}:\\
\;\;\;\;\frac{z}{y \cdot \frac{-2}{z}}\\


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

    1. Initial program 72.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg72.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out72.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg272.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg72.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-172.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out72.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative72.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in72.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac72.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval72.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval72.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+72.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define73.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified73.2%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 38.4%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative38.4%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    7. Simplified38.4%

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

    if 1.35e79 < z

    1. Initial program 59.8%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg59.8%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out59.8%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg259.8%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg59.8%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-159.8%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out59.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative59.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in59.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac59.8%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval59.8%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval59.8%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+59.8%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define67.8%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified67.8%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 71.4%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{z}^{2}}{y}} \]
    6. Step-by-step derivation
      1. *-commutative71.4%

        \[\leadsto \color{blue}{\frac{{z}^{2}}{y} \cdot -0.5} \]
      2. associate-*l/71.4%

        \[\leadsto \color{blue}{\frac{{z}^{2} \cdot -0.5}{y}} \]
    7. Simplified71.4%

      \[\leadsto \color{blue}{\frac{{z}^{2} \cdot -0.5}{y}} \]
    8. Step-by-step derivation
      1. associate-/l*71.4%

        \[\leadsto \color{blue}{{z}^{2} \cdot \frac{-0.5}{y}} \]
      2. unpow271.4%

        \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \frac{-0.5}{y} \]
      3. associate-*l*77.1%

        \[\leadsto \color{blue}{z \cdot \left(z \cdot \frac{-0.5}{y}\right)} \]
    9. Applied egg-rr77.1%

      \[\leadsto \color{blue}{z \cdot \left(z \cdot \frac{-0.5}{y}\right)} \]
    10. Step-by-step derivation
      1. associate-*r/77.1%

        \[\leadsto z \cdot \color{blue}{\frac{z \cdot -0.5}{y}} \]
      2. clear-num77.1%

        \[\leadsto z \cdot \color{blue}{\frac{1}{\frac{y}{z \cdot -0.5}}} \]
    11. Applied egg-rr77.1%

      \[\leadsto z \cdot \color{blue}{\frac{1}{\frac{y}{z \cdot -0.5}}} \]
    12. Step-by-step derivation
      1. un-div-inv77.1%

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{z \cdot -0.5}}} \]
      2. div-inv77.1%

        \[\leadsto \frac{z}{\color{blue}{y \cdot \frac{1}{z \cdot -0.5}}} \]
      3. *-commutative77.1%

        \[\leadsto \frac{z}{y \cdot \frac{1}{\color{blue}{-0.5 \cdot z}}} \]
      4. associate-/r*77.1%

        \[\leadsto \frac{z}{y \cdot \color{blue}{\frac{\frac{1}{-0.5}}{z}}} \]
      5. metadata-eval77.1%

        \[\leadsto \frac{z}{y \cdot \frac{\color{blue}{-2}}{z}} \]
    13. Applied egg-rr77.1%

      \[\leadsto \color{blue}{\frac{z}{y \cdot \frac{-2}{z}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 1.35 \cdot 10^{+79}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{y \cdot \frac{-2}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 43.3% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 10^{+79}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\


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

    1. Initial program 72.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg72.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out72.2%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg272.2%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg72.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-172.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out72.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative72.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in72.2%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac72.2%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval72.2%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval72.2%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+72.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define73.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified73.2%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 38.4%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative38.4%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    7. Simplified38.4%

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

    if 9.99999999999999967e78 < z

    1. Initial program 59.8%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg59.8%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
      2. distribute-lft-neg-out59.8%

        \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
      3. distribute-frac-neg259.8%

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg59.8%

        \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
      5. neg-mul-159.8%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
      6. distribute-lft-neg-out59.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative59.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
      8. distribute-lft-neg-in59.8%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
      9. times-frac59.8%

        \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
      10. metadata-eval59.8%

        \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      11. metadata-eval59.8%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
      12. associate--l+59.8%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
      13. fma-define67.8%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified67.8%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 71.4%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{z}^{2}}{y}} \]
    6. Step-by-step derivation
      1. *-commutative71.4%

        \[\leadsto \color{blue}{\frac{{z}^{2}}{y} \cdot -0.5} \]
      2. associate-*l/71.4%

        \[\leadsto \color{blue}{\frac{{z}^{2} \cdot -0.5}{y}} \]
    7. Simplified71.4%

      \[\leadsto \color{blue}{\frac{{z}^{2} \cdot -0.5}{y}} \]
    8. Step-by-step derivation
      1. associate-/l*71.4%

        \[\leadsto \color{blue}{{z}^{2} \cdot \frac{-0.5}{y}} \]
      2. unpow271.4%

        \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \frac{-0.5}{y} \]
      3. associate-*l*77.1%

        \[\leadsto \color{blue}{z \cdot \left(z \cdot \frac{-0.5}{y}\right)} \]
    9. Applied egg-rr77.1%

      \[\leadsto \color{blue}{z \cdot \left(z \cdot \frac{-0.5}{y}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 10^{+79}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 34.6% accurate, 5.0× speedup?

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

\\
0.5 \cdot y
\end{array}
Derivation
  1. Initial program 69.8%

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
  2. Step-by-step derivation
    1. remove-double-neg69.8%

      \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{-\left(-y \cdot 2\right)}} \]
    2. distribute-lft-neg-out69.8%

      \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{-\color{blue}{\left(-y\right) \cdot 2}} \]
    3. distribute-frac-neg269.8%

      \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
    4. distribute-frac-neg69.8%

      \[\leadsto \color{blue}{\frac{-\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\left(-y\right) \cdot 2}} \]
    5. neg-mul-169.8%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}}{\left(-y\right) \cdot 2} \]
    6. distribute-lft-neg-out69.8%

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
    7. *-commutative69.8%

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{-\color{blue}{2 \cdot y}} \]
    8. distribute-lft-neg-in69.8%

      \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{\left(-2\right) \cdot y}} \]
    9. times-frac69.8%

      \[\leadsto \color{blue}{\frac{-1}{-2} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y}} \]
    10. metadata-eval69.8%

      \[\leadsto \frac{-1}{\color{blue}{-2}} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
    11. metadata-eval69.8%

      \[\leadsto \color{blue}{0.5} \cdot \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y} \]
    12. associate--l+69.8%

      \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x + \left(y \cdot y - z \cdot z\right)}}{y} \]
    13. fma-define72.1%

      \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
  3. Simplified72.1%

    \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{y}} \]
  4. Add Preprocessing
  5. Taylor expanded in y around inf 34.8%

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  6. Step-by-step derivation
    1. *-commutative34.8%

      \[\leadsto \color{blue}{y \cdot 0.5} \]
  7. Simplified34.8%

    \[\leadsto \color{blue}{y \cdot 0.5} \]
  8. Final simplification34.8%

    \[\leadsto 0.5 \cdot y \]
  9. Add Preprocessing

Developer Target 1: 99.8% accurate, 1.0× speedup?

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

\\
y \cdot 0.5 - \left(\frac{0.5}{y} \cdot \left(z + x\right)\right) \cdot \left(z - x\right)
\end{array}

Reproduce

?
herbie shell --seed 2024123 
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
  :precision binary64

  :alt
  (! :herbie-platform default (- (* y 1/2) (* (* (/ 1/2 y) (+ z x)) (- z x))))

  (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))