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

Percentage Accurate: 69.7% → 95.7%
Time: 16.3s
Alternatives: 16
Speedup: 0.7×

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

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

Initial Program: 69.7% 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: 95.7% accurate, 0.7× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 5.3 \cdot 10^{-252}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y\_m}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{x - z}{y\_m} \cdot \frac{z + x}{y\_m}\right)\right)\\ \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= y_m 5.3e-252)
    (* 0.5 (* (+ z x) (* (- x z) (/ 1.0 y_m))))
    (* y_m (+ 0.5 (* 0.5 (* (/ (- x z) y_m) (/ (+ z x) y_m))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 5.3e-252) {
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	} else {
		tmp = y_m * (0.5 + (0.5 * (((x - z) / y_m) * ((z + x) / y_m))));
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y_m <= 5.3d-252) then
        tmp = 0.5d0 * ((z + x) * ((x - z) * (1.0d0 / y_m)))
    else
        tmp = y_m * (0.5d0 + (0.5d0 * (((x - z) / y_m) * ((z + x) / y_m))))
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 5.3e-252) {
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	} else {
		tmp = y_m * (0.5 + (0.5 * (((x - z) / y_m) * ((z + x) / y_m))));
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if y_m <= 5.3e-252:
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)))
	else:
		tmp = y_m * (0.5 + (0.5 * (((x - z) / y_m) * ((z + x) / y_m))))
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (y_m <= 5.3e-252)
		tmp = Float64(0.5 * Float64(Float64(z + x) * Float64(Float64(x - z) * Float64(1.0 / y_m))));
	else
		tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(x - z) / y_m) * Float64(Float64(z + x) / y_m)))));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if (y_m <= 5.3e-252)
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	else
		tmp = y_m * (0.5 + (0.5 * (((x - z) / y_m) * ((z + x) / y_m))));
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 5.3e-252], N[(0.5 * N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] * N[(1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(z + x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 5.3 \cdot 10^{-252}:\\
\;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y\_m}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 5.30000000000000022e-252

    1. Initial program 71.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.30000000000000022e-252 < y

    1. Initial program 66.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 93.5% accurate, 0.2× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := \frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\ t_1 := \frac{x - z}{y\_m}\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -2 \cdot 10^{+189}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot t\_1\right)\\ \mathbf{elif}\;t\_0 \leq 10^{-119}:\\ \;\;\;\;y\_m \cdot \left(0.5 - 0.5 \cdot \left(\frac{z}{y\_m} \cdot \frac{z}{y\_m}\right)\right)\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{z + x}{y\_m} \cdot \frac{x}{y\_m}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(t\_1 \cdot \frac{z}{y\_m}\right)\right)\\ \end{array} \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0)))
        (t_1 (/ (- x z) y_m)))
   (*
    y_s
    (if (<= t_0 -2e+189)
      (* 0.5 (* (+ z x) t_1))
      (if (<= t_0 1e-119)
        (* y_m (- 0.5 (* 0.5 (* (/ z y_m) (/ z y_m)))))
        (if (<= t_0 INFINITY)
          (* y_m (+ 0.5 (* 0.5 (* (/ (+ z x) y_m) (/ x y_m)))))
          (* y_m (+ 0.5 (* 0.5 (* t_1 (/ z y_m)))))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
	double t_1 = (x - z) / y_m;
	double tmp;
	if (t_0 <= -2e+189) {
		tmp = 0.5 * ((z + x) * t_1);
	} else if (t_0 <= 1e-119) {
		tmp = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))));
	} else if (t_0 <= ((double) INFINITY)) {
		tmp = y_m * (0.5 + (0.5 * (((z + x) / y_m) * (x / y_m))));
	} else {
		tmp = y_m * (0.5 + (0.5 * (t_1 * (z / y_m))));
	}
	return y_s * tmp;
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
	double t_1 = (x - z) / y_m;
	double tmp;
	if (t_0 <= -2e+189) {
		tmp = 0.5 * ((z + x) * t_1);
	} else if (t_0 <= 1e-119) {
		tmp = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))));
	} else if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = y_m * (0.5 + (0.5 * (((z + x) / y_m) * (x / y_m))));
	} else {
		tmp = y_m * (0.5 + (0.5 * (t_1 * (z / y_m))));
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)
	t_1 = (x - z) / y_m
	tmp = 0
	if t_0 <= -2e+189:
		tmp = 0.5 * ((z + x) * t_1)
	elif t_0 <= 1e-119:
		tmp = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))))
	elif t_0 <= math.inf:
		tmp = y_m * (0.5 + (0.5 * (((z + x) / y_m) * (x / y_m))))
	else:
		tmp = y_m * (0.5 + (0.5 * (t_1 * (z / y_m))))
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0))
	t_1 = Float64(Float64(x - z) / y_m)
	tmp = 0.0
	if (t_0 <= -2e+189)
		tmp = Float64(0.5 * Float64(Float64(z + x) * t_1));
	elseif (t_0 <= 1e-119)
		tmp = Float64(y_m * Float64(0.5 - Float64(0.5 * Float64(Float64(z / y_m) * Float64(z / y_m)))));
	elseif (t_0 <= Inf)
		tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(z + x) / y_m) * Float64(x / y_m)))));
	else
		tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(t_1 * Float64(z / y_m)))));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
	t_1 = (x - z) / y_m;
	tmp = 0.0;
	if (t_0 <= -2e+189)
		tmp = 0.5 * ((z + x) * t_1);
	elseif (t_0 <= 1e-119)
		tmp = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))));
	elseif (t_0 <= Inf)
		tmp = y_m * (0.5 + (0.5 * (((z + x) / y_m) * (x / y_m))));
	else
		tmp = y_m * (0.5 + (0.5 * (t_1 * (z / y_m))));
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, -2e+189], N[(0.5 * N[(N[(z + x), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-119], N[(y$95$m * N[(0.5 - N[(0.5 * N[(N[(z / y$95$m), $MachinePrecision] * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(z + x), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(t$95$1 * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\
t_1 := \frac{x - z}{y\_m}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+189}:\\
\;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot t\_1\right)\\

\mathbf{elif}\;t\_0 \leq 10^{-119}:\\
\;\;\;\;y\_m \cdot \left(0.5 - 0.5 \cdot \left(\frac{z}{y\_m} \cdot \frac{z}{y\_m}\right)\right)\\

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{z + x}{y\_m} \cdot \frac{x}{y\_m}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(t\_1 \cdot \frac{z}{y\_m}\right)\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < -2e189

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e189 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 1.00000000000000001e-119

    1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \left(0.5 + \left(\color{blue}{\left(-1 \cdot \frac{z}{y}\right)} \cdot \frac{z}{y}\right) \cdot 0.5\right) \]
    12. Step-by-step derivation
      1. neg-mul-171.7%

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

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

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

    if 1.00000000000000001e-119 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < +inf.0

    1. Initial program 79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64)))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 55.1% accurate, 0.3× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{z \cdot \left(x - z\right)}{y\_m}\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 6.2 \cdot 10^{-120}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y\_m \leq 4.4 \cdot 10^{-69}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{\frac{y\_m}{x}}\\ \mathbf{elif}\;y\_m \leq 4.1 \cdot 10^{-20}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y\_m \leq 1.5 \cdot 10^{+84} \lor \neg \left(y\_m \leq 3.3 \cdot 10^{+122} \lor \neg \left(y\_m \leq 3 \cdot 10^{+155}\right) \land y\_m \leq 3.1 \cdot 10^{+155}\right):\\ \;\;\;\;0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\frac{z}{y\_m} \cdot -0.5\right)\\ \end{array} \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ (* z (- x z)) y_m))))
   (*
    y_s
    (if (<= y_m 6.2e-120)
      t_0
      (if (<= y_m 4.4e-69)
        (* 0.5 (/ (- x z) (/ y_m x)))
        (if (<= y_m 4.1e-20)
          t_0
          (if (or (<= y_m 1.5e+84)
                  (not
                   (or (<= y_m 3.3e+122)
                       (and (not (<= y_m 3e+155)) (<= y_m 3.1e+155)))))
            (* 0.5 (+ y_m (* z (/ x y_m))))
            (* z (* (/ z y_m) -0.5)))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = 0.5 * ((z * (x - z)) / y_m);
	double tmp;
	if (y_m <= 6.2e-120) {
		tmp = t_0;
	} else if (y_m <= 4.4e-69) {
		tmp = 0.5 * ((x - z) / (y_m / x));
	} else if (y_m <= 4.1e-20) {
		tmp = t_0;
	} else if ((y_m <= 1.5e+84) || !((y_m <= 3.3e+122) || (!(y_m <= 3e+155) && (y_m <= 3.1e+155)))) {
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	} else {
		tmp = z * ((z / y_m) * -0.5);
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.5d0 * ((z * (x - z)) / y_m)
    if (y_m <= 6.2d-120) then
        tmp = t_0
    else if (y_m <= 4.4d-69) then
        tmp = 0.5d0 * ((x - z) / (y_m / x))
    else if (y_m <= 4.1d-20) then
        tmp = t_0
    else if ((y_m <= 1.5d+84) .or. (.not. (y_m <= 3.3d+122) .or. (.not. (y_m <= 3d+155)) .and. (y_m <= 3.1d+155))) then
        tmp = 0.5d0 * (y_m + (z * (x / y_m)))
    else
        tmp = z * ((z / y_m) * (-0.5d0))
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double t_0 = 0.5 * ((z * (x - z)) / y_m);
	double tmp;
	if (y_m <= 6.2e-120) {
		tmp = t_0;
	} else if (y_m <= 4.4e-69) {
		tmp = 0.5 * ((x - z) / (y_m / x));
	} else if (y_m <= 4.1e-20) {
		tmp = t_0;
	} else if ((y_m <= 1.5e+84) || !((y_m <= 3.3e+122) || (!(y_m <= 3e+155) && (y_m <= 3.1e+155)))) {
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	} else {
		tmp = z * ((z / y_m) * -0.5);
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	t_0 = 0.5 * ((z * (x - z)) / y_m)
	tmp = 0
	if y_m <= 6.2e-120:
		tmp = t_0
	elif y_m <= 4.4e-69:
		tmp = 0.5 * ((x - z) / (y_m / x))
	elif y_m <= 4.1e-20:
		tmp = t_0
	elif (y_m <= 1.5e+84) or not ((y_m <= 3.3e+122) or (not (y_m <= 3e+155) and (y_m <= 3.1e+155))):
		tmp = 0.5 * (y_m + (z * (x / y_m)))
	else:
		tmp = z * ((z / y_m) * -0.5)
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(0.5 * Float64(Float64(z * Float64(x - z)) / y_m))
	tmp = 0.0
	if (y_m <= 6.2e-120)
		tmp = t_0;
	elseif (y_m <= 4.4e-69)
		tmp = Float64(0.5 * Float64(Float64(x - z) / Float64(y_m / x)));
	elseif (y_m <= 4.1e-20)
		tmp = t_0;
	elseif ((y_m <= 1.5e+84) || !((y_m <= 3.3e+122) || (!(y_m <= 3e+155) && (y_m <= 3.1e+155))))
		tmp = Float64(0.5 * Float64(y_m + Float64(z * Float64(x / y_m))));
	else
		tmp = Float64(z * Float64(Float64(z / y_m) * -0.5));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	t_0 = 0.5 * ((z * (x - z)) / y_m);
	tmp = 0.0;
	if (y_m <= 6.2e-120)
		tmp = t_0;
	elseif (y_m <= 4.4e-69)
		tmp = 0.5 * ((x - z) / (y_m / x));
	elseif (y_m <= 4.1e-20)
		tmp = t_0;
	elseif ((y_m <= 1.5e+84) || ~(((y_m <= 3.3e+122) || (~((y_m <= 3e+155)) && (y_m <= 3.1e+155)))))
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	else
		tmp = z * ((z / y_m) * -0.5);
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(0.5 * N[(N[(z * N[(x - z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 6.2e-120], t$95$0, If[LessEqual[y$95$m, 4.4e-69], N[(0.5 * N[(N[(x - z), $MachinePrecision] / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 4.1e-20], t$95$0, If[Or[LessEqual[y$95$m, 1.5e+84], N[Not[Or[LessEqual[y$95$m, 3.3e+122], And[N[Not[LessEqual[y$95$m, 3e+155]], $MachinePrecision], LessEqual[y$95$m, 3.1e+155]]]], $MachinePrecision]], N[(0.5 * N[(y$95$m + N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(z / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

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

\mathbf{elif}\;y\_m \leq 4.4 \cdot 10^{-69}:\\
\;\;\;\;0.5 \cdot \frac{x - z}{\frac{y\_m}{x}}\\

\mathbf{elif}\;y\_m \leq 4.1 \cdot 10^{-20}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y\_m \leq 1.5 \cdot 10^{+84} \lor \neg \left(y\_m \leq 3.3 \cdot 10^{+122} \lor \neg \left(y\_m \leq 3 \cdot 10^{+155}\right) \land y\_m \leq 3.1 \cdot 10^{+155}\right):\\
\;\;\;\;0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 6.20000000000000038e-120 or 4.4e-69 < y < 4.1000000000000001e-20

    1. Initial program 76.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.20000000000000038e-120 < y < 4.4e-69

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr99.7%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    13. Taylor expanded in x around inf 46.8%

      \[\leadsto 0.5 \cdot \frac{x - z}{\color{blue}{\frac{y}{x}}} \]

    if 4.1000000000000001e-20 < y < 1.49999999999999998e84 or 3.2999999999999999e122 < y < 3.0000000000000001e155 or 3.09999999999999989e155 < y

    1. Initial program 43.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot y + 0.5 \cdot \frac{x \cdot z}{y}} \]
    12. Step-by-step derivation
      1. +-commutative65.1%

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

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{z \cdot \frac{x}{y}} + y\right) \]
    13. Simplified68.6%

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

    if 1.49999999999999998e84 < y < 3.2999999999999999e122 or 3.0000000000000001e155 < y < 3.09999999999999989e155

    1. Initial program 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \left(x - z\right)}{y}}{\frac{1}{z}}} \]
      4. *-commutative66.8%

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

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

        \[\leadsto \color{blue}{\frac{\frac{\left(x - z\right) \cdot 0.5}{y}}{1} \cdot z} \]
      2. /-rgt-identity67.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 6.2 \cdot 10^{-120}:\\ \;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y}\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-69}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{-20}:\\ \;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y}\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+84} \lor \neg \left(y \leq 3.3 \cdot 10^{+122} \lor \neg \left(y \leq 3 \cdot 10^{+155}\right) \land y \leq 3.1 \cdot 10^{+155}\right):\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 57.0% accurate, 0.3× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := 0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\ t_1 := 0.5 \cdot \frac{x - z}{\frac{y\_m}{x}}\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 6.5 \cdot 10^{-120}:\\ \;\;\;\;z \cdot \left(\left(x - z\right) \cdot \frac{0.5}{y\_m}\right)\\ \mathbf{elif}\;y\_m \leq 1.9 \cdot 10^{-64}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y\_m \leq 3.1 \cdot 10^{-20}:\\ \;\;\;\;\left(x - z\right) \cdot \left(0.5 \cdot \frac{z}{y\_m}\right)\\ \mathbf{elif}\;y\_m \leq 4.7 \cdot 10^{+81}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y\_m \leq 2.8 \cdot 10^{+94}:\\ \;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y\_m}\\ \mathbf{elif}\;y\_m \leq 1.85 \cdot 10^{+106}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y\_m \leq 2.7 \cdot 10^{+124}:\\ \;\;\;\;z \cdot \left(\frac{z}{y\_m} \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ y_m (* z (/ x y_m)))))
        (t_1 (* 0.5 (/ (- x z) (/ y_m x)))))
   (*
    y_s
    (if (<= y_m 6.5e-120)
      (* z (* (- x z) (/ 0.5 y_m)))
      (if (<= y_m 1.9e-64)
        t_1
        (if (<= y_m 3.1e-20)
          (* (- x z) (* 0.5 (/ z y_m)))
          (if (<= y_m 4.7e+81)
            t_0
            (if (<= y_m 2.8e+94)
              (* 0.5 (/ (* z (- x z)) y_m))
              (if (<= y_m 1.85e+106)
                t_1
                (if (<= y_m 2.7e+124) (* z (* (/ z y_m) -0.5)) t_0))))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = 0.5 * (y_m + (z * (x / y_m)));
	double t_1 = 0.5 * ((x - z) / (y_m / x));
	double tmp;
	if (y_m <= 6.5e-120) {
		tmp = z * ((x - z) * (0.5 / y_m));
	} else if (y_m <= 1.9e-64) {
		tmp = t_1;
	} else if (y_m <= 3.1e-20) {
		tmp = (x - z) * (0.5 * (z / y_m));
	} else if (y_m <= 4.7e+81) {
		tmp = t_0;
	} else if (y_m <= 2.8e+94) {
		tmp = 0.5 * ((z * (x - z)) / y_m);
	} else if (y_m <= 1.85e+106) {
		tmp = t_1;
	} else if (y_m <= 2.7e+124) {
		tmp = z * ((z / y_m) * -0.5);
	} else {
		tmp = t_0;
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * (y_m + (z * (x / y_m)))
    t_1 = 0.5d0 * ((x - z) / (y_m / x))
    if (y_m <= 6.5d-120) then
        tmp = z * ((x - z) * (0.5d0 / y_m))
    else if (y_m <= 1.9d-64) then
        tmp = t_1
    else if (y_m <= 3.1d-20) then
        tmp = (x - z) * (0.5d0 * (z / y_m))
    else if (y_m <= 4.7d+81) then
        tmp = t_0
    else if (y_m <= 2.8d+94) then
        tmp = 0.5d0 * ((z * (x - z)) / y_m)
    else if (y_m <= 1.85d+106) then
        tmp = t_1
    else if (y_m <= 2.7d+124) then
        tmp = z * ((z / y_m) * (-0.5d0))
    else
        tmp = t_0
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double t_0 = 0.5 * (y_m + (z * (x / y_m)));
	double t_1 = 0.5 * ((x - z) / (y_m / x));
	double tmp;
	if (y_m <= 6.5e-120) {
		tmp = z * ((x - z) * (0.5 / y_m));
	} else if (y_m <= 1.9e-64) {
		tmp = t_1;
	} else if (y_m <= 3.1e-20) {
		tmp = (x - z) * (0.5 * (z / y_m));
	} else if (y_m <= 4.7e+81) {
		tmp = t_0;
	} else if (y_m <= 2.8e+94) {
		tmp = 0.5 * ((z * (x - z)) / y_m);
	} else if (y_m <= 1.85e+106) {
		tmp = t_1;
	} else if (y_m <= 2.7e+124) {
		tmp = z * ((z / y_m) * -0.5);
	} else {
		tmp = t_0;
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	t_0 = 0.5 * (y_m + (z * (x / y_m)))
	t_1 = 0.5 * ((x - z) / (y_m / x))
	tmp = 0
	if y_m <= 6.5e-120:
		tmp = z * ((x - z) * (0.5 / y_m))
	elif y_m <= 1.9e-64:
		tmp = t_1
	elif y_m <= 3.1e-20:
		tmp = (x - z) * (0.5 * (z / y_m))
	elif y_m <= 4.7e+81:
		tmp = t_0
	elif y_m <= 2.8e+94:
		tmp = 0.5 * ((z * (x - z)) / y_m)
	elif y_m <= 1.85e+106:
		tmp = t_1
	elif y_m <= 2.7e+124:
		tmp = z * ((z / y_m) * -0.5)
	else:
		tmp = t_0
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(0.5 * Float64(y_m + Float64(z * Float64(x / y_m))))
	t_1 = Float64(0.5 * Float64(Float64(x - z) / Float64(y_m / x)))
	tmp = 0.0
	if (y_m <= 6.5e-120)
		tmp = Float64(z * Float64(Float64(x - z) * Float64(0.5 / y_m)));
	elseif (y_m <= 1.9e-64)
		tmp = t_1;
	elseif (y_m <= 3.1e-20)
		tmp = Float64(Float64(x - z) * Float64(0.5 * Float64(z / y_m)));
	elseif (y_m <= 4.7e+81)
		tmp = t_0;
	elseif (y_m <= 2.8e+94)
		tmp = Float64(0.5 * Float64(Float64(z * Float64(x - z)) / y_m));
	elseif (y_m <= 1.85e+106)
		tmp = t_1;
	elseif (y_m <= 2.7e+124)
		tmp = Float64(z * Float64(Float64(z / y_m) * -0.5));
	else
		tmp = t_0;
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	t_0 = 0.5 * (y_m + (z * (x / y_m)));
	t_1 = 0.5 * ((x - z) / (y_m / x));
	tmp = 0.0;
	if (y_m <= 6.5e-120)
		tmp = z * ((x - z) * (0.5 / y_m));
	elseif (y_m <= 1.9e-64)
		tmp = t_1;
	elseif (y_m <= 3.1e-20)
		tmp = (x - z) * (0.5 * (z / y_m));
	elseif (y_m <= 4.7e+81)
		tmp = t_0;
	elseif (y_m <= 2.8e+94)
		tmp = 0.5 * ((z * (x - z)) / y_m);
	elseif (y_m <= 1.85e+106)
		tmp = t_1;
	elseif (y_m <= 2.7e+124)
		tmp = z * ((z / y_m) * -0.5);
	else
		tmp = t_0;
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(0.5 * N[(y$95$m + N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(N[(x - z), $MachinePrecision] / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 6.5e-120], N[(z * N[(N[(x - z), $MachinePrecision] * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 1.9e-64], t$95$1, If[LessEqual[y$95$m, 3.1e-20], N[(N[(x - z), $MachinePrecision] * N[(0.5 * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 4.7e+81], t$95$0, If[LessEqual[y$95$m, 2.8e+94], N[(0.5 * N[(N[(z * N[(x - z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 1.85e+106], t$95$1, If[LessEqual[y$95$m, 2.7e+124], N[(z * N[(N[(z / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]), $MachinePrecision]]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\
t_1 := 0.5 \cdot \frac{x - z}{\frac{y\_m}{x}}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 6.5 \cdot 10^{-120}:\\
\;\;\;\;z \cdot \left(\left(x - z\right) \cdot \frac{0.5}{y\_m}\right)\\

\mathbf{elif}\;y\_m \leq 1.9 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;y\_m \leq 4.7 \cdot 10^{+81}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y\_m \leq 2.8 \cdot 10^{+94}:\\
\;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y\_m}\\

\mathbf{elif}\;y\_m \leq 1.85 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if y < 6.50000000000000029e-120

    1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \frac{x - z}{\color{blue}{\frac{y}{z}}} \]
    14. Taylor expanded in y around 0 46.8%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(0.5 \cdot \left(x - z\right)\right) \cdot z}}{y} \]
      4. *-commutative46.8%

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

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

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

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

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

    if 6.50000000000000029e-120 < y < 1.9000000000000001e-64 or 2.79999999999999998e94 < y < 1.84999999999999997e106

    1. Initial program 92.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr99.7%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    13. Taylor expanded in x around inf 51.2%

      \[\leadsto 0.5 \cdot \frac{x - z}{\color{blue}{\frac{y}{x}}} \]

    if 1.9000000000000001e-64 < y < 3.1e-20

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x - z\right) \cdot \frac{z}{y}\right)} \]
      3. *-commutative57.6%

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

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

        \[\leadsto \left(x - z\right) \cdot \color{blue}{\left(0.5 \cdot \frac{z}{y}\right)} \]
    13. Simplified57.6%

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

    if 3.1e-20 < y < 4.7000000000000002e81 or 2.69999999999999978e124 < y

    1. Initial program 41.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot y + 0.5 \cdot \frac{x \cdot z}{y}} \]
    12. Step-by-step derivation
      1. +-commutative65.2%

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

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{z \cdot \frac{x}{y}} + y\right) \]
    13. Simplified68.6%

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

    if 4.7000000000000002e81 < y < 2.79999999999999998e94

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.84999999999999997e106 < y < 2.69999999999999978e124

    1. Initial program 5.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr98.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \left(x - z\right)}{y}}{\frac{1}{z}}} \]
      4. *-commutative100.0%

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

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

        \[\leadsto \color{blue}{\frac{\frac{\left(x - z\right) \cdot 0.5}{y}}{1} \cdot z} \]
      2. /-rgt-identity100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 6.5 \cdot 10^{-120}:\\ \;\;\;\;z \cdot \left(\left(x - z\right) \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-64}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-20}:\\ \;\;\;\;\left(x - z\right) \cdot \left(0.5 \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+81}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+94}:\\ \;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y}\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{+106}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{+124}:\\ \;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 57.2% accurate, 0.3× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{x - z}{\frac{y\_m}{x}}\\ t_1 := z \cdot \left(\left(x - z\right) \cdot \frac{0.5}{y\_m}\right)\\ t_2 := 0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 1.05 \cdot 10^{-119}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y\_m \leq 7 \cdot 10^{-66}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y\_m \leq 4.3 \cdot 10^{-20}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y\_m \leq 3.75 \cdot 10^{+82}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y\_m \leq 9.5 \cdot 10^{+98}:\\ \;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y\_m}\\ \mathbf{elif}\;y\_m \leq 2.45 \cdot 10^{+106}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y\_m \leq 3.2 \cdot 10^{+122}:\\ \;\;\;\;z \cdot \left(\frac{z}{y\_m} \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ (- x z) (/ y_m x))))
        (t_1 (* z (* (- x z) (/ 0.5 y_m))))
        (t_2 (* 0.5 (+ y_m (* z (/ x y_m))))))
   (*
    y_s
    (if (<= y_m 1.05e-119)
      t_1
      (if (<= y_m 7e-66)
        t_0
        (if (<= y_m 4.3e-20)
          t_1
          (if (<= y_m 3.75e+82)
            t_2
            (if (<= y_m 9.5e+98)
              (* 0.5 (/ (* z (- x z)) y_m))
              (if (<= y_m 2.45e+106)
                t_0
                (if (<= y_m 3.2e+122) (* z (* (/ z y_m) -0.5)) t_2))))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = 0.5 * ((x - z) / (y_m / x));
	double t_1 = z * ((x - z) * (0.5 / y_m));
	double t_2 = 0.5 * (y_m + (z * (x / y_m)));
	double tmp;
	if (y_m <= 1.05e-119) {
		tmp = t_1;
	} else if (y_m <= 7e-66) {
		tmp = t_0;
	} else if (y_m <= 4.3e-20) {
		tmp = t_1;
	} else if (y_m <= 3.75e+82) {
		tmp = t_2;
	} else if (y_m <= 9.5e+98) {
		tmp = 0.5 * ((z * (x - z)) / y_m);
	} else if (y_m <= 2.45e+106) {
		tmp = t_0;
	} else if (y_m <= 3.2e+122) {
		tmp = z * ((z / y_m) * -0.5);
	} else {
		tmp = t_2;
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 0.5d0 * ((x - z) / (y_m / x))
    t_1 = z * ((x - z) * (0.5d0 / y_m))
    t_2 = 0.5d0 * (y_m + (z * (x / y_m)))
    if (y_m <= 1.05d-119) then
        tmp = t_1
    else if (y_m <= 7d-66) then
        tmp = t_0
    else if (y_m <= 4.3d-20) then
        tmp = t_1
    else if (y_m <= 3.75d+82) then
        tmp = t_2
    else if (y_m <= 9.5d+98) then
        tmp = 0.5d0 * ((z * (x - z)) / y_m)
    else if (y_m <= 2.45d+106) then
        tmp = t_0
    else if (y_m <= 3.2d+122) then
        tmp = z * ((z / y_m) * (-0.5d0))
    else
        tmp = t_2
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double t_0 = 0.5 * ((x - z) / (y_m / x));
	double t_1 = z * ((x - z) * (0.5 / y_m));
	double t_2 = 0.5 * (y_m + (z * (x / y_m)));
	double tmp;
	if (y_m <= 1.05e-119) {
		tmp = t_1;
	} else if (y_m <= 7e-66) {
		tmp = t_0;
	} else if (y_m <= 4.3e-20) {
		tmp = t_1;
	} else if (y_m <= 3.75e+82) {
		tmp = t_2;
	} else if (y_m <= 9.5e+98) {
		tmp = 0.5 * ((z * (x - z)) / y_m);
	} else if (y_m <= 2.45e+106) {
		tmp = t_0;
	} else if (y_m <= 3.2e+122) {
		tmp = z * ((z / y_m) * -0.5);
	} else {
		tmp = t_2;
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	t_0 = 0.5 * ((x - z) / (y_m / x))
	t_1 = z * ((x - z) * (0.5 / y_m))
	t_2 = 0.5 * (y_m + (z * (x / y_m)))
	tmp = 0
	if y_m <= 1.05e-119:
		tmp = t_1
	elif y_m <= 7e-66:
		tmp = t_0
	elif y_m <= 4.3e-20:
		tmp = t_1
	elif y_m <= 3.75e+82:
		tmp = t_2
	elif y_m <= 9.5e+98:
		tmp = 0.5 * ((z * (x - z)) / y_m)
	elif y_m <= 2.45e+106:
		tmp = t_0
	elif y_m <= 3.2e+122:
		tmp = z * ((z / y_m) * -0.5)
	else:
		tmp = t_2
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(0.5 * Float64(Float64(x - z) / Float64(y_m / x)))
	t_1 = Float64(z * Float64(Float64(x - z) * Float64(0.5 / y_m)))
	t_2 = Float64(0.5 * Float64(y_m + Float64(z * Float64(x / y_m))))
	tmp = 0.0
	if (y_m <= 1.05e-119)
		tmp = t_1;
	elseif (y_m <= 7e-66)
		tmp = t_0;
	elseif (y_m <= 4.3e-20)
		tmp = t_1;
	elseif (y_m <= 3.75e+82)
		tmp = t_2;
	elseif (y_m <= 9.5e+98)
		tmp = Float64(0.5 * Float64(Float64(z * Float64(x - z)) / y_m));
	elseif (y_m <= 2.45e+106)
		tmp = t_0;
	elseif (y_m <= 3.2e+122)
		tmp = Float64(z * Float64(Float64(z / y_m) * -0.5));
	else
		tmp = t_2;
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	t_0 = 0.5 * ((x - z) / (y_m / x));
	t_1 = z * ((x - z) * (0.5 / y_m));
	t_2 = 0.5 * (y_m + (z * (x / y_m)));
	tmp = 0.0;
	if (y_m <= 1.05e-119)
		tmp = t_1;
	elseif (y_m <= 7e-66)
		tmp = t_0;
	elseif (y_m <= 4.3e-20)
		tmp = t_1;
	elseif (y_m <= 3.75e+82)
		tmp = t_2;
	elseif (y_m <= 9.5e+98)
		tmp = 0.5 * ((z * (x - z)) / y_m);
	elseif (y_m <= 2.45e+106)
		tmp = t_0;
	elseif (y_m <= 3.2e+122)
		tmp = z * ((z / y_m) * -0.5);
	else
		tmp = t_2;
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(0.5 * N[(N[(x - z), $MachinePrecision] / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(N[(x - z), $MachinePrecision] * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(y$95$m + N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 1.05e-119], t$95$1, If[LessEqual[y$95$m, 7e-66], t$95$0, If[LessEqual[y$95$m, 4.3e-20], t$95$1, If[LessEqual[y$95$m, 3.75e+82], t$95$2, If[LessEqual[y$95$m, 9.5e+98], N[(0.5 * N[(N[(z * N[(x - z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 2.45e+106], t$95$0, If[LessEqual[y$95$m, 3.2e+122], N[(z * N[(N[(z / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]), $MachinePrecision]]]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x - z}{\frac{y\_m}{x}}\\
t_1 := z \cdot \left(\left(x - z\right) \cdot \frac{0.5}{y\_m}\right)\\
t_2 := 0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.05 \cdot 10^{-119}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y\_m \leq 7 \cdot 10^{-66}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y\_m \leq 4.3 \cdot 10^{-20}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y\_m \leq 3.75 \cdot 10^{+82}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y\_m \leq 9.5 \cdot 10^{+98}:\\
\;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y\_m}\\

\mathbf{elif}\;y\_m \leq 2.45 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < 1.05e-119 or 7.0000000000000001e-66 < y < 4.30000000000000011e-20

    1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr77.8%

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

      \[\leadsto 0.5 \cdot \frac{x - z}{\color{blue}{\frac{y}{z}}} \]
    14. Taylor expanded in y around 0 47.6%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(0.5 \cdot \left(x - z\right)\right) \cdot z}}{y} \]
      4. *-commutative47.6%

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

        \[\leadsto \color{blue}{\frac{\left(x - z\right) \cdot 0.5}{y} \cdot z} \]
      6. *-commutative52.6%

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

        \[\leadsto z \cdot \color{blue}{\left(\left(x - z\right) \cdot \frac{0.5}{y}\right)} \]
    16. Simplified52.6%

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

    if 1.05e-119 < y < 7.0000000000000001e-66 or 9.5000000000000001e98 < y < 2.44999999999999999e106

    1. Initial program 92.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr99.7%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    13. Taylor expanded in x around inf 51.2%

      \[\leadsto 0.5 \cdot \frac{x - z}{\color{blue}{\frac{y}{x}}} \]

    if 4.30000000000000011e-20 < y < 3.7499999999999999e82 or 3.20000000000000012e122 < y

    1. Initial program 41.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot y + 0.5 \cdot \frac{x \cdot z}{y}} \]
    12. Step-by-step derivation
      1. +-commutative65.2%

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

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{z \cdot \frac{x}{y}} + y\right) \]
    13. Simplified68.6%

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

    if 3.7499999999999999e82 < y < 9.5000000000000001e98

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.44999999999999999e106 < y < 3.20000000000000012e122

    1. Initial program 5.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr98.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \left(x - z\right)}{y}}{\frac{1}{z}}} \]
      4. *-commutative100.0%

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

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

        \[\leadsto \color{blue}{\frac{\frac{\left(x - z\right) \cdot 0.5}{y}}{1} \cdot z} \]
      2. /-rgt-identity100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.05 \cdot 10^{-119}:\\ \;\;\;\;z \cdot \left(\left(x - z\right) \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-66}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 4.3 \cdot 10^{-20}:\\ \;\;\;\;z \cdot \left(\left(x - z\right) \cdot \frac{0.5}{y}\right)\\ \mathbf{elif}\;y \leq 3.75 \cdot 10^{+82}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{+98}:\\ \;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y}\\ \mathbf{elif}\;y \leq 2.45 \cdot 10^{+106}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+122}:\\ \;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 81.4% accurate, 0.4× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := y\_m \cdot \left(0.5 - 0.5 \cdot \left(\frac{z}{y\_m} \cdot \frac{z}{y\_m}\right)\right)\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 9.4 \cdot 10^{-21}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y\_m}\right)\right)\\ \mathbf{elif}\;y\_m \leq 9 \cdot 10^{+65}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y\_m \leq 7.2 \cdot 10^{+66}:\\ \;\;\;\;\frac{x}{y\_m} \cdot \left(0.5 \cdot x\right)\\ \mathbf{elif}\;y\_m \leq 1.35 \cdot 10^{+74}:\\ \;\;\;\;y\_m \cdot 0.5\\ \mathbf{elif}\;y\_m \leq 8.2 \cdot 10^{+151}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (* y_m (- 0.5 (* 0.5 (* (/ z y_m) (/ z y_m)))))))
   (*
    y_s
    (if (<= y_m 9.4e-21)
      (* 0.5 (* (+ z x) (* (- x z) (/ 1.0 y_m))))
      (if (<= y_m 9e+65)
        t_0
        (if (<= y_m 7.2e+66)
          (* (/ x y_m) (* 0.5 x))
          (if (<= y_m 1.35e+74)
            (* y_m 0.5)
            (if (<= y_m 8.2e+151)
              (* 0.5 (* (+ z x) (/ (- x z) y_m)))
              t_0))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))));
	double tmp;
	if (y_m <= 9.4e-21) {
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	} else if (y_m <= 9e+65) {
		tmp = t_0;
	} else if (y_m <= 7.2e+66) {
		tmp = (x / y_m) * (0.5 * x);
	} else if (y_m <= 1.35e+74) {
		tmp = y_m * 0.5;
	} else if (y_m <= 8.2e+151) {
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	} else {
		tmp = t_0;
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y_m * (0.5d0 - (0.5d0 * ((z / y_m) * (z / y_m))))
    if (y_m <= 9.4d-21) then
        tmp = 0.5d0 * ((z + x) * ((x - z) * (1.0d0 / y_m)))
    else if (y_m <= 9d+65) then
        tmp = t_0
    else if (y_m <= 7.2d+66) then
        tmp = (x / y_m) * (0.5d0 * x)
    else if (y_m <= 1.35d+74) then
        tmp = y_m * 0.5d0
    else if (y_m <= 8.2d+151) then
        tmp = 0.5d0 * ((z + x) * ((x - z) / y_m))
    else
        tmp = t_0
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double t_0 = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))));
	double tmp;
	if (y_m <= 9.4e-21) {
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	} else if (y_m <= 9e+65) {
		tmp = t_0;
	} else if (y_m <= 7.2e+66) {
		tmp = (x / y_m) * (0.5 * x);
	} else if (y_m <= 1.35e+74) {
		tmp = y_m * 0.5;
	} else if (y_m <= 8.2e+151) {
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	} else {
		tmp = t_0;
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	t_0 = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))))
	tmp = 0
	if y_m <= 9.4e-21:
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)))
	elif y_m <= 9e+65:
		tmp = t_0
	elif y_m <= 7.2e+66:
		tmp = (x / y_m) * (0.5 * x)
	elif y_m <= 1.35e+74:
		tmp = y_m * 0.5
	elif y_m <= 8.2e+151:
		tmp = 0.5 * ((z + x) * ((x - z) / y_m))
	else:
		tmp = t_0
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(y_m * Float64(0.5 - Float64(0.5 * Float64(Float64(z / y_m) * Float64(z / y_m)))))
	tmp = 0.0
	if (y_m <= 9.4e-21)
		tmp = Float64(0.5 * Float64(Float64(z + x) * Float64(Float64(x - z) * Float64(1.0 / y_m))));
	elseif (y_m <= 9e+65)
		tmp = t_0;
	elseif (y_m <= 7.2e+66)
		tmp = Float64(Float64(x / y_m) * Float64(0.5 * x));
	elseif (y_m <= 1.35e+74)
		tmp = Float64(y_m * 0.5);
	elseif (y_m <= 8.2e+151)
		tmp = Float64(0.5 * Float64(Float64(z + x) * Float64(Float64(x - z) / y_m)));
	else
		tmp = t_0;
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	t_0 = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))));
	tmp = 0.0;
	if (y_m <= 9.4e-21)
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	elseif (y_m <= 9e+65)
		tmp = t_0;
	elseif (y_m <= 7.2e+66)
		tmp = (x / y_m) * (0.5 * x);
	elseif (y_m <= 1.35e+74)
		tmp = y_m * 0.5;
	elseif (y_m <= 8.2e+151)
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	else
		tmp = t_0;
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(y$95$m * N[(0.5 - N[(0.5 * N[(N[(z / y$95$m), $MachinePrecision] * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 9.4e-21], N[(0.5 * N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] * N[(1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 9e+65], t$95$0, If[LessEqual[y$95$m, 7.2e+66], N[(N[(x / y$95$m), $MachinePrecision] * N[(0.5 * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 1.35e+74], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[y$95$m, 8.2e+151], N[(0.5 * N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
\begin{array}{l}
t_0 := y\_m \cdot \left(0.5 - 0.5 \cdot \left(\frac{z}{y\_m} \cdot \frac{z}{y\_m}\right)\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 9.4 \cdot 10^{-21}:\\
\;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y\_m}\right)\right)\\

\mathbf{elif}\;y\_m \leq 9 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y\_m \leq 7.2 \cdot 10^{+66}:\\
\;\;\;\;\frac{x}{y\_m} \cdot \left(0.5 \cdot x\right)\\

\mathbf{elif}\;y\_m \leq 1.35 \cdot 10^{+74}:\\
\;\;\;\;y\_m \cdot 0.5\\

\mathbf{elif}\;y\_m \leq 8.2 \cdot 10^{+151}:\\
\;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y\_m}\right)\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < 9.4000000000000006e-21

    1. Initial program 77.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.4000000000000006e-21 < y < 9e65 or 8.1999999999999996e151 < y

    1. Initial program 37.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \left(0.5 + \left(\color{blue}{\left(-1 \cdot \frac{z}{y}\right)} \cdot \frac{z}{y}\right) \cdot 0.5\right) \]
    12. Step-by-step derivation
      1. neg-mul-183.8%

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

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

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

    if 9e65 < y < 7.2e66

    1. Initial program 98.4%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num100.0%

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

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

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

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

        \[\leadsto {\left(y \cdot \frac{2}{\color{blue}{{\left(\sqrt{x \cdot x + y \cdot y}\right)}^{2}} - z \cdot z}\right)}^{-1} \]
      6. hypot-define100.0%

        \[\leadsto {\left(y \cdot \frac{2}{{\color{blue}{\left(\mathsf{hypot}\left(x, y\right)\right)}}^{2} - z \cdot z}\right)}^{-1} \]
      7. pow2100.0%

        \[\leadsto {\left(y \cdot \frac{2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - \color{blue}{{z}^{2}}}\right)}^{-1} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{\left(y \cdot \frac{2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-1100.0%

        \[\leadsto \color{blue}{\frac{1}{y \cdot \frac{2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
      2. associate-*r/100.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{y \cdot 2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
    6. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot 2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
    7. Taylor expanded in x around inf 100.0%

      \[\leadsto \frac{1}{\color{blue}{2 \cdot \frac{y}{{x}^{2}}}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

        \[\leadsto \frac{1}{2 \cdot \frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac98.4%

        \[\leadsto \frac{1}{2 \cdot \color{blue}{\left(\frac{1}{x} \cdot \frac{y}{x}\right)}} \]
    9. Applied egg-rr98.4%

      \[\leadsto \frac{1}{2 \cdot \color{blue}{\left(\frac{1}{x} \cdot \frac{y}{x}\right)}} \]
    10. Step-by-step derivation
      1. associate-*r*98.4%

        \[\leadsto \frac{1}{\color{blue}{\left(2 \cdot \frac{1}{x}\right) \cdot \frac{y}{x}}} \]
      2. clear-num100.0%

        \[\leadsto \frac{1}{\left(2 \cdot \frac{1}{x}\right) \cdot \color{blue}{\frac{1}{\frac{x}{y}}}} \]
      3. un-div-inv100.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot \frac{1}{x}}{\frac{x}{y}}}} \]
      4. un-div-inv100.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{\frac{2}{x}}}{\frac{x}{y}}} \]
    11. Applied egg-rr100.0%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{2}{x}}{\frac{x}{y}}}} \]
    12. Step-by-step derivation
      1. clear-num100.0%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{2}{x}}} \]
      2. div-inv100.0%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{\frac{2}{x}}} \]
      3. clear-num100.0%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{2}} \]
      4. div-inv100.0%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(x \cdot \frac{1}{2}\right)} \]
      5. metadata-eval100.0%

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

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

    if 7.2e66 < y < 1.3499999999999999e74

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    5. Simplified100.0%

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

    if 1.3499999999999999e74 < y < 8.1999999999999996e151

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 9.4 \cdot 10^{-21}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y}\right)\right)\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+65}:\\ \;\;\;\;y \cdot \left(0.5 - 0.5 \cdot \left(\frac{z}{y} \cdot \frac{z}{y}\right)\right)\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+66}:\\ \;\;\;\;\frac{x}{y} \cdot \left(0.5 \cdot x\right)\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+74}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+151}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(0.5 - 0.5 \cdot \left(\frac{z}{y} \cdot \frac{z}{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 76.7% accurate, 0.5× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{z + x}{y\_m} \cdot \frac{x}{y\_m}\right)\right)\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 8.2 \cdot 10^{-32}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-7}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y\_m}\right)\right)\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+35}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+120}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot \left(0.5 - 0.5 \cdot \left(\frac{z}{y\_m} \cdot \frac{z}{y\_m}\right)\right)\\ \end{array} \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (* y_m (+ 0.5 (* 0.5 (* (/ (+ z x) y_m) (/ x y_m)))))))
   (*
    y_s
    (if (<= z 8.2e-32)
      t_0
      (if (<= z 5.4e-7)
        (* 0.5 (* (+ z x) (* (- x z) (/ 1.0 y_m))))
        (if (<= z 9e+35)
          t_0
          (if (<= z 2.8e+120)
            (* 0.5 (* (+ z x) (/ (- x z) y_m)))
            (* y_m (- 0.5 (* 0.5 (* (/ z y_m) (/ z y_m))))))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = y_m * (0.5 + (0.5 * (((z + x) / y_m) * (x / y_m))));
	double tmp;
	if (z <= 8.2e-32) {
		tmp = t_0;
	} else if (z <= 5.4e-7) {
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	} else if (z <= 9e+35) {
		tmp = t_0;
	} else if (z <= 2.8e+120) {
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	} else {
		tmp = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))));
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y_m * (0.5d0 + (0.5d0 * (((z + x) / y_m) * (x / y_m))))
    if (z <= 8.2d-32) then
        tmp = t_0
    else if (z <= 5.4d-7) then
        tmp = 0.5d0 * ((z + x) * ((x - z) * (1.0d0 / y_m)))
    else if (z <= 9d+35) then
        tmp = t_0
    else if (z <= 2.8d+120) then
        tmp = 0.5d0 * ((z + x) * ((x - z) / y_m))
    else
        tmp = y_m * (0.5d0 - (0.5d0 * ((z / y_m) * (z / y_m))))
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double t_0 = y_m * (0.5 + (0.5 * (((z + x) / y_m) * (x / y_m))));
	double tmp;
	if (z <= 8.2e-32) {
		tmp = t_0;
	} else if (z <= 5.4e-7) {
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	} else if (z <= 9e+35) {
		tmp = t_0;
	} else if (z <= 2.8e+120) {
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	} else {
		tmp = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))));
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	t_0 = y_m * (0.5 + (0.5 * (((z + x) / y_m) * (x / y_m))))
	tmp = 0
	if z <= 8.2e-32:
		tmp = t_0
	elif z <= 5.4e-7:
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)))
	elif z <= 9e+35:
		tmp = t_0
	elif z <= 2.8e+120:
		tmp = 0.5 * ((z + x) * ((x - z) / y_m))
	else:
		tmp = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))))
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(z + x) / y_m) * Float64(x / y_m)))))
	tmp = 0.0
	if (z <= 8.2e-32)
		tmp = t_0;
	elseif (z <= 5.4e-7)
		tmp = Float64(0.5 * Float64(Float64(z + x) * Float64(Float64(x - z) * Float64(1.0 / y_m))));
	elseif (z <= 9e+35)
		tmp = t_0;
	elseif (z <= 2.8e+120)
		tmp = Float64(0.5 * Float64(Float64(z + x) * Float64(Float64(x - z) / y_m)));
	else
		tmp = Float64(y_m * Float64(0.5 - Float64(0.5 * Float64(Float64(z / y_m) * Float64(z / y_m)))));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	t_0 = y_m * (0.5 + (0.5 * (((z + x) / y_m) * (x / y_m))));
	tmp = 0.0;
	if (z <= 8.2e-32)
		tmp = t_0;
	elseif (z <= 5.4e-7)
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	elseif (z <= 9e+35)
		tmp = t_0;
	elseif (z <= 2.8e+120)
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	else
		tmp = y_m * (0.5 - (0.5 * ((z / y_m) * (z / y_m))));
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(z + x), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[z, 8.2e-32], t$95$0, If[LessEqual[z, 5.4e-7], N[(0.5 * N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] * N[(1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e+35], t$95$0, If[LessEqual[z, 2.8e+120], N[(0.5 * N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 - N[(0.5 * N[(N[(z / y$95$m), $MachinePrecision] * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

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

\mathbf{elif}\;z \leq 5.4 \cdot 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y\_m}\right)\right)\\

\mathbf{elif}\;z \leq 9 \cdot 10^{+35}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 2.8 \cdot 10^{+120}:\\
\;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y\_m}\right)\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < 8.1999999999999995e-32 or 5.40000000000000018e-7 < z < 8.9999999999999993e35

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.1999999999999995e-32 < z < 5.40000000000000018e-7

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.9999999999999993e35 < z < 2.8000000000000001e120

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.8000000000000001e120 < z

    1. Initial program 62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \left(0.5 + \left(\color{blue}{\left(-1 \cdot \frac{z}{y}\right)} \cdot \frac{z}{y}\right) \cdot 0.5\right) \]
    12. Step-by-step derivation
      1. neg-mul-190.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 8.2 \cdot 10^{-32}:\\ \;\;\;\;y \cdot \left(0.5 + 0.5 \cdot \left(\frac{z + x}{y} \cdot \frac{x}{y}\right)\right)\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-7}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y}\right)\right)\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+35}:\\ \;\;\;\;y \cdot \left(0.5 + 0.5 \cdot \left(\frac{z + x}{y} \cdot \frac{x}{y}\right)\right)\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+120}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(0.5 - 0.5 \cdot \left(\frac{z}{y} \cdot \frac{z}{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 44.3% accurate, 0.5× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := \frac{x}{y\_m} \cdot \left(0.5 \cdot x\right)\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 5.5 \cdot 10^{-234}:\\ \;\;\;\;0.5 \cdot \left(y\_m + z \cdot 2\right)\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-60}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-38}:\\ \;\;\;\;y\_m \cdot 0.5\\ \mathbf{elif}\;z \leq 4500000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+27}:\\ \;\;\;\;y\_m \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\frac{z}{y\_m} \cdot -0.5\right)\\ \end{array} \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (* (/ x y_m) (* 0.5 x))))
   (*
    y_s
    (if (<= z 5.5e-234)
      (* 0.5 (+ y_m (* z 2.0)))
      (if (<= z 1.02e-60)
        t_0
        (if (<= z 3.3e-38)
          (* y_m 0.5)
          (if (<= z 4500000000.0)
            t_0
            (if (<= z 1.35e+27) (* y_m 0.5) (* z (* (/ z y_m) -0.5))))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = (x / y_m) * (0.5 * x);
	double tmp;
	if (z <= 5.5e-234) {
		tmp = 0.5 * (y_m + (z * 2.0));
	} else if (z <= 1.02e-60) {
		tmp = t_0;
	} else if (z <= 3.3e-38) {
		tmp = y_m * 0.5;
	} else if (z <= 4500000000.0) {
		tmp = t_0;
	} else if (z <= 1.35e+27) {
		tmp = y_m * 0.5;
	} else {
		tmp = z * ((z / y_m) * -0.5);
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x / y_m) * (0.5d0 * x)
    if (z <= 5.5d-234) then
        tmp = 0.5d0 * (y_m + (z * 2.0d0))
    else if (z <= 1.02d-60) then
        tmp = t_0
    else if (z <= 3.3d-38) then
        tmp = y_m * 0.5d0
    else if (z <= 4500000000.0d0) then
        tmp = t_0
    else if (z <= 1.35d+27) then
        tmp = y_m * 0.5d0
    else
        tmp = z * ((z / y_m) * (-0.5d0))
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double t_0 = (x / y_m) * (0.5 * x);
	double tmp;
	if (z <= 5.5e-234) {
		tmp = 0.5 * (y_m + (z * 2.0));
	} else if (z <= 1.02e-60) {
		tmp = t_0;
	} else if (z <= 3.3e-38) {
		tmp = y_m * 0.5;
	} else if (z <= 4500000000.0) {
		tmp = t_0;
	} else if (z <= 1.35e+27) {
		tmp = y_m * 0.5;
	} else {
		tmp = z * ((z / y_m) * -0.5);
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	t_0 = (x / y_m) * (0.5 * x)
	tmp = 0
	if z <= 5.5e-234:
		tmp = 0.5 * (y_m + (z * 2.0))
	elif z <= 1.02e-60:
		tmp = t_0
	elif z <= 3.3e-38:
		tmp = y_m * 0.5
	elif z <= 4500000000.0:
		tmp = t_0
	elif z <= 1.35e+27:
		tmp = y_m * 0.5
	else:
		tmp = z * ((z / y_m) * -0.5)
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(Float64(x / y_m) * Float64(0.5 * x))
	tmp = 0.0
	if (z <= 5.5e-234)
		tmp = Float64(0.5 * Float64(y_m + Float64(z * 2.0)));
	elseif (z <= 1.02e-60)
		tmp = t_0;
	elseif (z <= 3.3e-38)
		tmp = Float64(y_m * 0.5);
	elseif (z <= 4500000000.0)
		tmp = t_0;
	elseif (z <= 1.35e+27)
		tmp = Float64(y_m * 0.5);
	else
		tmp = Float64(z * Float64(Float64(z / y_m) * -0.5));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	t_0 = (x / y_m) * (0.5 * x);
	tmp = 0.0;
	if (z <= 5.5e-234)
		tmp = 0.5 * (y_m + (z * 2.0));
	elseif (z <= 1.02e-60)
		tmp = t_0;
	elseif (z <= 3.3e-38)
		tmp = y_m * 0.5;
	elseif (z <= 4500000000.0)
		tmp = t_0;
	elseif (z <= 1.35e+27)
		tmp = y_m * 0.5;
	else
		tmp = z * ((z / y_m) * -0.5);
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(x / y$95$m), $MachinePrecision] * N[(0.5 * x), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[z, 5.5e-234], N[(0.5 * N[(y$95$m + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.02e-60], t$95$0, If[LessEqual[z, 3.3e-38], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[z, 4500000000.0], t$95$0, If[LessEqual[z, 1.35e+27], N[(y$95$m * 0.5), $MachinePrecision], N[(z * N[(N[(z / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
\begin{array}{l}
t_0 := \frac{x}{y\_m} \cdot \left(0.5 \cdot x\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 5.5 \cdot 10^{-234}:\\
\;\;\;\;0.5 \cdot \left(y\_m + z \cdot 2\right)\\

\mathbf{elif}\;z \leq 1.02 \cdot 10^{-60}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 3.3 \cdot 10^{-38}:\\
\;\;\;\;y\_m \cdot 0.5\\

\mathbf{elif}\;z \leq 4500000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 1.35 \cdot 10^{+27}:\\
\;\;\;\;y\_m \cdot 0.5\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < 5.5e-234

    1. Initial program 69.6%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Step-by-step derivation
      1. remove-double-neg69.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-out69.6%

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

        \[\leadsto \color{blue}{-\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\left(-y\right) \cdot 2}} \]
      4. distribute-frac-neg69.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-169.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-out69.6%

        \[\leadsto \frac{-1 \cdot \left(\left(x \cdot x + y \cdot y\right) - z \cdot z\right)}{\color{blue}{-y \cdot 2}} \]
      7. *-commutative69.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-in69.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-frac69.6%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}}{y} \]
    3. Simplified70.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. Step-by-step derivation
      1. prod-diff56.3%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\mathsf{fma}\left(x, x, \mathsf{fma}\left(y + z, y - z, \mathsf{fma}\left(-z, z, \color{blue}{{z}^{2}}\right)\right)\right)}{y} \]
    6. Applied egg-rr58.1%

      \[\leadsto 0.5 \cdot \frac{\mathsf{fma}\left(x, x, \color{blue}{\mathsf{fma}\left(y + z, y - z, \mathsf{fma}\left(-z, z, {z}^{2}\right)\right)}\right)}{y} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt42.9%

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

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(x, x, \mathsf{fma}\left(y + z, y - z, \mathsf{fma}\left(-z, z, {z}^{2}\right)\right)\right)} \cdot \sqrt{\mathsf{fma}\left(x, x, \mathsf{fma}\left(y + z, y - z, \mathsf{fma}\left(-z, z, {z}^{2}\right)\right)\right)}}{\color{blue}{1 \cdot y}} \]
      3. times-frac42.9%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\sqrt{\mathsf{fma}\left(x, x, \mathsf{fma}\left(y + z, y - z, \mathsf{fma}\left(-z, z, {z}^{2}\right)\right)\right)}}{1} \cdot \frac{\sqrt{\mathsf{fma}\left(x, x, \mathsf{fma}\left(y + z, y - z, \mathsf{fma}\left(-z, z, {z}^{2}\right)\right)\right)}}{y}\right)} \]
    8. Applied egg-rr64.5%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{\mathsf{hypot}\left(x, z + y\right)}{1} \cdot \frac{\mathsf{hypot}\left(x, z + y\right)}{y}\right)} \]
    9. Taylor expanded in y around inf 37.4%

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

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

        \[\leadsto 0.5 \cdot \left(y \cdot \left(1 + \frac{\color{blue}{z \cdot 2}}{y}\right)\right) \]
    11. Simplified37.4%

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(y + 2 \cdot z\right)} \]
    13. Step-by-step derivation
      1. *-commutative32.9%

        \[\leadsto 0.5 \cdot \left(y + \color{blue}{z \cdot 2}\right) \]
    14. Simplified32.9%

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

    if 5.5e-234 < z < 1.01999999999999994e-60 or 3.3000000000000002e-38 < z < 4.5e9

    1. Initial program 75.1%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num75.2%

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

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

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

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

        \[\leadsto {\left(y \cdot \frac{2}{\color{blue}{{\left(\sqrt{x \cdot x + y \cdot y}\right)}^{2}} - z \cdot z}\right)}^{-1} \]
      6. hypot-define75.0%

        \[\leadsto {\left(y \cdot \frac{2}{{\color{blue}{\left(\mathsf{hypot}\left(x, y\right)\right)}}^{2} - z \cdot z}\right)}^{-1} \]
      7. pow275.0%

        \[\leadsto {\left(y \cdot \frac{2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - \color{blue}{{z}^{2}}}\right)}^{-1} \]
    4. Applied egg-rr75.0%

      \[\leadsto \color{blue}{{\left(y \cdot \frac{2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-175.0%

        \[\leadsto \color{blue}{\frac{1}{y \cdot \frac{2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
      2. associate-*r/75.1%

        \[\leadsto \frac{1}{\color{blue}{\frac{y \cdot 2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
    6. Simplified75.1%

      \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot 2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
    7. Taylor expanded in x around inf 53.0%

      \[\leadsto \frac{1}{\color{blue}{2 \cdot \frac{y}{{x}^{2}}}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity53.0%

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

        \[\leadsto \frac{1}{2 \cdot \frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac55.2%

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

      \[\leadsto \frac{1}{2 \cdot \color{blue}{\left(\frac{1}{x} \cdot \frac{y}{x}\right)}} \]
    10. Step-by-step derivation
      1. associate-*r*55.2%

        \[\leadsto \frac{1}{\color{blue}{\left(2 \cdot \frac{1}{x}\right) \cdot \frac{y}{x}}} \]
      2. clear-num55.2%

        \[\leadsto \frac{1}{\left(2 \cdot \frac{1}{x}\right) \cdot \color{blue}{\frac{1}{\frac{x}{y}}}} \]
      3. un-div-inv55.2%

        \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot \frac{1}{x}}{\frac{x}{y}}}} \]
      4. un-div-inv55.2%

        \[\leadsto \frac{1}{\frac{\color{blue}{\frac{2}{x}}}{\frac{x}{y}}} \]
    11. Applied egg-rr55.2%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{2}{x}}{\frac{x}{y}}}} \]
    12. Step-by-step derivation
      1. clear-num55.2%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{2}{x}}} \]
      2. div-inv55.2%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{\frac{2}{x}}} \]
      3. clear-num55.2%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{2}} \]
      4. div-inv55.2%

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

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

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

    if 1.01999999999999994e-60 < z < 3.3000000000000002e-38 or 4.5e9 < z < 1.3499999999999999e27

    1. Initial program 41.9%

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

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

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    5. Simplified88.2%

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

    if 1.3499999999999999e27 < z

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr81.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \left(x - z\right)}{y}}{\frac{1}{z}}} \]
      4. *-commutative73.4%

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

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

        \[\leadsto \color{blue}{\frac{\frac{\left(x - z\right) \cdot 0.5}{y}}{1} \cdot z} \]
      2. /-rgt-identity73.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 5.5 \cdot 10^{-234}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot 2\right)\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-60}:\\ \;\;\;\;\frac{x}{y} \cdot \left(0.5 \cdot x\right)\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-38}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 4500000000:\\ \;\;\;\;\frac{x}{y} \cdot \left(0.5 \cdot x\right)\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+27}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 77.8% accurate, 0.5× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 1.35 \cdot 10^{+37}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y\_m}\right)\right)\\ \mathbf{elif}\;y\_m \leq 5.6 \cdot 10^{+70}:\\ \;\;\;\;0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\ \mathbf{elif}\;y\_m \leq 1.75 \cdot 10^{+164}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{z}{y\_m} \cdot \frac{x}{y\_m}\right)\right)\\ \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= y_m 1.35e+37)
    (* 0.5 (* (+ z x) (* (- x z) (/ 1.0 y_m))))
    (if (<= y_m 5.6e+70)
      (* 0.5 (+ y_m (* z (/ x y_m))))
      (if (<= y_m 1.75e+164)
        (* 0.5 (* (+ z x) (/ (- x z) y_m)))
        (* y_m (+ 0.5 (* 0.5 (* (/ z y_m) (/ x y_m))))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 1.35e+37) {
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	} else if (y_m <= 5.6e+70) {
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	} else if (y_m <= 1.75e+164) {
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	} else {
		tmp = y_m * (0.5 + (0.5 * ((z / y_m) * (x / y_m))));
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y_m <= 1.35d+37) then
        tmp = 0.5d0 * ((z + x) * ((x - z) * (1.0d0 / y_m)))
    else if (y_m <= 5.6d+70) then
        tmp = 0.5d0 * (y_m + (z * (x / y_m)))
    else if (y_m <= 1.75d+164) then
        tmp = 0.5d0 * ((z + x) * ((x - z) / y_m))
    else
        tmp = y_m * (0.5d0 + (0.5d0 * ((z / y_m) * (x / y_m))))
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 1.35e+37) {
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	} else if (y_m <= 5.6e+70) {
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	} else if (y_m <= 1.75e+164) {
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	} else {
		tmp = y_m * (0.5 + (0.5 * ((z / y_m) * (x / y_m))));
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if y_m <= 1.35e+37:
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)))
	elif y_m <= 5.6e+70:
		tmp = 0.5 * (y_m + (z * (x / y_m)))
	elif y_m <= 1.75e+164:
		tmp = 0.5 * ((z + x) * ((x - z) / y_m))
	else:
		tmp = y_m * (0.5 + (0.5 * ((z / y_m) * (x / y_m))))
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (y_m <= 1.35e+37)
		tmp = Float64(0.5 * Float64(Float64(z + x) * Float64(Float64(x - z) * Float64(1.0 / y_m))));
	elseif (y_m <= 5.6e+70)
		tmp = Float64(0.5 * Float64(y_m + Float64(z * Float64(x / y_m))));
	elseif (y_m <= 1.75e+164)
		tmp = Float64(0.5 * Float64(Float64(z + x) * Float64(Float64(x - z) / y_m)));
	else
		tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(z / y_m) * Float64(x / y_m)))));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if (y_m <= 1.35e+37)
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	elseif (y_m <= 5.6e+70)
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	elseif (y_m <= 1.75e+164)
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	else
		tmp = y_m * (0.5 + (0.5 * ((z / y_m) * (x / y_m))));
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.35e+37], N[(0.5 * N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] * N[(1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 5.6e+70], N[(0.5 * N[(y$95$m + N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 1.75e+164], N[(0.5 * N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(z / y$95$m), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.35 \cdot 10^{+37}:\\
\;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y\_m}\right)\right)\\

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

\mathbf{elif}\;y\_m \leq 1.75 \cdot 10^{+164}:\\
\;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y\_m}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 1.34999999999999993e37

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.34999999999999993e37 < y < 5.59999999999999979e70

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot y + 0.5 \cdot \frac{x \cdot z}{y}} \]
    12. Step-by-step derivation
      1. +-commutative69.3%

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

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

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

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

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

    if 5.59999999999999979e70 < y < 1.7499999999999999e164

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.7499999999999999e164 < y

    1. Initial program 8.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.35 \cdot 10^{+37}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y}\right)\right)\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+70}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+164}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(0.5 + 0.5 \cdot \left(\frac{z}{y} \cdot \frac{x}{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 77.9% accurate, 0.6× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 7.2 \cdot 10^{+36}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y\_m}\right)\right)\\ \mathbf{elif}\;y\_m \leq 3.4 \cdot 10^{+70} \lor \neg \left(y\_m \leq 5.6 \cdot 10^{+163}\right):\\ \;\;\;\;0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y\_m}\right)\\ \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= y_m 7.2e+36)
    (* 0.5 (* (+ z x) (* (- x z) (/ 1.0 y_m))))
    (if (or (<= y_m 3.4e+70) (not (<= y_m 5.6e+163)))
      (* 0.5 (+ y_m (* z (/ x y_m))))
      (* 0.5 (* (+ z x) (/ (- x z) y_m)))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 7.2e+36) {
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	} else if ((y_m <= 3.4e+70) || !(y_m <= 5.6e+163)) {
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	} else {
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y_m <= 7.2d+36) then
        tmp = 0.5d0 * ((z + x) * ((x - z) * (1.0d0 / y_m)))
    else if ((y_m <= 3.4d+70) .or. (.not. (y_m <= 5.6d+163))) then
        tmp = 0.5d0 * (y_m + (z * (x / y_m)))
    else
        tmp = 0.5d0 * ((z + x) * ((x - z) / y_m))
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 7.2e+36) {
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	} else if ((y_m <= 3.4e+70) || !(y_m <= 5.6e+163)) {
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	} else {
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if y_m <= 7.2e+36:
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)))
	elif (y_m <= 3.4e+70) or not (y_m <= 5.6e+163):
		tmp = 0.5 * (y_m + (z * (x / y_m)))
	else:
		tmp = 0.5 * ((z + x) * ((x - z) / y_m))
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (y_m <= 7.2e+36)
		tmp = Float64(0.5 * Float64(Float64(z + x) * Float64(Float64(x - z) * Float64(1.0 / y_m))));
	elseif ((y_m <= 3.4e+70) || !(y_m <= 5.6e+163))
		tmp = Float64(0.5 * Float64(y_m + Float64(z * Float64(x / y_m))));
	else
		tmp = Float64(0.5 * Float64(Float64(z + x) * Float64(Float64(x - z) / y_m)));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if (y_m <= 7.2e+36)
		tmp = 0.5 * ((z + x) * ((x - z) * (1.0 / y_m)));
	elseif ((y_m <= 3.4e+70) || ~((y_m <= 5.6e+163)))
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	else
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 7.2e+36], N[(0.5 * N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] * N[(1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y$95$m, 3.4e+70], N[Not[LessEqual[y$95$m, 5.6e+163]], $MachinePrecision]], N[(0.5 * N[(y$95$m + N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 7.2 \cdot 10^{+36}:\\
\;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y\_m}\right)\right)\\

\mathbf{elif}\;y\_m \leq 3.4 \cdot 10^{+70} \lor \neg \left(y\_m \leq 5.6 \cdot 10^{+163}\right):\\
\;\;\;\;0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 7.1999999999999995e36

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.1999999999999995e36 < y < 3.4000000000000001e70 or 5.60000000000000029e163 < y

    1. Initial program 15.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot y + 0.5 \cdot \frac{x \cdot z}{y}} \]
    12. Step-by-step derivation
      1. +-commutative69.5%

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

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

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

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

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

    if 3.4000000000000001e70 < y < 5.60000000000000029e163

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7.2 \cdot 10^{+36}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \left(\left(x - z\right) \cdot \frac{1}{y}\right)\right)\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+70} \lor \neg \left(y \leq 5.6 \cdot 10^{+163}\right):\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 78.0% accurate, 0.6× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 1.1 \cdot 10^{+37} \lor \neg \left(y\_m \leq 3.5 \cdot 10^{+70}\right) \land y\_m \leq 1.9 \cdot 10^{+161}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\ \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (or (<= y_m 1.1e+37) (and (not (<= y_m 3.5e+70)) (<= y_m 1.9e+161)))
    (* 0.5 (* (+ z x) (/ (- x z) y_m)))
    (* 0.5 (+ y_m (* z (/ x y_m)))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((y_m <= 1.1e+37) || (!(y_m <= 3.5e+70) && (y_m <= 1.9e+161))) {
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	} else {
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y_m <= 1.1d+37) .or. (.not. (y_m <= 3.5d+70)) .and. (y_m <= 1.9d+161)) then
        tmp = 0.5d0 * ((z + x) * ((x - z) / y_m))
    else
        tmp = 0.5d0 * (y_m + (z * (x / y_m)))
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((y_m <= 1.1e+37) || (!(y_m <= 3.5e+70) && (y_m <= 1.9e+161))) {
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	} else {
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if (y_m <= 1.1e+37) or (not (y_m <= 3.5e+70) and (y_m <= 1.9e+161)):
		tmp = 0.5 * ((z + x) * ((x - z) / y_m))
	else:
		tmp = 0.5 * (y_m + (z * (x / y_m)))
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if ((y_m <= 1.1e+37) || (!(y_m <= 3.5e+70) && (y_m <= 1.9e+161)))
		tmp = Float64(0.5 * Float64(Float64(z + x) * Float64(Float64(x - z) / y_m)));
	else
		tmp = Float64(0.5 * Float64(y_m + Float64(z * Float64(x / y_m))));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if ((y_m <= 1.1e+37) || (~((y_m <= 3.5e+70)) && (y_m <= 1.9e+161)))
		tmp = 0.5 * ((z + x) * ((x - z) / y_m));
	else
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[Or[LessEqual[y$95$m, 1.1e+37], And[N[Not[LessEqual[y$95$m, 3.5e+70]], $MachinePrecision], LessEqual[y$95$m, 1.9e+161]]], N[(0.5 * N[(N[(z + x), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y$95$m + N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.1 \cdot 10^{+37} \lor \neg \left(y\_m \leq 3.5 \cdot 10^{+70}\right) \land y\_m \leq 1.9 \cdot 10^{+161}:\\
\;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y\_m}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.1e37 or 3.50000000000000002e70 < y < 1.9000000000000001e161

    1. Initial program 78.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1e37 < y < 3.50000000000000002e70 or 1.9000000000000001e161 < y

    1. Initial program 15.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot y + 0.5 \cdot \frac{x \cdot z}{y}} \]
    12. Step-by-step derivation
      1. +-commutative69.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.1 \cdot 10^{+37} \lor \neg \left(y \leq 3.5 \cdot 10^{+70}\right) \land y \leq 1.9 \cdot 10^{+161}:\\ \;\;\;\;0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 51.5% accurate, 0.6× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := 0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 8.2 \cdot 10^{-32}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 3.15 \cdot 10^{-7}:\\ \;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y\_m}\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{+27}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{\frac{y\_m}{z}}\\ \end{array} \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ y_m (* z (/ x y_m))))))
   (*
    y_s
    (if (<= z 8.2e-32)
      t_0
      (if (<= z 3.15e-7)
        (* 0.5 (/ (* z (- x z)) y_m))
        (if (<= z 1.12e+27) t_0 (* 0.5 (/ (- x z) (/ y_m z)))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = 0.5 * (y_m + (z * (x / y_m)));
	double tmp;
	if (z <= 8.2e-32) {
		tmp = t_0;
	} else if (z <= 3.15e-7) {
		tmp = 0.5 * ((z * (x - z)) / y_m);
	} else if (z <= 1.12e+27) {
		tmp = t_0;
	} else {
		tmp = 0.5 * ((x - z) / (y_m / z));
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.5d0 * (y_m + (z * (x / y_m)))
    if (z <= 8.2d-32) then
        tmp = t_0
    else if (z <= 3.15d-7) then
        tmp = 0.5d0 * ((z * (x - z)) / y_m)
    else if (z <= 1.12d+27) then
        tmp = t_0
    else
        tmp = 0.5d0 * ((x - z) / (y_m / z))
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double t_0 = 0.5 * (y_m + (z * (x / y_m)));
	double tmp;
	if (z <= 8.2e-32) {
		tmp = t_0;
	} else if (z <= 3.15e-7) {
		tmp = 0.5 * ((z * (x - z)) / y_m);
	} else if (z <= 1.12e+27) {
		tmp = t_0;
	} else {
		tmp = 0.5 * ((x - z) / (y_m / z));
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	t_0 = 0.5 * (y_m + (z * (x / y_m)))
	tmp = 0
	if z <= 8.2e-32:
		tmp = t_0
	elif z <= 3.15e-7:
		tmp = 0.5 * ((z * (x - z)) / y_m)
	elif z <= 1.12e+27:
		tmp = t_0
	else:
		tmp = 0.5 * ((x - z) / (y_m / z))
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(0.5 * Float64(y_m + Float64(z * Float64(x / y_m))))
	tmp = 0.0
	if (z <= 8.2e-32)
		tmp = t_0;
	elseif (z <= 3.15e-7)
		tmp = Float64(0.5 * Float64(Float64(z * Float64(x - z)) / y_m));
	elseif (z <= 1.12e+27)
		tmp = t_0;
	else
		tmp = Float64(0.5 * Float64(Float64(x - z) / Float64(y_m / z)));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	t_0 = 0.5 * (y_m + (z * (x / y_m)));
	tmp = 0.0;
	if (z <= 8.2e-32)
		tmp = t_0;
	elseif (z <= 3.15e-7)
		tmp = 0.5 * ((z * (x - z)) / y_m);
	elseif (z <= 1.12e+27)
		tmp = t_0;
	else
		tmp = 0.5 * ((x - z) / (y_m / z));
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(0.5 * N[(y$95$m + N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[z, 8.2e-32], t$95$0, If[LessEqual[z, 3.15e-7], N[(0.5 * N[(N[(z * N[(x - z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e+27], t$95$0, N[(0.5 * N[(N[(x - z), $MachinePrecision] / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

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

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

\mathbf{elif}\;z \leq 1.12 \cdot 10^{+27}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 8.1999999999999995e-32 or 3.15000000000000002e-7 < z < 1.12e27

    1. Initial program 69.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot y + 0.5 \cdot \frac{x \cdot z}{y}} \]
    12. Step-by-step derivation
      1. +-commutative43.5%

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

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

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

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

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

    if 8.1999999999999995e-32 < z < 3.15000000000000002e-7

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.12e27 < z

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr81.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 8.2 \cdot 10^{-32}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;z \leq 3.15 \cdot 10^{-7}:\\ \;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y}\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{+27}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{\frac{y}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 51.7% accurate, 0.7× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 4.3 \cdot 10^{-20} \lor \neg \left(y\_m \leq 2.2 \cdot 10^{+83}\right) \land y\_m \leq 1.3 \cdot 10^{+94}:\\ \;\;\;\;z \cdot \left(\frac{z}{y\_m} \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot 0.5\\ \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (or (<= y_m 4.3e-20) (and (not (<= y_m 2.2e+83)) (<= y_m 1.3e+94)))
    (* z (* (/ z y_m) -0.5))
    (* y_m 0.5))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((y_m <= 4.3e-20) || (!(y_m <= 2.2e+83) && (y_m <= 1.3e+94))) {
		tmp = z * ((z / y_m) * -0.5);
	} else {
		tmp = y_m * 0.5;
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y_m <= 4.3d-20) .or. (.not. (y_m <= 2.2d+83)) .and. (y_m <= 1.3d+94)) then
        tmp = z * ((z / y_m) * (-0.5d0))
    else
        tmp = y_m * 0.5d0
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if ((y_m <= 4.3e-20) || (!(y_m <= 2.2e+83) && (y_m <= 1.3e+94))) {
		tmp = z * ((z / y_m) * -0.5);
	} else {
		tmp = y_m * 0.5;
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if (y_m <= 4.3e-20) or (not (y_m <= 2.2e+83) and (y_m <= 1.3e+94)):
		tmp = z * ((z / y_m) * -0.5)
	else:
		tmp = y_m * 0.5
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if ((y_m <= 4.3e-20) || (!(y_m <= 2.2e+83) && (y_m <= 1.3e+94)))
		tmp = Float64(z * Float64(Float64(z / y_m) * -0.5));
	else
		tmp = Float64(y_m * 0.5);
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if ((y_m <= 4.3e-20) || (~((y_m <= 2.2e+83)) && (y_m <= 1.3e+94)))
		tmp = z * ((z / y_m) * -0.5);
	else
		tmp = y_m * 0.5;
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[Or[LessEqual[y$95$m, 4.3e-20], And[N[Not[LessEqual[y$95$m, 2.2e+83]], $MachinePrecision], LessEqual[y$95$m, 1.3e+94]]], N[(z * N[(N[(z / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 4.3 \cdot 10^{-20} \lor \neg \left(y\_m \leq 2.2 \cdot 10^{+83}\right) \land y\_m \leq 1.3 \cdot 10^{+94}:\\
\;\;\;\;z \cdot \left(\frac{z}{y\_m} \cdot -0.5\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4.30000000000000011e-20 or 2.19999999999999999e83 < y < 1.3e94

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr79.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \left(x - z\right)}{y}}{\frac{1}{z}}} \]
      4. *-commutative51.6%

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

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

        \[\leadsto \color{blue}{\frac{\frac{\left(x - z\right) \cdot 0.5}{y}}{1} \cdot z} \]
      2. /-rgt-identity51.6%

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

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

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

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

    if 4.30000000000000011e-20 < y < 2.19999999999999999e83 or 1.3e94 < y

    1. Initial program 42.9%

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

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

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    5. Simplified63.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.3 \cdot 10^{-20} \lor \neg \left(y \leq 2.2 \cdot 10^{+83}\right) \land y \leq 1.3 \cdot 10^{+94}:\\ \;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 43.0% accurate, 0.7× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ \begin{array}{l} t_0 := z \cdot \left(\frac{z}{y\_m} \cdot -0.5\right)\\ y\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq 1.18 \cdot 10^{-29}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+66}:\\ \;\;\;\;0.5 \cdot \left(y\_m + z \cdot \frac{x}{y\_m}\right)\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+91}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y\_m} \cdot \left(0.5 \cdot x\right)\\ \end{array} \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (let* ((t_0 (* z (* (/ z y_m) -0.5))))
   (*
    y_s
    (if (<= x 1.18e-29)
      t_0
      (if (<= x 6.5e+66)
        (* 0.5 (+ y_m (* z (/ x y_m))))
        (if (<= x 4.8e+91) t_0 (* (/ x y_m) (* 0.5 x))))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double t_0 = z * ((z / y_m) * -0.5);
	double tmp;
	if (x <= 1.18e-29) {
		tmp = t_0;
	} else if (x <= 6.5e+66) {
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	} else if (x <= 4.8e+91) {
		tmp = t_0;
	} else {
		tmp = (x / y_m) * (0.5 * x);
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = z * ((z / y_m) * (-0.5d0))
    if (x <= 1.18d-29) then
        tmp = t_0
    else if (x <= 6.5d+66) then
        tmp = 0.5d0 * (y_m + (z * (x / y_m)))
    else if (x <= 4.8d+91) then
        tmp = t_0
    else
        tmp = (x / y_m) * (0.5d0 * x)
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double t_0 = z * ((z / y_m) * -0.5);
	double tmp;
	if (x <= 1.18e-29) {
		tmp = t_0;
	} else if (x <= 6.5e+66) {
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	} else if (x <= 4.8e+91) {
		tmp = t_0;
	} else {
		tmp = (x / y_m) * (0.5 * x);
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	t_0 = z * ((z / y_m) * -0.5)
	tmp = 0
	if x <= 1.18e-29:
		tmp = t_0
	elif x <= 6.5e+66:
		tmp = 0.5 * (y_m + (z * (x / y_m)))
	elif x <= 4.8e+91:
		tmp = t_0
	else:
		tmp = (x / y_m) * (0.5 * x)
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	t_0 = Float64(z * Float64(Float64(z / y_m) * -0.5))
	tmp = 0.0
	if (x <= 1.18e-29)
		tmp = t_0;
	elseif (x <= 6.5e+66)
		tmp = Float64(0.5 * Float64(y_m + Float64(z * Float64(x / y_m))));
	elseif (x <= 4.8e+91)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / y_m) * Float64(0.5 * x));
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	t_0 = z * ((z / y_m) * -0.5);
	tmp = 0.0;
	if (x <= 1.18e-29)
		tmp = t_0;
	elseif (x <= 6.5e+66)
		tmp = 0.5 * (y_m + (z * (x / y_m)));
	elseif (x <= 4.8e+91)
		tmp = t_0;
	else
		tmp = (x / y_m) * (0.5 * x);
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(z * N[(N[(z / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[x, 1.18e-29], t$95$0, If[LessEqual[x, 6.5e+66], N[(0.5 * N[(y$95$m + N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.8e+91], t$95$0, N[(N[(x / y$95$m), $MachinePrecision] * N[(0.5 * x), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

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

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

\mathbf{elif}\;x \leq 4.8 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 1.17999999999999996e-29 or 6.5000000000000001e66 < x < 4.79999999999999966e91

    1. Initial program 69.4%

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(0.5 + \frac{{x}^{2} - {z}^{2}}{{y}^{2}} \cdot 0.5\right)} \]
    6. Step-by-step derivation
      1. unpow271.3%

        \[\leadsto y \cdot \left(0.5 + \frac{\color{blue}{x \cdot x} - {z}^{2}}{{y}^{2}} \cdot 0.5\right) \]
      2. unpow271.3%

        \[\leadsto y \cdot \left(0.5 + \frac{x \cdot x - \color{blue}{z \cdot z}}{{y}^{2}} \cdot 0.5\right) \]
      3. difference-of-squares71.3%

        \[\leadsto y \cdot \left(0.5 + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{{y}^{2}} \cdot 0.5\right) \]
    7. Applied egg-rr71.3%

      \[\leadsto y \cdot \left(0.5 + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{{y}^{2}} \cdot 0.5\right) \]
    8. Taylor expanded in y around 0 58.9%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(x + z\right) \cdot \left(x - z\right)}{y}} \]
    9. Step-by-step derivation
      1. associate-/l*65.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x + z\right) \cdot \frac{x - z}{y}\right)} \]
      2. +-commutative65.8%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(z + x\right)} \cdot \frac{x - z}{y}\right) \]
    10. Simplified65.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y}\right)} \]
    11. Step-by-step derivation
      1. associate-*r/58.9%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(z + x\right) \cdot \left(x - z\right)}{y}} \]
      2. +-commutative58.9%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\left(x + z\right)} \cdot \left(x - z\right)}{y} \]
      3. div-inv59.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(\left(x + z\right) \cdot \left(x - z\right)\right) \cdot \frac{1}{y}\right)} \]
      4. *-commutative59.0%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(\left(x - z\right) \cdot \left(x + z\right)\right)} \cdot \frac{1}{y}\right) \]
      5. associate-*r*65.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x - z\right) \cdot \left(\left(x + z\right) \cdot \frac{1}{y}\right)\right)} \]
      6. div-inv65.8%

        \[\leadsto 0.5 \cdot \left(\left(x - z\right) \cdot \color{blue}{\frac{x + z}{y}}\right) \]
      7. clear-num65.7%

        \[\leadsto 0.5 \cdot \left(\left(x - z\right) \cdot \color{blue}{\frac{1}{\frac{y}{x + z}}}\right) \]
      8. un-div-inv65.7%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    12. Applied egg-rr65.7%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x - z}{\frac{y}{x + z}}} \]
    13. Taylor expanded in x around 0 46.8%

      \[\leadsto 0.5 \cdot \frac{x - z}{\color{blue}{\frac{y}{z}}} \]
    14. Step-by-step derivation
      1. associate-*r/46.8%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(x - z\right)}{\frac{y}{z}}} \]
      2. div-inv46.8%

        \[\leadsto \frac{0.5 \cdot \left(x - z\right)}{\color{blue}{y \cdot \frac{1}{z}}} \]
      3. associate-/r*47.3%

        \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \left(x - z\right)}{y}}{\frac{1}{z}}} \]
      4. *-commutative47.3%

        \[\leadsto \frac{\frac{\color{blue}{\left(x - z\right) \cdot 0.5}}{y}}{\frac{1}{z}} \]
    15. Applied egg-rr47.3%

      \[\leadsto \color{blue}{\frac{\frac{\left(x - z\right) \cdot 0.5}{y}}{\frac{1}{z}}} \]
    16. Step-by-step derivation
      1. associate-/r/47.3%

        \[\leadsto \color{blue}{\frac{\frac{\left(x - z\right) \cdot 0.5}{y}}{1} \cdot z} \]
      2. /-rgt-identity47.3%

        \[\leadsto \color{blue}{\frac{\left(x - z\right) \cdot 0.5}{y}} \cdot z \]
      3. associate-/l*47.3%

        \[\leadsto \color{blue}{\left(\left(x - z\right) \cdot \frac{0.5}{y}\right)} \cdot z \]
    17. Applied egg-rr47.3%

      \[\leadsto \color{blue}{\left(\left(x - z\right) \cdot \frac{0.5}{y}\right) \cdot z} \]
    18. Taylor expanded in x around 0 44.9%

      \[\leadsto \color{blue}{\left(-0.5 \cdot \frac{z}{y}\right)} \cdot z \]

    if 1.17999999999999996e-29 < x < 6.5000000000000001e66

    1. Initial program 81.8%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 90.5%

      \[\leadsto \color{blue}{y \cdot \left(0.5 + 0.5 \cdot \frac{{x}^{2} - {z}^{2}}{{y}^{2}}\right)} \]
    4. Step-by-step derivation
      1. *-commutative90.5%

        \[\leadsto y \cdot \left(0.5 + \color{blue}{\frac{{x}^{2} - {z}^{2}}{{y}^{2}} \cdot 0.5}\right) \]
    5. Simplified90.5%

      \[\leadsto \color{blue}{y \cdot \left(0.5 + \frac{{x}^{2} - {z}^{2}}{{y}^{2}} \cdot 0.5\right)} \]
    6. Step-by-step derivation
      1. unpow290.5%

        \[\leadsto y \cdot \left(0.5 + \frac{\color{blue}{x \cdot x} - {z}^{2}}{{y}^{2}} \cdot 0.5\right) \]
      2. unpow290.5%

        \[\leadsto y \cdot \left(0.5 + \frac{x \cdot x - \color{blue}{z \cdot z}}{{y}^{2}} \cdot 0.5\right) \]
      3. difference-of-squares90.5%

        \[\leadsto y \cdot \left(0.5 + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{{y}^{2}} \cdot 0.5\right) \]
    7. Applied egg-rr90.5%

      \[\leadsto y \cdot \left(0.5 + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{{y}^{2}} \cdot 0.5\right) \]
    8. Step-by-step derivation
      1. *-commutative90.5%

        \[\leadsto y \cdot \left(0.5 + \frac{\color{blue}{\left(x - z\right) \cdot \left(x + z\right)}}{{y}^{2}} \cdot 0.5\right) \]
      2. unpow290.5%

        \[\leadsto y \cdot \left(0.5 + \frac{\left(x - z\right) \cdot \left(x + z\right)}{\color{blue}{y \cdot y}} \cdot 0.5\right) \]
      3. times-frac95.2%

        \[\leadsto y \cdot \left(0.5 + \color{blue}{\left(\frac{x - z}{y} \cdot \frac{x + z}{y}\right)} \cdot 0.5\right) \]
    9. Applied egg-rr95.2%

      \[\leadsto y \cdot \left(0.5 + \color{blue}{\left(\frac{x - z}{y} \cdot \frac{x + z}{y}\right)} \cdot 0.5\right) \]
    10. Taylor expanded in x around 0 63.9%

      \[\leadsto y \cdot \left(0.5 + \left(\frac{x - z}{y} \cdot \color{blue}{\frac{z}{y}}\right) \cdot 0.5\right) \]
    11. Taylor expanded in z around 0 52.4%

      \[\leadsto \color{blue}{0.5 \cdot y + 0.5 \cdot \frac{x \cdot z}{y}} \]
    12. Step-by-step derivation
      1. +-commutative52.4%

        \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot z}{y} + 0.5 \cdot y} \]
      2. associate-*l/52.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x}{y} \cdot z\right)} + 0.5 \cdot y \]
      3. distribute-lft-out52.4%

        \[\leadsto \color{blue}{0.5 \cdot \left(\frac{x}{y} \cdot z + y\right)} \]
      4. *-commutative52.4%

        \[\leadsto 0.5 \cdot \left(\color{blue}{z \cdot \frac{x}{y}} + y\right) \]
    13. Simplified52.4%

      \[\leadsto \color{blue}{0.5 \cdot \left(z \cdot \frac{x}{y} + y\right)} \]

    if 4.79999999999999966e91 < x

    1. Initial program 63.8%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num63.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot 2}{\left(x \cdot x + y \cdot y\right) - z \cdot z}}} \]
      2. inv-pow63.8%

        \[\leadsto \color{blue}{{\left(\frac{y \cdot 2}{\left(x \cdot x + y \cdot y\right) - z \cdot z}\right)}^{-1}} \]
      3. associate-/l*63.8%

        \[\leadsto {\color{blue}{\left(y \cdot \frac{2}{\left(x \cdot x + y \cdot y\right) - z \cdot z}\right)}}^{-1} \]
      4. add-sqr-sqrt63.8%

        \[\leadsto {\left(y \cdot \frac{2}{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}\right)}^{-1} \]
      5. pow263.8%

        \[\leadsto {\left(y \cdot \frac{2}{\color{blue}{{\left(\sqrt{x \cdot x + y \cdot y}\right)}^{2}} - z \cdot z}\right)}^{-1} \]
      6. hypot-define63.8%

        \[\leadsto {\left(y \cdot \frac{2}{{\color{blue}{\left(\mathsf{hypot}\left(x, y\right)\right)}}^{2} - z \cdot z}\right)}^{-1} \]
      7. pow263.8%

        \[\leadsto {\left(y \cdot \frac{2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - \color{blue}{{z}^{2}}}\right)}^{-1} \]
    4. Applied egg-rr63.8%

      \[\leadsto \color{blue}{{\left(y \cdot \frac{2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-163.8%

        \[\leadsto \color{blue}{\frac{1}{y \cdot \frac{2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
      2. associate-*r/63.8%

        \[\leadsto \frac{1}{\color{blue}{\frac{y \cdot 2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
    6. Simplified63.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot 2}{{\left(\mathsf{hypot}\left(x, y\right)\right)}^{2} - {z}^{2}}}} \]
    7. Taylor expanded in x around inf 68.5%

      \[\leadsto \frac{1}{\color{blue}{2 \cdot \frac{y}{{x}^{2}}}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity68.5%

        \[\leadsto \frac{1}{2 \cdot \frac{\color{blue}{1 \cdot y}}{{x}^{2}}} \]
      2. unpow268.5%

        \[\leadsto \frac{1}{2 \cdot \frac{1 \cdot y}{\color{blue}{x \cdot x}}} \]
      3. times-frac80.9%

        \[\leadsto \frac{1}{2 \cdot \color{blue}{\left(\frac{1}{x} \cdot \frac{y}{x}\right)}} \]
    9. Applied egg-rr80.9%

      \[\leadsto \frac{1}{2 \cdot \color{blue}{\left(\frac{1}{x} \cdot \frac{y}{x}\right)}} \]
    10. Step-by-step derivation
      1. associate-*r*80.9%

        \[\leadsto \frac{1}{\color{blue}{\left(2 \cdot \frac{1}{x}\right) \cdot \frac{y}{x}}} \]
      2. clear-num80.8%

        \[\leadsto \frac{1}{\left(2 \cdot \frac{1}{x}\right) \cdot \color{blue}{\frac{1}{\frac{x}{y}}}} \]
      3. un-div-inv80.9%

        \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot \frac{1}{x}}{\frac{x}{y}}}} \]
      4. un-div-inv80.9%

        \[\leadsto \frac{1}{\frac{\color{blue}{\frac{2}{x}}}{\frac{x}{y}}} \]
    11. Applied egg-rr80.9%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{2}{x}}{\frac{x}{y}}}} \]
    12. Step-by-step derivation
      1. clear-num80.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{\frac{2}{x}}} \]
      2. div-inv80.9%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{\frac{2}{x}}} \]
      3. clear-num80.8%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{2}} \]
      4. div-inv80.8%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(x \cdot \frac{1}{2}\right)} \]
      5. metadata-eval80.8%

        \[\leadsto \frac{x}{y} \cdot \left(x \cdot \color{blue}{0.5}\right) \]
    13. Applied egg-rr80.8%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \left(x \cdot 0.5\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification51.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.18 \cdot 10^{-29}:\\ \;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+66}:\\ \;\;\;\;0.5 \cdot \left(y + z \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+91}:\\ \;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(0.5 \cdot x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 41.4% accurate, 1.2× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;y\_m \leq 1.15 \cdot 10^{-30}:\\ \;\;\;\;-0.5 \cdot \left(x \cdot \frac{z}{y\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot 0.5\\ \end{array} \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
 :precision binary64
 (* y_s (if (<= y_m 1.15e-30) (* -0.5 (* x (/ z y_m))) (* y_m 0.5))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 1.15e-30) {
		tmp = -0.5 * (x * (z / y_m));
	} else {
		tmp = y_m * 0.5;
	}
	return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y_m <= 1.15d-30) then
        tmp = (-0.5d0) * (x * (z / y_m))
    else
        tmp = y_m * 0.5d0
    end if
    code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (y_m <= 1.15e-30) {
		tmp = -0.5 * (x * (z / y_m));
	} else {
		tmp = y_m * 0.5;
	}
	return y_s * tmp;
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if y_m <= 1.15e-30:
		tmp = -0.5 * (x * (z / y_m))
	else:
		tmp = y_m * 0.5
	return y_s * tmp
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (y_m <= 1.15e-30)
		tmp = Float64(-0.5 * Float64(x * Float64(z / y_m)));
	else
		tmp = Float64(y_m * 0.5);
	end
	return Float64(y_s * tmp)
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if (y_m <= 1.15e-30)
		tmp = -0.5 * (x * (z / y_m));
	else
		tmp = y_m * 0.5;
	end
	tmp_2 = y_s * tmp;
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.15e-30], N[(-0.5 * N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.15 \cdot 10^{-30}:\\
\;\;\;\;-0.5 \cdot \left(x \cdot \frac{z}{y\_m}\right)\\

\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.14999999999999992e-30

    1. Initial program 77.1%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 72.7%

      \[\leadsto \color{blue}{y \cdot \left(0.5 + 0.5 \cdot \frac{{x}^{2} - {z}^{2}}{{y}^{2}}\right)} \]
    4. Step-by-step derivation
      1. *-commutative72.7%

        \[\leadsto y \cdot \left(0.5 + \color{blue}{\frac{{x}^{2} - {z}^{2}}{{y}^{2}} \cdot 0.5}\right) \]
    5. Simplified72.7%

      \[\leadsto \color{blue}{y \cdot \left(0.5 + \frac{{x}^{2} - {z}^{2}}{{y}^{2}} \cdot 0.5\right)} \]
    6. Step-by-step derivation
      1. unpow272.7%

        \[\leadsto y \cdot \left(0.5 + \frac{\color{blue}{x \cdot x} - {z}^{2}}{{y}^{2}} \cdot 0.5\right) \]
      2. unpow272.7%

        \[\leadsto y \cdot \left(0.5 + \frac{x \cdot x - \color{blue}{z \cdot z}}{{y}^{2}} \cdot 0.5\right) \]
      3. difference-of-squares75.4%

        \[\leadsto y \cdot \left(0.5 + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{{y}^{2}} \cdot 0.5\right) \]
    7. Applied egg-rr75.4%

      \[\leadsto y \cdot \left(0.5 + \frac{\color{blue}{\left(x + z\right) \cdot \left(x - z\right)}}{{y}^{2}} \cdot 0.5\right) \]
    8. Taylor expanded in y around 0 73.8%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(x + z\right) \cdot \left(x - z\right)}{y}} \]
    9. Step-by-step derivation
      1. associate-/l*79.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x + z\right) \cdot \frac{x - z}{y}\right)} \]
      2. +-commutative79.4%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(z + x\right)} \cdot \frac{x - z}{y}\right) \]
    10. Simplified79.4%

      \[\leadsto \color{blue}{0.5 \cdot \left(\left(z + x\right) \cdot \frac{x - z}{y}\right)} \]
    11. Taylor expanded in x around 0 45.3%

      \[\leadsto 0.5 \cdot \left(\left(z + x\right) \cdot \color{blue}{\left(-1 \cdot \frac{z}{y}\right)}\right) \]
    12. Step-by-step derivation
      1. neg-mul-160.0%

        \[\leadsto y \cdot \left(0.5 + \left(\color{blue}{\left(-\frac{z}{y}\right)} \cdot \frac{z}{y}\right) \cdot 0.5\right) \]
      2. distribute-neg-frac260.0%

        \[\leadsto y \cdot \left(0.5 + \left(\color{blue}{\frac{z}{-y}} \cdot \frac{z}{y}\right) \cdot 0.5\right) \]
    13. Simplified45.3%

      \[\leadsto 0.5 \cdot \left(\left(z + x\right) \cdot \color{blue}{\frac{z}{-y}}\right) \]
    14. Taylor expanded in z around 0 9.3%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{x \cdot z}{y}} \]
    15. Step-by-step derivation
      1. associate-*r/9.3%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(x \cdot z\right)}{y}} \]
      2. associate-*r*9.3%

        \[\leadsto \frac{\color{blue}{\left(-0.5 \cdot x\right) \cdot z}}{y} \]
      3. associate-*l/10.9%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot x}{y} \cdot z} \]
      4. associate-*r/10.9%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \frac{x}{y}\right)} \cdot z \]
      5. *-commutative10.9%

        \[\leadsto \color{blue}{z \cdot \left(-0.5 \cdot \frac{x}{y}\right)} \]
      6. *-commutative10.9%

        \[\leadsto z \cdot \color{blue}{\left(\frac{x}{y} \cdot -0.5\right)} \]
      7. associate-*l/10.9%

        \[\leadsto z \cdot \color{blue}{\frac{x \cdot -0.5}{y}} \]
    16. Simplified10.9%

      \[\leadsto \color{blue}{z \cdot \frac{x \cdot -0.5}{y}} \]
    17. Taylor expanded in z around 0 9.3%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{x \cdot z}{y}} \]
    18. Step-by-step derivation
      1. associate-/l*14.5%

        \[\leadsto -0.5 \cdot \color{blue}{\left(x \cdot \frac{z}{y}\right)} \]
    19. Simplified14.5%

      \[\leadsto \color{blue}{-0.5 \cdot \left(x \cdot \frac{z}{y}\right)} \]

    if 1.14999999999999992e-30 < y

    1. Initial program 49.3%

      \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 58.3%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    4. Step-by-step derivation
      1. *-commutative58.3%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    5. Simplified58.3%

      \[\leadsto \color{blue}{y \cdot 0.5} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 16: 35.0% accurate, 5.0× speedup?

\[\begin{array}{l} y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ y\_s \cdot \left(y\_m \cdot 0.5\right) \end{array} \]
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z) :precision binary64 (* y_s (* y_m 0.5)))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	return y_s * (y_m * 0.5);
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    code = y_s * (y_m * 0.5d0)
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	return y_s * (y_m * 0.5);
}
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	return y_s * (y_m * 0.5)
y\_m = abs(y)
y\_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	return Float64(y_s * Float64(y_m * 0.5))
end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
function tmp = code(y_s, x, y_m, z)
	tmp = y_s * (y_m * 0.5);
end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)

\\
y\_s \cdot \left(y\_m \cdot 0.5\right)
\end{array}
Derivation
  1. Initial program 69.4%

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2} \]
  2. Add Preprocessing
  3. Taylor expanded in y around inf 31.8%

    \[\leadsto \color{blue}{0.5 \cdot y} \]
  4. Step-by-step derivation
    1. *-commutative31.8%

      \[\leadsto \color{blue}{y \cdot 0.5} \]
  5. Simplified31.8%

    \[\leadsto \color{blue}{y \cdot 0.5} \]
  6. Add Preprocessing

Developer target: 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 2024107 
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
  :precision binary64

  :alt
  (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))

  (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))