Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 84.4% → 97.2%
Time: 8.5s
Alternatives: 14
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 84.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: 97.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.7 \cdot 10^{+133}:\\
\;\;\;\;\frac{y \cdot \frac{\cosh x}{x}}{z}\\

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


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

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

    if 3.70000000000000023e133 < y

    1. Initial program 89.1%

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

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

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

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

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

Alternative 2: 93.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 95.7%

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

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

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

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

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

    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/50.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{1 + 0.5 \cdot {x}^{2}}}{x} \cdot y}{z} \]
    7. Step-by-step derivation
      1. unpow229.2%

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

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

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

Alternative 3: 92.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 69.2%

      \[\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/49.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{1 + 0.5 \cdot {x}^{2}}}{x} \cdot y}{z} \]
    7. Step-by-step derivation
      1. unpow249.2%

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

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

    if -1.35000000000000003e154 < x < 1.35000000000000003e154

    1. Initial program 90.7%

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

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

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

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

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

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

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

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

Alternative 4: 68.9% accurate, 6.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+117} \lor \neg \left(y \leq 2.6 \cdot 10^{+218}\right):\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.40000000000000028e117 or 2.60000000000000002e218 < y

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.40000000000000028e117 < y < 2.60000000000000002e218

    1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 69.6% accurate, 6.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.85 \cdot 10^{-266} \lor \neg \left(x \leq 2.1 \cdot 10^{-150}\right):\\
\;\;\;\;\frac{y}{x} \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.8500000000000001e-266 or 2.1000000000000001e-150 < x

    1. Initial program 85.9%

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

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

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

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

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

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

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

    if 1.8500000000000001e-266 < x < 2.1000000000000001e-150

    1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

Alternative 6: 69.1% accurate, 6.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 9 \cdot 10^{-269} \lor \neg \left(x \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\frac{y}{x} \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 9.0000000000000003e-269 or 1.35000000000000003e154 < x

    1. Initial program 83.5%

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

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

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

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

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

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

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

    if 9.0000000000000003e-269 < x < 1.35000000000000003e154

    1. Initial program 88.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{y}{\frac{z}{x}} + \color{blue}{\frac{y}{z \cdot x}} \]
    6. Simplified71.6%

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

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

Alternative 7: 69.7% accurate, 6.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.5 \cdot \left(x \cdot x\right)\\ \mathbf{if}\;z \leq -5.4 \cdot 10^{+17} \lor \neg \left(z \leq 4 \cdot 10^{-188}\right):\\ \;\;\;\;\frac{\frac{y}{x} \cdot t_0}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{t_0}{x \cdot z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.5 (* x x)))))
   (if (or (<= z -5.4e+17) (not (<= z 4e-188)))
     (/ (* (/ y x) t_0) z)
     (* y (/ t_0 (* x z))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 + (0.5 * (x * x));
	double tmp;
	if ((z <= -5.4e+17) || !(z <= 4e-188)) {
		tmp = ((y / x) * t_0) / z;
	} else {
		tmp = y * (t_0 / (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) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 + (0.5d0 * (x * x))
    if ((z <= (-5.4d+17)) .or. (.not. (z <= 4d-188))) then
        tmp = ((y / x) * t_0) / z
    else
        tmp = y * (t_0 / (x * z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 + (0.5 * (x * x));
	double tmp;
	if ((z <= -5.4e+17) || !(z <= 4e-188)) {
		tmp = ((y / x) * t_0) / z;
	} else {
		tmp = y * (t_0 / (x * z));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 + (0.5 * (x * x))
	tmp = 0
	if (z <= -5.4e+17) or not (z <= 4e-188):
		tmp = ((y / x) * t_0) / z
	else:
		tmp = y * (t_0 / (x * z))
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 + Float64(0.5 * Float64(x * x)))
	tmp = 0.0
	if ((z <= -5.4e+17) || !(z <= 4e-188))
		tmp = Float64(Float64(Float64(y / x) * t_0) / z);
	else
		tmp = Float64(y * Float64(t_0 / Float64(x * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 + (0.5 * (x * x));
	tmp = 0.0;
	if ((z <= -5.4e+17) || ~((z <= 4e-188)))
		tmp = ((y / x) * t_0) / z;
	else
		tmp = y * (t_0 / (x * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[z, -5.4e+17], N[Not[LessEqual[z, 4e-188]], $MachinePrecision]], N[(N[(N[(y / x), $MachinePrecision] * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(t$95$0 / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{+17} \lor \neg \left(z \leq 4 \cdot 10^{-188}\right):\\
\;\;\;\;\frac{\frac{y}{x} \cdot t_0}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.4e17 or 3.9999999999999998e-188 < z

    1. Initial program 83.3%

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

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

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

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

    if -5.4e17 < z < 3.9999999999999998e-188

    1. Initial program 88.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/96.8%

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

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

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

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

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

      \[\leadsto y \cdot \frac{\color{blue}{1 + 0.5 \cdot {x}^{2}}}{x \cdot z} \]
    5. Step-by-step derivation
      1. unpow287.3%

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

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

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

Alternative 8: 77.6% accurate, 8.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\frac{\color{blue}{1 + 0.5 \cdot {x}^{2}}}{x} \cdot y}{z} \]
  7. Step-by-step derivation
    1. unpow264.1%

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

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

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

Alternative 9: 65.2% accurate, 9.6× speedup?

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

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

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


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

    1. Initial program 79.7%

      \[\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/68.1%

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

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

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

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

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

      \[\leadsto y \cdot \frac{\color{blue}{1 + 0.5 \cdot {x}^{2}}}{x \cdot z} \]
    5. Step-by-step derivation
      1. unpow237.7%

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{y}{\frac{z}{x}}} \]
    9. Simplified37.9%

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

    if -28 < x < 1.3999999999999999

    1. Initial program 91.8%

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

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

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

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

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

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

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

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

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

Alternative 10: 65.8% accurate, 9.6× speedup?

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

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

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


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

    1. Initial program 79.7%

      \[\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/68.1%

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

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

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

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

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

      \[\leadsto y \cdot \frac{\color{blue}{1 + 0.5 \cdot {x}^{2}}}{x \cdot z} \]
    5. Step-by-step derivation
      1. unpow237.7%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x \cdot 0.5}}} \]
      2. div-inv37.9%

        \[\leadsto \color{blue}{y \cdot \frac{1}{\frac{z}{x \cdot 0.5}}} \]
      3. clear-num37.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \cdot 0.5 \]
      10. *-commutative37.9%

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot y}{\frac{z}{x}}} \]
      12. div-inv37.9%

        \[\leadsto \frac{0.5 \cdot y}{\color{blue}{z \cdot \frac{1}{x}}} \]
      13. times-frac42.7%

        \[\leadsto \color{blue}{\frac{0.5}{z} \cdot \frac{y}{\frac{1}{x}}} \]
    11. Applied egg-rr42.7%

      \[\leadsto \color{blue}{\frac{0.5}{z} \cdot \frac{y}{\frac{1}{x}}} \]
    12. Taylor expanded in y around 0 42.7%

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

    if -28 < x < 1.3999999999999999

    1. Initial program 91.8%

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

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

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

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

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

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

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

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

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

Alternative 11: 65.7% accurate, 9.7× speedup?

\[\begin{array}{l} \\ \frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{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(Float64(y * 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[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 65.7% accurate, 9.7× speedup?

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

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

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

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

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

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

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

Alternative 13: 55.4% accurate, 15.2× speedup?

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

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

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


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

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

    if 1.3999999999999999e-69 < z

    1. Initial program 81.6%

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

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

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

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

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

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

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

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

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

Alternative 14: 49.7% 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 85.3%

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

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

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

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

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

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

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

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

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

Developer target: 97.1% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

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