Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 84.5% → 96.6%
Time: 9.3s
Alternatives: 13
Speedup: 1.0×

Specification

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

\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\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 13 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: 84.5% accurate, 1.0× speedup?

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

\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}

Alternative 1: 96.6% accurate, 1.0× speedup?

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

\\
\frac{y \cdot \frac{\cosh x}{z}}{x}
\end{array}
Derivation
  1. Initial program 85.3%

    \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
  2. Step-by-step derivation
    1. associate-*r/81.0%

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

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

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

      \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
    3. *-commutative85.3%

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

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

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

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

Alternative 2: 79.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cosh x \cdot \frac{\frac{y}{x}}{z}\\ \mathbf{if}\;x \leq -1 \cdot 10^{-11}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-302}:\\ \;\;\;\;\frac{\frac{y}{z}}{x}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{+229}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-y}{\frac{z}{x \cdot -0.5 + \frac{-1}{x}}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (cosh x) (/ (/ y x) z))))
   (if (<= x -1e-11)
     t_0
     (if (<= x 1.6e-302)
       (/ (/ y z) x)
       (if (<= x 3.2e+229) t_0 (/ (- y) (/ z (+ (* x -0.5) (/ -1.0 x)))))))))
double code(double x, double y, double z) {
	double t_0 = cosh(x) * ((y / x) / z);
	double tmp;
	if (x <= -1e-11) {
		tmp = t_0;
	} else if (x <= 1.6e-302) {
		tmp = (y / z) / x;
	} else if (x <= 3.2e+229) {
		tmp = t_0;
	} else {
		tmp = -y / (z / ((x * -0.5) + (-1.0 / x)));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cosh(x) * ((y / x) / z)
    if (x <= (-1d-11)) then
        tmp = t_0
    else if (x <= 1.6d-302) then
        tmp = (y / z) / x
    else if (x <= 3.2d+229) then
        tmp = t_0
    else
        tmp = -y / (z / ((x * (-0.5d0)) + ((-1.0d0) / x)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = Math.cosh(x) * ((y / x) / z);
	double tmp;
	if (x <= -1e-11) {
		tmp = t_0;
	} else if (x <= 1.6e-302) {
		tmp = (y / z) / x;
	} else if (x <= 3.2e+229) {
		tmp = t_0;
	} else {
		tmp = -y / (z / ((x * -0.5) + (-1.0 / x)));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = math.cosh(x) * ((y / x) / z)
	tmp = 0
	if x <= -1e-11:
		tmp = t_0
	elif x <= 1.6e-302:
		tmp = (y / z) / x
	elif x <= 3.2e+229:
		tmp = t_0
	else:
		tmp = -y / (z / ((x * -0.5) + (-1.0 / x)))
	return tmp
function code(x, y, z)
	t_0 = Float64(cosh(x) * Float64(Float64(y / x) / z))
	tmp = 0.0
	if (x <= -1e-11)
		tmp = t_0;
	elseif (x <= 1.6e-302)
		tmp = Float64(Float64(y / z) / x);
	elseif (x <= 3.2e+229)
		tmp = t_0;
	else
		tmp = Float64(Float64(-y) / Float64(z / Float64(Float64(x * -0.5) + Float64(-1.0 / x))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = cosh(x) * ((y / x) / z);
	tmp = 0.0;
	if (x <= -1e-11)
		tmp = t_0;
	elseif (x <= 1.6e-302)
		tmp = (y / z) / x;
	elseif (x <= 3.2e+229)
		tmp = t_0;
	else
		tmp = -y / (z / ((x * -0.5) + (-1.0 / x)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] * N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e-11], t$95$0, If[LessEqual[x, 1.6e-302], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 3.2e+229], t$95$0, N[((-y) / N[(z / N[(N[(x * -0.5), $MachinePrecision] + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq 3.2 \cdot 10^{+229}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -9.99999999999999939e-12 or 1.59999999999999989e-302 < x < 3.1999999999999998e229

    1. Initial program 89.3%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/83.4%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified83.4%

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

    if -9.99999999999999939e-12 < x < 1.59999999999999989e-302

    1. Initial program 83.2%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/83.2%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified83.2%

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      3. *-commutative83.0%

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

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\cosh x}{z}}{x}} \]
    6. Taylor expanded in x around 0 95.7%

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

    if 3.1999999999999998e229 < x

    1. Initial program 55.6%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/50.0%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified50.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{-11}:\\ \;\;\;\;\cosh x \cdot \frac{\frac{y}{x}}{z}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-302}:\\ \;\;\;\;\frac{\frac{y}{z}}{x}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{+229}:\\ \;\;\;\;\cosh x \cdot \frac{\frac{y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{-y}{\frac{z}{x \cdot -0.5 + \frac{-1}{x}}}\\ \end{array} \]

Alternative 3: 90.6% accurate, 1.0× speedup?

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

\\
\frac{\cosh x}{x} \cdot \frac{y}{z}
\end{array}
Derivation
  1. Initial program 85.3%

    \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
  2. Step-by-step derivation
    1. associate-/l*80.6%

      \[\leadsto \color{blue}{\frac{\cosh x}{\frac{z}{\frac{y}{x}}}} \]
    2. associate-/r/86.3%

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

      \[\leadsto \frac{\cosh x}{\color{blue}{\frac{z \cdot x}{y}}} \]
    4. *-commutative79.9%

      \[\leadsto \frac{\cosh x}{\frac{\color{blue}{x \cdot z}}{y}} \]
  3. Simplified79.9%

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

      \[\leadsto \frac{\cosh x}{\color{blue}{\frac{x}{\frac{y}{z}}}} \]
    2. associate-/r/91.2%

      \[\leadsto \color{blue}{\frac{\cosh x}{x} \cdot \frac{y}{z}} \]
  5. Applied egg-rr91.2%

    \[\leadsto \color{blue}{\frac{\cosh x}{x} \cdot \frac{y}{z}} \]
  6. Final simplification91.2%

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

Alternative 4: 66.8% accurate, 5.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+76}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{z} + \frac{y}{x \cdot z}\\

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

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


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

    1. Initial program 69.9%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/63.3%

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

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

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

    if -1.1e76 < z < -4.00000000000000011e-161

    1. Initial program 87.6%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/87.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{z}} + 0.5 \cdot \frac{x \cdot y}{z} \]
      3. *-un-lft-identity67.0%

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000011e-161 < z

    1. Initial program 88.9%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-/l*83.9%

        \[\leadsto \color{blue}{\frac{\cosh x}{\frac{z}{\frac{y}{x}}}} \]
      2. associate-/r/89.9%

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

        \[\leadsto \frac{\cosh x}{\color{blue}{\frac{z \cdot x}{y}}} \]
      4. *-commutative79.5%

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

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

        \[\leadsto \frac{\cosh x}{\color{blue}{\frac{x}{\frac{y}{z}}}} \]
      2. associate-/r/94.2%

        \[\leadsto \color{blue}{\frac{\cosh x}{x} \cdot \frac{y}{z}} \]
    5. Applied egg-rr94.2%

      \[\leadsto \color{blue}{\frac{\cosh x}{x} \cdot \frac{y}{z}} \]
    6. Taylor expanded in x around 0 76.0%

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

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

Alternative 5: 66.2% accurate, 7.1× speedup?

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

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

\mathbf{elif}\;x \leq 40000000000:\\
\;\;\;\;\frac{y}{z} \cdot \left(\frac{1}{x} + x \cdot 0.5\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.1e101

    1. Initial program 67.4%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/60.5%

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

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

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

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

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

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

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

    if -2.1e101 < x < 4e10

    1. Initial program 91.3%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-/l*90.0%

        \[\leadsto \color{blue}{\frac{\cosh x}{\frac{z}{\frac{y}{x}}}} \]
      2. associate-/r/93.6%

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

        \[\leadsto \frac{\cosh x}{\color{blue}{\frac{z \cdot x}{y}}} \]
      4. *-commutative88.9%

        \[\leadsto \frac{\cosh x}{\frac{\color{blue}{x \cdot z}}{y}} \]
    3. Simplified88.9%

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

        \[\leadsto \frac{\cosh x}{\color{blue}{\frac{x}{\frac{y}{z}}}} \]
      2. associate-/r/94.6%

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

      \[\leadsto \color{blue}{\frac{\cosh x}{x} \cdot \frac{y}{z}} \]
    6. Taylor expanded in x around 0 85.5%

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

    if 4e10 < x

    1. Initial program 82.1%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/69.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{y}{\frac{z}{x}}} \]
      7. remove-double-neg53.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5}{-z} \cdot \frac{-y}{\frac{1}{x}}} \]
      14. add-sqr-sqrt31.2%

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

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

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

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

        \[\leadsto \frac{0.5}{\color{blue}{z}} \cdot \frac{-y}{\frac{1}{x}} \]
      19. add-sqr-sqrt0.2%

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

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

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

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

        \[\leadsto \frac{0.5}{z} \cdot \frac{\color{blue}{y}}{\frac{1}{x}} \]
    9. Applied egg-rr55.3%

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

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

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

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

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

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

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

Alternative 6: 65.6% accurate, 7.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.1e101

    1. Initial program 67.4%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/60.5%

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

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

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

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

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

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

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

    if -2.1e101 < x < 4.20000000000000026e-302

    1. Initial program 86.2%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-/l*83.8%

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

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

        \[\leadsto \frac{\cosh x}{\color{blue}{\frac{z \cdot x}{y}}} \]
      4. *-commutative86.5%

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

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

        \[\leadsto \frac{\cosh x}{\color{blue}{\frac{x}{\frac{y}{z}}}} \]
      2. associate-/r/94.4%

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

      \[\leadsto \color{blue}{\frac{\cosh x}{x} \cdot \frac{y}{z}} \]
    6. Taylor expanded in x around 0 81.7%

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

    if 4.20000000000000026e-302 < x

    1. Initial program 90.9%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/85.2%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified85.2%

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{-x \cdot y}{-z}} + \frac{y}{x \cdot z} \]
      2. div-inv73.2%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{-y \cdot x}}{-z} + \frac{y}{x \cdot z} \]
      4. distribute-neg-frac73.2%

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

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

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

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

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

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

Alternative 7: 66.0% accurate, 7.1× speedup?

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

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

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

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


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

    1. Initial program 76.9%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/70.8%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified70.8%

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

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

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

    if -2e-8 < x < 1.8499999999999999e-301

    1. Initial program 83.2%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/83.2%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified83.2%

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      3. *-commutative83.0%

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

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\cosh x}{z}}{x}} \]
    6. Taylor expanded in x around 0 95.7%

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

    if 1.8499999999999999e-301 < x

    1. Initial program 90.9%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/85.2%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified85.2%

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{-x \cdot y}{-z}} + \frac{y}{x \cdot z} \]
      2. div-inv73.2%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\color{blue}{-y \cdot x}}{-z} + \frac{y}{x \cdot z} \]
      4. distribute-neg-frac73.2%

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

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

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

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

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

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

Alternative 8: 66.3% accurate, 7.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-53}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{z} + \frac{y}{x \cdot z}\\

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


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

    1. Initial program 79.5%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/75.3%

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

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

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

    if -7.5000000000000001e-53 < z

    1. Initial program 87.6%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-/l*83.2%

        \[\leadsto \color{blue}{\frac{\cosh x}{\frac{z}{\frac{y}{x}}}} \]
      2. associate-/r/90.6%

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

        \[\leadsto \frac{\cosh x}{\color{blue}{\frac{z \cdot x}{y}}} \]
      4. *-commutative81.5%

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

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

        \[\leadsto \frac{\cosh x}{\color{blue}{\frac{x}{\frac{y}{z}}}} \]
      2. associate-/r/94.9%

        \[\leadsto \color{blue}{\frac{\cosh x}{x} \cdot \frac{y}{z}} \]
    5. Applied egg-rr94.9%

      \[\leadsto \color{blue}{\frac{\cosh x}{x} \cdot \frac{y}{z}} \]
    6. Taylor expanded in x around 0 75.4%

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

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

Alternative 9: 65.9% accurate, 9.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.42 \lor \neg \left(x \leq 3.9 \cdot 10^{-5}\right):\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.4199999999999999 or 3.8999999999999999e-5 < x

    1. Initial program 80.0%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/71.2%

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

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

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

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

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

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

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

    if -1.4199999999999999 < x < 3.8999999999999999e-5

    1. Initial program 90.4%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/90.4%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified90.4%

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      3. *-commutative90.3%

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

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\cosh x}{z}}{x}} \]
    6. Taylor expanded in x around 0 95.0%

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

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

Alternative 10: 66.3% accurate, 9.6× speedup?

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

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

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

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


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

    1. Initial program 76.6%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/70.3%

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

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

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

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

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

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

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

    if -1.4199999999999999 < x < 3.8999999999999999e-5

    1. Initial program 90.4%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/90.4%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified90.4%

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      3. *-commutative90.3%

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

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\cosh x}{z}}{x}} \]
    6. Taylor expanded in x around 0 95.0%

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

    if 3.8999999999999999e-5 < x

    1. Initial program 83.6%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/72.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{y}{\frac{z}{x}}} \]
      7. remove-double-neg52.8%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{-\left(-y\right)}}{\frac{z}{x}} \]
      8. remove-double-neg52.8%

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(-y\right)}{\frac{-z}{x}}} \]
      12. div-inv52.8%

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

        \[\leadsto \color{blue}{\frac{0.5}{-z} \cdot \frac{-y}{\frac{1}{x}}} \]
      14. add-sqr-sqrt32.2%

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

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

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

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

        \[\leadsto \frac{0.5}{\color{blue}{z}} \cdot \frac{-y}{\frac{1}{x}} \]
      19. add-sqr-sqrt0.2%

        \[\leadsto \frac{0.5}{z} \cdot \frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{\frac{1}{x}} \]
      20. sqrt-unprod30.4%

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

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

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

        \[\leadsto \frac{0.5}{z} \cdot \frac{\color{blue}{y}}{\frac{1}{x}} \]
    9. Applied egg-rr54.4%

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

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

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

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

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

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

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

Alternative 11: 52.6% accurate, 11.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{-130} \lor \neg \left(z \leq 3.8\right):\\ \;\;\;\;\frac{y}{x \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -5e-130) (not (<= z 3.8))) (/ y (* x z)) (/ (/ y x) z)))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -5e-130) || !(z <= 3.8)) {
		tmp = y / (x * z);
	} else {
		tmp = (y / 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 <= (-5d-130)) .or. (.not. (z <= 3.8d0))) then
        tmp = y / (x * z)
    else
        tmp = (y / x) / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -5e-130) || !(z <= 3.8)) {
		tmp = y / (x * z);
	} else {
		tmp = (y / x) / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -5e-130) or not (z <= 3.8):
		tmp = y / (x * z)
	else:
		tmp = (y / x) / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -5e-130) || !(z <= 3.8))
		tmp = Float64(y / Float64(x * z));
	else
		tmp = Float64(Float64(y / x) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -5e-130) || ~((z <= 3.8)))
		tmp = y / (x * z);
	else
		tmp = (y / x) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -5e-130], N[Not[LessEqual[z, 3.8]], $MachinePrecision]], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-130} \lor \neg \left(z \leq 3.8\right):\\
\;\;\;\;\frac{y}{x \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.9999999999999996e-130 or 3.7999999999999998 < z

    1. Initial program 80.1%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/72.4%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified72.4%

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

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

    if -4.9999999999999996e-130 < z < 3.7999999999999998

    1. Initial program 91.9%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*l/91.8%

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
    3. Simplified91.8%

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

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

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

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

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

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

Alternative 12: 55.5% accurate, 15.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -40000000:\\
\;\;\;\;\frac{y}{x \cdot z}\\

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


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

    1. Initial program 77.4%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/72.4%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified72.4%

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

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

    if -4e7 < z

    1. Initial program 87.7%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. associate-*r/83.7%

        \[\leadsto \color{blue}{\cosh x \cdot \frac{\frac{y}{x}}{z}} \]
    3. Simplified83.7%

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      3. *-commutative87.7%

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

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\cosh x}{z}}{x}} \]
    6. Taylor expanded in x around 0 63.2%

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

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

Alternative 13: 49.5% accurate, 21.4× speedup?

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

\\
\frac{y}{x \cdot z}
\end{array}
Derivation
  1. Initial program 85.3%

    \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
  2. Step-by-step derivation
    1. associate-*r/81.0%

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

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

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

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

Developer target: 96.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{y}{z}}{x} \cdot \cosh x\\ \mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\ \;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (/ (/ y z) x) (cosh x))))
   (if (< y -4.618902267687042e-52)
     t_0
     (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) t_0))))
double code(double x, double y, double z) {
	double t_0 = ((y / z) / x) * cosh(x);
	double tmp;
	if (y < -4.618902267687042e-52) {
		tmp = t_0;
	} else if (y < 1.038530535935153e-39) {
		tmp = ((cosh(x) * y) / x) / z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((y / z) / x) * cosh(x)
    if (y < (-4.618902267687042d-52)) then
        tmp = t_0
    else if (y < 1.038530535935153d-39) then
        tmp = ((cosh(x) * y) / x) / z
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = ((y / z) / x) * Math.cosh(x);
	double tmp;
	if (y < -4.618902267687042e-52) {
		tmp = t_0;
	} else if (y < 1.038530535935153e-39) {
		tmp = ((Math.cosh(x) * y) / x) / z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = ((y / z) / x) * math.cosh(x)
	tmp = 0
	if y < -4.618902267687042e-52:
		tmp = t_0
	elif y < 1.038530535935153e-39:
		tmp = ((math.cosh(x) * y) / x) / z
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(Float64(y / z) / x) * cosh(x))
	tmp = 0.0
	if (y < -4.618902267687042e-52)
		tmp = t_0;
	elseif (y < 1.038530535935153e-39)
		tmp = Float64(Float64(Float64(cosh(x) * y) / x) / z);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = ((y / z) / x) * cosh(x);
	tmp = 0.0;
	if (y < -4.618902267687042e-52)
		tmp = t_0;
	elseif (y < 1.038530535935153e-39)
		tmp = ((cosh(x) * y) / x) / z;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]}, If[Less[y, -4.618902267687042e-52], t$95$0, If[Less[y, 1.038530535935153e-39], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\frac{y}{z}}{x} \cdot \cosh x\\
\mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023306 
(FPCore (x y z)
  :name "Linear.Quaternion:$ctan from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))

  (/ (* (cosh x) (/ y x)) z))