Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 84.4% → 96.9%
Time: 7.8s
Alternatives: 15
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 15 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.4% accurate, 1.0× speedup?

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

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

Alternative 1: 96.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 77.4%

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

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

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

    if 7.60000000000000024e-16 < y

    1. Initial program 92.1%

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

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

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

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

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

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

Alternative 2: 92.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cosh x \cdot \frac{y}{x}\\ \mathbf{if}\;t_0 \leq \infty:\\ \;\;\;\;\frac{t_0}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (cosh x) (/ y x))))
   (if (<= t_0 INFINITY) (/ t_0 z) (* y (/ (cosh x) (* x z))))))
double code(double x, double y, double z) {
	double t_0 = cosh(x) * (y / x);
	double tmp;
	if (t_0 <= ((double) INFINITY)) {
		tmp = t_0 / z;
	} else {
		tmp = y * (cosh(x) / (x * z));
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double t_0 = Math.cosh(x) * (y / x);
	double tmp;
	if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = t_0 / z;
	} else {
		tmp = y * (Math.cosh(x) / (x * z));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = math.cosh(x) * (y / x)
	tmp = 0
	if t_0 <= math.inf:
		tmp = t_0 / z
	else:
		tmp = y * (math.cosh(x) / (x * z))
	return tmp
function code(x, y, z)
	t_0 = Float64(cosh(x) * Float64(y / x))
	tmp = 0.0
	if (t_0 <= Inf)
		tmp = Float64(t_0 / z);
	else
		tmp = Float64(y * Float64(cosh(x) / Float64(x * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = cosh(x) * (y / x);
	tmp = 0.0;
	if (t_0 <= Inf)
		tmp = t_0 / z;
	else
		tmp = y * (cosh(x) / (x * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 / z), $MachinePrecision], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
\mathbf{if}\;t_0 \leq \infty:\\
\;\;\;\;\frac{t_0}{z}\\

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


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

    1. Initial program 95.9%

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

    if +inf.0 < (*.f64 (cosh.f64 x) (/.f64 y x))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

Alternative 3: 84.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-202} \lor \neg \left(z \leq 4 \cdot 10^{-212}\right):\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.9999999999999998e-202 or 3.99999999999999982e-212 < z

    1. Initial program 81.1%

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

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

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

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

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

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

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

    if -6.9999999999999998e-202 < z < 3.99999999999999982e-212

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 87.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-62} \lor \neg \left(y \leq 4 \cdot 10^{-128}\right):\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.60000000000000011e-62 or 4.00000000000000022e-128 < y

    1. Initial program 92.4%

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

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

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

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

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

    if -1.60000000000000011e-62 < y < 4.00000000000000022e-128

    1. Initial program 60.8%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{-62} \lor \neg \left(y \leq 4 \cdot 10^{-128}\right):\\ \;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\ \end{array} \]

Alternative 5: 75.4% accurate, 5.0× speedup?

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

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

\mathbf{elif}\;y \leq -1 \cdot 10^{-170}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;y \leq 2.8 \cdot 10^{+127}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.00000000000000016e138 or 2.8000000000000002e127 < y

    1. Initial program 87.5%

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

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

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

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

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

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

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

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

    if -5.00000000000000016e138 < y < -9.99999999999999983e-171 or 2.2000000000000001e-66 < y < 2.8000000000000002e127

    1. Initial program 95.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + 0.5 \cdot {x}^{2}}{z} \cdot \frac{y}{x}} \]
      2. unpow281.3%

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

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

    if -9.99999999999999983e-171 < y < 2.2000000000000001e-66

    1. Initial program 57.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{+138}:\\ \;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \frac{y \cdot x}{z}\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-170}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{z}\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-66}:\\ \;\;\;\;y \cdot \frac{1 + x \cdot \left(x \cdot 0.5\right)}{x \cdot z}\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+127}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \frac{y \cdot x}{z}\\ \end{array} \]

Alternative 6: 71.1% accurate, 6.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{-178} \lor \neg \left(y \leq 3.9 \cdot 10^{-66}\right):\\
\;\;\;\;\frac{y}{x} \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.70000000000000009e-178 or 3.89999999999999983e-66 < y

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + 0.5 \cdot {x}^{2}}{z} \cdot \frac{y}{x}} \]
      2. unpow279.5%

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

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

    if -2.70000000000000009e-178 < y < 3.89999999999999983e-66

    1. Initial program 57.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 65.3% accurate, 8.2× speedup?

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

\\
y \cdot \left(\frac{1}{x \cdot z} + 0.5 \cdot \frac{x}{z}\right)
\end{array}
Derivation
  1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

Alternative 8: 68.3% accurate, 8.2× speedup?

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

\\
y \cdot \frac{1 + x \cdot \left(x \cdot 0.5\right)}{x \cdot z}
\end{array}
Derivation
  1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 65.4% accurate, 9.6× speedup?

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

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

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


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

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999 < x < 1.4199999999999999

    1. Initial program 92.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
    6. Simplified94.1%

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

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

Alternative 10: 65.7% accurate, 9.6× speedup?

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

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

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


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

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999 < x < 1.4199999999999999

    1. Initial program 92.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
    6. Simplified94.1%

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

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

Alternative 11: 66.0% accurate, 9.6× speedup?

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

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

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


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

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999 < x < 1.4199999999999999

    1. Initial program 92.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
    6. Simplified94.1%

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

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

Alternative 12: 65.3% accurate, 9.7× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\leadsto y \cdot \color{blue}{\frac{0.5 \cdot x + \frac{1}{x}}{z}} \]
  6. Final simplification63.5%

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

Alternative 13: 49.7% accurate, 15.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+136}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\

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


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

    1. Initial program 81.2%

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

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

    if 1.00000000000000006e136 < y

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

Alternative 14: 54.2% accurate, 15.2× speedup?

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

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

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


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

    1. Initial program 84.2%

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

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

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

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

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

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

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

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

    if -4.49999999999999973e155 < z

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
    6. Simplified51.2%

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

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

Alternative 15: 48.1% accurate, 21.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

Developer target: 97.0% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023185 
(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))