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

Percentage Accurate: 68.9% → 99.9%
Time: 7.7s
Alternatives: 9
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 68.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.2× speedup?

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

\\
\left(\left(x + z\right) \cdot \frac{z - x}{y} - y\right) \cdot -0.5
\end{array}
Derivation
  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. sub-neg69.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{z \cdot z - x \cdot x}{y} - \frac{y \cdot y}{y}\right)} \cdot \frac{-1}{2} \]
    11. difference-of-squares74.7%

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

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

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

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

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

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

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

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

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

Alternative 2: 43.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{if}\;z \leq 2.15 \cdot 10^{-277}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-240}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 8.3 \cdot 10^{-227}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-139}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-112}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-68}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-41}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.62 \cdot 10^{+35} \lor \neg \left(z \leq 3.6 \cdot 10^{+56}\right) \land z \leq 4.2 \cdot 10^{+80}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z}{\frac{y}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ x (/ y x)))))
   (if (<= z 2.15e-277)
     t_0
     (if (<= z 6.5e-240)
       (* y 0.5)
       (if (<= z 8.3e-227)
         t_0
         (if (<= z 3.8e-139)
           (* y 0.5)
           (if (<= z 7.2e-112)
             t_0
             (if (<= z 3.3e-68)
               (* y 0.5)
               (if (<= z 3.6e-41)
                 t_0
                 (if (or (<= z 1.62e+35)
                         (and (not (<= z 3.6e+56)) (<= z 4.2e+80)))
                   (* y 0.5)
                   (* -0.5 (/ z (/ y z)))))))))))))
double code(double x, double y, double z) {
	double t_0 = 0.5 * (x / (y / x));
	double tmp;
	if (z <= 2.15e-277) {
		tmp = t_0;
	} else if (z <= 6.5e-240) {
		tmp = y * 0.5;
	} else if (z <= 8.3e-227) {
		tmp = t_0;
	} else if (z <= 3.8e-139) {
		tmp = y * 0.5;
	} else if (z <= 7.2e-112) {
		tmp = t_0;
	} else if (z <= 3.3e-68) {
		tmp = y * 0.5;
	} else if (z <= 3.6e-41) {
		tmp = t_0;
	} else if ((z <= 1.62e+35) || (!(z <= 3.6e+56) && (z <= 4.2e+80))) {
		tmp = y * 0.5;
	} else {
		tmp = -0.5 * (z / (y / z));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.5d0 * (x / (y / x))
    if (z <= 2.15d-277) then
        tmp = t_0
    else if (z <= 6.5d-240) then
        tmp = y * 0.5d0
    else if (z <= 8.3d-227) then
        tmp = t_0
    else if (z <= 3.8d-139) then
        tmp = y * 0.5d0
    else if (z <= 7.2d-112) then
        tmp = t_0
    else if (z <= 3.3d-68) then
        tmp = y * 0.5d0
    else if (z <= 3.6d-41) then
        tmp = t_0
    else if ((z <= 1.62d+35) .or. (.not. (z <= 3.6d+56)) .and. (z <= 4.2d+80)) then
        tmp = y * 0.5d0
    else
        tmp = (-0.5d0) * (z / (y / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 0.5 * (x / (y / x));
	double tmp;
	if (z <= 2.15e-277) {
		tmp = t_0;
	} else if (z <= 6.5e-240) {
		tmp = y * 0.5;
	} else if (z <= 8.3e-227) {
		tmp = t_0;
	} else if (z <= 3.8e-139) {
		tmp = y * 0.5;
	} else if (z <= 7.2e-112) {
		tmp = t_0;
	} else if (z <= 3.3e-68) {
		tmp = y * 0.5;
	} else if (z <= 3.6e-41) {
		tmp = t_0;
	} else if ((z <= 1.62e+35) || (!(z <= 3.6e+56) && (z <= 4.2e+80))) {
		tmp = y * 0.5;
	} else {
		tmp = -0.5 * (z / (y / z));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 0.5 * (x / (y / x))
	tmp = 0
	if z <= 2.15e-277:
		tmp = t_0
	elif z <= 6.5e-240:
		tmp = y * 0.5
	elif z <= 8.3e-227:
		tmp = t_0
	elif z <= 3.8e-139:
		tmp = y * 0.5
	elif z <= 7.2e-112:
		tmp = t_0
	elif z <= 3.3e-68:
		tmp = y * 0.5
	elif z <= 3.6e-41:
		tmp = t_0
	elif (z <= 1.62e+35) or (not (z <= 3.6e+56) and (z <= 4.2e+80)):
		tmp = y * 0.5
	else:
		tmp = -0.5 * (z / (y / z))
	return tmp
function code(x, y, z)
	t_0 = Float64(0.5 * Float64(x / Float64(y / x)))
	tmp = 0.0
	if (z <= 2.15e-277)
		tmp = t_0;
	elseif (z <= 6.5e-240)
		tmp = Float64(y * 0.5);
	elseif (z <= 8.3e-227)
		tmp = t_0;
	elseif (z <= 3.8e-139)
		tmp = Float64(y * 0.5);
	elseif (z <= 7.2e-112)
		tmp = t_0;
	elseif (z <= 3.3e-68)
		tmp = Float64(y * 0.5);
	elseif (z <= 3.6e-41)
		tmp = t_0;
	elseif ((z <= 1.62e+35) || (!(z <= 3.6e+56) && (z <= 4.2e+80)))
		tmp = Float64(y * 0.5);
	else
		tmp = Float64(-0.5 * Float64(z / Float64(y / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 0.5 * (x / (y / x));
	tmp = 0.0;
	if (z <= 2.15e-277)
		tmp = t_0;
	elseif (z <= 6.5e-240)
		tmp = y * 0.5;
	elseif (z <= 8.3e-227)
		tmp = t_0;
	elseif (z <= 3.8e-139)
		tmp = y * 0.5;
	elseif (z <= 7.2e-112)
		tmp = t_0;
	elseif (z <= 3.3e-68)
		tmp = y * 0.5;
	elseif (z <= 3.6e-41)
		tmp = t_0;
	elseif ((z <= 1.62e+35) || (~((z <= 3.6e+56)) && (z <= 4.2e+80)))
		tmp = y * 0.5;
	else
		tmp = -0.5 * (z / (y / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 2.15e-277], t$95$0, If[LessEqual[z, 6.5e-240], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 8.3e-227], t$95$0, If[LessEqual[z, 3.8e-139], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 7.2e-112], t$95$0, If[LessEqual[z, 3.3e-68], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 3.6e-41], t$95$0, If[Or[LessEqual[z, 1.62e+35], And[N[Not[LessEqual[z, 3.6e+56]], $MachinePrecision], LessEqual[z, 4.2e+80]]], N[(y * 0.5), $MachinePrecision], N[(-0.5 * N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{if}\;z \leq 2.15 \cdot 10^{-277}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-240}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 8.3 \cdot 10^{-227}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 3.8 \cdot 10^{-139}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 7.2 \cdot 10^{-112}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 3.6 \cdot 10^{-41}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.62 \cdot 10^{+35} \lor \neg \left(z \leq 3.6 \cdot 10^{+56}\right) \land z \leq 4.2 \cdot 10^{+80}:\\
\;\;\;\;y \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 2.14999999999999995e-277 or 6.50000000000000007e-240 < z < 8.2999999999999996e-227 or 3.80000000000000008e-139 < z < 7.2000000000000002e-112 or 3.2999999999999998e-68 < z < 3.6e-41

    1. Initial program 69.2%

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

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

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

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{z \cdot z}}{y} \]
      3. difference-of-squares61.5%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative65.6%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{z + x}}{\frac{y}{x - z}} \]
    4. Simplified65.6%

      \[\leadsto \color{blue}{0.5 \cdot \frac{z + x}{\frac{y}{x - z}}} \]
    5. Step-by-step derivation
      1. div-inv65.6%

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{{x}^{2}}{y}} \]
    8. Step-by-step derivation
      1. unpow239.2%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{y}{x}}} \]
    9. Simplified40.7%

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

    if 2.14999999999999995e-277 < z < 6.50000000000000007e-240 or 8.2999999999999996e-227 < z < 3.80000000000000008e-139 or 7.2000000000000002e-112 < z < 3.2999999999999998e-68 or 3.6e-41 < z < 1.62e35 or 3.59999999999999998e56 < z < 4.20000000000000003e80

    1. Initial program 68.4%

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

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

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

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

    if 1.62e35 < z < 3.59999999999999998e56 or 4.20000000000000003e80 < z

    1. Initial program 71.5%

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

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

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

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

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

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

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

        \[\leadsto \left(-\color{blue}{\left(z \cdot z\right) \cdot -0.5}\right) \cdot \frac{1}{-y} \]
      4. distribute-rgt-neg-in63.2%

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

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

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

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

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

        \[\leadsto \frac{\left(z \cdot z\right) \cdot \color{blue}{\left(--0.5\right)}}{-y} \]
      4. distribute-rgt-neg-in63.2%

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

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

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

        \[\leadsto -\color{blue}{\frac{z}{\frac{-y}{z \cdot -0.5}}} \]
      8. distribute-neg-frac67.6%

        \[\leadsto \color{blue}{\frac{-z}{\frac{-y}{z \cdot -0.5}}} \]
      9. neg-mul-167.6%

        \[\leadsto \frac{-z}{\frac{\color{blue}{-1 \cdot y}}{z \cdot -0.5}} \]
      10. *-commutative67.6%

        \[\leadsto \frac{-z}{\frac{-1 \cdot y}{\color{blue}{-0.5 \cdot z}}} \]
      11. times-frac67.6%

        \[\leadsto \frac{-z}{\color{blue}{\frac{-1}{-0.5} \cdot \frac{y}{z}}} \]
      12. metadata-eval67.6%

        \[\leadsto \frac{-z}{\color{blue}{2} \cdot \frac{y}{z}} \]
    8. Simplified67.6%

      \[\leadsto \color{blue}{\frac{-z}{2 \cdot \frac{y}{z}}} \]
    9. Step-by-step derivation
      1. neg-mul-167.6%

        \[\leadsto \frac{\color{blue}{-1 \cdot z}}{2 \cdot \frac{y}{z}} \]
      2. times-frac67.6%

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{\frac{y}{z}}} \]
      3. metadata-eval67.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 2.15 \cdot 10^{-277}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-240}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 8.3 \cdot 10^{-227}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-139}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-112}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-68}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-41}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 1.62 \cdot 10^{+35} \lor \neg \left(z \leq 3.6 \cdot 10^{+56}\right) \land z \leq 4.2 \cdot 10^{+80}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z}{\frac{y}{z}}\\ \end{array} \]

Alternative 3: 43.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{if}\;z \leq 10^{-275}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-238}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{-227}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{-138}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-112}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{-68}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-41}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{+34}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+56}:\\ \;\;\;\;\left(z \cdot -0.5\right) \cdot \frac{z}{y}\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+80}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z}{\frac{y}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ x (/ y x)))))
   (if (<= z 1e-275)
     t_0
     (if (<= z 1.4e-238)
       (* y 0.5)
       (if (<= z 7.6e-227)
         t_0
         (if (<= z 1.32e-138)
           (* y 0.5)
           (if (<= z 2.6e-112)
             t_0
             (if (<= z 8.8e-68)
               (* y 0.5)
               (if (<= z 2.6e-41)
                 t_0
                 (if (<= z 9.2e+34)
                   (* y 0.5)
                   (if (<= z 6e+56)
                     (* (* z -0.5) (/ z y))
                     (if (<= z 3.8e+80)
                       (* y 0.5)
                       (* -0.5 (/ z (/ y z)))))))))))))))
double code(double x, double y, double z) {
	double t_0 = 0.5 * (x / (y / x));
	double tmp;
	if (z <= 1e-275) {
		tmp = t_0;
	} else if (z <= 1.4e-238) {
		tmp = y * 0.5;
	} else if (z <= 7.6e-227) {
		tmp = t_0;
	} else if (z <= 1.32e-138) {
		tmp = y * 0.5;
	} else if (z <= 2.6e-112) {
		tmp = t_0;
	} else if (z <= 8.8e-68) {
		tmp = y * 0.5;
	} else if (z <= 2.6e-41) {
		tmp = t_0;
	} else if (z <= 9.2e+34) {
		tmp = y * 0.5;
	} else if (z <= 6e+56) {
		tmp = (z * -0.5) * (z / y);
	} else if (z <= 3.8e+80) {
		tmp = y * 0.5;
	} else {
		tmp = -0.5 * (z / (y / z));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.5d0 * (x / (y / x))
    if (z <= 1d-275) then
        tmp = t_0
    else if (z <= 1.4d-238) then
        tmp = y * 0.5d0
    else if (z <= 7.6d-227) then
        tmp = t_0
    else if (z <= 1.32d-138) then
        tmp = y * 0.5d0
    else if (z <= 2.6d-112) then
        tmp = t_0
    else if (z <= 8.8d-68) then
        tmp = y * 0.5d0
    else if (z <= 2.6d-41) then
        tmp = t_0
    else if (z <= 9.2d+34) then
        tmp = y * 0.5d0
    else if (z <= 6d+56) then
        tmp = (z * (-0.5d0)) * (z / y)
    else if (z <= 3.8d+80) then
        tmp = y * 0.5d0
    else
        tmp = (-0.5d0) * (z / (y / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 0.5 * (x / (y / x));
	double tmp;
	if (z <= 1e-275) {
		tmp = t_0;
	} else if (z <= 1.4e-238) {
		tmp = y * 0.5;
	} else if (z <= 7.6e-227) {
		tmp = t_0;
	} else if (z <= 1.32e-138) {
		tmp = y * 0.5;
	} else if (z <= 2.6e-112) {
		tmp = t_0;
	} else if (z <= 8.8e-68) {
		tmp = y * 0.5;
	} else if (z <= 2.6e-41) {
		tmp = t_0;
	} else if (z <= 9.2e+34) {
		tmp = y * 0.5;
	} else if (z <= 6e+56) {
		tmp = (z * -0.5) * (z / y);
	} else if (z <= 3.8e+80) {
		tmp = y * 0.5;
	} else {
		tmp = -0.5 * (z / (y / z));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 0.5 * (x / (y / x))
	tmp = 0
	if z <= 1e-275:
		tmp = t_0
	elif z <= 1.4e-238:
		tmp = y * 0.5
	elif z <= 7.6e-227:
		tmp = t_0
	elif z <= 1.32e-138:
		tmp = y * 0.5
	elif z <= 2.6e-112:
		tmp = t_0
	elif z <= 8.8e-68:
		tmp = y * 0.5
	elif z <= 2.6e-41:
		tmp = t_0
	elif z <= 9.2e+34:
		tmp = y * 0.5
	elif z <= 6e+56:
		tmp = (z * -0.5) * (z / y)
	elif z <= 3.8e+80:
		tmp = y * 0.5
	else:
		tmp = -0.5 * (z / (y / z))
	return tmp
function code(x, y, z)
	t_0 = Float64(0.5 * Float64(x / Float64(y / x)))
	tmp = 0.0
	if (z <= 1e-275)
		tmp = t_0;
	elseif (z <= 1.4e-238)
		tmp = Float64(y * 0.5);
	elseif (z <= 7.6e-227)
		tmp = t_0;
	elseif (z <= 1.32e-138)
		tmp = Float64(y * 0.5);
	elseif (z <= 2.6e-112)
		tmp = t_0;
	elseif (z <= 8.8e-68)
		tmp = Float64(y * 0.5);
	elseif (z <= 2.6e-41)
		tmp = t_0;
	elseif (z <= 9.2e+34)
		tmp = Float64(y * 0.5);
	elseif (z <= 6e+56)
		tmp = Float64(Float64(z * -0.5) * Float64(z / y));
	elseif (z <= 3.8e+80)
		tmp = Float64(y * 0.5);
	else
		tmp = Float64(-0.5 * Float64(z / Float64(y / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 0.5 * (x / (y / x));
	tmp = 0.0;
	if (z <= 1e-275)
		tmp = t_0;
	elseif (z <= 1.4e-238)
		tmp = y * 0.5;
	elseif (z <= 7.6e-227)
		tmp = t_0;
	elseif (z <= 1.32e-138)
		tmp = y * 0.5;
	elseif (z <= 2.6e-112)
		tmp = t_0;
	elseif (z <= 8.8e-68)
		tmp = y * 0.5;
	elseif (z <= 2.6e-41)
		tmp = t_0;
	elseif (z <= 9.2e+34)
		tmp = y * 0.5;
	elseif (z <= 6e+56)
		tmp = (z * -0.5) * (z / y);
	elseif (z <= 3.8e+80)
		tmp = y * 0.5;
	else
		tmp = -0.5 * (z / (y / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1e-275], t$95$0, If[LessEqual[z, 1.4e-238], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 7.6e-227], t$95$0, If[LessEqual[z, 1.32e-138], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 2.6e-112], t$95$0, If[LessEqual[z, 8.8e-68], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 2.6e-41], t$95$0, If[LessEqual[z, 9.2e+34], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 6e+56], N[(N[(z * -0.5), $MachinePrecision] * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+80], N[(y * 0.5), $MachinePrecision], N[(-0.5 * N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{if}\;z \leq 10^{-275}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.4 \cdot 10^{-238}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 7.6 \cdot 10^{-227}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.32 \cdot 10^{-138}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 2.6 \cdot 10^{-112}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 8.8 \cdot 10^{-68}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;z \leq 2.6 \cdot 10^{-41}:\\
\;\;\;\;t_0\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < 9.99999999999999934e-276 or 1.40000000000000002e-238 < z < 7.60000000000000019e-227 or 1.32e-138 < z < 2.59999999999999992e-112 or 8.80000000000000009e-68 < z < 2.5999999999999999e-41

    1. Initial program 69.2%

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

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

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

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{z \cdot z}}{y} \]
      3. difference-of-squares61.5%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative65.6%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{z + x}}{\frac{y}{x - z}} \]
    4. Simplified65.6%

      \[\leadsto \color{blue}{0.5 \cdot \frac{z + x}{\frac{y}{x - z}}} \]
    5. Step-by-step derivation
      1. div-inv65.6%

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{{x}^{2}}{y}} \]
    8. Step-by-step derivation
      1. unpow239.2%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{y}{x}}} \]
    9. Simplified40.7%

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

    if 9.99999999999999934e-276 < z < 1.40000000000000002e-238 or 7.60000000000000019e-227 < z < 1.32e-138 or 2.59999999999999992e-112 < z < 8.80000000000000009e-68 or 2.5999999999999999e-41 < z < 9.1999999999999993e34 or 6.00000000000000012e56 < z < 3.79999999999999997e80

    1. Initial program 68.4%

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

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

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

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

    if 9.1999999999999993e34 < z < 6.00000000000000012e56

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

    if 3.79999999999999997e80 < z

    1. Initial program 71.1%

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

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

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

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

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

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

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

        \[\leadsto \left(-\color{blue}{\left(z \cdot z\right) \cdot -0.5}\right) \cdot \frac{1}{-y} \]
      4. distribute-rgt-neg-in65.3%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(\left(z \cdot z\right) \cdot 0.5\right) \cdot 1}{-y}} \]
      2. *-rgt-identity65.3%

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

        \[\leadsto \frac{\left(z \cdot z\right) \cdot \color{blue}{\left(--0.5\right)}}{-y} \]
      4. distribute-rgt-neg-in65.3%

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

        \[\leadsto \frac{-\color{blue}{z \cdot \left(z \cdot -0.5\right)}}{-y} \]
      6. distribute-neg-frac65.3%

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

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

        \[\leadsto \color{blue}{\frac{-z}{\frac{-y}{z \cdot -0.5}}} \]
      9. neg-mul-170.1%

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

        \[\leadsto \frac{-z}{\frac{-1 \cdot y}{\color{blue}{-0.5 \cdot z}}} \]
      11. times-frac70.1%

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

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

      \[\leadsto \color{blue}{\frac{-z}{2 \cdot \frac{y}{z}}} \]
    9. Step-by-step derivation
      1. neg-mul-170.1%

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

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{\frac{y}{z}}} \]
      3. metadata-eval70.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 10^{-275}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-238}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{-227}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{-138}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-112}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{-68}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-41}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{+34}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+56}:\\ \;\;\;\;\left(z \cdot -0.5\right) \cdot \frac{z}{y}\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+80}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z}{\frac{y}{z}}\\ \end{array} \]

Alternative 4: 80.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+260} \lor \neg \left(x \cdot x \leq 2 \cdot 10^{+288}\right) \land x \cdot x \leq 2 \cdot 10^{+304}:\\ \;\;\;\;-0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* x x) 5e+260)
         (and (not (<= (* x x) 2e+288)) (<= (* x x) 2e+304)))
   (* -0.5 (- (/ z (/ y z)) y))
   (* 0.5 (/ x (/ y x)))))
double code(double x, double y, double z) {
	double tmp;
	if (((x * x) <= 5e+260) || (!((x * x) <= 2e+288) && ((x * x) <= 2e+304))) {
		tmp = -0.5 * ((z / (y / z)) - y);
	} else {
		tmp = 0.5 * (x / (y / x));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (((x * x) <= 5d+260) .or. (.not. ((x * x) <= 2d+288)) .and. ((x * x) <= 2d+304)) then
        tmp = (-0.5d0) * ((z / (y / z)) - y)
    else
        tmp = 0.5d0 * (x / (y / x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (((x * x) <= 5e+260) || (!((x * x) <= 2e+288) && ((x * x) <= 2e+304))) {
		tmp = -0.5 * ((z / (y / z)) - y);
	} else {
		tmp = 0.5 * (x / (y / x));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if ((x * x) <= 5e+260) or (not ((x * x) <= 2e+288) and ((x * x) <= 2e+304)):
		tmp = -0.5 * ((z / (y / z)) - y)
	else:
		tmp = 0.5 * (x / (y / x))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((Float64(x * x) <= 5e+260) || (!(Float64(x * x) <= 2e+288) && (Float64(x * x) <= 2e+304)))
		tmp = Float64(-0.5 * Float64(Float64(z / Float64(y / z)) - y));
	else
		tmp = Float64(0.5 * Float64(x / Float64(y / x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((x * x) <= 5e+260) || (~(((x * x) <= 2e+288)) && ((x * x) <= 2e+304)))
		tmp = -0.5 * ((z / (y / z)) - y);
	else
		tmp = 0.5 * (x / (y / x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 5e+260], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 2e+288]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 2e+304]]], N[(-0.5 * N[(N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+260} \lor \neg \left(x \cdot x \leq 2 \cdot 10^{+288}\right) \land x \cdot x \leq 2 \cdot 10^{+304}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 4.9999999999999996e260 or 2e288 < (*.f64 x x) < 1.9999999999999999e304

    1. Initial program 71.0%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - z \cdot z\right)} + \left(x \cdot x + y \cdot y\right)}{y \cdot 2} \]
      4. associate-+l-71.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub71.0%

        \[\leadsto \color{blue}{\left(\frac{z \cdot z - x \cdot x}{y} - \frac{y \cdot y}{y}\right)} \cdot \frac{-1}{2} \]
      11. difference-of-squares71.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999996e260 < (*.f64 x x) < 2e288 or 1.9999999999999999e304 < (*.f64 x x)

    1. Initial program 66.0%

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

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

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

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{z \cdot z}}{y} \]
      3. difference-of-squares83.6%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative87.5%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{z + x}}{\frac{y}{x - z}} \]
    4. Simplified87.5%

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{{x}^{2}}{y}} \]
    8. Step-by-step derivation
      1. unpow276.9%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{y}{x}}} \]
    9. Simplified80.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+260} \lor \neg \left(x \cdot x \leq 2 \cdot 10^{+288}\right) \land x \cdot x \leq 2 \cdot 10^{+304}:\\ \;\;\;\;-0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\ \end{array} \]

Alternative 5: 85.2% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z z) < 1.9999999999999999e-7

    1. Initial program 74.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(-\color{blue}{\frac{x}{y} \cdot x}\right) - y\right) \cdot -0.5 \]
      4. distribute-rgt-neg-in94.6%

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

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

    if 1.9999999999999999e-7 < (*.f64 z z) < 5.00000000000000026e300

    1. Initial program 69.9%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - z \cdot z\right)} + \left(x \cdot x + y \cdot y\right)}{y \cdot 2} \]
      4. associate-+l-69.9%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(z \cdot z - x \cdot x\right) - y \cdot y}}{y} \cdot \frac{-1}{2} \]
      10. div-sub69.9%

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

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

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

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

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

        \[\leadsto \left(\left(x + z\right) \cdot \frac{z - x}{y} - \frac{y}{\color{blue}{1}}\right) \cdot \frac{-1}{2} \]
      16. /-rgt-identity99.8%

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

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

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

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

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

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

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

    if 5.00000000000000026e300 < (*.f64 z z)

    1. Initial program 59.6%

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

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

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

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{z \cdot z}}{y} \]
      3. difference-of-squares83.0%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative93.9%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{z + x}}{\frac{y}{x - z}} \]
    4. Simplified93.9%

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

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

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

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

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

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

Alternative 6: 52.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4 \cdot 10^{-107}:\\
\;\;\;\;y \cdot 0.5\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 4e-107

    1. Initial program 72.9%

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

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

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

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

    if 4e-107 < (*.f64 x x) < 4.0000000000000002e92

    1. Initial program 73.0%

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

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

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

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

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

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

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

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

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

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

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

    if 4.0000000000000002e92 < (*.f64 x x)

    1. Initial program 64.6%

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

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

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

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{z \cdot z}}{y} \]
      3. difference-of-squares75.3%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x + z}{\frac{y}{x - z}}} \]
      5. +-commutative80.8%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{z + x}}{\frac{y}{x - z}} \]
    4. Simplified80.8%

      \[\leadsto \color{blue}{0.5 \cdot \frac{z + x}{\frac{y}{x - z}}} \]
    5. Step-by-step derivation
      1. div-inv80.7%

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{{x}^{2}}{y}} \]
    8. Step-by-step derivation
      1. unpow263.5%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{y}{x}}} \]
    9. Simplified66.0%

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

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

Alternative 7: 84.5% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 1.00000000000000001e240

    1. Initial program 72.4%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - z \cdot z\right)} + \left(x \cdot x + y \cdot y\right)}{y \cdot 2} \]
      4. associate-+l-72.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot z - x \cdot x}{y} - \frac{y \cdot y}{y}\right)} \cdot \frac{-1}{2} \]
      11. difference-of-squares72.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000001e240 < (*.f64 x x)

    1. Initial program 63.8%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - z \cdot z\right)} + \left(x \cdot x + y \cdot y\right)}{y \cdot 2} \]
      4. associate-+l-63.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot z - x \cdot x}{y} - \frac{y \cdot y}{y}\right)} \cdot \frac{-1}{2} \]
      11. difference-of-squares79.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(-\color{blue}{\frac{x}{y} \cdot x}\right) - y\right) \cdot -0.5 \]
      4. distribute-rgt-neg-in89.0%

        \[\leadsto \left(\color{blue}{\frac{x}{y} \cdot \left(-x\right)} - y\right) \cdot -0.5 \]
    8. Simplified89.0%

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

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

Alternative 8: 43.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 2.35 \cdot 10^{+36} \lor \neg \left(z \leq 7.5 \cdot 10^{+56}\right) \land z \leq 7.4 \cdot 10^{+81}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z}{\frac{y}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z 2.35e+36) (and (not (<= z 7.5e+56)) (<= z 7.4e+81)))
   (* y 0.5)
   (* -0.5 (/ z (/ y z)))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= 2.35e+36) || (!(z <= 7.5e+56) && (z <= 7.4e+81))) {
		tmp = y * 0.5;
	} else {
		tmp = -0.5 * (z / (y / z));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= 2.35d+36) .or. (.not. (z <= 7.5d+56)) .and. (z <= 7.4d+81)) then
        tmp = y * 0.5d0
    else
        tmp = (-0.5d0) * (z / (y / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= 2.35e+36) || (!(z <= 7.5e+56) && (z <= 7.4e+81))) {
		tmp = y * 0.5;
	} else {
		tmp = -0.5 * (z / (y / z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= 2.35e+36) or (not (z <= 7.5e+56) and (z <= 7.4e+81)):
		tmp = y * 0.5
	else:
		tmp = -0.5 * (z / (y / z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= 2.35e+36) || (!(z <= 7.5e+56) && (z <= 7.4e+81)))
		tmp = Float64(y * 0.5);
	else
		tmp = Float64(-0.5 * Float64(z / Float64(y / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= 2.35e+36) || (~((z <= 7.5e+56)) && (z <= 7.4e+81)))
		tmp = y * 0.5;
	else
		tmp = -0.5 * (z / (y / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, 2.35e+36], And[N[Not[LessEqual[z, 7.5e+56]], $MachinePrecision], LessEqual[z, 7.4e+81]]], N[(y * 0.5), $MachinePrecision], N[(-0.5 * N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.35 \cdot 10^{+36} \lor \neg \left(z \leq 7.5 \cdot 10^{+56}\right) \land z \leq 7.4 \cdot 10^{+81}:\\
\;\;\;\;y \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.34999999999999994e36 or 7.4999999999999999e56 < z < 7.4000000000000001e81

    1. Initial program 68.9%

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

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

        \[\leadsto \color{blue}{y \cdot 0.5} \]
    4. Simplified44.0%

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

    if 2.34999999999999994e36 < z < 7.4999999999999999e56 or 7.4000000000000001e81 < z

    1. Initial program 71.5%

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

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

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

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

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

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

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

        \[\leadsto \left(-\color{blue}{\left(z \cdot z\right) \cdot -0.5}\right) \cdot \frac{1}{-y} \]
      4. distribute-rgt-neg-in63.2%

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

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

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

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

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

        \[\leadsto \frac{\left(z \cdot z\right) \cdot \color{blue}{\left(--0.5\right)}}{-y} \]
      4. distribute-rgt-neg-in63.2%

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

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

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

        \[\leadsto -\color{blue}{\frac{z}{\frac{-y}{z \cdot -0.5}}} \]
      8. distribute-neg-frac67.6%

        \[\leadsto \color{blue}{\frac{-z}{\frac{-y}{z \cdot -0.5}}} \]
      9. neg-mul-167.6%

        \[\leadsto \frac{-z}{\frac{\color{blue}{-1 \cdot y}}{z \cdot -0.5}} \]
      10. *-commutative67.6%

        \[\leadsto \frac{-z}{\frac{-1 \cdot y}{\color{blue}{-0.5 \cdot z}}} \]
      11. times-frac67.6%

        \[\leadsto \frac{-z}{\color{blue}{\frac{-1}{-0.5} \cdot \frac{y}{z}}} \]
      12. metadata-eval67.6%

        \[\leadsto \frac{-z}{\color{blue}{2} \cdot \frac{y}{z}} \]
    8. Simplified67.6%

      \[\leadsto \color{blue}{\frac{-z}{2 \cdot \frac{y}{z}}} \]
    9. Step-by-step derivation
      1. neg-mul-167.6%

        \[\leadsto \frac{\color{blue}{-1 \cdot z}}{2 \cdot \frac{y}{z}} \]
      2. times-frac67.6%

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{z}{\frac{y}{z}}} \]
      3. metadata-eval67.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 2.35 \cdot 10^{+36} \lor \neg \left(z \leq 7.5 \cdot 10^{+56}\right) \land z \leq 7.4 \cdot 10^{+81}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z}{\frac{y}{z}}\\ \end{array} \]

Alternative 9: 33.8% accurate, 5.0× speedup?

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot 0.5} \]
  5. Final simplification36.4%

    \[\leadsto y \cdot 0.5 \]

Developer target: 99.9% accurate, 1.0× speedup?

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

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

Reproduce

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

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

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