Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2

Percentage Accurate: 82.6% → 95.0%
Time: 14.1s
Alternatives: 15
Speedup: 1.0×

Specification

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

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

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

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

Alternative 1: 95.0% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\ \mathbf{if}\;t_0 \leq -2 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z}{y}}\\ \mathbf{elif}\;t_0 \leq 10^{-291}:\\ \;\;\;\;\frac{1}{z \cdot \frac{\frac{z}{x}}{y}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+151}:\\ \;\;\;\;\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z}}{z \cdot \frac{z}{x}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (+ z 1.0) (* z z))))
   (if (<= t_0 -2e+42)
     (/ (/ x z) (* z (/ z y)))
     (if (<= t_0 1e-291)
       (/ 1.0 (* z (/ (/ z x) y)))
       (if (<= t_0 5e+151)
         (* (/ y (* z z)) (/ x (+ z 1.0)))
         (/ (/ y z) (* z (/ z x))))))))
assert(x < y);
double code(double x, double y, double z) {
	double t_0 = (z + 1.0) * (z * z);
	double tmp;
	if (t_0 <= -2e+42) {
		tmp = (x / z) / (z * (z / y));
	} else if (t_0 <= 1e-291) {
		tmp = 1.0 / (z * ((z / x) / y));
	} else if (t_0 <= 5e+151) {
		tmp = (y / (z * z)) * (x / (z + 1.0));
	} else {
		tmp = (y / z) / (z * (z / x));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (z + 1.0d0) * (z * z)
    if (t_0 <= (-2d+42)) then
        tmp = (x / z) / (z * (z / y))
    else if (t_0 <= 1d-291) then
        tmp = 1.0d0 / (z * ((z / x) / y))
    else if (t_0 <= 5d+151) then
        tmp = (y / (z * z)) * (x / (z + 1.0d0))
    else
        tmp = (y / z) / (z * (z / x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double t_0 = (z + 1.0) * (z * z);
	double tmp;
	if (t_0 <= -2e+42) {
		tmp = (x / z) / (z * (z / y));
	} else if (t_0 <= 1e-291) {
		tmp = 1.0 / (z * ((z / x) / y));
	} else if (t_0 <= 5e+151) {
		tmp = (y / (z * z)) * (x / (z + 1.0));
	} else {
		tmp = (y / z) / (z * (z / x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	t_0 = (z + 1.0) * (z * z)
	tmp = 0
	if t_0 <= -2e+42:
		tmp = (x / z) / (z * (z / y))
	elif t_0 <= 1e-291:
		tmp = 1.0 / (z * ((z / x) / y))
	elif t_0 <= 5e+151:
		tmp = (y / (z * z)) * (x / (z + 1.0))
	else:
		tmp = (y / z) / (z * (z / x))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	t_0 = Float64(Float64(z + 1.0) * Float64(z * z))
	tmp = 0.0
	if (t_0 <= -2e+42)
		tmp = Float64(Float64(x / z) / Float64(z * Float64(z / y)));
	elseif (t_0 <= 1e-291)
		tmp = Float64(1.0 / Float64(z * Float64(Float64(z / x) / y)));
	elseif (t_0 <= 5e+151)
		tmp = Float64(Float64(y / Float64(z * z)) * Float64(x / Float64(z + 1.0)));
	else
		tmp = Float64(Float64(y / z) / Float64(z * Float64(z / x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	t_0 = (z + 1.0) * (z * z);
	tmp = 0.0;
	if (t_0 <= -2e+42)
		tmp = (x / z) / (z * (z / y));
	elseif (t_0 <= 1e-291)
		tmp = 1.0 / (z * ((z / x) / y));
	elseif (t_0 <= 5e+151)
		tmp = (y / (z * z)) * (x / (z + 1.0));
	else
		tmp = (y / z) / (z * (z / x));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+42], N[(N[(x / z), $MachinePrecision] / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-291], N[(1.0 / N[(z * N[(N[(z / x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+151], N[(N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision] * N[(x / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z}{y}}\\

\mathbf{elif}\;t_0 \leq 10^{-291}:\\
\;\;\;\;\frac{1}{z \cdot \frac{\frac{z}{x}}{y}}\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+151}:\\
\;\;\;\;\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z 1)) < -2.00000000000000009e42

    1. Initial program 79.7%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg85.5%

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right) \cdot \left(z + 1\right)}} \]
      6. sqr-neg85.5%

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity85.5%

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/79.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{z} \cdot \frac{y}{z}}}{z + 1} \]
      9. associate-/l*92.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{\frac{z + 1}{\frac{y}{z}}}} \]
      10. div-inv92.9%

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

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

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

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\frac{{z}^{2}}{y}}} \]
    7. Step-by-step derivation
      1. unpow291.5%

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

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\frac{z}{\frac{y}{z}}}} \]
    8. Simplified92.8%

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\frac{z}{\frac{y}{z}}}} \]
    9. Step-by-step derivation
      1. associate-/r/92.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\frac{z}{y} \cdot z}} \]
    10. Applied egg-rr92.9%

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

    if -2.00000000000000009e42 < (*.f64 (*.f64 z z) (+.f64 z 1)) < 9.99999999999999962e-292

    1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity78.4%

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} \]
      2. *-rgt-identity79.8%

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

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

        \[\leadsto \frac{x}{z \cdot z} \cdot \color{blue}{y} \]
    6. Simplified78.4%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot y} \]
    7. Step-by-step derivation
      1. associate-*l/79.8%

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z}}{z}} \]
      3. clear-num93.3%

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

        \[\leadsto \frac{\frac{1}{\frac{z}{x \cdot y}}}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} \]
      5. sqrt-prod42.5%

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

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

        \[\leadsto \frac{\frac{1}{\frac{z}{x \cdot y}}}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} \]
      8. add-sqr-sqrt2.0%

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

        \[\leadsto \color{blue}{\frac{1}{\left(-z\right) \cdot \frac{z}{x \cdot y}}} \]
      10. add-sqr-sqrt1.8%

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

        \[\leadsto \frac{1}{\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}} \cdot \frac{z}{x \cdot y}} \]
      12. sqr-neg42.5%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{z \cdot z}} \cdot \frac{z}{x \cdot y}} \]
      13. sqrt-prod42.6%

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

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

        \[\leadsto \frac{1}{z \cdot \color{blue}{\frac{\frac{z}{x}}{y}}} \]
    8. Applied egg-rr99.8%

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

    if 9.99999999999999962e-292 < (*.f64 (*.f64 z z) (+.f64 z 1)) < 5.0000000000000002e151

    1. Initial program 93.1%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z}} \cdot \frac{x}{z + 1} \]
    3. Simplified92.6%

      \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}} \]

    if 5.0000000000000002e151 < (*.f64 (*.f64 z z) (+.f64 z 1))

    1. Initial program 74.9%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg75.6%

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity75.6%

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/74.9%

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

        \[\leadsto \frac{\color{blue}{x \cdot y}}{z \cdot \mathsf{fma}\left(z, z, z\right)} \]
      3. associate-/r*78.5%

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

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

        \[\leadsto \frac{x \cdot \frac{y}{z}}{\color{blue}{z \cdot z + z}} \]
      6. distribute-lft1-in82.6%

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

        \[\leadsto \color{blue}{\frac{x}{z + 1} \cdot \frac{\frac{y}{z}}{z}} \]
      8. clear-num99.7%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{z}}{\frac{z + 1}{x} \cdot z}} \]
      10. *-un-lft-identity96.4%

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

      \[\leadsto \color{blue}{\frac{\frac{y}{z}}{\frac{z + 1}{x} \cdot z}} \]
    6. Taylor expanded in z around inf 84.4%

      \[\leadsto \frac{\frac{y}{z}}{\color{blue}{\frac{{z}^{2}}{x}}} \]
    7. Step-by-step derivation
      1. unpow284.4%

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

        \[\leadsto \frac{\frac{y}{z}}{\color{blue}{z \cdot \frac{z}{x}}} \]
    8. Simplified96.4%

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

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

Alternative 2: 79.2% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-65} \lor \neg \left(x \cdot y \leq 4 \cdot 10^{+19}\right):\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* x y) -1e-65) (not (<= (* x y) 4e+19)))
   (* y (/ x (* z z)))
   (* (/ x z) (/ y z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (((x * y) <= -1e-65) || !((x * y) <= 4e+19)) {
		tmp = y * (x / (z * z));
	} else {
		tmp = (x / z) * (y / z);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (((x * y) <= (-1d-65)) .or. (.not. ((x * y) <= 4d+19))) then
        tmp = y * (x / (z * z))
    else
        tmp = (x / z) * (y / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (((x * y) <= -1e-65) || !((x * y) <= 4e+19)) {
		tmp = y * (x / (z * z));
	} else {
		tmp = (x / z) * (y / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if ((x * y) <= -1e-65) or not ((x * y) <= 4e+19):
		tmp = y * (x / (z * z))
	else:
		tmp = (x / z) * (y / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if ((Float64(x * y) <= -1e-65) || !(Float64(x * y) <= 4e+19))
		tmp = Float64(y * Float64(x / Float64(z * z)));
	else
		tmp = Float64(Float64(x / z) * Float64(y / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((x * y) <= -1e-65) || ~(((x * y) <= 4e+19)))
		tmp = y * (x / (z * z));
	else
		tmp = (x / z) * (y / z);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e-65], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4e+19]], $MachinePrecision]], N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-65} \lor \neg \left(x \cdot y \leq 4 \cdot 10^{+19}\right):\\
\;\;\;\;y \cdot \frac{x}{z \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -9.99999999999999923e-66 or 4e19 < (*.f64 x y)

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity84.9%

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} \]
      2. *-rgt-identity71.8%

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

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

        \[\leadsto \frac{x}{z \cdot z} \cdot \color{blue}{y} \]
    6. Simplified72.9%

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

    if -9.99999999999999923e-66 < (*.f64 x y) < 4e19

    1. Initial program 84.0%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg87.6%

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity87.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z}} \]
    6. Simplified94.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-65} \lor \neg \left(x \cdot y \leq 4 \cdot 10^{+19}\right):\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \end{array} \]

Alternative 3: 93.0% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -44000000000 \lor \neg \left(z \leq 0.75\right):\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot \left(\frac{x}{z} - x\right)\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -44000000000.0) (not (<= z 0.75)))
   (* (/ x z) (/ y (* z z)))
   (* (/ y z) (- (/ x z) x))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -44000000000.0) || !(z <= 0.75)) {
		tmp = (x / z) * (y / (z * z));
	} else {
		tmp = (y / z) * ((x / z) - x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-44000000000.0d0)) .or. (.not. (z <= 0.75d0))) then
        tmp = (x / z) * (y / (z * z))
    else
        tmp = (y / z) * ((x / z) - x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -44000000000.0) || !(z <= 0.75)) {
		tmp = (x / z) * (y / (z * z));
	} else {
		tmp = (y / z) * ((x / z) - x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z <= -44000000000.0) or not (z <= 0.75):
		tmp = (x / z) * (y / (z * z))
	else:
		tmp = (y / z) * ((x / z) - x)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if ((z <= -44000000000.0) || !(z <= 0.75))
		tmp = Float64(Float64(x / z) * Float64(y / Float64(z * z)));
	else
		tmp = Float64(Float64(y / z) * Float64(Float64(x / z) - x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -44000000000.0) || ~((z <= 0.75)))
		tmp = (x / z) * (y / (z * z));
	else
		tmp = (y / z) * ((x / z) - x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[Or[LessEqual[z, -44000000000.0], N[Not[LessEqual[z, 0.75]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -44000000000 \lor \neg \left(z \leq 0.75\right):\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.4e10 or 0.75 < z

    1. Initial program 79.4%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z}} \cdot \frac{x}{z + 1} \]
    3. Simplified90.0%

      \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}} \]
    4. Taylor expanded in z around inf 89.4%

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

    if -4.4e10 < z < 0.75

    1. Initial program 86.6%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg89.5%

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right) \cdot \left(z + 1\right)}} \]
      6. sqr-neg89.5%

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity89.5%

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/86.6%

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot \left(z \cdot z\right) + z \cdot z}} \]
      5. *-un-lft-identity86.6%

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

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot z}}{z + 1}} \]
      8. frac-times96.3%

        \[\leadsto \frac{\color{blue}{\frac{x}{z} \cdot \frac{y}{z}}}{z + 1} \]
      9. associate-/l*96.2%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{\frac{z + 1}{\frac{y}{z}}}} \]
      10. div-inv96.2%

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
      3. times-frac72.9%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
      4. mul-1-neg72.9%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{z}, \frac{y}{z}, \left(-x\right) \cdot \frac{y}{z}\right)} \]
      8. distribute-lft-neg-out72.0%

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{z}, \frac{y}{z}, -\color{blue}{\frac{y}{z} \cdot x}\right) \]
      10. associate-*l/72.9%

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z} - \frac{y \cdot x}{z}} \]
      12. associate-*l/72.0%

        \[\leadsto \frac{x}{z} \cdot \frac{y}{z} - \color{blue}{\frac{y}{z} \cdot x} \]
      13. *-commutative72.0%

        \[\leadsto \frac{x}{z} \cdot \frac{y}{z} - \color{blue}{x \cdot \frac{y}{z}} \]
      14. distribute-rgt-out--94.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -44000000000 \lor \neg \left(z \leq 0.75\right):\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot \left(\frac{x}{z} - x\right)\\ \end{array} \]

Alternative 4: 94.7% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -44000000000 \lor \neg \left(z \leq 0.75\right):\\ \;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot \left(\frac{x}{z} - x\right)\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -44000000000.0) (not (<= z 0.75)))
   (/ (/ x z) (* z (/ z y)))
   (* (/ y z) (- (/ x z) x))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -44000000000.0) || !(z <= 0.75)) {
		tmp = (x / z) / (z * (z / y));
	} else {
		tmp = (y / z) * ((x / z) - x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-44000000000.0d0)) .or. (.not. (z <= 0.75d0))) then
        tmp = (x / z) / (z * (z / y))
    else
        tmp = (y / z) * ((x / z) - x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -44000000000.0) || !(z <= 0.75)) {
		tmp = (x / z) / (z * (z / y));
	} else {
		tmp = (y / z) * ((x / z) - x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z <= -44000000000.0) or not (z <= 0.75):
		tmp = (x / z) / (z * (z / y))
	else:
		tmp = (y / z) * ((x / z) - x)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if ((z <= -44000000000.0) || !(z <= 0.75))
		tmp = Float64(Float64(x / z) / Float64(z * Float64(z / y)));
	else
		tmp = Float64(Float64(y / z) * Float64(Float64(x / z) - x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -44000000000.0) || ~((z <= 0.75)))
		tmp = (x / z) / (z * (z / y));
	else
		tmp = (y / z) * ((x / z) - x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[Or[LessEqual[z, -44000000000.0], N[Not[LessEqual[z, 0.75]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -44000000000 \lor \neg \left(z \leq 0.75\right):\\
\;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z}{y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.4e10 or 0.75 < z

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity82.4%

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/79.4%

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot \left(z \cdot z\right) + z \cdot z}} \]
      5. *-un-lft-identity55.8%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{z} \cdot \frac{y}{z}}}{z + 1} \]
      9. associate-/l*95.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{\frac{z + 1}{\frac{y}{z}}}} \]
      10. div-inv95.8%

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

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

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

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\frac{{z}^{2}}{y}}} \]
    7. Step-by-step derivation
      1. unpow288.5%

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

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\frac{z}{\frac{y}{z}}}} \]
    8. Simplified95.1%

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\frac{z}{\frac{y}{z}}}} \]
    9. Step-by-step derivation
      1. associate-/r/95.2%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\frac{z}{y} \cdot z}} \]
    10. Applied egg-rr95.2%

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

    if -4.4e10 < z < 0.75

    1. Initial program 86.6%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg89.5%

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right) \cdot \left(z + 1\right)}} \]
      6. sqr-neg89.5%

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity89.5%

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/86.6%

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot \left(z \cdot z\right) + z \cdot z}} \]
      5. *-un-lft-identity86.6%

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

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot z}}{z + 1}} \]
      8. frac-times96.3%

        \[\leadsto \frac{\color{blue}{\frac{x}{z} \cdot \frac{y}{z}}}{z + 1} \]
      9. associate-/l*96.2%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{\frac{z + 1}{\frac{y}{z}}}} \]
      10. div-inv96.2%

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
      3. times-frac72.9%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
      4. mul-1-neg72.9%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{z}, \frac{y}{z}, \left(-x\right) \cdot \frac{y}{z}\right)} \]
      8. distribute-lft-neg-out72.0%

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{z}, \frac{y}{z}, -\color{blue}{\frac{y}{z} \cdot x}\right) \]
      10. associate-*l/72.9%

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z} - \frac{y \cdot x}{z}} \]
      12. associate-*l/72.0%

        \[\leadsto \frac{x}{z} \cdot \frac{y}{z} - \color{blue}{\frac{y}{z} \cdot x} \]
      13. *-commutative72.0%

        \[\leadsto \frac{x}{z} \cdot \frac{y}{z} - \color{blue}{x \cdot \frac{y}{z}} \]
      14. distribute-rgt-out--94.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -44000000000 \lor \neg \left(z \leq 0.75\right):\\ \;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot \left(\frac{x}{z} - x\right)\\ \end{array} \]

Alternative 5: 79.2% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{-144}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot z}\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-78}:\\ \;\;\;\;\frac{x \cdot \frac{y}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.8e-144)
   (* x (/ y (* z z)))
   (if (<= z 2.2e-78) (/ (* x (/ y z)) z) (* y (/ x (* z z))))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.8e-144) {
		tmp = x * (y / (z * z));
	} else if (z <= 2.2e-78) {
		tmp = (x * (y / z)) / z;
	} else {
		tmp = y * (x / (z * z));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-1.8d-144)) then
        tmp = x * (y / (z * z))
    else if (z <= 2.2d-78) then
        tmp = (x * (y / z)) / z
    else
        tmp = y * (x / (z * z))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.8e-144) {
		tmp = x * (y / (z * z));
	} else if (z <= 2.2e-78) {
		tmp = (x * (y / z)) / z;
	} else {
		tmp = y * (x / (z * z));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if z <= -1.8e-144:
		tmp = x * (y / (z * z))
	elif z <= 2.2e-78:
		tmp = (x * (y / z)) / z
	else:
		tmp = y * (x / (z * z))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.8e-144)
		tmp = Float64(x * Float64(y / Float64(z * z)));
	elseif (z <= 2.2e-78)
		tmp = Float64(Float64(x * Float64(y / z)) / z);
	else
		tmp = Float64(y * Float64(x / Float64(z * z)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1.8e-144)
		tmp = x * (y / (z * z));
	elseif (z <= 2.2e-78)
		tmp = (x * (y / z)) / z;
	else
		tmp = y * (x / (z * z));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[z, -1.8e-144], N[(x * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-78], N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-144}:\\
\;\;\;\;x \cdot \frac{y}{z \cdot z}\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-78}:\\
\;\;\;\;\frac{x \cdot \frac{y}{z}}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.8e-144

    1. Initial program 84.3%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z}} \cdot \frac{x}{z + 1} \]
    3. Simplified90.8%

      \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}} \]
    4. Taylor expanded in z around 0 74.0%

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

    if -1.8e-144 < z < 2.1999999999999999e-78

    1. Initial program 82.9%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z}} \cdot \frac{x}{z + 1} \]
    3. Simplified78.4%

      \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}} \]
    4. Taylor expanded in z around 0 78.4%

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z} \cdot x}{z}} \]
    6. Applied egg-rr97.2%

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

    if 2.1999999999999999e-78 < z

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity85.1%

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} \]
      2. *-rgt-identity70.5%

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

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

        \[\leadsto \frac{x}{z \cdot z} \cdot \color{blue}{y} \]
    6. Simplified73.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{-144}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot z}\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-78}:\\ \;\;\;\;\frac{x \cdot \frac{y}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \end{array} \]

Alternative 6: 79.9% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -44000000000:\\ \;\;\;\;\frac{x}{\frac{z \cdot \left(-z\right)}{y}}\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-79}:\\ \;\;\;\;\frac{x \cdot \frac{y}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= z -44000000000.0)
   (/ x (/ (* z (- z)) y))
   (if (<= z 4.3e-79) (/ (* x (/ y z)) z) (* y (/ x (* z z))))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -44000000000.0) {
		tmp = x / ((z * -z) / y);
	} else if (z <= 4.3e-79) {
		tmp = (x * (y / z)) / z;
	} else {
		tmp = y * (x / (z * z));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-44000000000.0d0)) then
        tmp = x / ((z * -z) / y)
    else if (z <= 4.3d-79) then
        tmp = (x * (y / z)) / z
    else
        tmp = y * (x / (z * z))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -44000000000.0) {
		tmp = x / ((z * -z) / y);
	} else if (z <= 4.3e-79) {
		tmp = (x * (y / z)) / z;
	} else {
		tmp = y * (x / (z * z));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if z <= -44000000000.0:
		tmp = x / ((z * -z) / y)
	elif z <= 4.3e-79:
		tmp = (x * (y / z)) / z
	else:
		tmp = y * (x / (z * z))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (z <= -44000000000.0)
		tmp = Float64(x / Float64(Float64(z * Float64(-z)) / y));
	elseif (z <= 4.3e-79)
		tmp = Float64(Float64(x * Float64(y / z)) / z);
	else
		tmp = Float64(y * Float64(x / Float64(z * z)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -44000000000.0)
		tmp = x / ((z * -z) / y);
	elseif (z <= 4.3e-79)
		tmp = (x * (y / z)) / z;
	else
		tmp = y * (x / (z * z));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[z, -44000000000.0], N[(x / N[(N[(z * (-z)), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.3e-79], N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -44000000000:\\
\;\;\;\;\frac{x}{\frac{z \cdot \left(-z\right)}{y}}\\

\mathbf{elif}\;z \leq 4.3 \cdot 10^{-79}:\\
\;\;\;\;\frac{x \cdot \frac{y}{z}}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.4e10

    1. Initial program 79.7%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z}} \cdot \frac{x}{z + 1} \]
    3. Simplified92.4%

      \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}} \]
    4. Taylor expanded in z around 0 68.4%

      \[\leadsto \frac{y}{z \cdot z} \cdot \color{blue}{x} \]
    5. Step-by-step derivation
      1. *-commutative68.4%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z}} \]
      3. frac-times53.5%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z}} \]
      4. clear-num53.6%

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

        \[\leadsto \frac{1}{\frac{z}{x}} \cdot \color{blue}{\frac{-y}{-z}} \]
      6. frac-times66.7%

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

        \[\leadsto \frac{\color{blue}{-y}}{\frac{z}{x} \cdot \left(-z\right)} \]
      8. add-sqr-sqrt31.7%

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

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{\frac{z}{x} \cdot \left(-z\right)} \]
      10. sqr-neg51.3%

        \[\leadsto \frac{\sqrt{\color{blue}{y \cdot y}}}{\frac{z}{x} \cdot \left(-z\right)} \]
      11. sqrt-unprod35.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{-z \cdot z}} \]
      6. associate-/l*71.2%

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

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

    if -4.4e10 < z < 4.29999999999999982e-79

    1. Initial program 85.9%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z}} \cdot \frac{x}{z + 1} \]
    3. Simplified81.3%

      \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}} \]
    4. Taylor expanded in z around 0 80.2%

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

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

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

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

    if 4.29999999999999982e-79 < z

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity85.1%

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} \]
      2. *-rgt-identity70.5%

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

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

        \[\leadsto \frac{x}{z \cdot z} \cdot \color{blue}{y} \]
    6. Simplified73.4%

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

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

Alternative 7: 96.2% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{\frac{x}{z}}{\left(z + 1\right) \cdot \frac{z}{y}} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (/ (/ x z) (* (+ z 1.0) (/ z y))))
assert(x < y);
double code(double x, double y, double z) {
	return (x / z) / ((z + 1.0) * (z / y));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x / z) / ((z + 1.0d0) * (z / y))
end function
assert x < y;
public static double code(double x, double y, double z) {
	return (x / z) / ((z + 1.0) * (z / y));
}
[x, y] = sort([x, y])
def code(x, y, z):
	return (x / z) / ((z + 1.0) * (z / y))
x, y = sort([x, y])
function code(x, y, z)
	return Float64(Float64(x / z) / Float64(Float64(z + 1.0) * Float64(z / y)))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = (x / z) / ((z + 1.0) * (z / y));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[(x / z), $MachinePrecision] / N[(N[(z + 1.0), $MachinePrecision] * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{z}}{\left(z + 1\right) \cdot \frac{z}{y}}
\end{array}
Derivation
  1. Initial program 83.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
    10. *-rgt-identity86.1%

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

    \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
  4. Step-by-step derivation
    1. associate-*r/83.1%

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

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

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot \left(z \cdot z\right) + z \cdot z}} \]
    5. *-un-lft-identity71.8%

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

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

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot z}}{z + 1}} \]
    8. frac-times96.7%

      \[\leadsto \frac{\color{blue}{\frac{x}{z} \cdot \frac{y}{z}}}{z + 1} \]
    9. associate-/l*96.0%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{\frac{z + 1}{\frac{y}{z}}}} \]
    10. div-inv96.0%

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

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

    \[\leadsto \color{blue}{\frac{\frac{x}{z}}{\left(z + 1\right) \cdot \frac{z}{y}}} \]
  6. Final simplification96.5%

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

Alternative 8: 96.9% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{\frac{x}{z} \cdot \frac{y}{z}}{z + 1} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (/ (* (/ x z) (/ y z)) (+ z 1.0)))
assert(x < y);
double code(double x, double y, double z) {
	return ((x / z) * (y / z)) / (z + 1.0);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((x / z) * (y / z)) / (z + 1.0d0)
end function
assert x < y;
public static double code(double x, double y, double z) {
	return ((x / z) * (y / z)) / (z + 1.0);
}
[x, y] = sort([x, y])
def code(x, y, z):
	return ((x / z) * (y / z)) / (z + 1.0)
x, y = sort([x, y])
function code(x, y, z)
	return Float64(Float64(Float64(x / z) * Float64(y / z)) / Float64(z + 1.0))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = ((x / z) * (y / z)) / (z + 1.0);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{z} \cdot \frac{y}{z}}{z + 1}
\end{array}
Derivation
  1. Initial program 83.1%

    \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
  2. Step-by-step derivation
    1. associate-*l*83.1%

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{z} \cdot \frac{y}{z}}{z + 1}} \]
  3. Simplified96.7%

    \[\leadsto \color{blue}{\frac{\frac{x}{z} \cdot \frac{y}{z}}{z + 1}} \]
  4. Final simplification96.7%

    \[\leadsto \frac{\frac{x}{z} \cdot \frac{y}{z}}{z + 1} \]

Alternative 9: 77.9% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{-81}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= x -2.1e-81) (* x (/ y (* z z))) (* (/ x z) (/ y z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.1e-81) {
		tmp = x * (y / (z * z));
	} else {
		tmp = (x / z) * (y / z);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-2.1d-81)) then
        tmp = x * (y / (z * z))
    else
        tmp = (x / z) * (y / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.1e-81) {
		tmp = x * (y / (z * z));
	} else {
		tmp = (x / z) * (y / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if x <= -2.1e-81:
		tmp = x * (y / (z * z))
	else:
		tmp = (x / z) * (y / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (x <= -2.1e-81)
		tmp = Float64(x * Float64(y / Float64(z * z)));
	else
		tmp = Float64(Float64(x / z) * Float64(y / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -2.1e-81)
		tmp = x * (y / (z * z));
	else
		tmp = (x / z) * (y / z);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[x, -2.1e-81], N[(x * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-81}:\\
\;\;\;\;x \cdot \frac{y}{z \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.0999999999999999e-81

    1. Initial program 84.5%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z}} \cdot \frac{x}{z + 1} \]
    3. Simplified95.0%

      \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}} \]
    4. Taylor expanded in z around 0 80.1%

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

    if -2.0999999999999999e-81 < x

    1. Initial program 82.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity83.9%

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} \]
      2. times-frac78.4%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z}} \]
    6. Simplified78.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{-81}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \end{array} \]

Alternative 10: 40.0% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= z -5e-310) (* (/ x z) (- y)) (* (/ x z) y)))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -5e-310) {
		tmp = (x / z) * -y;
	} else {
		tmp = (x / z) * y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-5d-310)) then
        tmp = (x / z) * -y
    else
        tmp = (x / z) * y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -5e-310) {
		tmp = (x / z) * -y;
	} else {
		tmp = (x / z) * y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if z <= -5e-310:
		tmp = (x / z) * -y
	else:
		tmp = (x / z) * y
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (z <= -5e-310)
		tmp = Float64(Float64(x / z) * Float64(-y));
	else
		tmp = Float64(Float64(x / z) * y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -5e-310)
		tmp = (x / z) * -y;
	else
		tmp = (x / z) * y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[z, -5e-310], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.999999999999985e-310

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity86.9%

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}} + -1 \cdot \frac{x \cdot y}{z}} \]
      2. unpow261.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
      3. *-commutative61.0%

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

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
      5. *-commutative67.2%

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + -1 \cdot \frac{\color{blue}{y \cdot x}}{z} \]
      6. associate-*r/69.6%

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

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

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + \color{blue}{\left(-y\right)} \cdot \frac{x}{z} \]
      9. distribute-rgt-out69.6%

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

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-1 \cdot y\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg38.9%

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

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

    if -4.999999999999985e-310 < z

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity85.4%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
      3. *-commutative40.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} + -1 \cdot \frac{x \cdot y}{z} \]
      4. times-frac44.8%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
      5. *-commutative44.8%

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + -1 \cdot \frac{\color{blue}{y \cdot x}}{z} \]
      6. associate-*r/46.5%

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

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

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

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

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-1 \cdot y\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg20.6%

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-y\right)} \]
    10. Step-by-step derivation
      1. expm1-log1p-u20.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)\right)} \]
      2. expm1-udef27.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)} - 1} \]
      3. add-sqr-sqrt14.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)}\right)} - 1 \]
      4. sqrt-unprod33.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right)} - 1 \]
      5. sqr-neg33.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \sqrt{\color{blue}{y \cdot y}}\right)} - 1 \]
      6. sqrt-unprod21.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} - 1 \]
      7. add-sqr-sqrt44.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{y}\right)} - 1 \]
      8. associate-*l/44.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{x \cdot y}{z}}\right)} - 1 \]
    11. Applied egg-rr44.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)} - 1} \]
    12. Step-by-step derivation
      1. expm1-def35.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)\right)} \]
      2. expm1-log1p42.8%

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
      3. associate-*l/46.0%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    13. Simplified46.0%

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

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

Alternative 11: 40.2% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{-310}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= z -5e-310) (* x (/ (- y) z)) (* (/ x z) y)))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -5e-310) {
		tmp = x * (-y / z);
	} else {
		tmp = (x / z) * y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-5d-310)) then
        tmp = x * (-y / z)
    else
        tmp = (x / z) * y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -5e-310) {
		tmp = x * (-y / z);
	} else {
		tmp = (x / z) * y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if z <= -5e-310:
		tmp = x * (-y / z)
	else:
		tmp = (x / z) * y
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (z <= -5e-310)
		tmp = Float64(x * Float64(Float64(-y) / z));
	else
		tmp = Float64(Float64(x / z) * y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -5e-310)
		tmp = x * (-y / z);
	else
		tmp = (x / z) * y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[z, -5e-310], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-310}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.999999999999985e-310

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity86.9%

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}} + -1 \cdot \frac{x \cdot y}{z}} \]
      2. unpow261.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
      3. *-commutative61.0%

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

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
      5. *-commutative67.2%

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + -1 \cdot \frac{\color{blue}{y \cdot x}}{z} \]
      6. associate-*r/69.6%

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

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

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + \color{blue}{\left(-y\right)} \cdot \frac{x}{z} \]
      9. distribute-rgt-out69.6%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot y}{z}} \]
    8. Step-by-step derivation
      1. mul-1-neg35.0%

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

        \[\leadsto -\color{blue}{x \cdot \frac{y}{z}} \]
      3. distribute-lft-neg-out40.5%

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

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

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

    if -4.999999999999985e-310 < z

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity85.4%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
      3. *-commutative40.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} + -1 \cdot \frac{x \cdot y}{z} \]
      4. times-frac44.8%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
      5. *-commutative44.8%

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + -1 \cdot \frac{\color{blue}{y \cdot x}}{z} \]
      6. associate-*r/46.5%

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

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

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

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

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-1 \cdot y\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg20.6%

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-y\right)} \]
    10. Step-by-step derivation
      1. expm1-log1p-u20.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)\right)} \]
      2. expm1-udef27.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)} - 1} \]
      3. add-sqr-sqrt14.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)}\right)} - 1 \]
      4. sqrt-unprod33.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right)} - 1 \]
      5. sqr-neg33.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \sqrt{\color{blue}{y \cdot y}}\right)} - 1 \]
      6. sqrt-unprod21.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} - 1 \]
      7. add-sqr-sqrt44.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{y}\right)} - 1 \]
      8. associate-*l/44.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{x \cdot y}{z}}\right)} - 1 \]
    11. Applied egg-rr44.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)} - 1} \]
    12. Step-by-step derivation
      1. expm1-def35.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)\right)} \]
      2. expm1-log1p42.8%

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
      3. associate-*l/46.0%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    13. Simplified46.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{-310}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array} \]

Alternative 12: 33.1% accurate, 1.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+89}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= x -5e+89) (* x (/ y z)) (* (/ x z) y)))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (x <= -5e+89) {
		tmp = x * (y / z);
	} else {
		tmp = (x / z) * y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-5d+89)) then
        tmp = x * (y / z)
    else
        tmp = (x / z) * y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -5e+89) {
		tmp = x * (y / z);
	} else {
		tmp = (x / z) * y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if x <= -5e+89:
		tmp = x * (y / z)
	else:
		tmp = (x / z) * y
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (x <= -5e+89)
		tmp = Float64(x * Float64(y / z));
	else
		tmp = Float64(Float64(x / z) * y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -5e+89)
		tmp = x * (y / z);
	else
		tmp = (x / z) * y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[x, -5e+89], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+89}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.99999999999999983e89

    1. Initial program 74.6%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg85.6%

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity85.7%

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}} + -1 \cdot \frac{x \cdot y}{z}} \]
      2. unpow230.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
      3. *-commutative30.8%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} + -1 \cdot \frac{x \cdot y}{z} \]
      4. times-frac31.0%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
      5. *-commutative31.0%

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + -1 \cdot \frac{\color{blue}{y \cdot x}}{z} \]
      6. associate-*r/31.1%

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

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

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + \color{blue}{\left(-y\right)} \cdot \frac{x}{z} \]
      9. distribute-rgt-out54.5%

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

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

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

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-y\right)} \]
    10. Step-by-step derivation
      1. expm1-log1p-u5.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)\right)} \]
      2. expm1-udef15.7%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)} - 1} \]
      3. add-sqr-sqrt7.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)}\right)} - 1 \]
      4. sqrt-unprod13.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right)} - 1 \]
      5. sqr-neg13.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \sqrt{\color{blue}{y \cdot y}}\right)} - 1 \]
      6. sqrt-unprod9.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} - 1 \]
      7. add-sqr-sqrt33.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{y}\right)} - 1 \]
      8. associate-*l/33.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{x \cdot y}{z}}\right)} - 1 \]
    11. Applied egg-rr33.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)} - 1} \]
    12. Step-by-step derivation
      1. expm1-def23.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)\right)} \]
      2. expm1-log1p30.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    13. Simplified38.8%

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

    if -4.99999999999999983e89 < x

    1. Initial program 85.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity86.2%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
      3. *-commutative54.5%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} + -1 \cdot \frac{x \cdot y}{z} \]
      4. times-frac60.6%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
      5. *-commutative60.6%

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + -1 \cdot \frac{\color{blue}{y \cdot x}}{z} \]
      6. associate-*r/63.1%

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

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

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

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

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-1 \cdot y\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg33.0%

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-y\right)} \]
    10. Step-by-step derivation
      1. expm1-log1p-u29.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)\right)} \]
      2. expm1-udef36.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)} - 1} \]
      3. add-sqr-sqrt17.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)}\right)} - 1 \]
      4. sqrt-unprod35.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right)} - 1 \]
      5. sqr-neg35.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \sqrt{\color{blue}{y \cdot y}}\right)} - 1 \]
      6. sqrt-unprod22.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} - 1 \]
      7. add-sqr-sqrt40.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{y}\right)} - 1 \]
      8. associate-*l/40.2%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{x \cdot y}{z}}\right)} - 1 \]
    11. Applied egg-rr40.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)} - 1} \]
    12. Step-by-step derivation
      1. expm1-def29.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)\right)} \]
      2. expm1-log1p34.0%

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
      3. associate-*l/37.4%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    13. Simplified37.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+89}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array} \]

Alternative 13: 33.5% accurate, 1.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{+90}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= x -4e+90) (* x (/ y z)) (/ y (/ z x))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (x <= -4e+90) {
		tmp = x * (y / z);
	} else {
		tmp = y / (z / x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-4d+90)) then
        tmp = x * (y / z)
    else
        tmp = y / (z / x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -4e+90) {
		tmp = x * (y / z);
	} else {
		tmp = y / (z / x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if x <= -4e+90:
		tmp = x * (y / z)
	else:
		tmp = y / (z / x)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (x <= -4e+90)
		tmp = Float64(x * Float64(y / z));
	else
		tmp = Float64(y / Float64(z / x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -4e+90)
		tmp = x * (y / z);
	else
		tmp = y / (z / x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[x, -4e+90], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+90}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.99999999999999987e90

    1. Initial program 74.6%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg85.6%

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity85.7%

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}} + -1 \cdot \frac{x \cdot y}{z}} \]
      2. unpow230.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
      3. *-commutative30.8%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} + -1 \cdot \frac{x \cdot y}{z} \]
      4. times-frac31.0%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
      5. *-commutative31.0%

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + -1 \cdot \frac{\color{blue}{y \cdot x}}{z} \]
      6. associate-*r/31.1%

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

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

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + \color{blue}{\left(-y\right)} \cdot \frac{x}{z} \]
      9. distribute-rgt-out54.5%

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

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

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

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-y\right)} \]
    10. Step-by-step derivation
      1. expm1-log1p-u5.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)\right)} \]
      2. expm1-udef15.7%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)} - 1} \]
      3. add-sqr-sqrt7.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)}\right)} - 1 \]
      4. sqrt-unprod13.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right)} - 1 \]
      5. sqr-neg13.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \sqrt{\color{blue}{y \cdot y}}\right)} - 1 \]
      6. sqrt-unprod9.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} - 1 \]
      7. add-sqr-sqrt33.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{y}\right)} - 1 \]
      8. associate-*l/33.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{x \cdot y}{z}}\right)} - 1 \]
    11. Applied egg-rr33.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)} - 1} \]
    12. Step-by-step derivation
      1. expm1-def23.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)\right)} \]
      2. expm1-log1p30.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    13. Simplified38.8%

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

    if -3.99999999999999987e90 < x

    1. Initial program 85.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity86.2%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
      3. *-commutative54.5%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} + -1 \cdot \frac{x \cdot y}{z} \]
      4. times-frac60.6%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
      5. *-commutative60.6%

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + -1 \cdot \frac{\color{blue}{y \cdot x}}{z} \]
      6. associate-*r/63.1%

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

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

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

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

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-1 \cdot y\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg33.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-y}{\frac{z}{x}}} \]
      4. add-sqr-sqrt16.4%

        \[\leadsto \frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{\frac{z}{x}} \]
      5. sqrt-unprod35.1%

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

        \[\leadsto \frac{\sqrt{\color{blue}{y \cdot y}}}{\frac{z}{x}} \]
      7. sqrt-unprod20.0%

        \[\leadsto \frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{\frac{z}{x}} \]
      8. add-sqr-sqrt37.4%

        \[\leadsto \frac{\color{blue}{y}}{\frac{z}{x}} \]
    11. Applied egg-rr37.4%

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification37.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{+90}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \end{array} \]

Alternative 14: 75.2% accurate, 1.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{z} \cdot \frac{y}{z} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* (/ x z) (/ y z)))
assert(x < y);
double code(double x, double y, double z) {
	return (x / z) * (y / z);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x / z) * (y / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
	return (x / z) * (y / z);
}
[x, y] = sort([x, y])
def code(x, y, z):
	return (x / z) * (y / z)
x, y = sort([x, y])
function code(x, y, z)
	return Float64(Float64(x / z) * Float64(y / z))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = (x / z) * (y / z);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{z} \cdot \frac{y}{z}
\end{array}
Derivation
  1. Initial program 83.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
    10. *-rgt-identity86.1%

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

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

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} \]
    2. times-frac74.5%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z}} \]
  6. Simplified74.5%

    \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z}} \]
  7. Final simplification74.5%

    \[\leadsto \frac{x}{z} \cdot \frac{y}{z} \]

Alternative 15: 31.3% accurate, 2.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ x \cdot \frac{y}{z} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* x (/ y z)))
assert(x < y);
double code(double x, double y, double z) {
	return x * (y / z);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x * (y / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
	return x * (y / z);
}
[x, y] = sort([x, y])
def code(x, y, z):
	return x * (y / z)
x, y = sort([x, y])
function code(x, y, z)
	return Float64(x * Float64(y / z))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = x * (y / z);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
x \cdot \frac{y}{z}
\end{array}
Derivation
  1. Initial program 83.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
    10. *-rgt-identity86.1%

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

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

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

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot z}} + -1 \cdot \frac{x \cdot y}{z} \]
    3. *-commutative50.1%

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

      \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} + -1 \cdot \frac{x \cdot y}{z} \]
    5. *-commutative55.2%

      \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + -1 \cdot \frac{\color{blue}{y \cdot x}}{z} \]
    6. associate-*r/57.2%

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

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

      \[\leadsto \frac{y}{z} \cdot \frac{x}{z} + \color{blue}{\left(-y\right)} \cdot \frac{x}{z} \]
    9. distribute-rgt-out69.0%

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

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

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

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

    \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-y\right)} \]
  10. Step-by-step derivation
    1. expm1-log1p-u24.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)\right)} \]
    2. expm1-udef32.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \left(-y\right)\right)} - 1} \]
    3. add-sqr-sqrt15.2%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)}\right)} - 1 \]
    4. sqrt-unprod31.4%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right)} - 1 \]
    5. sqr-neg31.4%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \sqrt{\color{blue}{y \cdot y}}\right)} - 1 \]
    6. sqrt-unprod19.8%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} - 1 \]
    7. add-sqr-sqrt39.0%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{z} \cdot \color{blue}{y}\right)} - 1 \]
    8. associate-*l/39.0%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{x \cdot y}{z}}\right)} - 1 \]
  11. Applied egg-rr39.0%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)} - 1} \]
  12. Step-by-step derivation
    1. expm1-def28.7%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot y}{z}\right)\right)} \]
    2. expm1-log1p33.3%

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
  13. Simplified36.3%

    \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
  14. Final simplification36.3%

    \[\leadsto x \cdot \frac{y}{z} \]

Developer target: 95.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z < 249.6182814532307:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023275 
(FPCore (x y z)
  :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z))

  (/ (* x y) (* (* z z) (+ z 1.0))))