Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, B

Percentage Accurate: 99.8% → 99.8%
Time: 8.6s
Alternatives: 10
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 0.5 \cdot \left(x + \frac{y}{{z}^{-0.5}}\right) \end{array} \]
(FPCore (x y z) :precision binary64 (* 0.5 (+ x (/ y (pow z -0.5)))))
double code(double x, double y, double z) {
	return 0.5 * (x + (y / pow(z, -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 = 0.5d0 * (x + (y / (z ** (-0.5d0))))
end function
public static double code(double x, double y, double z) {
	return 0.5 * (x + (y / Math.pow(z, -0.5)));
}
def code(x, y, z):
	return 0.5 * (x + (y / math.pow(z, -0.5)))
function code(x, y, z)
	return Float64(0.5 * Float64(x + Float64(y / (z ^ -0.5))))
end
function tmp = code(x, y, z)
	tmp = 0.5 * (x + (y / (z ^ -0.5)));
end
code[x_, y_, z_] := N[(0.5 * N[(x + N[(y / N[Power[z, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
  4. Step-by-step derivation
    1. add-sqr-sqrt52.5%

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

      \[\leadsto 0.5 \cdot \left(x + \color{blue}{\sqrt{\left(y \cdot \sqrt{z}\right) \cdot \left(y \cdot \sqrt{z}\right)}}\right) \]
    3. pow1/260.8%

      \[\leadsto 0.5 \cdot \left(x + \color{blue}{{\left(\left(y \cdot \sqrt{z}\right) \cdot \left(y \cdot \sqrt{z}\right)\right)}^{0.5}}\right) \]
    4. *-commutative60.8%

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

      \[\leadsto 0.5 \cdot \left(x + {\left(\left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}\right)}^{0.5}\right) \]
    6. swap-sqr58.8%

      \[\leadsto 0.5 \cdot \left(x + {\color{blue}{\left(\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)\right)}}^{0.5}\right) \]
    7. add-sqr-sqrt58.8%

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

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

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

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

      \[\leadsto 0.5 \cdot \left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot z\right)}}\right) \]
  7. Simplified60.8%

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

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

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

      \[\leadsto 0.5 \cdot \left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right) \cdot \sqrt{z}}\right) \]
    4. add-sqr-sqrt99.8%

      \[\leadsto 0.5 \cdot \left(x + \color{blue}{y} \cdot \sqrt{z}\right) \]
    5. *-commutative99.8%

      \[\leadsto 0.5 \cdot \left(x + \color{blue}{\sqrt{z} \cdot y}\right) \]
    6. pow1/299.8%

      \[\leadsto 0.5 \cdot \left(x + \color{blue}{{z}^{0.5}} \cdot y\right) \]
    7. metadata-eval99.8%

      \[\leadsto 0.5 \cdot \left(x + {z}^{\color{blue}{\left(0.25 + 0.25\right)}} \cdot y\right) \]
    8. pow-prod-up99.6%

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

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

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

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

      \[\leadsto 0.5 \cdot \left(x + \color{blue}{\frac{1}{\frac{1}{{z}^{0.25} \cdot {z}^{0.25}}}} \cdot y\right) \]
    3. metadata-eval99.6%

      \[\leadsto 0.5 \cdot \left(x + \frac{1}{\frac{\color{blue}{\sqrt{1}}}{{z}^{0.25} \cdot {z}^{0.25}}} \cdot y\right) \]
    4. pow-prod-up99.7%

      \[\leadsto 0.5 \cdot \left(x + \frac{1}{\frac{\sqrt{1}}{\color{blue}{{z}^{\left(0.25 + 0.25\right)}}}} \cdot y\right) \]
    5. metadata-eval99.7%

      \[\leadsto 0.5 \cdot \left(x + \frac{1}{\frac{\sqrt{1}}{{z}^{\color{blue}{0.5}}}} \cdot y\right) \]
    6. pow1/299.7%

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

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

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

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

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

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

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

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

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

Alternative 2: 75.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \sqrt{z}\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{-12} \lor \neg \left(t_0 \leq 2 \cdot 10^{-34}\right):\\ \;\;\;\;0.5 \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (sqrt z))))
   (if (or (<= t_0 -5e-12) (not (<= t_0 2e-34))) (* 0.5 t_0) (* 0.5 x))))
double code(double x, double y, double z) {
	double t_0 = y * sqrt(z);
	double tmp;
	if ((t_0 <= -5e-12) || !(t_0 <= 2e-34)) {
		tmp = 0.5 * t_0;
	} else {
		tmp = 0.5 * 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) :: t_0
    real(8) :: tmp
    t_0 = y * sqrt(z)
    if ((t_0 <= (-5d-12)) .or. (.not. (t_0 <= 2d-34))) then
        tmp = 0.5d0 * t_0
    else
        tmp = 0.5d0 * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * Math.sqrt(z);
	double tmp;
	if ((t_0 <= -5e-12) || !(t_0 <= 2e-34)) {
		tmp = 0.5 * t_0;
	} else {
		tmp = 0.5 * x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * math.sqrt(z)
	tmp = 0
	if (t_0 <= -5e-12) or not (t_0 <= 2e-34):
		tmp = 0.5 * t_0
	else:
		tmp = 0.5 * x
	return tmp
function code(x, y, z)
	t_0 = Float64(y * sqrt(z))
	tmp = 0.0
	if ((t_0 <= -5e-12) || !(t_0 <= 2e-34))
		tmp = Float64(0.5 * t_0);
	else
		tmp = Float64(0.5 * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * sqrt(z);
	tmp = 0.0;
	if ((t_0 <= -5e-12) || ~((t_0 <= 2e-34)))
		tmp = 0.5 * t_0;
	else
		tmp = 0.5 * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-12], N[Not[LessEqual[t$95$0, 2e-34]], $MachinePrecision]], N[(0.5 * t$95$0), $MachinePrecision], N[(0.5 * x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \sqrt{z}\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{-12} \lor \neg \left(t_0 \leq 2 \cdot 10^{-34}\right):\\
\;\;\;\;0.5 \cdot t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (sqrt.f64 z)) < -4.9999999999999997e-12 or 1.99999999999999986e-34 < (*.f64 y (sqrt.f64 z))

    1. Initial program 99.7%

      \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.7%

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

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

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

    if -4.9999999999999997e-12 < (*.f64 y (sqrt.f64 z)) < 1.99999999999999986e-34

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Taylor expanded in x around inf 79.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \sqrt{z} \leq -5 \cdot 10^{-12} \lor \neg \left(y \cdot \sqrt{z} \leq 2 \cdot 10^{-34}\right):\\ \;\;\;\;0.5 \cdot \left(y \cdot \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot x\\ \end{array} \]

Alternative 3: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 4: 52.0% accurate, 7.2× speedup?

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

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

\mathbf{elif}\;y \leq 3.4 \cdot 10^{+190}:\\
\;\;\;\;0.5 \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.80000000000000026e193

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+23.3%

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}} \]
      5. swap-sqr3.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}} \]
      6. add-sqr-sqrt3.1%

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

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

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} + -1 \cdot \frac{x}{{y}^{2} \cdot z}}} \]
    7. Step-by-step derivation
      1. mul-1-neg89.2%

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

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} - \frac{x}{{y}^{2} \cdot z}}} \]
      3. associate-*l/89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 \cdot \sqrt{\frac{1}{z}}}{y}} - \frac{x}{{y}^{2} \cdot z}} \]
      4. *-lft-identity89.1%

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \color{blue}{\frac{\frac{x}{y \cdot y}}{z}}} \]
      7. associate-/r*89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\color{blue}{\frac{\frac{x}{y}}{y}}}{z}} \]
    8. Simplified89.1%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\frac{\frac{x}{y}}{y}}{z}}} \]
    9. Taylor expanded in z around 0 38.4%

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-\frac{y \cdot y}{\frac{x}{z}}\right)} \]
    12. Step-by-step derivation
      1. *-un-lft-identity38.3%

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

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

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

    if -5.80000000000000026e193 < y < 3.3999999999999999e190

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Taylor expanded in x around inf 56.3%

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

    if 3.3999999999999999e190 < y

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+10.7%

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}} \]
      5. swap-sqr3.7%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}} \]
      6. add-sqr-sqrt3.7%

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

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

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} + -1 \cdot \frac{x}{{y}^{2} \cdot z}}} \]
    7. Step-by-step derivation
      1. mul-1-neg99.5%

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

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} - \frac{x}{{y}^{2} \cdot z}}} \]
      3. associate-*l/99.6%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 \cdot \sqrt{\frac{1}{z}}}{y}} - \frac{x}{{y}^{2} \cdot z}} \]
      4. *-lft-identity99.6%

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \color{blue}{\frac{\frac{x}{y \cdot y}}{z}}} \]
      7. associate-/r*99.6%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\color{blue}{\frac{\frac{x}{y}}{y}}}{z}} \]
    8. Simplified99.6%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\frac{\frac{x}{y}}{y}}{z}}} \]
    9. Taylor expanded in z around 0 16.7%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\color{blue}{-1}}{z} \cdot \frac{x}{y \cdot y}} \]
      6. distribute-neg-frac16.7%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\left(-\frac{1}{z}\right)} \cdot \frac{x}{y \cdot y}} \]
      7. distribute-lft-neg-out16.7%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{-\frac{1}{z} \cdot \frac{x}{y \cdot y}}} \]
      8. *-inverses16.7%

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

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\frac{y}{y}}{z} \cdot \color{blue}{\frac{\frac{x}{y}}{y}}} \]
      10. times-frac16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\color{blue}{\frac{\frac{y}{y} \cdot \frac{x}{y}}{z \cdot y}}} \]
      11. associate-/r/16.7%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{y}{\frac{y}{\frac{x}{y}}}}}{z \cdot y}} \]
      12. associate-/r/16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{y}{y} \cdot \frac{x}{y}}}{z \cdot y}} \]
      13. *-commutative16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\frac{y}{y} \cdot \frac{x}{y}}{\color{blue}{y \cdot z}}} \]
      14. *-inverses16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{1} \cdot \frac{x}{y}}{y \cdot z}} \]
      15. metadata-eval16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{1}{1}} \cdot \frac{x}{y}}{y \cdot z}} \]
      16. times-frac16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{1 \cdot x}{1 \cdot y}}}{y \cdot z}} \]
      17. *-lft-identity16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\frac{\color{blue}{x}}{1 \cdot y}}{y \cdot z}} \]
      18. associate-/l/16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{\frac{x}{y}}{1}}}{y \cdot z}} \]
      19. /-rgt-identity16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{x}{y}}}{y \cdot z}} \]
    11. Simplified16.8%

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

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

        \[\leadsto 0.5 \cdot \frac{1}{-\color{blue}{\sqrt{\frac{\frac{x}{y}}{y \cdot z} \cdot \frac{\frac{x}{y}}{y \cdot z}}}} \]
      3. sqr-neg0.1%

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

        \[\leadsto 0.5 \cdot \frac{1}{-\color{blue}{\sqrt{-\frac{\frac{x}{y}}{y \cdot z}} \cdot \sqrt{-\frac{\frac{x}{y}}{y \cdot z}}}} \]
      5. add-sqr-sqrt21.1%

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

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

      \[\leadsto 0.5 \cdot \frac{1}{-\color{blue}{\left(0 - \frac{\frac{x}{y}}{y \cdot z}\right)}} \]
    14. Step-by-step derivation
      1. neg-sub021.1%

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{-\left(-\frac{x}{\color{blue}{z \cdot \left(y \cdot y\right)}}\right)} \]
      5. distribute-neg-frac21.0%

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

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

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

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

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

Alternative 5: 52.0% accurate, 7.2× speedup?

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

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

\mathbf{elif}\;y \leq 2 \cdot 10^{+188}:\\
\;\;\;\;0.5 \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.15e191

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+23.3%

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}} \]
      5. swap-sqr3.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}} \]
      6. add-sqr-sqrt3.1%

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

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

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} + -1 \cdot \frac{x}{{y}^{2} \cdot z}}} \]
    7. Step-by-step derivation
      1. mul-1-neg89.2%

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

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} - \frac{x}{{y}^{2} \cdot z}}} \]
      3. associate-*l/89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 \cdot \sqrt{\frac{1}{z}}}{y}} - \frac{x}{{y}^{2} \cdot z}} \]
      4. *-lft-identity89.1%

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \color{blue}{\frac{\frac{x}{y \cdot y}}{z}}} \]
      7. associate-/r*89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\color{blue}{\frac{\frac{x}{y}}{y}}}{z}} \]
    8. Simplified89.1%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\frac{\frac{x}{y}}{y}}{z}}} \]
    9. Taylor expanded in z around 0 38.4%

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-\frac{y \cdot y}{\frac{x}{z}}\right)} \]
    12. Step-by-step derivation
      1. *-un-lft-identity38.3%

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

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

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

    if -1.15e191 < y < 2e188

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Taylor expanded in x around inf 56.3%

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

    if 2e188 < y

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+10.7%

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}} \]
      5. swap-sqr3.7%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}} \]
      6. add-sqr-sqrt3.7%

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

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

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} + -1 \cdot \frac{x}{{y}^{2} \cdot z}}} \]
    7. Step-by-step derivation
      1. mul-1-neg99.5%

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

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} - \frac{x}{{y}^{2} \cdot z}}} \]
      3. associate-*l/99.6%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 \cdot \sqrt{\frac{1}{z}}}{y}} - \frac{x}{{y}^{2} \cdot z}} \]
      4. *-lft-identity99.6%

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \color{blue}{\frac{\frac{x}{y \cdot y}}{z}}} \]
      7. associate-/r*99.6%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\color{blue}{\frac{\frac{x}{y}}{y}}}{z}} \]
    8. Simplified99.6%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\frac{\frac{x}{y}}{y}}{z}}} \]
    9. Taylor expanded in z around 0 16.7%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\color{blue}{-1}}{z} \cdot \frac{x}{y \cdot y}} \]
      6. distribute-neg-frac16.7%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\left(-\frac{1}{z}\right)} \cdot \frac{x}{y \cdot y}} \]
      7. distribute-lft-neg-out16.7%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{-\frac{1}{z} \cdot \frac{x}{y \cdot y}}} \]
      8. *-inverses16.7%

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

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\frac{y}{y}}{z} \cdot \color{blue}{\frac{\frac{x}{y}}{y}}} \]
      10. times-frac16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\color{blue}{\frac{\frac{y}{y} \cdot \frac{x}{y}}{z \cdot y}}} \]
      11. associate-/r/16.7%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{y}{\frac{y}{\frac{x}{y}}}}}{z \cdot y}} \]
      12. associate-/r/16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{y}{y} \cdot \frac{x}{y}}}{z \cdot y}} \]
      13. *-commutative16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\frac{y}{y} \cdot \frac{x}{y}}{\color{blue}{y \cdot z}}} \]
      14. *-inverses16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{1} \cdot \frac{x}{y}}{y \cdot z}} \]
      15. metadata-eval16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{1}{1}} \cdot \frac{x}{y}}{y \cdot z}} \]
      16. times-frac16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{1 \cdot x}{1 \cdot y}}}{y \cdot z}} \]
      17. *-lft-identity16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\frac{\color{blue}{x}}{1 \cdot y}}{y \cdot z}} \]
      18. associate-/l/16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{\frac{x}{y}}{1}}}{y \cdot z}} \]
      19. /-rgt-identity16.8%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{x}{y}}}{y \cdot z}} \]
    11. Simplified16.8%

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

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

        \[\leadsto 0.5 \cdot \frac{1}{-\color{blue}{\sqrt{\frac{\frac{x}{y}}{y \cdot z} \cdot \frac{\frac{x}{y}}{y \cdot z}}}} \]
      3. sqr-neg0.1%

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

        \[\leadsto 0.5 \cdot \frac{1}{-\color{blue}{\sqrt{-\frac{\frac{x}{y}}{y \cdot z}} \cdot \sqrt{-\frac{\frac{x}{y}}{y \cdot z}}}} \]
      5. add-sqr-sqrt21.1%

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

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

      \[\leadsto 0.5 \cdot \frac{1}{-\color{blue}{\left(0 - \frac{\frac{x}{y}}{y \cdot z}\right)}} \]
    14. Step-by-step derivation
      1. neg-sub021.1%

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

        \[\leadsto 0.5 \cdot \frac{1}{-\color{blue}{\frac{-\frac{x}{y}}{y \cdot z}}} \]
    15. Simplified21.1%

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

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

Alternative 6: 51.6% accurate, 9.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.49999999999999994e194

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+23.3%

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}} \]
      5. swap-sqr3.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}} \]
      6. add-sqr-sqrt3.1%

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

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

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} + -1 \cdot \frac{x}{{y}^{2} \cdot z}}} \]
    7. Step-by-step derivation
      1. mul-1-neg89.2%

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

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} - \frac{x}{{y}^{2} \cdot z}}} \]
      3. associate-*l/89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 \cdot \sqrt{\frac{1}{z}}}{y}} - \frac{x}{{y}^{2} \cdot z}} \]
      4. *-lft-identity89.1%

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \color{blue}{\frac{\frac{x}{y \cdot y}}{z}}} \]
      7. associate-/r*89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\color{blue}{\frac{\frac{x}{y}}{y}}}{z}} \]
    8. Simplified89.1%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\frac{\frac{x}{y}}{y}}{z}}} \]
    9. Taylor expanded in z around 0 38.4%

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

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

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

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

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

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

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

    if -2.49999999999999994e194 < y

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Taylor expanded in x around inf 50.2%

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

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

Alternative 7: 51.6% accurate, 9.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.79999999999999984e195

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+23.3%

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}} \]
      5. swap-sqr3.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}} \]
      6. add-sqr-sqrt3.1%

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

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

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} + -1 \cdot \frac{x}{{y}^{2} \cdot z}}} \]
    7. Step-by-step derivation
      1. mul-1-neg89.2%

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

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} - \frac{x}{{y}^{2} \cdot z}}} \]
      3. associate-*l/89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 \cdot \sqrt{\frac{1}{z}}}{y}} - \frac{x}{{y}^{2} \cdot z}} \]
      4. *-lft-identity89.1%

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \color{blue}{\frac{\frac{x}{y \cdot y}}{z}}} \]
      7. associate-/r*89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\color{blue}{\frac{\frac{x}{y}}{y}}}{z}} \]
    8. Simplified89.1%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\frac{\frac{x}{y}}{y}}{z}}} \]
    9. Taylor expanded in z around 0 38.4%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\left(-\frac{1}{z}\right)} \cdot \frac{x}{y \cdot y}} \]
      7. distribute-lft-neg-out38.4%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{-\frac{1}{z} \cdot \frac{x}{y \cdot y}}} \]
      8. *-inverses38.4%

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

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\frac{y}{y}}{z} \cdot \color{blue}{\frac{\frac{x}{y}}{y}}} \]
      10. times-frac38.4%

        \[\leadsto 0.5 \cdot \frac{1}{-\color{blue}{\frac{\frac{y}{y} \cdot \frac{x}{y}}{z \cdot y}}} \]
      11. associate-/r/38.4%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{y}{\frac{y}{\frac{x}{y}}}}}{z \cdot y}} \]
      12. associate-/r/38.4%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{y}{y} \cdot \frac{x}{y}}}{z \cdot y}} \]
      13. *-commutative38.4%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\frac{y}{y} \cdot \frac{x}{y}}{\color{blue}{y \cdot z}}} \]
      14. *-inverses38.4%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{1} \cdot \frac{x}{y}}{y \cdot z}} \]
      15. metadata-eval38.4%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{1}{1}} \cdot \frac{x}{y}}{y \cdot z}} \]
      16. times-frac38.4%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{1 \cdot x}{1 \cdot y}}}{y \cdot z}} \]
      17. *-lft-identity38.4%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\frac{\color{blue}{x}}{1 \cdot y}}{y \cdot z}} \]
      18. associate-/l/38.4%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{\frac{x}{y}}{1}}}{y \cdot z}} \]
      19. /-rgt-identity38.4%

        \[\leadsto 0.5 \cdot \frac{1}{-\frac{\color{blue}{\frac{x}{y}}}{y \cdot z}} \]
    11. Simplified38.4%

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left(-\color{blue}{y \cdot \frac{y}{\frac{x}{z}}}\right) \]
      5. distribute-rgt-neg-in38.5%

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

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

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

    if -5.79999999999999984e195 < y

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Taylor expanded in x around inf 50.2%

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

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

Alternative 8: 51.6% accurate, 9.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.8000000000000003e192

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+23.3%

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}} \]
      5. swap-sqr3.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}} \]
      6. add-sqr-sqrt3.1%

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

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

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} + -1 \cdot \frac{x}{{y}^{2} \cdot z}}} \]
    7. Step-by-step derivation
      1. mul-1-neg89.2%

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

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} - \frac{x}{{y}^{2} \cdot z}}} \]
      3. associate-*l/89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 \cdot \sqrt{\frac{1}{z}}}{y}} - \frac{x}{{y}^{2} \cdot z}} \]
      4. *-lft-identity89.1%

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \color{blue}{\frac{\frac{x}{y \cdot y}}{z}}} \]
      7. associate-/r*89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\color{blue}{\frac{\frac{x}{y}}{y}}}{z}} \]
    8. Simplified89.1%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\frac{\frac{x}{y}}{y}}{z}}} \]
    9. Taylor expanded in z around 0 38.4%

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{-1 \cdot \left(y \cdot \color{blue}{\left(z \cdot y\right)}\right)}{x} \]
      5. neg-mul-138.4%

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{y \cdot \left(-z \cdot y\right)}}{x} \]
      7. distribute-lft-neg-in38.4%

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

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

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

    if -8.8000000000000003e192 < y

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Taylor expanded in x around inf 50.2%

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

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

Alternative 9: 51.6% accurate, 9.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.59999999999999943e191

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+23.3%

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

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}} \]
      5. swap-sqr3.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{x - y \cdot \sqrt{z}}{x \cdot x - \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}} \]
      6. add-sqr-sqrt3.1%

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

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

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} + -1 \cdot \frac{x}{{y}^{2} \cdot z}}} \]
    7. Step-by-step derivation
      1. mul-1-neg89.2%

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

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{y} \cdot \sqrt{\frac{1}{z}} - \frac{x}{{y}^{2} \cdot z}}} \]
      3. associate-*l/89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 \cdot \sqrt{\frac{1}{z}}}{y}} - \frac{x}{{y}^{2} \cdot z}} \]
      4. *-lft-identity89.1%

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

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

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \color{blue}{\frac{\frac{x}{y \cdot y}}{z}}} \]
      7. associate-/r*89.1%

        \[\leadsto 0.5 \cdot \frac{1}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\color{blue}{\frac{\frac{x}{y}}{y}}}{z}} \]
    8. Simplified89.1%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{\sqrt{\frac{1}{z}}}{y} - \frac{\frac{\frac{x}{y}}{y}}{z}}} \]
    9. Taylor expanded in z around 0 38.4%

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

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

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\left(-\frac{y \cdot y}{\frac{x}{z}}\right)} \]
    12. Step-by-step derivation
      1. *-un-lft-identity38.3%

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

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

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

    if -9.59999999999999943e191 < y

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Taylor expanded in x around inf 50.2%

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

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

Alternative 10: 51.3% accurate, 36.3× speedup?

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

\\
0.5 \cdot x
\end{array}
Derivation
  1. Initial program 99.8%

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

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

    \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
  4. Taylor expanded in x around inf 46.6%

    \[\leadsto 0.5 \cdot \color{blue}{x} \]
  5. Final simplification46.6%

    \[\leadsto 0.5 \cdot x \]

Reproduce

?
herbie shell --seed 2023261 
(FPCore (x y z)
  :name "Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, B"
  :precision binary64
  (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))