Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 85.0% → 96.1%
Time: 7.6s
Alternatives: 16
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 92.5% 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 97.8%

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

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

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

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

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

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

    \[\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: 87.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+97} \lor \neg \left(z \leq 4.8 \cdot 10^{+169}\right):\\
\;\;\;\;\frac{y}{x} \cdot \frac{\cosh 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 z < -2.7999999999999999e97 or 4.7999999999999997e169 < z

    1. Initial program 80.2%

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

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

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

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

    if -2.7999999999999999e97 < z < 4.7999999999999997e169

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

Alternative 4: 83.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \frac{\cosh x}{x \cdot z}} \]
  4. Final simplification85.2%

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

Alternative 5: 68.2% accurate, 6.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{-218}:\\ \;\;\;\;y \cdot \frac{x \cdot 0.5 + \frac{1}{x}}{z}\\ \mathbf{elif}\;x \leq 1.4:\\ \;\;\;\;\frac{\frac{1}{z}}{\frac{x}{y}}\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+257}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x \cdot \left(x \cdot 0.5\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{z} \cdot \left(x \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -1.9e-218)
   (* y (/ (+ (* x 0.5) (/ 1.0 x)) z))
   (if (<= x 1.4)
     (/ (/ 1.0 z) (/ x y))
     (if (<= x 7.2e+257)
       (* (/ y x) (/ (* x (* x 0.5)) z))
       (* (/ 0.5 z) (* x y))))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.9e-218) {
		tmp = y * (((x * 0.5) + (1.0 / x)) / z);
	} else if (x <= 1.4) {
		tmp = (1.0 / z) / (x / y);
	} else if (x <= 7.2e+257) {
		tmp = (y / x) * ((x * (x * 0.5)) / z);
	} else {
		tmp = (0.5 / z) * (x * 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 (x <= (-1.9d-218)) then
        tmp = y * (((x * 0.5d0) + (1.0d0 / x)) / z)
    else if (x <= 1.4d0) then
        tmp = (1.0d0 / z) / (x / y)
    else if (x <= 7.2d+257) then
        tmp = (y / x) * ((x * (x * 0.5d0)) / z)
    else
        tmp = (0.5d0 / z) * (x * y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.9e-218) {
		tmp = y * (((x * 0.5) + (1.0 / x)) / z);
	} else if (x <= 1.4) {
		tmp = (1.0 / z) / (x / y);
	} else if (x <= 7.2e+257) {
		tmp = (y / x) * ((x * (x * 0.5)) / z);
	} else {
		tmp = (0.5 / z) * (x * y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -1.9e-218:
		tmp = y * (((x * 0.5) + (1.0 / x)) / z)
	elif x <= 1.4:
		tmp = (1.0 / z) / (x / y)
	elif x <= 7.2e+257:
		tmp = (y / x) * ((x * (x * 0.5)) / z)
	else:
		tmp = (0.5 / z) * (x * y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -1.9e-218)
		tmp = Float64(y * Float64(Float64(Float64(x * 0.5) + Float64(1.0 / x)) / z));
	elseif (x <= 1.4)
		tmp = Float64(Float64(1.0 / z) / Float64(x / y));
	elseif (x <= 7.2e+257)
		tmp = Float64(Float64(y / x) * Float64(Float64(x * Float64(x * 0.5)) / z));
	else
		tmp = Float64(Float64(0.5 / z) * Float64(x * y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -1.9e-218)
		tmp = y * (((x * 0.5) + (1.0 / x)) / z);
	elseif (x <= 1.4)
		tmp = (1.0 / z) / (x / y);
	elseif (x <= 7.2e+257)
		tmp = (y / x) * ((x * (x * 0.5)) / z);
	else
		tmp = (0.5 / z) * (x * y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -1.9e-218], N[(y * N[(N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4], N[(N[(1.0 / z), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e+257], N[(N[(y / x), $MachinePrecision] * N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / z), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-218}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5 + \frac{1}{x}}{z}\\

\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{1}{z}}{\frac{x}{y}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.8999999999999999e-218

    1. Initial program 83.7%

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

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

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

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

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

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

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

      \[\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 68.6%

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

    if -1.8999999999999999e-218 < x < 1.3999999999999999

    1. Initial program 97.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/91.4%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{z} \cdot \frac{y}{x}} \]
      4. clear-num95.1%

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

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

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

    if 1.3999999999999999 < x < 7.19999999999999968e257

    1. Initial program 85.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/75.9%

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

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

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

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

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

      \[\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*44.8%

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

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

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

        \[\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-rr49.6%

      \[\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 y around 0 47.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot {x}^{2}}{z}} \cdot \frac{y}{x} \]
      2. *-commutative58.5%

        \[\leadsto \frac{\color{blue}{{x}^{2} \cdot 0.5}}{z} \cdot \frac{y}{x} \]
      3. unpow258.5%

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

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

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

    if 7.19999999999999968e257 < x

    1. Initial program 35.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/64.3%

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

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

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

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

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

      \[\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 59.0%

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

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

        \[\leadsto \left(y \cdot 0.5\right) \cdot \color{blue}{\frac{1}{\frac{z}{x}}} \]
      3. un-div-inv59.0%

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

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

      \[\leadsto \color{blue}{\frac{0.5 \cdot y}{\frac{z}{x}}} \]
    8. Step-by-step derivation
      1. div-inv59.0%

        \[\leadsto \frac{0.5 \cdot y}{\color{blue}{z \cdot \frac{1}{x}}} \]
      2. frac-times65.5%

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

        \[\leadsto \frac{0.5}{z} \cdot \color{blue}{\frac{y \cdot x}{1}} \]
      4. /-rgt-identity65.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{-218}:\\ \;\;\;\;y \cdot \frac{x \cdot 0.5 + \frac{1}{x}}{z}\\ \mathbf{elif}\;x \leq 1.4:\\ \;\;\;\;\frac{\frac{1}{z}}{\frac{x}{y}}\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+257}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x \cdot \left(x \cdot 0.5\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{z} \cdot \left(x \cdot y\right)\\ \end{array} \]

Alternative 6: 69.4% accurate, 6.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.0999999999999999e-201 or 1.24999999999999995e274 < x

    1. Initial program 78.0%

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

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

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

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

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

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

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

      \[\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*66.8%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{\frac{1}{z} \cdot z + x \cdot \left(0.5 \cdot x\right)}{x \cdot z}} \]
      4. *-commutative74.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-rr74.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 74.2%

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

    if -3.0999999999999999e-201 < x < 1.24999999999999995e274

    1. Initial program 91.5%

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

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

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

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

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

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

      \[\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*71.2%

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

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

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

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

      \[\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 y around 0 73.0%

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

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

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

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

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

Alternative 7: 68.4% accurate, 7.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5000000:\\ \;\;\;\;\frac{\frac{y}{x} + x \cdot \left(y \cdot 0.5\right)}{z}\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{+256}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x \cdot \left(x \cdot 0.5\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{z} \cdot \left(x \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 5000000.0)
   (/ (+ (/ y x) (* x (* y 0.5))) z)
   (if (<= x 7.5e+256)
     (* (/ y x) (/ (* x (* x 0.5)) z))
     (* (/ 0.5 z) (* x y)))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 5000000.0) {
		tmp = ((y / x) + (x * (y * 0.5))) / z;
	} else if (x <= 7.5e+256) {
		tmp = (y / x) * ((x * (x * 0.5)) / z);
	} else {
		tmp = (0.5 / z) * (x * 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 (x <= 5000000.0d0) then
        tmp = ((y / x) + (x * (y * 0.5d0))) / z
    else if (x <= 7.5d+256) then
        tmp = (y / x) * ((x * (x * 0.5d0)) / z)
    else
        tmp = (0.5d0 / z) * (x * y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= 5000000.0) {
		tmp = ((y / x) + (x * (y * 0.5))) / z;
	} else if (x <= 7.5e+256) {
		tmp = (y / x) * ((x * (x * 0.5)) / z);
	} else {
		tmp = (0.5 / z) * (x * y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= 5000000.0:
		tmp = ((y / x) + (x * (y * 0.5))) / z
	elif x <= 7.5e+256:
		tmp = (y / x) * ((x * (x * 0.5)) / z)
	else:
		tmp = (0.5 / z) * (x * y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= 5000000.0)
		tmp = Float64(Float64(Float64(y / x) + Float64(x * Float64(y * 0.5))) / z);
	elseif (x <= 7.5e+256)
		tmp = Float64(Float64(y / x) * Float64(Float64(x * Float64(x * 0.5)) / z));
	else
		tmp = Float64(Float64(0.5 / z) * Float64(x * y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= 5000000.0)
		tmp = ((y / x) + (x * (y * 0.5))) / z;
	elseif (x <= 7.5e+256)
		tmp = (y / x) * ((x * (x * 0.5)) / z);
	else
		tmp = (0.5 / z) * (x * y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, 5000000.0], N[(N[(N[(y / x), $MachinePrecision] + N[(x * N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[x, 7.5e+256], N[(N[(y / x), $MachinePrecision] * N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / z), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5000000:\\
\;\;\;\;\frac{\frac{y}{x} + x \cdot \left(y \cdot 0.5\right)}{z}\\

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

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


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

    1. Initial program 89.5%

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

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

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

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

    if 5e6 < x < 7.4999999999999999e256

    1. Initial program 84.6%

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

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

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

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

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

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

      \[\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*46.4%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{\frac{1}{z} \cdot z + x \cdot \left(0.5 \cdot x\right)}{x \cdot z}} \]
      4. *-commutative51.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-rr51.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 y around 0 49.6%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot {x}^{2}}{z}} \cdot \frac{y}{x} \]
      2. *-commutative60.5%

        \[\leadsto \frac{\color{blue}{{x}^{2} \cdot 0.5}}{z} \cdot \frac{y}{x} \]
      3. unpow260.5%

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

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

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

    if 7.4999999999999999e256 < x

    1. Initial program 35.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/64.3%

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

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

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

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

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

      \[\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 59.0%

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

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

        \[\leadsto \left(y \cdot 0.5\right) \cdot \color{blue}{\frac{1}{\frac{z}{x}}} \]
      3. un-div-inv59.0%

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

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

      \[\leadsto \color{blue}{\frac{0.5 \cdot y}{\frac{z}{x}}} \]
    8. Step-by-step derivation
      1. div-inv59.0%

        \[\leadsto \frac{0.5 \cdot y}{\color{blue}{z \cdot \frac{1}{x}}} \]
      2. frac-times65.5%

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

        \[\leadsto \frac{0.5}{z} \cdot \color{blue}{\frac{y \cdot x}{1}} \]
      4. /-rgt-identity65.5%

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

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

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

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

Alternative 8: 68.9% accurate, 7.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{+171}:\\
\;\;\;\;y \cdot \frac{1 + x \cdot \left(x \cdot 0.5\right)}{x \cdot z}\\

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


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

    1. Initial program 83.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{\cosh x}{x \cdot z}} \]
    4. Taylor expanded in x around 0 67.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*67.6%

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

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

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

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

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

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

    if 4.49999999999999969e171 < y

    1. Initial program 97.2%

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

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

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

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

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

Alternative 9: 65.0% accurate, 9.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.42 \lor \neg \left(x \leq 1.4\right):\\ \;\;\;\;0.5 \cdot \frac{y}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -1.42) (not (<= x 1.4))) (* 0.5 (/ y (/ z x))) (/ (/ y x) z)))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.42) || !(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 <= (-1.42d0)) .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 <= -1.42) || !(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 <= -1.42) 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 <= -1.42) || !(x <= 1.4))
		tmp = Float64(0.5 * Float64(y / Float64(z / x)));
	else
		tmp = Float64(Float64(y / x) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -1.42) || ~((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, -1.42], N[Not[LessEqual[x, 1.4]], $MachinePrecision]], N[(0.5 * N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 73.3%

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

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

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

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

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

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

      \[\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 40.0%

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

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

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

    if -1.4199999999999999 < x < 1.3999999999999999

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 65.7% accurate, 9.6× speedup?

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

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

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


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

    1. Initial program 73.3%

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

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

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

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

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

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

      \[\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 42.5%

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

    if -1.4199999999999999 < x < 1.3999999999999999

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 65.6% accurate, 9.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.42:\\ \;\;\;\;\frac{0.5}{z} \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq 1.4:\\ \;\;\;\;\frac{\frac{y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -1.42)
   (* (/ 0.5 z) (* x y))
   (if (<= x 1.4) (/ (/ y x) z) (* y (* 0.5 (/ x z))))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.42) {
		tmp = (0.5 / z) * (x * y);
	} else if (x <= 1.4) {
		tmp = (y / x) / z;
	} else {
		tmp = y * (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 (x <= (-1.42d0)) then
        tmp = (0.5d0 / z) * (x * y)
    else if (x <= 1.4d0) then
        tmp = (y / x) / z
    else
        tmp = y * (0.5d0 * (x / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.42) {
		tmp = (0.5 / z) * (x * y);
	} else if (x <= 1.4) {
		tmp = (y / x) / z;
	} else {
		tmp = y * (0.5 * (x / z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -1.42:
		tmp = (0.5 / z) * (x * y)
	elif x <= 1.4:
		tmp = (y / x) / z
	else:
		tmp = y * (0.5 * (x / z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -1.42)
		tmp = Float64(Float64(0.5 / z) * Float64(x * y));
	elseif (x <= 1.4)
		tmp = Float64(Float64(y / x) / z);
	else
		tmp = Float64(y * Float64(0.5 * Float64(x / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -1.42)
		tmp = (0.5 / z) * (x * y);
	elseif (x <= 1.4)
		tmp = (y / x) / z;
	else
		tmp = y * (0.5 * (x / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -1.42], N[(N[(0.5 / z), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\

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


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

    1. Initial program 71.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/78.8%

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

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

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

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

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

      \[\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 y \cdot \color{blue}{\left(0.5 \cdot \frac{x}{z}\right)} \]
    6. Step-by-step derivation
      1. associate-*r*35.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{z} \cdot \color{blue}{\frac{y \cdot x}{1}} \]
      4. /-rgt-identity37.1%

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

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

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

    if -1.4199999999999999 < x < 1.3999999999999999

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

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

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

    if 1.3999999999999999 < x

    1. Initial program 75.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/73.5%

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

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

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

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

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

      \[\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 47.8%

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

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

Alternative 12: 65.9% accurate, 9.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.42:\\ \;\;\;\;\frac{0.5}{z} \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq 1.4:\\ \;\;\;\;\frac{\frac{1}{z}}{\frac{x}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -1.42)
   (* (/ 0.5 z) (* x y))
   (if (<= x 1.4) (/ (/ 1.0 z) (/ x y)) (* y (* 0.5 (/ x z))))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.42) {
		tmp = (0.5 / z) * (x * y);
	} else if (x <= 1.4) {
		tmp = (1.0 / z) / (x / y);
	} else {
		tmp = y * (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 (x <= (-1.42d0)) then
        tmp = (0.5d0 / z) * (x * y)
    else if (x <= 1.4d0) then
        tmp = (1.0d0 / z) / (x / y)
    else
        tmp = y * (0.5d0 * (x / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.42) {
		tmp = (0.5 / z) * (x * y);
	} else if (x <= 1.4) {
		tmp = (1.0 / z) / (x / y);
	} else {
		tmp = y * (0.5 * (x / z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -1.42:
		tmp = (0.5 / z) * (x * y)
	elif x <= 1.4:
		tmp = (1.0 / z) / (x / y)
	else:
		tmp = y * (0.5 * (x / z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -1.42)
		tmp = Float64(Float64(0.5 / z) * Float64(x * y));
	elseif (x <= 1.4)
		tmp = Float64(Float64(1.0 / z) / Float64(x / y));
	else
		tmp = Float64(y * Float64(0.5 * Float64(x / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -1.42)
		tmp = (0.5 / z) * (x * y);
	elseif (x <= 1.4)
		tmp = (1.0 / z) / (x / y);
	else
		tmp = y * (0.5 * (x / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -1.42], N[(N[(0.5 / z), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4], N[(N[(1.0 / z), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{1}{z}}{\frac{x}{y}}\\

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


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

    1. Initial program 71.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/78.8%

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

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

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

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

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

      \[\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 y \cdot \color{blue}{\left(0.5 \cdot \frac{x}{z}\right)} \]
    6. Step-by-step derivation
      1. associate-*r*35.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{z} \cdot \color{blue}{\frac{y \cdot x}{1}} \]
      4. /-rgt-identity37.1%

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

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

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

    if -1.4199999999999999 < x < 1.3999999999999999

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{1 \cdot y}}{z \cdot x} \]
      3. frac-times95.0%

        \[\leadsto \color{blue}{\frac{1}{z} \cdot \frac{y}{x}} \]
      4. clear-num94.9%

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

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

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

    if 1.3999999999999999 < x

    1. Initial program 75.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/73.5%

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

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

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

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

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

      \[\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 47.8%

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

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

Alternative 13: 65.4% 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 85.5%

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

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

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

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

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

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

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

    \[\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 69.3%

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

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

Alternative 14: 52.4% accurate, 15.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2 \cdot 10^{-56}:\\ \;\;\;\;\frac{\frac{y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z}}{x}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 2e-56) (/ (/ y x) z) (/ (/ y z) x)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 2e-56) {
		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 (y <= 2d-56) 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 (y <= 2e-56) {
		tmp = (y / x) / z;
	} else {
		tmp = (y / z) / x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 2e-56:
		tmp = (y / x) / z
	else:
		tmp = (y / z) / x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 2e-56)
		tmp = 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 (y <= 2e-56)
		tmp = (y / x) / z;
	else
		tmp = (y / z) / x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 2e-56], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e-56 < y

    1. Initial program 95.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 48.5% 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.5%

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

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

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

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

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

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

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

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

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

Alternative 16: 48.6% accurate, 21.4× speedup?

\[\begin{array}{l} \\ \frac{\frac{y}{x}}{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(Float64(y / x) / z)
end
function tmp = code(x, y, z)
	tmp = (y / x) / z;
end
code[x_, y_, z_] := N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{y}{x}}{z}} \]
  7. Final simplification54.1%

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

Developer target: 96.7% 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 2023238 
(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))