Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 84.7% → 99.7%
Time: 10.7s
Alternatives: 16
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 16 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.7% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 95.5%

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

    if 2e177 < (*.f64 (cosh.f64 x) (/.f64 y x))

    1. Initial program 67.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq 2 \cdot 10^{+177}:\\ \;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \frac{\cosh x}{z}}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 83.9% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{y\_m}{x\_m \cdot z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 2.15 \cdot 10^{-122}:\\
\;\;\;\;\cosh x\_m \cdot t\_0\\

\mathbf{elif}\;y\_m \leq 6.5 \cdot 10^{+202}:\\
\;\;\;\;\frac{y\_m}{x\_m} \cdot \frac{\cosh x\_m}{z}\\

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


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 2.15000000000000009e-122

    1. Initial program 78.4%

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

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

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

      \[\leadsto \color{blue}{\cosh x \cdot \frac{y}{z \cdot x}} \]
    4. Add Preprocessing

    if 2.15000000000000009e-122 < y < 6.4999999999999996e202

    1. Initial program 93.2%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x} \cdot \frac{\cosh x}{z}} \]
    4. Add Preprocessing

    if 6.4999999999999996e202 < y

    1. Initial program 91.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.15 \cdot 10^{-122}:\\ \;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+202}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{\cosh x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \frac{x \cdot y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 80.2% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 82.5%

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

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

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

      \[\leadsto \color{blue}{\cosh x \cdot \frac{y}{z \cdot x}} \]
    4. Add Preprocessing

    if 6.5e180 < y

    1. Initial program 93.4%

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

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

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

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

      \[\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 simplification79.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 6.5 \cdot 10^{+180}:\\ \;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \frac{x \cdot y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 84.7% accurate, 1.0× speedup?

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

\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 5 \cdot 10^{-42}:\\
\;\;\;\;\frac{\cosh x\_m}{x\_m \cdot \frac{z}{y\_m}}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 5.00000000000000003e-42

    1. Initial program 85.8%

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

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

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

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

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

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

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

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

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

    if 5.00000000000000003e-42 < z

    1. Initial program 79.0%

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

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

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

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

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

Alternative 5: 96.2% accurate, 1.0× speedup?

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

\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 1.7 \cdot 10^{-99}:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.70000000000000003e-99

    1. Initial program 87.4%

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

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

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

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

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

    if 1.70000000000000003e-99 < x

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 60.4% accurate, 3.8× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\frac{z}{x\_m}}{y\_m \cdot 0.5}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1.4 \cdot 10^{-71}:\\
\;\;\;\;\frac{z + \frac{y\_m}{x\_m} \cdot t\_0}{z \cdot t\_0}\\

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

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


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 1.4e-71

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z + \frac{\frac{z}{x}}{y \cdot 0.5} \cdot \frac{y}{x}}{\color{blue}{\frac{\frac{z}{x}}{y \cdot 0.5}} \cdot z} \]
    9. Applied egg-rr58.2%

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

    if 1.4e-71 < z < 9.9999999999999999e51

    1. Initial program 82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999999e51 < z

    1. Initial program 76.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 1.4 \cdot 10^{-71}:\\ \;\;\;\;\frac{z + \frac{y}{x} \cdot \frac{\frac{z}{x}}{y \cdot 0.5}}{z \cdot \frac{\frac{z}{x}}{y \cdot 0.5}}\\ \mathbf{elif}\;z \leq 10^{+52}:\\ \;\;\;\;\frac{y + x \cdot \left(x \cdot \left(y \cdot 0.5\right)\right)}{x \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \frac{x \cdot y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 70.0% accurate, 4.6× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{y\_m}{x\_m \cdot z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 4 \cdot 10^{-103}:\\
\;\;\;\;t\_0 + y\_m \cdot \frac{0.5}{\frac{z}{x\_m}}\\

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

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


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 3.99999999999999983e-103

    1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999983e-103 < z < 1.65000000000000007e44

    1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.65000000000000007e44 < z

    1. Initial program 76.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 4 \cdot 10^{-103}:\\ \;\;\;\;\frac{y}{x \cdot z} + y \cdot \frac{0.5}{\frac{z}{x}}\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{+44}:\\ \;\;\;\;\frac{y + x \cdot \left(x \cdot \left(y \cdot 0.5\right)\right)}{x \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \frac{x \cdot y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 70.5% accurate, 5.9× speedup?

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

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

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4.8e-71

    1. Initial program 78.9%

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

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

    if 4.8e-71 < y

    1. Initial program 94.1%

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

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

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

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

      \[\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 simplification65.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.8 \cdot 10^{-71}:\\ \;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(x \cdot y\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \frac{x \cdot y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 66.8% accurate, 6.7× speedup?

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

\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 3.7 \cdot 10^{-178}:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 3.70000000000000004e-178

    1. Initial program 86.3%

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

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

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

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

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

    if 3.70000000000000004e-178 < x

    1. Initial program 80.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.7 \cdot 10^{-178}:\\ \;\;\;\;\frac{y}{x \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 66.8% accurate, 6.7× speedup?

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

\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 5.2 \cdot 10^{-180}:\\
\;\;\;\;\frac{y\_m}{x\_m \cdot z}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 5.1999999999999998e-180

    1. Initial program 86.3%

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

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

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

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

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

    if 5.1999999999999998e-180 < x

    1. Initial program 80.2%

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

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

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

Alternative 11: 62.8% accurate, 8.9× speedup?

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

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

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


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

    1. Initial program 88.2%

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

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

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

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

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

    if 1e-3 < x

    1. Initial program 72.6%

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

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

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

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

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

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

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

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

Alternative 12: 66.8% accurate, 8.9× speedup?

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

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

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


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

    1. Initial program 88.2%

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

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

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

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

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

    if 1e-3 < x

    1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 66.8% accurate, 8.9× speedup?

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

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

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


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

    1. Initial program 88.2%

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

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

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

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

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

    if 1e-3 < x

    1. Initial program 72.6%

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

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

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

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

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

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

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

Alternative 14: 53.0% accurate, 10.7× speedup?

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

\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 4.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{\frac{y\_m}{x\_m}}{z}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4.8e-71

    1. Initial program 78.9%

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

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

    if 4.8e-71 < y

    1. Initial program 94.1%

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

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

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

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

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

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

Alternative 15: 57.2% accurate, 10.7× speedup?

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

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

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4e8

    1. Initial program 80.1%

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

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

    if 4e8 < y

    1. Initial program 94.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 49.7% accurate, 21.4× speedup?

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

\\
y\_s \cdot \left(x\_s \cdot \frac{y\_m}{x\_m \cdot z}\right)
\end{array}
Derivation
  1. Initial program 83.8%

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

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

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

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

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

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

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