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

Percentage Accurate: 68.9% → 94.1%
Time: 9.3s
Alternatives: 10
Speedup: 0.8×

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

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

Initial Program: 68.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: 94.1% accurate, 0.0× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)\\ \mathbf{if}\;x \leq 4.5 \cdot 10^{+185}:\\ \;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(t_0 \cdot \frac{0.5}{y}\right)\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (hypot y (hypot x z))))
   (if (<= x 4.5e+185)
     (+ (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (* x (/ x y))))
     (* t_0 (* t_0 (/ 0.5 y))))))
x = abs(x);
double code(double x, double y, double z) {
	double t_0 = hypot(y, hypot(x, z));
	double tmp;
	if (x <= 4.5e+185) {
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
	} else {
		tmp = t_0 * (t_0 * (0.5 / y));
	}
	return tmp;
}
x = Math.abs(x);
public static double code(double x, double y, double z) {
	double t_0 = Math.hypot(y, Math.hypot(x, z));
	double tmp;
	if (x <= 4.5e+185) {
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
	} else {
		tmp = t_0 * (t_0 * (0.5 / y));
	}
	return tmp;
}
x = abs(x)
def code(x, y, z):
	t_0 = math.hypot(y, math.hypot(x, z))
	tmp = 0
	if x <= 4.5e+185:
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)))
	else:
		tmp = t_0 * (t_0 * (0.5 / y))
	return tmp
x = abs(x)
function code(x, y, z)
	t_0 = hypot(y, hypot(x, z))
	tmp = 0.0
	if (x <= 4.5e+185)
		tmp = Float64(Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))) + Float64(0.5 * Float64(x * Float64(x / y))));
	else
		tmp = Float64(t_0 * Float64(t_0 * Float64(0.5 / y)));
	end
	return tmp
end
x = abs(x)
function tmp_2 = code(x, y, z)
	t_0 = hypot(y, hypot(x, z));
	tmp = 0.0;
	if (x <= 4.5e+185)
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
	else
		tmp = t_0 * (t_0 * (0.5 / y));
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[y ^ 2 + N[Sqrt[x ^ 2 + z ^ 2], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[x, 4.5e+185], N[(N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$0 * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{+185}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\

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


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

    1. Initial program 65.4%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.5000000000000002e185 < x

    1. Initial program 80.0%

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

        \[\leadsto \color{blue}{\left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right) \cdot \frac{1}{y \cdot 2}} \]
      2. add-sqr-sqrt80.0%

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

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

      \[\leadsto \color{blue}{\mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right) \cdot \left(\mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right) \cdot \frac{0.5}{y}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.5 \cdot 10^{+185}:\\ \;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right) \cdot \left(\mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right) \cdot \frac{0.5}{y}\right)\\ \end{array} \]

Alternative 2: 94.2% accurate, 0.0× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)\\ \mathbf{if}\;x \leq 2.2 \cdot 10^{+158}:\\ \;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{y} \cdot \frac{t_0}{2}\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (hypot y (hypot x z))))
   (if (<= x 2.2e+158)
     (+ (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (* x (/ x y))))
     (* (/ t_0 y) (/ t_0 2.0)))))
x = abs(x);
double code(double x, double y, double z) {
	double t_0 = hypot(y, hypot(x, z));
	double tmp;
	if (x <= 2.2e+158) {
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
	} else {
		tmp = (t_0 / y) * (t_0 / 2.0);
	}
	return tmp;
}
x = Math.abs(x);
public static double code(double x, double y, double z) {
	double t_0 = Math.hypot(y, Math.hypot(x, z));
	double tmp;
	if (x <= 2.2e+158) {
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
	} else {
		tmp = (t_0 / y) * (t_0 / 2.0);
	}
	return tmp;
}
x = abs(x)
def code(x, y, z):
	t_0 = math.hypot(y, math.hypot(x, z))
	tmp = 0
	if x <= 2.2e+158:
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)))
	else:
		tmp = (t_0 / y) * (t_0 / 2.0)
	return tmp
x = abs(x)
function code(x, y, z)
	t_0 = hypot(y, hypot(x, z))
	tmp = 0.0
	if (x <= 2.2e+158)
		tmp = Float64(Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))) + Float64(0.5 * Float64(x * Float64(x / y))));
	else
		tmp = Float64(Float64(t_0 / y) * Float64(t_0 / 2.0));
	end
	return tmp
end
x = abs(x)
function tmp_2 = code(x, y, z)
	t_0 = hypot(y, hypot(x, z));
	tmp = 0.0;
	if (x <= 2.2e+158)
		tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
	else
		tmp = (t_0 / y) * (t_0 / 2.0);
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[y ^ 2 + N[Sqrt[x ^ 2 + z ^ 2], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[x, 2.2e+158], N[(N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / y), $MachinePrecision] * N[(t$95$0 / 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)\\
\mathbf{if}\;x \leq 2.2 \cdot 10^{+158}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{t_0}{y} \cdot \frac{t_0}{2}\\


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

    1. Initial program 66.0%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 82.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.2000000000000001e158 < x

    1. Initial program 72.0%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt72.0%

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)}{y} \cdot \frac{\mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)}{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.2 \cdot 10^{+158}:\\ \;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)}{y} \cdot \frac{\mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)}{2}\\ \end{array} \]

Alternative 3: 52.5% accurate, 0.4× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-280}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 10^{+38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \cdot z \leq 10^{+60}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+115}:\\ \;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\ \mathbf{elif}\;z \cdot z \leq 10^{+180}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+190}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \left(z \cdot \frac{1}{y}\right)\right)\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* x (/ 0.5 y)))))
   (if (<= (* z z) 2e-280)
     (* 0.5 y)
     (if (<= (* z z) 1e+38)
       t_0
       (if (<= (* z z) 1e+60)
         (* 0.5 y)
         (if (<= (* z z) 5e+115)
           (/ (* x (* x 0.5)) y)
           (if (<= (* z z) 1e+180)
             (* 0.5 y)
             (if (<= (* z z) 2e+190) t_0 (* -0.5 (* z (* z (/ 1.0 y))))))))))))
x = abs(x);
double code(double x, double y, double z) {
	double t_0 = x * (x * (0.5 / y));
	double tmp;
	if ((z * z) <= 2e-280) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 1e+38) {
		tmp = t_0;
	} else if ((z * z) <= 1e+60) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 5e+115) {
		tmp = (x * (x * 0.5)) / y;
	} else if ((z * z) <= 1e+180) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 2e+190) {
		tmp = t_0;
	} else {
		tmp = -0.5 * (z * (z * (1.0 / y)));
	}
	return tmp;
}
NOTE: x should be positive before calling this function
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 * (x * (0.5d0 / y))
    if ((z * z) <= 2d-280) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 1d+38) then
        tmp = t_0
    else if ((z * z) <= 1d+60) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 5d+115) then
        tmp = (x * (x * 0.5d0)) / y
    else if ((z * z) <= 1d+180) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 2d+190) then
        tmp = t_0
    else
        tmp = (-0.5d0) * (z * (z * (1.0d0 / y)))
    end if
    code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
	double t_0 = x * (x * (0.5 / y));
	double tmp;
	if ((z * z) <= 2e-280) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 1e+38) {
		tmp = t_0;
	} else if ((z * z) <= 1e+60) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 5e+115) {
		tmp = (x * (x * 0.5)) / y;
	} else if ((z * z) <= 1e+180) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 2e+190) {
		tmp = t_0;
	} else {
		tmp = -0.5 * (z * (z * (1.0 / y)));
	}
	return tmp;
}
x = abs(x)
def code(x, y, z):
	t_0 = x * (x * (0.5 / y))
	tmp = 0
	if (z * z) <= 2e-280:
		tmp = 0.5 * y
	elif (z * z) <= 1e+38:
		tmp = t_0
	elif (z * z) <= 1e+60:
		tmp = 0.5 * y
	elif (z * z) <= 5e+115:
		tmp = (x * (x * 0.5)) / y
	elif (z * z) <= 1e+180:
		tmp = 0.5 * y
	elif (z * z) <= 2e+190:
		tmp = t_0
	else:
		tmp = -0.5 * (z * (z * (1.0 / y)))
	return tmp
x = abs(x)
function code(x, y, z)
	t_0 = Float64(x * Float64(x * Float64(0.5 / y)))
	tmp = 0.0
	if (Float64(z * z) <= 2e-280)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 1e+38)
		tmp = t_0;
	elseif (Float64(z * z) <= 1e+60)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 5e+115)
		tmp = Float64(Float64(x * Float64(x * 0.5)) / y);
	elseif (Float64(z * z) <= 1e+180)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 2e+190)
		tmp = t_0;
	else
		tmp = Float64(-0.5 * Float64(z * Float64(z * Float64(1.0 / y))));
	end
	return tmp
end
x = abs(x)
function tmp_2 = code(x, y, z)
	t_0 = x * (x * (0.5 / y));
	tmp = 0.0;
	if ((z * z) <= 2e-280)
		tmp = 0.5 * y;
	elseif ((z * z) <= 1e+38)
		tmp = t_0;
	elseif ((z * z) <= 1e+60)
		tmp = 0.5 * y;
	elseif ((z * z) <= 5e+115)
		tmp = (x * (x * 0.5)) / y;
	elseif ((z * z) <= 1e+180)
		tmp = 0.5 * y;
	elseif ((z * z) <= 2e+190)
		tmp = t_0;
	else
		tmp = -0.5 * (z * (z * (1.0 / y)));
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 2e-280], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+38], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 1e+60], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+115], N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+180], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+190], t$95$0, N[(-0.5 * N[(z * N[(z * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-280}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 10^{+38}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \cdot z \leq 10^{+60}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\

\mathbf{elif}\;z \cdot z \leq 10^{+180}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+190}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z z) < 1.9999999999999999e-280 or 9.99999999999999977e37 < (*.f64 z z) < 9.9999999999999995e59 or 5.00000000000000008e115 < (*.f64 z z) < 1e180

    1. Initial program 59.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in y around inf 60.3%

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

    if 1.9999999999999999e-280 < (*.f64 z z) < 9.99999999999999977e37 or 1e180 < (*.f64 z z) < 2.0000000000000001e190

    1. Initial program 78.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 53.2%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified53.2%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. associate-/r/53.2%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      2. unpow253.2%

        \[\leadsto \frac{0.5}{y} \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. associate-*r*59.6%

        \[\leadsto \color{blue}{\left(\frac{0.5}{y} \cdot x\right) \cdot x} \]
    6. Applied egg-rr59.6%

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

    if 9.9999999999999995e59 < (*.f64 z z) < 5.00000000000000008e115

    1. Initial program 87.4%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 54.9%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified54.9%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. associate-/r/54.8%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      2. unpow254.8%

        \[\leadsto \frac{0.5}{y} \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. associate-*r*54.7%

        \[\leadsto \color{blue}{\left(\frac{0.5}{y} \cdot x\right) \cdot x} \]
    6. Applied egg-rr54.7%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{0.5 \cdot x}{y}} \]
      3. associate-*r/54.9%

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

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

    if 2.0000000000000001e190 < (*.f64 z z)

    1. Initial program 60.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in z around inf 71.9%

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

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

      \[\leadsto \color{blue}{\frac{{z}^{2}}{y} \cdot -0.5} \]
    5. Step-by-step derivation
      1. div-inv71.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-280}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 10^{+38}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;z \cdot z \leq 10^{+60}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+115}:\\ \;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\ \mathbf{elif}\;z \cdot z \leq 10^{+180}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+190}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \left(z \cdot \frac{1}{y}\right)\right)\\ \end{array} \]

Alternative 4: 50.3% accurate, 0.5× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{if}\;z \cdot z \leq 3 \cdot 10^{-280}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 4.5 \cdot 10^{+39}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \cdot z \leq 7.8 \cdot 10^{+59}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 9.5 \cdot 10^{+121}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \cdot z \leq 6 \cdot 10^{+179}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 1.85 \cdot 10^{+197}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* x (/ 0.5 y)))))
   (if (<= (* z z) 3e-280)
     (* 0.5 y)
     (if (<= (* z z) 4.5e+39)
       t_0
       (if (<= (* z z) 7.8e+59)
         (* 0.5 y)
         (if (<= (* z z) 9.5e+121)
           t_0
           (if (<= (* z z) 6e+179)
             (* 0.5 y)
             (if (<= (* z z) 1.85e+197) t_0 (* -0.5 (/ (* z z) y))))))))))
x = abs(x);
double code(double x, double y, double z) {
	double t_0 = x * (x * (0.5 / y));
	double tmp;
	if ((z * z) <= 3e-280) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 4.5e+39) {
		tmp = t_0;
	} else if ((z * z) <= 7.8e+59) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 9.5e+121) {
		tmp = t_0;
	} else if ((z * z) <= 6e+179) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 1.85e+197) {
		tmp = t_0;
	} else {
		tmp = -0.5 * ((z * z) / y);
	}
	return tmp;
}
NOTE: x should be positive before calling this function
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 * (x * (0.5d0 / y))
    if ((z * z) <= 3d-280) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 4.5d+39) then
        tmp = t_0
    else if ((z * z) <= 7.8d+59) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 9.5d+121) then
        tmp = t_0
    else if ((z * z) <= 6d+179) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 1.85d+197) then
        tmp = t_0
    else
        tmp = (-0.5d0) * ((z * z) / y)
    end if
    code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
	double t_0 = x * (x * (0.5 / y));
	double tmp;
	if ((z * z) <= 3e-280) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 4.5e+39) {
		tmp = t_0;
	} else if ((z * z) <= 7.8e+59) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 9.5e+121) {
		tmp = t_0;
	} else if ((z * z) <= 6e+179) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 1.85e+197) {
		tmp = t_0;
	} else {
		tmp = -0.5 * ((z * z) / y);
	}
	return tmp;
}
x = abs(x)
def code(x, y, z):
	t_0 = x * (x * (0.5 / y))
	tmp = 0
	if (z * z) <= 3e-280:
		tmp = 0.5 * y
	elif (z * z) <= 4.5e+39:
		tmp = t_0
	elif (z * z) <= 7.8e+59:
		tmp = 0.5 * y
	elif (z * z) <= 9.5e+121:
		tmp = t_0
	elif (z * z) <= 6e+179:
		tmp = 0.5 * y
	elif (z * z) <= 1.85e+197:
		tmp = t_0
	else:
		tmp = -0.5 * ((z * z) / y)
	return tmp
x = abs(x)
function code(x, y, z)
	t_0 = Float64(x * Float64(x * Float64(0.5 / y)))
	tmp = 0.0
	if (Float64(z * z) <= 3e-280)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 4.5e+39)
		tmp = t_0;
	elseif (Float64(z * z) <= 7.8e+59)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 9.5e+121)
		tmp = t_0;
	elseif (Float64(z * z) <= 6e+179)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 1.85e+197)
		tmp = t_0;
	else
		tmp = Float64(-0.5 * Float64(Float64(z * z) / y));
	end
	return tmp
end
x = abs(x)
function tmp_2 = code(x, y, z)
	t_0 = x * (x * (0.5 / y));
	tmp = 0.0;
	if ((z * z) <= 3e-280)
		tmp = 0.5 * y;
	elseif ((z * z) <= 4.5e+39)
		tmp = t_0;
	elseif ((z * z) <= 7.8e+59)
		tmp = 0.5 * y;
	elseif ((z * z) <= 9.5e+121)
		tmp = t_0;
	elseif ((z * z) <= 6e+179)
		tmp = 0.5 * y;
	elseif ((z * z) <= 1.85e+197)
		tmp = t_0;
	else
		tmp = -0.5 * ((z * z) / y);
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 3e-280], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 4.5e+39], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 7.8e+59], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 9.5e+121], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 6e+179], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1.85e+197], t$95$0, N[(-0.5 * N[(N[(z * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{if}\;z \cdot z \leq 3 \cdot 10^{-280}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 4.5 \cdot 10^{+39}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \cdot z \leq 7.8 \cdot 10^{+59}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 9.5 \cdot 10^{+121}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \cdot z \leq 6 \cdot 10^{+179}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 1.85 \cdot 10^{+197}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z z) < 2.99999999999999987e-280 or 4.49999999999999996e39 < (*.f64 z z) < 7.80000000000000043e59 or 9.49999999999999949e121 < (*.f64 z z) < 5.9999999999999996e179

    1. Initial program 59.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in y around inf 60.3%

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

    if 2.99999999999999987e-280 < (*.f64 z z) < 4.49999999999999996e39 or 7.80000000000000043e59 < (*.f64 z z) < 9.49999999999999949e121 or 5.9999999999999996e179 < (*.f64 z z) < 1.8500000000000002e197

    1. Initial program 79.8%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 53.5%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified53.5%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. associate-/r/53.5%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      2. unpow253.5%

        \[\leadsto \frac{0.5}{y} \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. associate-*r*58.8%

        \[\leadsto \color{blue}{\left(\frac{0.5}{y} \cdot x\right) \cdot x} \]
    6. Applied egg-rr58.8%

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

    if 1.8500000000000002e197 < (*.f64 z z)

    1. Initial program 60.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in z around inf 71.9%

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

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

      \[\leadsto \color{blue}{\frac{{z}^{2}}{y} \cdot -0.5} \]
    5. Step-by-step derivation
      1. unpow271.9%

        \[\leadsto \frac{\color{blue}{z \cdot z}}{y} \cdot -0.5 \]
    6. Applied egg-rr71.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 3 \cdot 10^{-280}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 4.5 \cdot 10^{+39}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;z \cdot z \leq 7.8 \cdot 10^{+59}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 9.5 \cdot 10^{+121}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;z \cdot z \leq 6 \cdot 10^{+179}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 1.85 \cdot 10^{+197}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\ \end{array} \]

Alternative 5: 50.2% accurate, 0.5× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{if}\;z \cdot z \leq 2.2 \cdot 10^{-280}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 1.32 \cdot 10^{+38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \cdot z \leq 10^{+60}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 7.8 \cdot 10^{+116}:\\ \;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\ \mathbf{elif}\;z \cdot z \leq 10^{+180}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 9.8 \cdot 10^{+191}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* x (/ 0.5 y)))))
   (if (<= (* z z) 2.2e-280)
     (* 0.5 y)
     (if (<= (* z z) 1.32e+38)
       t_0
       (if (<= (* z z) 1e+60)
         (* 0.5 y)
         (if (<= (* z z) 7.8e+116)
           (/ (* x (* x 0.5)) y)
           (if (<= (* z z) 1e+180)
             (* 0.5 y)
             (if (<= (* z z) 9.8e+191) t_0 (* -0.5 (/ (* z z) y))))))))))
x = abs(x);
double code(double x, double y, double z) {
	double t_0 = x * (x * (0.5 / y));
	double tmp;
	if ((z * z) <= 2.2e-280) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 1.32e+38) {
		tmp = t_0;
	} else if ((z * z) <= 1e+60) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 7.8e+116) {
		tmp = (x * (x * 0.5)) / y;
	} else if ((z * z) <= 1e+180) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 9.8e+191) {
		tmp = t_0;
	} else {
		tmp = -0.5 * ((z * z) / y);
	}
	return tmp;
}
NOTE: x should be positive before calling this function
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 * (x * (0.5d0 / y))
    if ((z * z) <= 2.2d-280) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 1.32d+38) then
        tmp = t_0
    else if ((z * z) <= 1d+60) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 7.8d+116) then
        tmp = (x * (x * 0.5d0)) / y
    else if ((z * z) <= 1d+180) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 9.8d+191) then
        tmp = t_0
    else
        tmp = (-0.5d0) * ((z * z) / y)
    end if
    code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
	double t_0 = x * (x * (0.5 / y));
	double tmp;
	if ((z * z) <= 2.2e-280) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 1.32e+38) {
		tmp = t_0;
	} else if ((z * z) <= 1e+60) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 7.8e+116) {
		tmp = (x * (x * 0.5)) / y;
	} else if ((z * z) <= 1e+180) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 9.8e+191) {
		tmp = t_0;
	} else {
		tmp = -0.5 * ((z * z) / y);
	}
	return tmp;
}
x = abs(x)
def code(x, y, z):
	t_0 = x * (x * (0.5 / y))
	tmp = 0
	if (z * z) <= 2.2e-280:
		tmp = 0.5 * y
	elif (z * z) <= 1.32e+38:
		tmp = t_0
	elif (z * z) <= 1e+60:
		tmp = 0.5 * y
	elif (z * z) <= 7.8e+116:
		tmp = (x * (x * 0.5)) / y
	elif (z * z) <= 1e+180:
		tmp = 0.5 * y
	elif (z * z) <= 9.8e+191:
		tmp = t_0
	else:
		tmp = -0.5 * ((z * z) / y)
	return tmp
x = abs(x)
function code(x, y, z)
	t_0 = Float64(x * Float64(x * Float64(0.5 / y)))
	tmp = 0.0
	if (Float64(z * z) <= 2.2e-280)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 1.32e+38)
		tmp = t_0;
	elseif (Float64(z * z) <= 1e+60)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 7.8e+116)
		tmp = Float64(Float64(x * Float64(x * 0.5)) / y);
	elseif (Float64(z * z) <= 1e+180)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 9.8e+191)
		tmp = t_0;
	else
		tmp = Float64(-0.5 * Float64(Float64(z * z) / y));
	end
	return tmp
end
x = abs(x)
function tmp_2 = code(x, y, z)
	t_0 = x * (x * (0.5 / y));
	tmp = 0.0;
	if ((z * z) <= 2.2e-280)
		tmp = 0.5 * y;
	elseif ((z * z) <= 1.32e+38)
		tmp = t_0;
	elseif ((z * z) <= 1e+60)
		tmp = 0.5 * y;
	elseif ((z * z) <= 7.8e+116)
		tmp = (x * (x * 0.5)) / y;
	elseif ((z * z) <= 1e+180)
		tmp = 0.5 * y;
	elseif ((z * z) <= 9.8e+191)
		tmp = t_0;
	else
		tmp = -0.5 * ((z * z) / y);
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 2.2e-280], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1.32e+38], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 1e+60], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 7.8e+116], N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+180], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 9.8e+191], t$95$0, N[(-0.5 * N[(N[(z * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{if}\;z \cdot z \leq 2.2 \cdot 10^{-280}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 1.32 \cdot 10^{+38}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \cdot z \leq 10^{+60}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 7.8 \cdot 10^{+116}:\\
\;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\

\mathbf{elif}\;z \cdot z \leq 10^{+180}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 9.8 \cdot 10^{+191}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z z) < 2.2000000000000001e-280 or 1.32e38 < (*.f64 z z) < 9.9999999999999995e59 or 7.80000000000000065e116 < (*.f64 z z) < 1e180

    1. Initial program 59.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in y around inf 60.3%

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

    if 2.2000000000000001e-280 < (*.f64 z z) < 1.32e38 or 1e180 < (*.f64 z z) < 9.7999999999999999e191

    1. Initial program 78.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 53.2%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified53.2%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. associate-/r/53.2%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      2. unpow253.2%

        \[\leadsto \frac{0.5}{y} \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. associate-*r*59.6%

        \[\leadsto \color{blue}{\left(\frac{0.5}{y} \cdot x\right) \cdot x} \]
    6. Applied egg-rr59.6%

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

    if 9.9999999999999995e59 < (*.f64 z z) < 7.80000000000000065e116

    1. Initial program 87.4%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 54.9%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified54.9%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. associate-/r/54.8%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      2. unpow254.8%

        \[\leadsto \frac{0.5}{y} \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. associate-*r*54.7%

        \[\leadsto \color{blue}{\left(\frac{0.5}{y} \cdot x\right) \cdot x} \]
    6. Applied egg-rr54.7%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{0.5 \cdot x}{y}} \]
      3. associate-*r/54.9%

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

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

    if 9.7999999999999999e191 < (*.f64 z z)

    1. Initial program 60.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in z around inf 71.9%

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

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

      \[\leadsto \color{blue}{\frac{{z}^{2}}{y} \cdot -0.5} \]
    5. Step-by-step derivation
      1. unpow271.9%

        \[\leadsto \frac{\color{blue}{z \cdot z}}{y} \cdot -0.5 \]
    6. Applied egg-rr71.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2.2 \cdot 10^{-280}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 1.32 \cdot 10^{+38}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;z \cdot z \leq 10^{+60}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 7.8 \cdot 10^{+116}:\\ \;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\ \mathbf{elif}\;z \cdot z \leq 10^{+180}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 9.8 \cdot 10^{+191}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\ \end{array} \]

Alternative 6: 52.5% accurate, 0.5× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-280}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 10^{+38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \cdot z \leq 10^{+60}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+115}:\\ \;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\ \mathbf{elif}\;z \cdot z \leq 10^{+180}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+190}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot \frac{z}{y}\right) \cdot -0.5\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* x (/ 0.5 y)))))
   (if (<= (* z z) 2e-280)
     (* 0.5 y)
     (if (<= (* z z) 1e+38)
       t_0
       (if (<= (* z z) 1e+60)
         (* 0.5 y)
         (if (<= (* z z) 5e+115)
           (/ (* x (* x 0.5)) y)
           (if (<= (* z z) 1e+180)
             (* 0.5 y)
             (if (<= (* z z) 2e+190) t_0 (* (* z (/ z y)) -0.5)))))))))
x = abs(x);
double code(double x, double y, double z) {
	double t_0 = x * (x * (0.5 / y));
	double tmp;
	if ((z * z) <= 2e-280) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 1e+38) {
		tmp = t_0;
	} else if ((z * z) <= 1e+60) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 5e+115) {
		tmp = (x * (x * 0.5)) / y;
	} else if ((z * z) <= 1e+180) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 2e+190) {
		tmp = t_0;
	} else {
		tmp = (z * (z / y)) * -0.5;
	}
	return tmp;
}
NOTE: x should be positive before calling this function
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 * (x * (0.5d0 / y))
    if ((z * z) <= 2d-280) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 1d+38) then
        tmp = t_0
    else if ((z * z) <= 1d+60) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 5d+115) then
        tmp = (x * (x * 0.5d0)) / y
    else if ((z * z) <= 1d+180) then
        tmp = 0.5d0 * y
    else if ((z * z) <= 2d+190) then
        tmp = t_0
    else
        tmp = (z * (z / y)) * (-0.5d0)
    end if
    code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
	double t_0 = x * (x * (0.5 / y));
	double tmp;
	if ((z * z) <= 2e-280) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 1e+38) {
		tmp = t_0;
	} else if ((z * z) <= 1e+60) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 5e+115) {
		tmp = (x * (x * 0.5)) / y;
	} else if ((z * z) <= 1e+180) {
		tmp = 0.5 * y;
	} else if ((z * z) <= 2e+190) {
		tmp = t_0;
	} else {
		tmp = (z * (z / y)) * -0.5;
	}
	return tmp;
}
x = abs(x)
def code(x, y, z):
	t_0 = x * (x * (0.5 / y))
	tmp = 0
	if (z * z) <= 2e-280:
		tmp = 0.5 * y
	elif (z * z) <= 1e+38:
		tmp = t_0
	elif (z * z) <= 1e+60:
		tmp = 0.5 * y
	elif (z * z) <= 5e+115:
		tmp = (x * (x * 0.5)) / y
	elif (z * z) <= 1e+180:
		tmp = 0.5 * y
	elif (z * z) <= 2e+190:
		tmp = t_0
	else:
		tmp = (z * (z / y)) * -0.5
	return tmp
x = abs(x)
function code(x, y, z)
	t_0 = Float64(x * Float64(x * Float64(0.5 / y)))
	tmp = 0.0
	if (Float64(z * z) <= 2e-280)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 1e+38)
		tmp = t_0;
	elseif (Float64(z * z) <= 1e+60)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 5e+115)
		tmp = Float64(Float64(x * Float64(x * 0.5)) / y);
	elseif (Float64(z * z) <= 1e+180)
		tmp = Float64(0.5 * y);
	elseif (Float64(z * z) <= 2e+190)
		tmp = t_0;
	else
		tmp = Float64(Float64(z * Float64(z / y)) * -0.5);
	end
	return tmp
end
x = abs(x)
function tmp_2 = code(x, y, z)
	t_0 = x * (x * (0.5 / y));
	tmp = 0.0;
	if ((z * z) <= 2e-280)
		tmp = 0.5 * y;
	elseif ((z * z) <= 1e+38)
		tmp = t_0;
	elseif ((z * z) <= 1e+60)
		tmp = 0.5 * y;
	elseif ((z * z) <= 5e+115)
		tmp = (x * (x * 0.5)) / y;
	elseif ((z * z) <= 1e+180)
		tmp = 0.5 * y;
	elseif ((z * z) <= 2e+190)
		tmp = t_0;
	else
		tmp = (z * (z / y)) * -0.5;
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 2e-280], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+38], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 1e+60], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+115], N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+180], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+190], t$95$0, N[(N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-280}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 10^{+38}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \cdot z \leq 10^{+60}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\

\mathbf{elif}\;z \cdot z \leq 10^{+180}:\\
\;\;\;\;0.5 \cdot y\\

\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+190}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z z) < 1.9999999999999999e-280 or 9.99999999999999977e37 < (*.f64 z z) < 9.9999999999999995e59 or 5.00000000000000008e115 < (*.f64 z z) < 1e180

    1. Initial program 59.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in y around inf 60.3%

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

    if 1.9999999999999999e-280 < (*.f64 z z) < 9.99999999999999977e37 or 1e180 < (*.f64 z z) < 2.0000000000000001e190

    1. Initial program 78.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 53.2%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified53.2%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. associate-/r/53.2%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      2. unpow253.2%

        \[\leadsto \frac{0.5}{y} \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. associate-*r*59.6%

        \[\leadsto \color{blue}{\left(\frac{0.5}{y} \cdot x\right) \cdot x} \]
    6. Applied egg-rr59.6%

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

    if 9.9999999999999995e59 < (*.f64 z z) < 5.00000000000000008e115

    1. Initial program 87.4%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 54.9%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified54.9%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. associate-/r/54.8%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      2. unpow254.8%

        \[\leadsto \frac{0.5}{y} \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. associate-*r*54.7%

        \[\leadsto \color{blue}{\left(\frac{0.5}{y} \cdot x\right) \cdot x} \]
    6. Applied egg-rr54.7%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{0.5 \cdot x}{y}} \]
      3. associate-*r/54.9%

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

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

    if 2.0000000000000001e190 < (*.f64 z z)

    1. Initial program 60.2%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in z around inf 71.9%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-280}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 10^{+38}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;z \cdot z \leq 10^{+60}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+115}:\\ \;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\ \mathbf{elif}\;z \cdot z \leq 10^{+180}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+190}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot \frac{z}{y}\right) \cdot -0.5\\ \end{array} \]

Alternative 7: 85.7% accurate, 0.8× speedup?

\[\begin{array}{l} x = |x|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{+165} \lor \neg \left(y \leq 1.35 \cdot 10^{+154}\right):\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -1.05e+165) (not (<= y 1.35e+154)))
   (* 0.5 y)
   (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0))))
x = abs(x);
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.05e+165) || !(y <= 1.35e+154)) {
		tmp = 0.5 * y;
	} else {
		tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
	}
	return tmp;
}
NOTE: x should be positive before calling this function
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 <= (-1.05d+165)) .or. (.not. (y <= 1.35d+154))) then
        tmp = 0.5d0 * y
    else
        tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
    end if
    code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.05e+165) || !(y <= 1.35e+154)) {
		tmp = 0.5 * y;
	} else {
		tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
	}
	return tmp;
}
x = abs(x)
def code(x, y, z):
	tmp = 0
	if (y <= -1.05e+165) or not (y <= 1.35e+154):
		tmp = 0.5 * y
	else:
		tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
	return tmp
x = abs(x)
function code(x, y, z)
	tmp = 0.0
	if ((y <= -1.05e+165) || !(y <= 1.35e+154))
		tmp = Float64(0.5 * y);
	else
		tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0));
	end
	return tmp
end
x = abs(x)
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -1.05e+165) || ~((y <= 1.35e+154)))
		tmp = 0.5 * y;
	else
		tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := If[Or[LessEqual[y, -1.05e+165], N[Not[LessEqual[y, 1.35e+154]], $MachinePrecision]], N[(0.5 * y), $MachinePrecision], 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}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+165} \lor \neg \left(y \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;0.5 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.05e165 or 1.35000000000000003e154 < y

    1. Initial program 9.8%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in y around inf 76.5%

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

    if -1.05e165 < y < 1.35000000000000003e154

    1. Initial program 86.6%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{+165} \lor \neg \left(y \leq 1.35 \cdot 10^{+154}\right):\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\\ \end{array} \]

Alternative 8: 92.9% accurate, 0.8× speedup?

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

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


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

    1. Initial program 65.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 80.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.04999999999999992e231 < x

    1. Initial program 86.7%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 100.0%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified100.0%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. associate-/r/100.0%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      2. unpow2100.0%

        \[\leadsto \frac{0.5}{y} \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. associate-*r*100.0%

        \[\leadsto \color{blue}{\left(\frac{0.5}{y} \cdot x\right) \cdot x} \]
    6. Applied egg-rr100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.05 \cdot 10^{+231}:\\ \;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \end{array} \]

Alternative 9: 52.4% accurate, 1.7× speedup?

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

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


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

    1. Initial program 65.4%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in y around inf 40.0%

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

    if 4.3999999999999997e84 < x

    1. Initial program 72.6%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Taylor expanded in x around inf 75.2%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    4. Simplified75.2%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{y}{{x}^{2}}}} \]
    5. Step-by-step derivation
      1. associate-/r/75.2%

        \[\leadsto \color{blue}{\frac{0.5}{y} \cdot {x}^{2}} \]
      2. unpow275.2%

        \[\leadsto \frac{0.5}{y} \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. associate-*r*79.7%

        \[\leadsto \color{blue}{\left(\frac{0.5}{y} \cdot x\right) \cdot x} \]
    6. Applied egg-rr79.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.4 \cdot 10^{+84}:\\ \;\;\;\;0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\ \end{array} \]

Alternative 10: 34.2% accurate, 5.0× speedup?

\[\begin{array}{l} x = |x|\\ \\ 0.5 \cdot y \end{array} \]
NOTE: x should be positive before calling this function
(FPCore (x y z) :precision binary64 (* 0.5 y))
x = abs(x);
double code(double x, double y, double z) {
	return 0.5 * y;
}
NOTE: x should be positive before calling this function
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
x = Math.abs(x);
public static double code(double x, double y, double z) {
	return 0.5 * y;
}
x = abs(x)
def code(x, y, z):
	return 0.5 * y
x = abs(x)
function code(x, y, z)
	return Float64(0.5 * y)
end
x = abs(x)
function tmp = code(x, y, z)
	tmp = 0.5 * y;
end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := N[(0.5 * y), $MachinePrecision]
\begin{array}{l}
x = |x|\\
\\
0.5 \cdot y
\end{array}
Derivation
  1. Initial program 66.5%

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
  2. Taylor expanded in y around inf 35.2%

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  3. Final simplification35.2%

    \[\leadsto 0.5 \cdot y \]

Developer target: 99.9% 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 2023336 
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
  :precision binary64

  :herbie-target
  (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))

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