Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 84.8% → 98.8%
Time: 9.3s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 84.8% 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: 98.8% accurate, 1.0× speedup?

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

\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 10^{+104}:\\
\;\;\;\;\frac{y_m \cdot \frac{\cosh x}{x}}{z}\\

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


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

    1. Initial program 85.1%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. expm1-log1p-u50.0%

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

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

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

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

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

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

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

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

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

    if 1e104 < y

    1. Initial program 88.0%

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

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

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

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

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

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

Alternative 2: 85.9% accurate, 1.0× speedup?

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

\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 1.2 \cdot 10^{+190}:\\
\;\;\;\;\frac{\cosh x}{z} \cdot \frac{y_m}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.1999999999999999e190

    1. Initial program 85.4%

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

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

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

    if 1.1999999999999999e190 < y

    1. Initial program 88.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.2 \cdot 10^{+190}:\\ \;\;\;\;\frac{\cosh x}{z} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{z} + \frac{y}{x \cdot z}\\ \end{array} \]

Alternative 3: 87.8% accurate, 1.0× speedup?

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

\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 1.18 \cdot 10^{+104}:\\
\;\;\;\;\frac{\cosh x}{z} \cdot \frac{y_m}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.18e104

    1. Initial program 85.1%

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

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

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

    if 1.18e104 < y

    1. Initial program 88.0%

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

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

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

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

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

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

Alternative 4: 61.9% accurate, 4.6× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{z}{y_m \cdot x}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 6.6 \cdot 10^{-9}:\\
\;\;\;\;\frac{\frac{y_m}{z}}{x}\\

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


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

    1. Initial program 87.5%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot z}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity62.2%

        \[\leadsto \frac{\color{blue}{1 \cdot y}}{x \cdot z} \]
      2. times-frac68.3%

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

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

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

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

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

    if 6.60000000000000037e-9 < x

    1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{\frac{z}{y}}{x}} + \color{blue}{\frac{\frac{y}{z}}{x}} \]
      2. clear-num36.7%

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

        \[\leadsto \frac{0.5}{\frac{\frac{z}{y}}{x}} + \color{blue}{\frac{1}{\frac{z}{y} \cdot x}} \]
      4. +-commutative36.7%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{\frac{z}{y}}}{x}} + \frac{0.5}{\frac{\frac{z}{y}}{x}} \]
      6. clear-num36.7%

        \[\leadsto \frac{\color{blue}{\frac{y}{z}}}{x} + \frac{0.5}{\frac{\frac{z}{y}}{x}} \]
      7. associate-/l/36.7%

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

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{z}} + \frac{0.5}{\frac{\frac{z}{y}}{x}} \]
      9. frac-add41.9%

        \[\leadsto \color{blue}{\frac{\frac{y}{x} \cdot \frac{\frac{z}{y}}{x} + z \cdot 0.5}{z \cdot \frac{\frac{z}{y}}{x}}} \]
      10. associate-/l/42.1%

        \[\leadsto \frac{\frac{y}{x} \cdot \color{blue}{\frac{z}{x \cdot y}} + z \cdot 0.5}{z \cdot \frac{\frac{z}{y}}{x}} \]
      11. *-commutative42.1%

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

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

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

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

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

Alternative 5: 66.5% accurate, 7.1× speedup?

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

\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 1.5 \cdot 10^{+180}:\\
\;\;\;\;\frac{\frac{y_m}{x} + 0.5 \cdot \left(y_m \cdot x\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.50000000000000001e180

    1. Initial program 85.4%

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

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

    if 1.50000000000000001e180 < y

    1. Initial program 87.6%

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

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

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

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

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

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

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

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

Alternative 6: 68.1% accurate, 7.1× speedup?

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

\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 2.15 \cdot 10^{-38}:\\
\;\;\;\;\frac{\frac{y_m}{x} + 0.5 \cdot \left(y_m \cdot x\right)}{z}\\

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


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

    1. Initial program 87.9%

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

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

    if 2.1500000000000001e-38 < z

    1. Initial program 79.3%

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

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

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

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

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

Alternative 7: 65.9% accurate, 8.2× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ y_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 7.8 \cdot 10^{+210}:\\ \;\;\;\;\frac{y_m \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+299}:\\ \;\;\;\;\frac{y_m}{x \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot \left(y_m \cdot x\right)}{z}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
 :precision binary64
 (*
  y_s
  (if (<= z 7.8e+210)
    (/ (* y_m (+ (* x 0.5) (/ 1.0 x))) z)
    (if (<= z 1.55e+299) (/ y_m (* x z)) (/ (* 0.5 (* y_m x)) z)))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (z <= 7.8e+210) {
		tmp = (y_m * ((x * 0.5) + (1.0 / x))) / z;
	} else if (z <= 1.55e+299) {
		tmp = y_m / (x * z);
	} else {
		tmp = (0.5 * (y_m * x)) / z;
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= 7.8d+210) then
        tmp = (y_m * ((x * 0.5d0) + (1.0d0 / x))) / z
    else if (z <= 1.55d+299) then
        tmp = y_m / (x * z)
    else
        tmp = (0.5d0 * (y_m * x)) / z
    end if
    code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
	double tmp;
	if (z <= 7.8e+210) {
		tmp = (y_m * ((x * 0.5) + (1.0 / x))) / z;
	} else if (z <= 1.55e+299) {
		tmp = y_m / (x * z);
	} else {
		tmp = (0.5 * (y_m * x)) / z;
	}
	return y_s * tmp;
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
def code(y_s, x, y_m, z):
	tmp = 0
	if z <= 7.8e+210:
		tmp = (y_m * ((x * 0.5) + (1.0 / x))) / z
	elif z <= 1.55e+299:
		tmp = y_m / (x * z)
	else:
		tmp = (0.5 * (y_m * x)) / z
	return y_s * tmp
y_m = abs(y)
y_s = copysign(1.0, y)
function code(y_s, x, y_m, z)
	tmp = 0.0
	if (z <= 7.8e+210)
		tmp = Float64(Float64(y_m * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z);
	elseif (z <= 1.55e+299)
		tmp = Float64(y_m / Float64(x * z));
	else
		tmp = Float64(Float64(0.5 * Float64(y_m * x)) / z);
	end
	return Float64(y_s * tmp)
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
function tmp_2 = code(y_s, x, y_m, z)
	tmp = 0.0;
	if (z <= 7.8e+210)
		tmp = (y_m * ((x * 0.5) + (1.0 / x))) / z;
	elseif (z <= 1.55e+299)
		tmp = y_m / (x * z);
	else
		tmp = (0.5 * (y_m * x)) / z;
	end
	tmp_2 = y_s * tmp;
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[z, 7.8e+210], N[(N[(y$95$m * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.55e+299], N[(y$95$m / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)

\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 7.8 \cdot 10^{+210}:\\
\;\;\;\;\frac{y_m \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\

\mathbf{elif}\;z \leq 1.55 \cdot 10^{+299}:\\
\;\;\;\;\frac{y_m}{x \cdot z}\\

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


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

    1. Initial program 88.0%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Step-by-step derivation
      1. expm1-log1p-u50.7%

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

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

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

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

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

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

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

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

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

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

    if 7.8e210 < z < 1.55e299

    1. Initial program 58.2%

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

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

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

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

    if 1.55e299 < z

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 7.8 \cdot 10^{+210}:\\ \;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+299}:\\ \;\;\;\;\frac{y}{x \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot \left(y \cdot x\right)}{z}\\ \end{array} \]

Alternative 8: 65.9% accurate, 8.2× speedup?

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

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(y_m \cdot x\right)\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 3.5 \cdot 10^{+211}:\\
\;\;\;\;\frac{\frac{y_m}{x} + t_0}{z}\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{+299}:\\
\;\;\;\;\frac{y_m}{x \cdot z}\\

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


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

    1. Initial program 88.0%

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

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

    if 3.49999999999999996e211 < z < 1.80000000000000002e299

    1. Initial program 58.2%

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

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

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

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

    if 1.80000000000000002e299 < z

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 3.5 \cdot 10^{+211}:\\ \;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(y \cdot x\right)}{z}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+299}:\\ \;\;\;\;\frac{y}{x \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot \left(y \cdot x\right)}{z}\\ \end{array} \]

Alternative 9: 60.0% accurate, 11.8× speedup?

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

\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.45:\\
\;\;\;\;\frac{\frac{y_m}{z}}{x}\\

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


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

    1. Initial program 87.6%

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

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

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

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

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

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

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

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

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

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

    if 1.44999999999999996 < x

    1. Initial program 80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 60.0% accurate, 11.8× speedup?

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

\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.45:\\
\;\;\;\;\frac{\frac{y_m}{z}}{x}\\

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


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

    1. Initial program 87.6%

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

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

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

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

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

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

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

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

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

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

    if 1.44999999999999996 < x

    1. Initial program 80.0%

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

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

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

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

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

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

Alternative 11: 53.9% accurate, 15.2× speedup?

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

\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 10^{+29}:\\
\;\;\;\;\frac{\frac{y_m}{x}}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 9.99999999999999914e28

    1. Initial program 83.7%

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

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

    if 9.99999999999999914e28 < y

    1. Initial program 90.7%

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

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

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

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

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

Alternative 12: 56.0% accurate, 15.2× speedup?

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

\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{y_m}{z}}{x}\\

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


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

    1. Initial program 88.1%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot z}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity49.3%

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

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

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

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

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

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

    if 2.00000000000000008e-25 < z

    1. Initial program 78.0%

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

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

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

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

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

Alternative 13: 50.2% accurate, 21.4× speedup?

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

\\
y_s \cdot \frac{y_m}{x \cdot z}
\end{array}
Derivation
  1. Initial program 85.7%

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

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

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

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

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

Developer target: 97.4% 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 2023332 
(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))