Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 84.0% → 97.5%
Time: 8.2s
Alternatives: 14
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 14 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.0% 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: 97.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7.4 \cdot 10^{-16}:\\ \;\;\;\;\frac{y \cdot \frac{\cosh x}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \frac{\cosh x}{z}}{x}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 7.4e-16) (/ (* y (/ (cosh x) x)) z) (/ (* y (/ (cosh x) z)) x)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 7.4e-16) {
		tmp = (y * (cosh(x) / x)) / z;
	} else {
		tmp = (y * (cosh(x) / 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 (y <= 7.4d-16) then
        tmp = (y * (cosh(x) / x)) / z
    else
        tmp = (y * (cosh(x) / z)) / x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 7.4e-16) {
		tmp = (y * (Math.cosh(x) / x)) / z;
	} else {
		tmp = (y * (Math.cosh(x) / z)) / x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 7.4e-16:
		tmp = (y * (math.cosh(x) / x)) / z
	else:
		tmp = (y * (math.cosh(x) / z)) / x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 7.4e-16)
		tmp = Float64(Float64(y * Float64(cosh(x) / x)) / z);
	else
		tmp = Float64(Float64(y * Float64(cosh(x) / z)) / x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 7.4e-16)
		tmp = (y * (cosh(x) / x)) / z;
	else
		tmp = (y * (cosh(x) / z)) / x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 7.4e-16], N[(N[(y * N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y * N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.4 \cdot 10^{-16}:\\
\;\;\;\;\frac{y \cdot \frac{\cosh x}{x}}{z}\\

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


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

    1. Initial program 86.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      4. expm1-log1p-u50.9%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\right)} - 1 \]
      7. *-commutative37.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(\cosh x \cdot \frac{\frac{1}{x}}{z}\right)} \]
      10. *-commutative85.3%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{1 \cdot \cosh x}{x \cdot z}} \]
      13. *-lft-identity84.3%

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

      \[\leadsto \color{blue}{y \cdot \frac{\cosh x}{x \cdot z}} \]
    8. Step-by-step derivation
      1. *-commutative84.3%

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

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

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

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

    if 7.3999999999999999e-16 < y

    1. Initial program 88.6%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\cosh x}{z}\\ \mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \leq 2 \cdot 10^{-56}:\\ \;\;\;\;t_0 \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot t_0}{x}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (cosh x) z)))
   (if (<= (/ (* (cosh x) (/ y x)) z) 2e-56) (* t_0 (/ y x)) (/ (* y t_0) x))))
double code(double x, double y, double z) {
	double t_0 = cosh(x) / z;
	double tmp;
	if (((cosh(x) * (y / x)) / z) <= 2e-56) {
		tmp = t_0 * (y / x);
	} else {
		tmp = (y * t_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) / z
    if (((cosh(x) * (y / x)) / z) <= 2d-56) then
        tmp = t_0 * (y / x)
    else
        tmp = (y * t_0) / x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = Math.cosh(x) / z;
	double tmp;
	if (((Math.cosh(x) * (y / x)) / z) <= 2e-56) {
		tmp = t_0 * (y / x);
	} else {
		tmp = (y * t_0) / x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = math.cosh(x) / z
	tmp = 0
	if ((math.cosh(x) * (y / x)) / z) <= 2e-56:
		tmp = t_0 * (y / x)
	else:
		tmp = (y * t_0) / x
	return tmp
function code(x, y, z)
	t_0 = Float64(cosh(x) / z)
	tmp = 0.0
	if (Float64(Float64(cosh(x) * Float64(y / x)) / z) <= 2e-56)
		tmp = Float64(t_0 * Float64(y / x));
	else
		tmp = Float64(Float64(y * t_0) / x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = cosh(x) / z;
	tmp = 0.0;
	if (((cosh(x) * (y / x)) / z) <= 2e-56)
		tmp = t_0 * (y / x);
	else
		tmp = (y * t_0) / x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 2e-56], N[(t$95$0 * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(y * t$95$0), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 2.0000000000000001e-56

    1. Initial program 97.1%

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

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

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

    if 2.0000000000000001e-56 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z)

    1. Initial program 75.8%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 83.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.15 \cdot 10^{-218}:\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\

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

\mathbf{elif}\;x \leq 8.3 \cdot 10^{+183}:\\
\;\;\;\;\frac{\cosh x}{z} \cdot \frac{y}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.15e-218

    1. Initial program 83.7%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      4. expm1-log1p-u53.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x \cdot y}{x \cdot z}} \]
      5. *-rgt-identity85.7%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(\cosh x \cdot \frac{\frac{1}{x}}{z}\right)} \]
      10. *-commutative85.6%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{1 \cdot \cosh x}{x \cdot z}} \]
      13. *-lft-identity85.6%

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

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

    if -2.15e-218 < x < 1.14999999999999989e-159

    1. Initial program 88.6%

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot z}} \]
    5. Step-by-step derivation
      1. clear-num90.7%

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \frac{1}{x \cdot z}} \]
      3. div-inv90.7%

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
      5. div-inv98.1%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{1}{x}} \]
      6. clear-num98.0%

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

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

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

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

    if 1.14999999999999989e-159 < x < 8.2999999999999997e183

    1. Initial program 97.4%

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

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

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

    if 8.2999999999999997e183 < x

    1. Initial program 60.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      4. expm1-log1p-u20.0%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\right)} - 1 \]
      7. *-commutative15.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x \cdot y}{x \cdot z}} \]
      5. *-rgt-identity45.0%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(\cosh x \cdot \frac{\frac{1}{x}}{z}\right)} \]
      10. *-commutative50.0%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{1 \cdot \cosh x}{x \cdot z}} \]
      13. *-lft-identity45.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.15 \cdot 10^{-218}:\\ \;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-159}:\\ \;\;\;\;\frac{\frac{1}{x}}{\frac{z}{y}}\\ \mathbf{elif}\;x \leq 8.3 \cdot 10^{+183}:\\ \;\;\;\;\frac{\cosh x}{z} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z \cdot \left(x \cdot 0.5\right) + \frac{z}{x}}{z \cdot z}\\ \end{array} \]

Alternative 4: 83.6% accurate, 1.0× speedup?

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\cosh x \cdot y}{x \cdot z}} \]
    2. *-commutative84.6%

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

      \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
    4. expm1-log1p-u49.4%

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

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

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\right)} - 1 \]
    7. *-commutative37.8%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\cosh x \cdot y}{x \cdot z}} \]
    5. *-rgt-identity84.6%

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\cosh x \cdot \frac{\frac{1}{x}}{z}\right)} \]
    10. *-commutative85.5%

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

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

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

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

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

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

Alternative 5: 68.7% accurate, 4.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(y \cdot x\right)\\ t_1 := \frac{y}{x \cdot z} + \frac{0.5}{\frac{z}{y \cdot x}}\\ \mathbf{if}\;z \leq -5 \cdot 10^{+34}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-229}:\\ \;\;\;\;\frac{\frac{y}{x} + t_0}{z}\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+25}:\\ \;\;\;\;y \cdot \frac{z + \left(x \cdot z\right) \cdot \left(x \cdot 0.5\right)}{z \cdot \left(x \cdot z\right)}\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+125}:\\ \;\;\;\;\frac{z \cdot \frac{y}{x} + z \cdot t_0}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 0.5 (* y x))) (t_1 (+ (/ y (* x z)) (/ 0.5 (/ z (* y x))))))
   (if (<= z -5e+34)
     t_1
     (if (<= z 6.5e-229)
       (/ (+ (/ y x) t_0) z)
       (if (<= z 2.6e+25)
         (* y (/ (+ z (* (* x z) (* x 0.5))) (* z (* x z))))
         (if (<= z 5.6e+125) (/ (+ (* z (/ y x)) (* z t_0)) (* z z)) t_1))))))
double code(double x, double y, double z) {
	double t_0 = 0.5 * (y * x);
	double t_1 = (y / (x * z)) + (0.5 / (z / (y * x)));
	double tmp;
	if (z <= -5e+34) {
		tmp = t_1;
	} else if (z <= 6.5e-229) {
		tmp = ((y / x) + t_0) / z;
	} else if (z <= 2.6e+25) {
		tmp = y * ((z + ((x * z) * (x * 0.5))) / (z * (x * z)));
	} else if (z <= 5.6e+125) {
		tmp = ((z * (y / x)) + (z * t_0)) / (z * z);
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * (y * x)
    t_1 = (y / (x * z)) + (0.5d0 / (z / (y * x)))
    if (z <= (-5d+34)) then
        tmp = t_1
    else if (z <= 6.5d-229) then
        tmp = ((y / x) + t_0) / z
    else if (z <= 2.6d+25) then
        tmp = y * ((z + ((x * z) * (x * 0.5d0))) / (z * (x * z)))
    else if (z <= 5.6d+125) then
        tmp = ((z * (y / x)) + (z * t_0)) / (z * z)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 0.5 * (y * x);
	double t_1 = (y / (x * z)) + (0.5 / (z / (y * x)));
	double tmp;
	if (z <= -5e+34) {
		tmp = t_1;
	} else if (z <= 6.5e-229) {
		tmp = ((y / x) + t_0) / z;
	} else if (z <= 2.6e+25) {
		tmp = y * ((z + ((x * z) * (x * 0.5))) / (z * (x * z)));
	} else if (z <= 5.6e+125) {
		tmp = ((z * (y / x)) + (z * t_0)) / (z * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 0.5 * (y * x)
	t_1 = (y / (x * z)) + (0.5 / (z / (y * x)))
	tmp = 0
	if z <= -5e+34:
		tmp = t_1
	elif z <= 6.5e-229:
		tmp = ((y / x) + t_0) / z
	elif z <= 2.6e+25:
		tmp = y * ((z + ((x * z) * (x * 0.5))) / (z * (x * z)))
	elif z <= 5.6e+125:
		tmp = ((z * (y / x)) + (z * t_0)) / (z * z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(0.5 * Float64(y * x))
	t_1 = Float64(Float64(y / Float64(x * z)) + Float64(0.5 / Float64(z / Float64(y * x))))
	tmp = 0.0
	if (z <= -5e+34)
		tmp = t_1;
	elseif (z <= 6.5e-229)
		tmp = Float64(Float64(Float64(y / x) + t_0) / z);
	elseif (z <= 2.6e+25)
		tmp = Float64(y * Float64(Float64(z + Float64(Float64(x * z) * Float64(x * 0.5))) / Float64(z * Float64(x * z))));
	elseif (z <= 5.6e+125)
		tmp = Float64(Float64(Float64(z * Float64(y / x)) + Float64(z * t_0)) / Float64(z * z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 0.5 * (y * x);
	t_1 = (y / (x * z)) + (0.5 / (z / (y * x)));
	tmp = 0.0;
	if (z <= -5e+34)
		tmp = t_1;
	elseif (z <= 6.5e-229)
		tmp = ((y / x) + t_0) / z;
	elseif (z <= 2.6e+25)
		tmp = y * ((z + ((x * z) * (x * 0.5))) / (z * (x * z)));
	elseif (z <= 5.6e+125)
		tmp = ((z * (y / x)) + (z * t_0)) / (z * z);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.5 * N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 / N[(z / N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+34], t$95$1, If[LessEqual[z, 6.5e-229], N[(N[(N[(y / x), $MachinePrecision] + t$95$0), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 2.6e+25], N[(y * N[(N[(z + N[(N[(x * z), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.6e+125], N[(N[(N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision] + N[(z * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-229}:\\
\;\;\;\;\frac{\frac{y}{x} + t_0}{z}\\

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

\mathbf{elif}\;z \leq 5.6 \cdot 10^{+125}:\\
\;\;\;\;\frac{z \cdot \frac{y}{x} + z \cdot t_0}{z \cdot z}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.9999999999999998e34 or 5.6000000000000002e125 < z

    1. Initial program 79.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x \cdot y}{x \cdot z}} \]
      2. *-commutative72.6%

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      4. expm1-log1p-u54.3%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\right)} - 1 \]
      7. *-commutative35.3%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x \cdot y}{x \cdot z}} \]
      5. *-rgt-identity72.6%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(\cosh x \cdot \frac{\frac{1}{x}}{z}\right)} \]
      10. *-commutative75.5%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{1 \cdot \cosh x}{x \cdot z}} \]
      13. *-lft-identity73.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999998e34 < z < 6.5e-229

    1. Initial program 91.8%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Taylor expanded in x around 0 83.4%

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

    if 6.5e-229 < z < 2.5999999999999998e25

    1. Initial program 92.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      4. expm1-log1p-u50.1%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\right)} - 1 \]
      7. *-commutative45.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x \cdot y}{x \cdot z}} \]
      5. *-rgt-identity99.9%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(\cosh x \cdot \frac{\frac{1}{x}}{z}\right)} \]
      10. *-commutative99.8%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{1 \cdot \cosh x}{x \cdot z}} \]
      13. *-lft-identity99.9%

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

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

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

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

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

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

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

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

    if 2.5999999999999998e25 < z < 5.6000000000000002e125

    1. Initial program 89.2%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      4. expm1-log1p-u68.0%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\right)} - 1 \]
      7. *-commutative32.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\frac{1 \cdot \cosh x}{x \cdot z}} \]
      13. *-lft-identity73.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{+34}:\\ \;\;\;\;\frac{y}{x \cdot z} + \frac{0.5}{\frac{z}{y \cdot x}}\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-229}:\\ \;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(y \cdot x\right)}{z}\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+25}:\\ \;\;\;\;y \cdot \frac{z + \left(x \cdot z\right) \cdot \left(x \cdot 0.5\right)}{z \cdot \left(x \cdot z\right)}\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+125}:\\ \;\;\;\;\frac{z \cdot \frac{y}{x} + z \cdot \left(0.5 \cdot \left(y \cdot x\right)\right)}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot z} + \frac{0.5}{\frac{z}{y \cdot x}}\\ \end{array} \]

Alternative 6: 68.3% accurate, 6.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -145 or 3.00000000000000014e222 < x

    1. Initial program 71.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      4. expm1-log1p-u42.3%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\right)} - 1 \]
      7. *-commutative45.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(\cosh x \cdot \frac{\frac{1}{x}}{z}\right)} \]
      10. *-commutative71.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -145 < x < 3.00000000000000014e222

    1. Initial program 93.1%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      4. expm1-log1p-u52.1%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\right)} - 1 \]
      7. *-commutative35.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(\cosh x \cdot \frac{\frac{1}{x}}{z}\right)} \]
      10. *-commutative90.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 69.1% accurate, 7.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -185 or 390 < x

    1. Initial program 80.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      4. expm1-log1p-u41.7%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\right)} - 1 \]
      7. *-commutative39.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(\cosh x \cdot \frac{\frac{1}{x}}{z}\right)} \]
      10. *-commutative75.8%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{1 \cdot \cosh x}{x \cdot z}} \]
      13. *-lft-identity74.2%

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

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

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

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

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

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

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

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

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

    if -185 < x < 390

    1. Initial program 92.9%

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

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

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

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

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

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

Alternative 8: 67.6% accurate, 7.1× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -165 or 3.79999999999999983e226 < x

    1. Initial program 71.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\cosh x}{z} \cdot \frac{y}{x}} \]
      4. expm1-log1p-u42.3%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\right)} - 1 \]
      7. *-commutative45.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(\cosh x \cdot \frac{\frac{1}{x}}{z}\right)} \]
      10. *-commutative71.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -165 < x < 3.79999999999999983e226

    1. Initial program 93.1%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Taylor expanded in x around 0 79.1%

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

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

Alternative 9: 62.2% accurate, 9.6× speedup?

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

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

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


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

    1. Initial program 80.5%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Taylor expanded in x around 0 39.0%

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{z}{y}}} \]
    5. Simplified32.1%

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

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

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

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

    if -1.3999999999999999 < x < 1.3999999999999999

    1. Initial program 93.4%

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

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

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

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

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

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

Alternative 10: 66.2% accurate, 9.6× speedup?

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

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

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


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

    1. Initial program 80.5%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Taylor expanded in x around 0 39.0%

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

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

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

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

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

    if -1.3999999999999999 < x < 1.3999999999999999

    1. Initial program 93.4%

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

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

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

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

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

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

Alternative 11: 66.1% accurate, 9.6× speedup?

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

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

\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{y}{x \cdot z}\\

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


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

    1. Initial program 75.8%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Taylor expanded in x around 0 33.7%

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

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

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

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

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

    if -1.3999999999999999 < x < 1.3999999999999999

    1. Initial program 93.4%

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

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

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

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

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

    if 1.3999999999999999 < x

    1. Initial program 84.7%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Taylor expanded in x around 0 43.7%

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

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

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

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

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

Alternative 12: 50.6% accurate, 15.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.05 \cdot 10^{-151}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\

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


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

    1. Initial program 89.1%

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

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

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

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

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

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

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

    if 3.05e-151 < y

    1. Initial program 84.4%

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

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

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

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

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

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

Alternative 13: 55.2% accurate, 15.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.4 \cdot 10^{-50}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\

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


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

    1. Initial program 88.0%

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

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

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

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

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

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

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

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

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

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

    if 4.3999999999999998e-50 < z

    1. Initial program 85.5%

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

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

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

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

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

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

Alternative 14: 49.9% 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 87.2%

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

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

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

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

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

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

Developer target: 97.1% 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 2023271 
(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))