Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 84.7% → 99.8%
Time: 7.9s
Alternatives: 8
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 8 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.7% 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: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 17000000000:\\ \;\;\;\;\frac{\frac{y}{z\_m} \cdot \cosh x}{x}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{\cosh x}{x}}{z\_m}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= z_m 17000000000.0)
    (/ (* (/ y z_m) (cosh x)) x)
    (* y (/ (/ (cosh x) x) z_m)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (z_m <= 17000000000.0) {
		tmp = ((y / z_m) * cosh(x)) / x;
	} else {
		tmp = y * ((cosh(x) / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (z_m <= 17000000000.0d0) then
        tmp = ((y / z_m) * cosh(x)) / x
    else
        tmp = y * ((cosh(x) / x) / z_m)
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (z_m <= 17000000000.0) {
		tmp = ((y / z_m) * Math.cosh(x)) / x;
	} else {
		tmp = y * ((Math.cosh(x) / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m):
	tmp = 0
	if z_m <= 17000000000.0:
		tmp = ((y / z_m) * math.cosh(x)) / x
	else:
		tmp = y * ((math.cosh(x) / x) / z_m)
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (z_m <= 17000000000.0)
		tmp = Float64(Float64(Float64(y / z_m) * cosh(x)) / x);
	else
		tmp = Float64(y * Float64(Float64(cosh(x) / x) / z_m));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m)
	tmp = 0.0;
	if (z_m <= 17000000000.0)
		tmp = ((y / z_m) * cosh(x)) / x;
	else
		tmp = y * ((cosh(x) / x) / z_m);
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 17000000000.0], N[(N[(N[(y / z$95$m), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 17000000000:\\
\;\;\;\;\frac{\frac{y}{z\_m} \cdot \cosh x}{x}\\

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


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

    1. Initial program 86.6%

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

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

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

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

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

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

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

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

    if 1.7e10 < z

    1. Initial program 82.3%

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

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

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

      \[\leadsto \color{blue}{\cosh x \cdot \frac{y}{z \cdot x}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num71.8%

        \[\leadsto \cosh x \cdot \color{blue}{\frac{1}{\frac{z \cdot x}{y}}} \]
      2. un-div-inv71.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{\frac{\cosh x}{x}}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 97.9% accurate, 0.5× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ \begin{array}{l} t_0 := \cosh x \cdot \frac{y}{x}\\ z\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+276}:\\ \;\;\;\;\frac{t\_0}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{\cosh x}{x}}{z\_m}\\ \end{array} \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (let* ((t_0 (* (cosh x) (/ y x))))
   (* z_s (if (<= t_0 2e+276) (/ t_0 z_m) (* y (/ (/ (cosh x) x) z_m))))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double t_0 = cosh(x) * (y / x);
	double tmp;
	if (t_0 <= 2e+276) {
		tmp = t_0 / z_m;
	} else {
		tmp = y * ((cosh(x) / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cosh(x) * (y / x)
    if (t_0 <= 2d+276) then
        tmp = t_0 / z_m
    else
        tmp = y * ((cosh(x) / x) / z_m)
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
	double t_0 = Math.cosh(x) * (y / x);
	double tmp;
	if (t_0 <= 2e+276) {
		tmp = t_0 / z_m;
	} else {
		tmp = y * ((Math.cosh(x) / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m):
	t_0 = math.cosh(x) * (y / x)
	tmp = 0
	if t_0 <= 2e+276:
		tmp = t_0 / z_m
	else:
		tmp = y * ((math.cosh(x) / x) / z_m)
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	t_0 = Float64(cosh(x) * Float64(y / x))
	tmp = 0.0
	if (t_0 <= 2e+276)
		tmp = Float64(t_0 / z_m);
	else
		tmp = Float64(y * Float64(Float64(cosh(x) / x) / z_m));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m)
	t_0 = cosh(x) * (y / x);
	tmp = 0.0;
	if (t_0 <= 2e+276)
		tmp = t_0 / z_m;
	else
		tmp = y * ((cosh(x) / x) / z_m);
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[t$95$0, 2e+276], N[(t$95$0 / z$95$m), $MachinePrecision], N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+276}:\\
\;\;\;\;\frac{t\_0}{z\_m}\\

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


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

    1. Initial program 95.9%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Add Preprocessing

    if 2.0000000000000001e276 < (*.f64 (cosh.f64 x) (/.f64 y x))

    1. Initial program 66.9%

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

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

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

      \[\leadsto \color{blue}{\cosh x \cdot \frac{y}{z \cdot x}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num70.0%

        \[\leadsto \cosh x \cdot \color{blue}{\frac{1}{\frac{z \cdot x}{y}}} \]
      2. un-div-inv70.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{\frac{\cosh x}{x}}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ \begin{array}{l} t_0 := \frac{\cosh x}{x}\\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 520000000:\\ \;\;\;\;\frac{y \cdot t\_0}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{t\_0}{z\_m}\\ \end{array} \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (let* ((t_0 (/ (cosh x) x)))
   (* z_s (if (<= z_m 520000000.0) (/ (* y t_0) z_m) (* y (/ t_0 z_m))))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double t_0 = cosh(x) / x;
	double tmp;
	if (z_m <= 520000000.0) {
		tmp = (y * t_0) / z_m;
	} else {
		tmp = y * (t_0 / z_m);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cosh(x) / x
    if (z_m <= 520000000.0d0) then
        tmp = (y * t_0) / z_m
    else
        tmp = y * (t_0 / z_m)
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
	double t_0 = Math.cosh(x) / x;
	double tmp;
	if (z_m <= 520000000.0) {
		tmp = (y * t_0) / z_m;
	} else {
		tmp = y * (t_0 / z_m);
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m):
	t_0 = math.cosh(x) / x
	tmp = 0
	if z_m <= 520000000.0:
		tmp = (y * t_0) / z_m
	else:
		tmp = y * (t_0 / z_m)
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	t_0 = Float64(cosh(x) / x)
	tmp = 0.0
	if (z_m <= 520000000.0)
		tmp = Float64(Float64(y * t_0) / z_m);
	else
		tmp = Float64(y * Float64(t_0 / z_m));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m)
	t_0 = cosh(x) / x;
	tmp = 0.0;
	if (z_m <= 520000000.0)
		tmp = (y * t_0) / z_m;
	else
		tmp = y * (t_0 / z_m);
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 520000000.0], N[(N[(y * t$95$0), $MachinePrecision] / z$95$m), $MachinePrecision], N[(y * N[(t$95$0 / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
\begin{array}{l}
t_0 := \frac{\cosh x}{x}\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 520000000:\\
\;\;\;\;\frac{y \cdot t\_0}{z\_m}\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t\_0}{z\_m}\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 5.2e8

    1. Initial program 86.4%

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

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

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

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

        \[\leadsto \cosh x \cdot \color{blue}{\frac{1}{\frac{z \cdot x}{y}}} \]
      2. un-div-inv80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.2e8 < z

    1. Initial program 83.2%

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

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

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

      \[\leadsto \color{blue}{\cosh x \cdot \frac{y}{z \cdot x}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num73.3%

        \[\leadsto \cosh x \cdot \color{blue}{\frac{1}{\frac{z \cdot x}{y}}} \]
      2. un-div-inv73.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{\frac{\cosh x}{x}}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 74.9% accurate, 1.0× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq 1.75 \cdot 10^{-81}:\\ \;\;\;\;\frac{\frac{y}{z\_m}}{x}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{\cosh x}{x}}{z\_m}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (* z_s (if (<= x 1.75e-81) (/ (/ y z_m) x) (* y (/ (/ (cosh x) x) z_m)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (x <= 1.75e-81) {
		tmp = (y / z_m) / x;
	} else {
		tmp = y * ((cosh(x) / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (x <= 1.75d-81) then
        tmp = (y / z_m) / x
    else
        tmp = y * ((cosh(x) / x) / z_m)
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (x <= 1.75e-81) {
		tmp = (y / z_m) / x;
	} else {
		tmp = y * ((Math.cosh(x) / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m):
	tmp = 0
	if x <= 1.75e-81:
		tmp = (y / z_m) / x
	else:
		tmp = y * ((math.cosh(x) / x) / z_m)
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (x <= 1.75e-81)
		tmp = Float64(Float64(y / z_m) / x);
	else
		tmp = Float64(y * Float64(Float64(cosh(x) / x) / z_m));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m)
	tmp = 0.0;
	if (x <= 1.75e-81)
		tmp = (y / z_m) / x;
	else
		tmp = y * ((cosh(x) / x) / z_m);
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[x, 1.75e-81], N[(N[(y / z$95$m), $MachinePrecision] / x), $MachinePrecision], N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.75 \cdot 10^{-81}:\\
\;\;\;\;\frac{\frac{y}{z\_m}}{x}\\

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


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

    1. Initial program 85.5%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. *-commutative85.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{1}{z}}{x}} \]
      2. un-div-inv65.1%

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

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

    if 1.74999999999999993e-81 < x

    1. Initial program 86.2%

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

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

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

      \[\leadsto \color{blue}{\cosh x \cdot \frac{y}{z \cdot x}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num71.1%

        \[\leadsto \cosh x \cdot \color{blue}{\frac{1}{\frac{z \cdot x}{y}}} \]
      2. un-div-inv71.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{\frac{\cosh x}{x}}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 57.4% accurate, 8.9× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 50000000000:\\ \;\;\;\;\frac{\frac{y}{z\_m}}{x}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{1}{x}}{z\_m}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (* z_s (if (<= z_m 50000000000.0) (/ (/ y z_m) x) (* y (/ (/ 1.0 x) z_m)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (z_m <= 50000000000.0) {
		tmp = (y / z_m) / x;
	} else {
		tmp = y * ((1.0 / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (z_m <= 50000000000.0d0) then
        tmp = (y / z_m) / x
    else
        tmp = y * ((1.0d0 / x) / z_m)
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (z_m <= 50000000000.0) {
		tmp = (y / z_m) / x;
	} else {
		tmp = y * ((1.0 / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m):
	tmp = 0
	if z_m <= 50000000000.0:
		tmp = (y / z_m) / x
	else:
		tmp = y * ((1.0 / x) / z_m)
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (z_m <= 50000000000.0)
		tmp = Float64(Float64(y / z_m) / x);
	else
		tmp = Float64(y * Float64(Float64(1.0 / x) / z_m));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m)
	tmp = 0.0;
	if (z_m <= 50000000000.0)
		tmp = (y / z_m) / x;
	else
		tmp = y * ((1.0 / x) / z_m);
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 50000000000.0], N[(N[(y / z$95$m), $MachinePrecision] / x), $MachinePrecision], N[(y * N[(N[(1.0 / x), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 50000000000:\\
\;\;\;\;\frac{\frac{y}{z\_m}}{x}\\

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


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

    1. Initial program 86.6%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. *-commutative86.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{1}{z}}{x}} \]
      2. un-div-inv57.0%

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

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

    if 5e10 < z

    1. Initial program 82.3%

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

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

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

      \[\leadsto \color{blue}{\cosh x \cdot \frac{y}{z \cdot x}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num71.8%

        \[\leadsto \cosh x \cdot \color{blue}{\frac{1}{\frac{z \cdot x}{y}}} \]
      2. un-div-inv71.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{\color{blue}{\frac{1}{x}}}{z} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 57.3% accurate, 10.7× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 4 \cdot 10^{-47}:\\ \;\;\;\;\frac{\frac{y}{z\_m}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z\_m \cdot x}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (* z_s (if (<= z_m 4e-47) (/ (/ y z_m) x) (/ y (* z_m x)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (z_m <= 4e-47) {
		tmp = (y / z_m) / x;
	} else {
		tmp = y / (z_m * x);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (z_m <= 4d-47) then
        tmp = (y / z_m) / x
    else
        tmp = y / (z_m * x)
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (z_m <= 4e-47) {
		tmp = (y / z_m) / x;
	} else {
		tmp = y / (z_m * x);
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m):
	tmp = 0
	if z_m <= 4e-47:
		tmp = (y / z_m) / x
	else:
		tmp = y / (z_m * x)
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (z_m <= 4e-47)
		tmp = Float64(Float64(y / z_m) / x);
	else
		tmp = Float64(y / Float64(z_m * x));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m)
	tmp = 0.0;
	if (z_m <= 4e-47)
		tmp = (y / z_m) / x;
	else
		tmp = y / (z_m * x);
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 4e-47], N[(N[(y / z$95$m), $MachinePrecision] / x), $MachinePrecision], N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 4 \cdot 10^{-47}:\\
\;\;\;\;\frac{\frac{y}{z\_m}}{x}\\

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


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

    1. Initial program 87.5%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. *-commutative87.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{1}{z}}{x}} \]
      2. un-div-inv57.6%

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

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

    if 3.9999999999999999e-47 < z

    1. Initial program 80.7%

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

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

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

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

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

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

Alternative 7: 53.3% accurate, 10.7× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 200000:\\ \;\;\;\;\frac{\frac{y}{x}}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z\_m \cdot x}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (* z_s (if (<= z_m 200000.0) (/ (/ y x) z_m) (/ y (* z_m x)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (z_m <= 200000.0) {
		tmp = (y / x) / z_m;
	} else {
		tmp = y / (z_m * x);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (z_m <= 200000.0d0) then
        tmp = (y / x) / z_m
    else
        tmp = y / (z_m * x)
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (z_m <= 200000.0) {
		tmp = (y / x) / z_m;
	} else {
		tmp = y / (z_m * x);
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m):
	tmp = 0
	if z_m <= 200000.0:
		tmp = (y / x) / z_m
	else:
		tmp = y / (z_m * x)
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (z_m <= 200000.0)
		tmp = Float64(Float64(y / x) / z_m);
	else
		tmp = Float64(y / Float64(z_m * x));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m)
	tmp = 0.0;
	if (z_m <= 200000.0)
		tmp = (y / x) / z_m;
	else
		tmp = y / (z_m * x);
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 200000.0], N[(N[(y / x), $MachinePrecision] / z$95$m), $MachinePrecision], N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 200000:\\
\;\;\;\;\frac{\frac{y}{x}}{z\_m}\\

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


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

    1. Initial program 86.4%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 53.5%

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

    if 2e5 < z

    1. Initial program 83.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 200000:\\ \;\;\;\;\frac{\frac{y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z \cdot x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 50.0% accurate, 21.4× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \frac{y}{z\_m \cdot x} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m) :precision binary64 (* z_s (/ y (* z_m x))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	return z_s * (y / (z_m * x));
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    code = z_s * (y / (z_m * x))
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
	return z_s * (y / (z_m * x));
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m):
	return z_s * (y / (z_m * x))
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	return Float64(z_s * Float64(y / Float64(z_m * x)))
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp = code(z_s, x, y, z_m)
	tmp = z_s * (y / (z_m * x));
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

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

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

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

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

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

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

    \[\leadsto \frac{y}{z \cdot x} \]
  7. Add Preprocessing

Developer target: 97.1% accurate, 0.9× 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 2024085 
(FPCore (x y z)
  :name "Linear.Quaternion:$ctan from linear-1.19.1.3"
  :precision binary64

  :alt
  (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))